processList.vue 6.7 KB

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