processList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="processWrapper ">
  3. <view style="height:98rpx"></view>
  4. <view class="ding">
  5. <scroll-view scroll-x class="bg-white nav text-center">
  6. <view class="cu-item" :class="index==TabCur?'text-blue cur':''" v-for="(item,index) in tabNav"
  7. :key="index" @tap="tabSelect" :data-id="index">
  8. <!-- <view v-if="TabCur==index" class="cu-tag badge">
  9. <block class="cu-tag badge">{{TabCur? porcessedList.length:alarm_count}} </block>
  10. </view> -->
  11. <view v-if="TabCur==index&&!TabCur" class="cu-tag badge">
  12. <block class="cu-tag badge">{{alarm_count}} </block>
  13. </view>
  14. {{item}}
  15. </view>
  16. </scroll-view>
  17. </view>
  18. <block v-if="TabCur==0">
  19. <view class="processList">
  20. <view class="cu-list menu-avatar">
  21. <view class="cu-item" v-for="(item,index) in unporcessList" :key="index">
  22. <view class="cu-avatar lg">
  23. <image class="image-bg" src="/static/process-icon.png" />
  24. </view>
  25. <view class="content">
  26. <view class="pro-title">
  27. <view class="cut">{{item.owner_name}}</view>
  28. </view>
  29. <view class="pro-des ">
  30. <view class="text-cut">
  31. {{item.unitinfo}}
  32. </view>
  33. </view>
  34. <view class="pro-date ">{{item.time}}</view>
  35. </view>
  36. <view class="action" style="z-index:99">
  37. <view class="unProcess" @tap="goUnprocessDetail(item)">未处理</view>
  38. </view>
  39. </view>
  40. <view class=" text-center margin-top" v-if="alarm_count == 0">暂无数据...</view>
  41. <view v-show="isLoadMore&&alarm_count != 0">
  42. <uni-load-more :status="loadStatus"></uni-load-more>
  43. </view>
  44. </view>
  45. </view>
  46. </block>
  47. <block v-if="TabCur==1">
  48. <view class="processList">
  49. <view class="cu-list menu-avatar ">
  50. <view class="cu-item" v-for="(item,index) in porcessedList" :key="index">
  51. <view class="cu-avatar lg">
  52. <image class="image-bg" src="/static/processed-icon.png" />
  53. </view>
  54. <view class="content">
  55. <view class="pro-title">
  56. <view class="cut">{{item.owner_name}}</view>
  57. </view>
  58. <view class="pro-des ">
  59. <view class="text-cut">
  60. {{item.unitinfo}}
  61. </view>
  62. </view>
  63. <view class="pro-date ">{{item.time}}</view>
  64. </view>
  65. <view class="action" style="z-index:99">
  66. <view class="processed" @tap="goProcessedDetail(item)">已处理</view>
  67. </view>
  68. </view>
  69. <view v-show="isLoadMore&&alarm_count1 != 0">
  70. <uni-load-more :status="loadStatus"></uni-load-more>
  71. </view>
  72. <view class="text-center margin-top" v-if="alarm_count1 == 0">暂无数据...</view>
  73. </view>
  74. </view>
  75. </block>
  76. </view>
  77. </template>
  78. <script>
  79. import json from '../../data/json.js';
  80. export default {
  81. data() {
  82. return {
  83. unporcessList: [],
  84. porcessedList: [],
  85. type: '0',
  86. modalName: null,
  87. listTouchStart: 0,
  88. listTouchDirection: null,
  89. CustomBar: this.CustomBar,
  90. TabCur: 0,
  91. tabNav: ['未处理', '已处理'],
  92. alarm_count: '',
  93. alarm_count1: '',
  94. page: 1,
  95. pageSize: 10,
  96. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  97. isLoadMore: false, //是否加载中
  98. };
  99. },
  100. onReachBottom() { //上拉触底函数
  101. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  102. this.isLoadMore = true
  103. this.page += 1
  104. this.getProcessData({
  105. "company_code": uni.getStorageSync('selectedCode'),
  106. "type": this.type,
  107. "processing_status": this.TabCur,
  108. "page": this.page,
  109. "pageSize": this.pageSize,
  110. }, this.TabCur);
  111. }
  112. },
  113. onLoad: function(option) {
  114. this.getProcessData({
  115. "company_code": uni.getStorageSync('selectedCode'),
  116. "type": option.type,
  117. "processing_status": 0,
  118. "page": this.page,
  119. "pageSize": this.pageSize,
  120. }, 0);
  121. this.companyCode = option.companyCode;
  122. this.processingStatus = 1
  123. this.type = option.type;
  124. let url = "";
  125. switch (parseInt(option.type)) {
  126. case 1:
  127. url = "报警主机"
  128. break;
  129. case 2:
  130. url = "水系统"
  131. break;
  132. case 4:
  133. url = "消防栓监测"
  134. break;
  135. case 6:
  136. url = "RTU测控终端"
  137. break;
  138. case 7:
  139. url = "电气火灾"
  140. break;
  141. case 16:
  142. url = "视频告警"
  143. break;
  144. case 17:
  145. url = "电梯报警"
  146. break;
  147. case 128:
  148. url = "井盖监测"
  149. break;
  150. case 129:
  151. url = "地磁"
  152. break;
  153. case 130:
  154. url = "门磁"
  155. break;
  156. case 131:
  157. url = "可燃气体"
  158. break;
  159. default:
  160. break;
  161. }
  162. uni.setNavigationBarTitle({
  163. title: url
  164. });
  165. },
  166. onNavigationBarButtonTap(e) {
  167. console.log(e)
  168. uni.navigateTo({
  169. url: './export/export?type=' + this.type,
  170. success: res => {},
  171. fail: () => {},
  172. complete: () => {}
  173. });
  174. },
  175. methods: {
  176. async getProcessData(params, whichTab) {
  177. const res = await this.$myRequest({
  178. url: 'ComprehensiveAlarm/getIntegratedAlarmList',
  179. data: params,
  180. showLoading: true
  181. })
  182. if (res.data.alarm_count) {
  183. if (whichTab == 0) {
  184. this.unporcessList = this.unporcessList.concat(res.data.data)
  185. this.alarm_count = parseInt(res.data.alarm_count)
  186. } else {
  187. this.porcessedList = this.porcessedList.concat(res.data.data);
  188. this.alarm_count1 = parseInt(res.data.alarm_count)
  189. }
  190. if (res.data.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
  191. this.isLoadMore = true
  192. this.loadStatus = 'nomore'
  193. } else {
  194. this.isLoadMore = false
  195. }
  196. } else {
  197. this.isLoadMore = true
  198. this.loadStatus = 'nomore'
  199. }
  200. },
  201. tabSelect(e) {
  202. this.unporcessList = [],
  203. this.porcessedList = [],
  204. this.page = 1
  205. console.log(e.currentTarget);
  206. this.TabCur = e.currentTarget.dataset.id;
  207. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  208. this.getProcessData({
  209. "company_code": uni.getStorageSync('selectedCode'),
  210. "type": this.type,
  211. "processing_status": e.currentTarget.dataset.id,
  212. "page": this.page,
  213. "pageSize": this.pageSize
  214. }, this.TabCur);
  215. },
  216. // 页面跳转
  217. goUnprocessDetail(item) {
  218. uni.navigateTo({
  219. url: '/pages/unprocessDetail/unprocessDetail?id=' + item
  220. .id + '&type=' + this.type,
  221. });
  222. },
  223. goProcessedDetail(item) {
  224. uni.navigateTo({
  225. url: '/pages/processedDetail/processedDetail?id=' + item.id + '&type=' + item.type,
  226. success: res => {},
  227. fail: () => {},
  228. complete: () => {}
  229. });
  230. },
  231. }
  232. }
  233. </script>
  234. <style lang="scss">
  235. //已处理未处理消息个数样式
  236. .nav .cu-item.cur {
  237. position: relative;
  238. border-bottom: 8rpx solid;
  239. }
  240. .cu-tag.badge {
  241. top: 14rpx;
  242. right: 96rpx;
  243. }
  244. .nav .cu-item {
  245. width: 50%;
  246. margin: 0;
  247. .text-blue,
  248. .line-blue,
  249. .lines-blue {
  250. color: #4274E7
  251. }
  252. }
  253. </style>