processList.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  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? unporcessList.length:record_count}} </block>
  10. </view> -->
  11. <view v-if="TabCur==index&&!TabCur" class="cu-tag badge">
  12. <block class="cu-tag badge">{{record_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">{{type==1?item.artificial_code:item.supervise_code}}</view>
  28. </view>
  29. <view class="pro-des ">
  30. <view class="text-cut">
  31. {{item.content}}
  32. </view>
  33. </view>
  34. <view class="pro-date ">{{item.timestamp}}</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="record_count == 0">暂无数据...</view>
  41. <view v-show="isLoadMore&&record_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">{{type==1?item.artificial_code:item.supervise_code}}</view>
  57. </view>
  58. <view class="pro-des ">
  59. <view class="text-cut">
  60. {{item.content}}
  61. </view>
  62. </view>
  63. <view class="pro-date ">{{item.timestamp}}</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 class="text-center margin-top" v-if="record_count1 == 0">暂无数据...</view>
  70. <view v-show="isLoadMore&&record_count1 != 0&&this.page>1">
  71. <uni-load-more :status="loadStatus"></uni-load-more>
  72. </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: 1,
  86. modalName: null,
  87. listTouchStart: 0,
  88. listTouchDirection: null,
  89. CustomBar: this.CustomBar,
  90. TabCur: 0,
  91. tabNav: ['未处理', '已处理'],
  92. record_count: '',
  93. record_count1: '',
  94. requestUrl:'',
  95. keyWords:'',
  96. page: 1,
  97. pageSize: 10,
  98. loadStatus: 'loading', //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
  99. isLoadMore: false, //是否加载中
  100. bottomFlag:false
  101. };
  102. },
  103. onReachBottom() { //上拉触底函数
  104. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  105. this.isLoadMore = true
  106. this.page += 1;
  107. this.getProcessData({
  108. "company_code": uni.getStorageSync('selectedCode'),
  109. "clzt":this.TabCur,
  110. "page": this.page,
  111. "pageSize": this.pageSize,
  112. }, this.TabCur);
  113. }
  114. },
  115. onBackPress(event) {
  116. uni.reLaunch({
  117. url: "/"
  118. })
  119. return true;
  120. },
  121. onLoad: function(option) {
  122. this.type=option.type;
  123. if(option.type==1){
  124. this.keyWords='人工督察单';
  125. uni.setNavigationBarTitle({
  126. title: "消防支队人工督察单",
  127. });
  128. }else{
  129. this.keyWords='电子督察单';
  130. uni.setNavigationBarTitle({
  131. title: "消防支队电子督察单",
  132. });
  133. }
  134. this.getProcessData({
  135. "company_code": uni.getStorageSync('selectedCode'),
  136. "clzt": 0,
  137. "page": this.page,
  138. "pageSize": this.pageSize,
  139. }, 0);
  140. },
  141. onNavigationBarButtonTap(e) {
  142. console.log(e)
  143. uni.navigateTo({
  144. url: '/pages/export/export?keywords='+this.keyWords,
  145. success: res => {},
  146. fail: () => {},
  147. complete: () => {}
  148. });
  149. },
  150. methods: {
  151. async getProcessData(params = {}, whichTab) {
  152. const res = await this.$myRequest({
  153. url: this.type==1?'FireInspector/getManualInspectorList':'FireInspector/getElectronicInspectorList',
  154. data: params,
  155. showLoading: true
  156. })
  157. if (res.data.record_count) {
  158. if (whichTab == 0) {
  159. this.unporcessList = this.unporcessList.concat(res.data.data)
  160. this.record_count = parseInt(res.data.record_count)
  161. } else {
  162. this.porcessedList = this.porcessedList.concat(res.data.data);
  163. this.record_count1 = parseInt(res.data.record_count)
  164. }
  165. if (res.data.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
  166. this.isLoadMore = true
  167. this.loadStatus = 'nomore'
  168. } else {
  169. this.isLoadMore = false
  170. }
  171. } else {
  172. this.isLoadMore = true
  173. this.loadStatus = 'nomore'
  174. }
  175. },
  176. tabSelect(e) {
  177. this.unporcessList = [],
  178. this.porcessedList = [],
  179. console.log(e.currentTarget);
  180. this.TabCur = e.currentTarget.dataset.id;
  181. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  182. this.getProcessData({
  183. "company_code": uni.getStorageSync('selectedCode'),
  184. "clzt": e.currentTarget.dataset.id
  185. }, this.TabCur);
  186. },
  187. // 页面跳转
  188. goUnprocessDetail(item) {
  189. uni.navigateTo({
  190. url: '/pages/inspectList/unprocessDetail/unprocessDetail?id='+item.id+'&type='+this.type,
  191. success: res => {},
  192. fail: () => {},
  193. complete: () => {}
  194. });
  195. },
  196. goProcessedDetail(item) {
  197. uni.navigateTo({
  198. url: '/pages/inspectList/processedDetail/processedDetail?id='+item.id+'&type='+this.type,
  199. success: res => {},
  200. fail: () => {},
  201. complete: () => {}
  202. });
  203. },
  204. }
  205. }
  206. </script>
  207. <style lang="scss">
  208. //已处理未处理消息个数样式
  209. .nav .cu-item.cur {
  210. position: relative;
  211. border-bottom: 8rpx solid;
  212. }
  213. .cu-tag.badge {
  214. top: 14rpx;
  215. right: 96rpx;
  216. }
  217. .nav .cu-item {
  218. width: 50%;
  219. margin: 0;
  220. .text-blue,
  221. .line-blue,
  222. .lines-blue {
  223. color: #4274E7
  224. }
  225. }
  226. </style>