processList.vue 8.3 KB

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