processList.vue 7.0 KB

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