processList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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. onLoad: function(option) {
  116. this.type=option.type;
  117. if(option.type==1){
  118. this.keyWords='人工督察单';
  119. uni.setNavigationBarTitle({
  120. title: "消防支队人工督察单",
  121. });
  122. }else{
  123. this.keyWords='电子督察单';
  124. uni.setNavigationBarTitle({
  125. title: "消防支队电子督察单",
  126. });
  127. }
  128. this.getProcessData({
  129. "company_code": uni.getStorageSync('selectedCode'),
  130. "clzt": 0,
  131. "page": this.page,
  132. "pageSize": this.pageSize,
  133. }, 0);
  134. },
  135. onNavigationBarButtonTap(e) {
  136. console.log(e)
  137. uni.navigateTo({
  138. url: '/pages/export/export?keywords='+this.keyWords,
  139. success: res => {},
  140. fail: () => {},
  141. complete: () => {}
  142. });
  143. },
  144. methods: {
  145. async getProcessData(params = {}, whichTab) {
  146. const res = await this.$myRequest({
  147. url: this.type==1?'FireInspector/getManualInspectorList':'FireInspector/getElectronicInspectorList',
  148. data: params,
  149. showLoading: true
  150. })
  151. if (res.data.record_count) {
  152. if (whichTab == 0) {
  153. this.unporcessList = this.unporcessList.concat(res.data.data)
  154. this.record_count = parseInt(res.data.record_count)
  155. } else {
  156. this.porcessedList = this.porcessedList.concat(res.data.data);
  157. this.record_count1 = parseInt(res.data.record_count)
  158. }
  159. if (res.data.data.length < this.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
  160. this.isLoadMore = true
  161. this.loadStatus = 'nomore'
  162. } else {
  163. this.isLoadMore = false
  164. }
  165. } else {
  166. this.isLoadMore = true
  167. this.loadStatus = 'nomore'
  168. }
  169. },
  170. tabSelect(e) {
  171. this.unporcessList = [],
  172. this.porcessedList = [],
  173. console.log(e.currentTarget);
  174. this.TabCur = e.currentTarget.dataset.id;
  175. this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60;
  176. this.getProcessData({
  177. "company_code": uni.getStorageSync('selectedCode'),
  178. "clzt": e.currentTarget.dataset.id
  179. }, this.TabCur);
  180. },
  181. // 页面跳转
  182. goUnprocessDetail(item) {
  183. uni.navigateTo({
  184. url: '/pages/inspectList/unprocessDetail/unprocessDetail?id='+item.id+'&type='+this.type,
  185. success: res => {},
  186. fail: () => {},
  187. complete: () => {}
  188. });
  189. },
  190. goProcessedDetail(item) {
  191. uni.navigateTo({
  192. url: '/pages/inspectList/processedDetail/processedDetail?id='+item.id+'&type='+this.type,
  193. success: res => {},
  194. fail: () => {},
  195. complete: () => {}
  196. });
  197. },
  198. }
  199. }
  200. </script>
  201. <style lang="scss">
  202. //已处理未处理消息个数样式
  203. .nav .cu-item.cur {
  204. position: relative;
  205. border-bottom: 8rpx solid;
  206. }
  207. .cu-tag.badge {
  208. top: 14rpx;
  209. right: 96rpx;
  210. }
  211. .nav .cu-item {
  212. width: 50%;
  213. margin: 0;
  214. .text-blue,
  215. .line-blue,
  216. .lines-blue {
  217. color: #4274E7
  218. }
  219. }
  220. </style>