index4.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <!-- 卡片栏 -->
  4. <view v-if="tableData.length>0 && isLoaded">
  5. <view v-for="(item, index) in tableData" :key="index">
  6. <uni-card>
  7. <!-- 标题 -->
  8. <view class="titles">{{ item.dd }}</view>
  9. <!-- 简要内容 -->
  10. <view class="duanluo">
  11. <text class="name-align-drill">财产损失金额 :</text>
  12. <text class="conts">{{ item.ccssje }}</text>
  13. </view>
  14. <view class="duanluo">
  15. <text class="name-align-drill">事故原因:</text>
  16. <text class="conts">{{ item.sgyy }}</text>
  17. </view>
  18. <view class="duanluo">
  19. <text class="name-align-drill">起火时间 :</text>
  20. <text class="conts">{{ item.qhsj }}</text>
  21. </view>
  22. <view style="margin-top: 60rpx;">
  23. <!-- 删除按钮 -->
  24. <view class="an-niu" @click.native="showModal(item)">
  25. <view class="detailDel">删除</view>
  26. </view>
  27. <view class="an-niu" @click.native="onClick(item)" link><text class="detail">查看详情</text></view>
  28. </view>
  29. </uni-card>
  30. </view>
  31. </view>
  32. <!-- tableData为空时显示 -->
  33. <view v-else-if="tableData.length==0 && isLoaded" style="text-align: center;">
  34. <view class="text-gray" style="padding-top: 20px;" v-if="tableData == 0">
  35. <img :src="tan90" alt="暂无数据" />
  36. </view>
  37. </view>
  38. <view>
  39. <image :src="Group" @click="addClick" class="tiantupian"></image>
  40. </view>
  41. <u-modal :show="show" @confirm="confirm" @cancel="cancel" @close="close" asyncClose closeOnClickOverlay
  42. showCancelButton confirmColor="red" :title="title" :content="content" ref="uModal"></u-modal>
  43. <!-- 加载中 -->
  44. <isLodingModel></isLodingModel>
  45. </view>
  46. </template>
  47. <script>
  48. var that = '';
  49. import {
  50. getArchive, //获取培训演练信息列表
  51. delArchive //删除培训演练信息
  52. } from '@/api/archive/index4.js';
  53. import config from '@/config'
  54. const baseUrlImg = config.baseUrlImg
  55. export default {
  56. data() {
  57. return {
  58. isLoaded: false,
  59. Group: `${baseUrlImg}/checkActive/Group.png`,
  60. showOrg: false,
  61. actions: [],
  62. // 数据
  63. tableData: {},
  64. title: '是否删除该数据项?',
  65. content: '确认删除?',
  66. id: '',
  67. tan90: `${baseUrlImg}/tan90.png`,
  68. // 每页数据量
  69. pageSize: 5,
  70. // 当前页
  71. pageNo: 1,
  72. // 数据总量
  73. total: 0,
  74. // tableData数据加载中
  75. loading: false,
  76. // 初始化时搜索框的值
  77. keyword: '',
  78. // 存放orgid,orgname
  79. formData: {
  80. orgName: ''
  81. },
  82. show: false,
  83. showtimeStart: false,
  84. showtimeEnd: false
  85. };
  86. },
  87. // 在 vue页面,向起始页通过事件传递数据
  88. onLoad: function(option) {},
  89. onShow() {
  90. this.tableData = []
  91. this.getData();
  92. },
  93. onReady() {},
  94. // 在 vue页面,向起始页通过事件传递数据
  95. watch: {
  96. loading: {
  97. handler(newLength, oldLength) {
  98. this.$modal.isLoadingModel(this.loading)
  99. },
  100. immediate: true
  101. }
  102. },
  103. mixins: [uni.$u.mixin],
  104. methods: {
  105. // 模态框内容
  106. showModal(val) {
  107. this.show = true;
  108. this.id = val.id;
  109. },
  110. confirm() {
  111. this.show = false;
  112. delArchive({
  113. id: this.id
  114. }).then(response => {
  115. this.loading = true;
  116. this.isLoaded = false
  117. this.tableData = []
  118. this.getData();
  119. });
  120. },
  121. close() {
  122. this.show = false;
  123. },
  124. cancel() {
  125. this.show = false;
  126. },
  127. // 获取数据
  128. getData() {
  129. this.loading = true;
  130. const value = uni.getStorageSync('getUserInfo_key');
  131. // 获取培训演练信息详细信息
  132. getArchive({
  133. pageNo: this.pageNo,
  134. pageSize: this.pageSize,
  135. streetId: value.streetInfo ? value.streetInfo.id : ''
  136. }).then(response => {
  137. this.isLoaded = true
  138. this.tableData = [...this.tableData, ...response.data.list]
  139. this.loading = false
  140. // this.tableData = response.data.list;
  141. });
  142. },
  143. // 传递数据
  144. onClick(val) {
  145. this.isLoaded = false
  146. uni.navigateTo({
  147. url: '/pagesA/fire/archive/archive_details/archive_details4?id=' + val.id,
  148. events: {
  149. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  150. acceptDataFromOpenedPage: function(val) {
  151. }
  152. },
  153. success: function(res) {
  154. // 通过eventChannel向被打开页面传送数据
  155. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  156. }
  157. });
  158. },
  159. addClick() {
  160. this.isLoaded = false
  161. uni.navigateTo({
  162. url: '/pagesA/fire/archive/add_archive/add_archive4'
  163. });
  164. },
  165. // 触底的事件
  166. onReachBottom() {
  167. // 判断是否还有下一页数据
  168. if (this.pageNo * this.pageSize >= this.total)
  169. return uni.showToast({
  170. title: `数据加载完毕`
  171. });
  172. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  173. if (this.loading) return;
  174. this.pageNo += 1;
  175. this.getData(this.pageNo);
  176. }
  177. }
  178. };
  179. </script>
  180. <style lang="scss" scoped>
  181. body {
  182. background-color: #f5f7f9;
  183. }
  184. page {
  185. background-color: #f5f7f9;
  186. }
  187. /deep/ .u-tabs__wrapper[data-v-0de61367],
  188. /deep/.u-tabs__wrapper.data-v-0de61367,
  189. /deep/ .u-tabs__wrapper {
  190. width: 99%;
  191. }
  192. /deep/.u-tabs__wrapper__nav__item[data-v-0de61367],
  193. /deep/.u-tabs__wrapper__nav__item.data-v-0de61367,
  194. /deep/.u-tabs__wrapper__nav__item {
  195. padding: 0 60rpx;
  196. }
  197. .uni-container {
  198. height: 100vh;
  199. padding-right: 20upx;
  200. }
  201. .addInsp {
  202. width: 40px;
  203. position: fixed;
  204. right: 4px;
  205. z-index: 99999;
  206. }
  207. ::v-deep .u-icon__icon {
  208. margin-right: 0px !important;
  209. }
  210. .an-niu {
  211. float: right;
  212. font-size: 10px;
  213. text-align: center;
  214. display: flex;
  215. margin-top: -64upx;
  216. padding-bottom: 30rpx;
  217. // margin-top: 50rpx;
  218. color: #fff;
  219. .detail {
  220. width: 60px;
  221. height: 60rpx;
  222. padding: 0 20rpx;
  223. border-radius: 30px;
  224. background-color: #f7c41e;
  225. margin-right: 20rpx;
  226. text-align: center;
  227. line-height: 60rpx;
  228. font-size: 27upx;
  229. }
  230. .detailDel {
  231. width: 60px;
  232. height: 60rpx;
  233. padding: 0 20rpx;
  234. border-radius: 30px;
  235. background-color: #ff2e31;
  236. color: white;
  237. margin-right: 20rpx;
  238. text-align: center;
  239. line-height: 60rpx;
  240. font-size: 30upx;
  241. }
  242. .solve {
  243. width: 62px;
  244. height: 60rpx;
  245. margin-right: 20rpx;
  246. border-radius: 30px;
  247. background-color: #4cb2b6;
  248. line-height: 60rpx;
  249. }
  250. /deep/ .padding-tb-sm {
  251. padding-top: 0px;
  252. padding-bottom: 10px;
  253. }
  254. .deletes {
  255. width: 62px;
  256. height: 60rpx;
  257. border-radius: 60rpx;
  258. background-color: red;
  259. color: #fff;
  260. line-height: 60rpx;
  261. }
  262. }
  263. /deep/.segmented-control__item--button {
  264. background-color: rgb(76, 178, 182) !important;
  265. }
  266. /deep/.segmented-control__item--button--active {
  267. background-color: #ffffff !important;
  268. }
  269. /deep/.uni-card {
  270. box-shadow: 0px 0px 3px 0px rgba(86, 165, 168, 0.63) !important;
  271. border-radius: 30rpx;
  272. }
  273. .tiantupian {
  274. width: 110rpx;
  275. height: 110rpx;
  276. position: fixed;
  277. right: 15px;
  278. bottom: 80rpx;
  279. }
  280. //列表样式
  281. .titles {
  282. font-weight: 600;
  283. margin-bottom: 10rpx;
  284. color: #1E293B;
  285. font-size: 30rpx;
  286. }
  287. .conts {
  288. max-width: 470rpx;
  289. display: -webkit-box;
  290. /*弹性伸缩盒子模型显示*/
  291. -webkit-box-orient: vertical;
  292. /*排列方式*/
  293. -webkit-line-clamp: 1;
  294. /*显示文本行数*/
  295. overflow: hidden;
  296. /*溢出隐藏*/
  297. color: #274647;
  298. text-overflow: ellipsis;
  299. /*不知道干嘛的*/
  300. .conts-title {
  301. margin-right: 10rpx;
  302. color: #728f90;
  303. }
  304. }
  305. .max-width {
  306. max-width: 180upx;
  307. }
  308. .duanluo {
  309. display: flex;
  310. margin-bottom: 15rpx;
  311. color: #728f90;
  312. }
  313. </style>