toDoList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. <template>
  2. <view class="pagesCons">
  3. <view class="tab-body">
  4. <view class="uTabs">
  5. <u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :current="current" @change="tabsChange" :is-scroll="false"
  6. swiperWidth="750"></u-tabs-swiper>
  7. </view>
  8. <view class="all-filter" v-show="current==2">
  9. <u-row>
  10. <text>发起时间</text>
  11. <view @click="changeSort('createTime')" class="filter-icon">
  12. <u-icon name="arrow-up-fill" :color="(sortIndex===0)?'#2979ff':'#888888'" size="24"></u-icon>
  13. <u-icon name="arrow-down-fill" :color="(sortIndex===1)?'#2979ff':'#888888'" size="24"></u-icon>
  14. </view>
  15. </u-row>
  16. <u-row>
  17. <text>处理时间</text>
  18. <view @click="changeSort('handleTime')" class="filter-icon">
  19. <u-icon name="arrow-up-fill" :color="(sortIndex===2)?'#2979ff':'#888888'" size="24"></u-icon>
  20. <u-icon name="arrow-down-fill" :color="(sortIndex===3)?'#2979ff':'#888888'" size="24"></u-icon>
  21. </view>
  22. </u-row>
  23. <view class="filter" @click="showSearch=true">
  24. <text>筛选</text>
  25. <u-icon name="shaixuan" custom-prefix="xd-icon" size="32" color="#888888"></u-icon>
  26. </view>
  27. </view>
  28. <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
  29. <swiper-item class="swiper-item" v-for="(tabs, index) in tabList" :key="index">
  30. <scroll-view scroll-y class="scroll-view" @scrolltolower="onreachBottom">
  31. <view class="check-order-list" v-if="index==current" v-for="(item,sindex) in list" :key="item.id+'-'+sindex"
  32. @click="viewRow(item)">
  33. <view class="check-row">
  34. <view class="ellipsis-one">{{item.storeName}}</view>
  35. <view class="createDate">{{item.createDate}}</view>
  36. </view>
  37. <view class="check-row">
  38. <view v-if="item.clsName" class="ellipsis-one">
  39. {{item.clsName}}
  40. </view>
  41. <view v-else class="ygq">
  42. <u-icon name="info-circle"></u-icon>
  43. 未关联问题项
  44. </view>
  45. <view class="text-right">
  46. <text>{{item.putUserName}}</text>
  47. </view>
  48. <view v-if="$hasPermissions('M_backlog_detail_mobile')" class="icon-xian">
  49. <u-icon name="icon-xian-11" custom-prefix="xd-icon" size="30" color="#888888"></u-icon>
  50. </view>
  51. </view>
  52. <view class="check-row">
  53. <view>
  54. {{item.sourceTypeDictValue}}
  55. </view>
  56. <view class="text-right">
  57. <text v-if="item.copyFlag && item.copyFlag == 1" class="mark">
  58. 抄送
  59. </text>
  60. <view :class="['status',clsStatus(item.statusDictValue)]">{{item.statusDictValue}}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <u-empty style="padding-top: 10vh;height: auto;" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'"
  65. mode="list"></u-empty>
  66. <view class="list-nomore" v-if="status == 'nomore'">已经到底了</view>
  67. <view v-if="index==current" style="padding: 20upx;">
  68. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  69. </view>
  70. </scroll-view>
  71. </swiper-item>
  72. </swiper>
  73. </view>
  74. <!-- 待办单查询弹框 -->
  75. <search-modal :visible="showSearch" @refresh="refresh" @close="showSearch=false"></search-modal>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. getBackLogList
  81. } from '@/api/backLog.js'
  82. import {
  83. getLookUpDatas,
  84. listLookUp
  85. } from '@/api/data'
  86. import searchModal from './searchModal.vue'
  87. export default {
  88. components: {
  89. searchModal
  90. },
  91. data() {
  92. return {
  93. showSearch: false, // 是否显示搜索弹框
  94. searchParams: {}, // 全部查询数据参数
  95. status: 'loadmore',
  96. noDataText: '暂无数据',
  97. background: {
  98. // 渐变色
  99. backgroundImage: 'linear-gradient(45deg, rgb(85, 170, 255), rgb(21, 102, 223))'
  100. },
  101. tabList: [{
  102. dispName: '我创建的',
  103. typeId: 1,
  104. queryLabel: 'FROM_ME' // tab参数
  105. },
  106. {
  107. dispName: '发给我的',
  108. typeId: 3,
  109. queryLabel: 'TO_ME' // tab参数
  110. },
  111. {
  112. dispName: '全部',
  113. typeId: 2,
  114. queryLabel: 'ALL' // tab参数
  115. },
  116. ],
  117. current: 0,
  118. swiperCurrent: 0,
  119. pageNo: 1,
  120. pageSize: 10,
  121. list: [],
  122. total: 0,
  123. action: 'swiperChange', // 操作类型,上划分页,或左右滑动
  124. sortField: 'create_time', // 全部 排序字段 默认按发起时间
  125. sortOrder: 'desc', // 全部 排序字段 默认按发起时间降序
  126. sortList: [ // 排序列表
  127. {
  128. sortField: 'create_time',
  129. sortOrder: 'asc'
  130. },
  131. {
  132. sortField: 'create_time',
  133. sortOrder: 'desc'
  134. },
  135. {
  136. sortField: 'handle_time',
  137. sortOrder: 'asc'
  138. },
  139. {
  140. sortField: 'handle_time',
  141. sortOrder: 'desc'
  142. }
  143. ],
  144. sortIndex: 1, // 排序下标 默认按发起时间降序
  145. }
  146. },
  147. onLoad() {
  148. if (this.$hasPermissions("B_todoList_new_mobile")) {
  149. // #ifdef APP-PLUS
  150. // 设置标题栏按钮
  151. let currentWebview = this.$scope.$getAppWebview();
  152. currentWebview.setTitleNViewButtonStyle(0, {
  153. text: '\ue610 新增',
  154. fontSize: 16,
  155. color: '#eee',
  156. width: '80px',
  157. fontSrc: '/static/iconfont/iconfont.ttf'
  158. });
  159. // #endif
  160. }
  161. // 监听新增后刷新
  162. uni.$on('refreshBL', this.refresh)
  163. // 监听待办处理后刷新
  164. uni.$on('refreshBl-handle', this.handleRefresh)
  165. this.pageInit()
  166. },
  167. onUnload() {
  168. uni.$off('refreshBL', this.refresh)
  169. uni.$off('refreshBl-handle', this.handleRefresh)
  170. },
  171. methods: {
  172. pageInit() {
  173. this.sortIndex = 1
  174. this.searchParams = {}
  175. this.pageNo = 1
  176. this.getRow()
  177. },
  178. handleRefresh() {
  179. this.getRow()
  180. },
  181. // tabs通知swiper切换
  182. tabsChange(index) {
  183. this.swiperCurrent = index;
  184. },
  185. swiperChange(event) {
  186. this.action = 'swiperChange'
  187. this.status = 'loading'
  188. },
  189. // swiper-item左右移动,通知tabs的滑块跟随移动
  190. transition(e) {
  191. let dx = e.detail.dx;
  192. this.$refs.uTabs.setDx(dx);
  193. },
  194. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  195. // swiper滑动结束,分别设置tabs和swiper的状态
  196. animationfinish(e) {
  197. let current = e.detail.current;
  198. let isCurtab = this.current == current
  199. if (this.status != "nomore") {
  200. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  201. if (loadData) {
  202. this.$refs.uTabs.setFinishCurrent(current);
  203. this.swiperCurrent = current;
  204. this.current = current;
  205. this.resetPage();
  206. }
  207. }
  208. },
  209. // 全部 排序
  210. changeSort(type) {
  211. if (type === 'createTime') {
  212. this.sortIndex = this.sortIndex === 1 ? 0 : 1
  213. }
  214. if (type === 'handleTime') {
  215. this.sortIndex = this.sortIndex === 2 ? 3 : 2
  216. }
  217. this.getRow(1)
  218. },
  219. // scroll-view到底部加载更多
  220. onreachBottom() {
  221. this.action = 'onreachBottom'
  222. if (this.list.length < this.total) {
  223. this.pageNo += 1
  224. this.getRow()
  225. } else {
  226. uni.showToast({
  227. title: '已经到底了',
  228. icon: 'none'
  229. });
  230. this.status = "nomore"
  231. }
  232. },
  233. // 查询列表
  234. getRow(pageNo) {
  235. if (pageNo) {
  236. this.pageNo = pageNo
  237. }
  238. let params = {
  239. pageNo: this.pageNo,
  240. pageSize: this.pageSize,
  241. queryLabel: this.tabList[this.current].queryLabel, // tab分类
  242. }
  243. if (params.queryLabel == 'ALL') {
  244. // 排序字段 create_time 发起时间 handle_time 处理时间
  245. params.sortField = this.sortList[this.sortIndex].sortField
  246. // asc 升序 desc 降序
  247. params.sortOrder = this.sortList[this.sortIndex].sortOrder
  248. params.statusList = this.searchParams.status ? this.searchParams.status : [] // 状态(pending 待整改 check_pending待审核 finished 整改完成 expired 已过期)
  249. params.sourceTypeList = this.searchParams.sourceType ? this.searchParams.sourceType : [] // 问题来源(远程巡店 VIDEO_INSPECTION /现场巡店 SPOT_INSPECTION/点检 POINT_INSPECTION /手动创建 MANUAL)
  250. params.putUserName = this.searchParams.putUserName ? this.searchParams.putUserName : '' // 巡店人
  251. params.storeName = this.searchParams.storeName ? this.searchParams.storeName : '' // 门店名称
  252. params.beginDate = this.searchParams.beginDate ? this.searchParams.beginDate : '' // 发起开始时间
  253. params.endDate = this.searchParams.endDate ? this.searchParams.endDate : '' // 发起结束时间
  254. }
  255. this.status = "loading"
  256. getBackLogList(params).then(res => {
  257. if (res.status == 200) {
  258. if (this.pageNo > 1) {
  259. this.list = this.list.concat(res.data.list || [])
  260. } else {
  261. this.list = res.data.list || []
  262. }
  263. this.total = res.data.count || 0
  264. } else {
  265. this.list = []
  266. this.total = 0
  267. this.noDataText = res.message
  268. }
  269. this.status = "loadmore"
  270. })
  271. },
  272. resetPage() {
  273. this.status = 'loading';
  274. // 上划分页
  275. if (this.action == 'onreachBottom') {
  276. this.getRow();
  277. }
  278. // 左右切换tab
  279. if (this.action == 'swiperChange') {
  280. this.list = [];
  281. this.getRow(1);
  282. }
  283. },
  284. // 获取查询参数 刷新列表
  285. refresh(params) {
  286. // console.log(params,'1111111111')
  287. this.searchParams = params
  288. this.getRow(1)
  289. },
  290. // 新增页
  291. onNavigationBarButtonTap(e) {
  292. uni.navigateTo({
  293. url: "/pages/toDoList/addBacklog"
  294. })
  295. },
  296. // 详细页
  297. viewRow(item) {
  298. if (!this.$hasPermissions('M_backlog_detail_mobile')) {
  299. return
  300. }
  301. // 已完成的
  302. uni.navigateTo({
  303. url: "/pages/toDoList/backlogDetail?id=" + item.id
  304. })
  305. },
  306. // 状态颜色处理
  307. clsStatus(status) {
  308. if (status == '待审核') {
  309. return 'dsh'
  310. }
  311. if (status == '待整改') {
  312. return 'dzg'
  313. }
  314. if (status == '整改完成') {
  315. return 'ywc'
  316. }
  317. if (status == '已过期') {
  318. return 'ygq'
  319. }
  320. }
  321. }
  322. }
  323. </script>
  324. <style lang="scss">
  325. page {
  326. height: 100%;
  327. background: #F8F8F8;
  328. }
  329. .pagesCons {
  330. height: 100%;
  331. background: #F8F8F8;
  332. display: flex;
  333. flex-direction: column;
  334. .text-right {
  335. text-align: right;
  336. }
  337. .tab-body {
  338. flex: 1;
  339. display: flex;
  340. flex-direction: column;
  341. .uTabs {
  342. border-bottom: 1px solid #EEEEEE;
  343. box-shadow: 1px 1px 3px #eeeeee;
  344. }
  345. .check-list {
  346. flex: 1;
  347. overflow-y: scroll;
  348. .swiper-item {
  349. width: 100%;
  350. height: 100%;
  351. overflow: hidden;
  352. .scroll-view {
  353. width: 100%;
  354. height: 100%;
  355. overflow: auto;
  356. }
  357. }
  358. }
  359. // 全部筛选
  360. .all-filter {
  361. width: 100%;
  362. display: flex;
  363. align-items: center;
  364. justify-content: space-around;
  365. box-shadow: 1px 1px 3px #EEEEEE;
  366. .filter-icon {
  367. display: flex;
  368. flex-direction: column;
  369. padding: 20upx;
  370. }
  371. }
  372. // 列表样式
  373. .check-order-list {
  374. background: #ffffff;
  375. padding: 10upx 20upx;
  376. margin: 25upx;
  377. border-radius: 6upx;
  378. box-shadow: 1px 1px 3px #EEEEEE;
  379. .check-row {
  380. display: flex;
  381. align-items: center;
  382. padding: 20upx 10upx;
  383. font-size: 28upx;
  384. .icon-xian {
  385. text-align: right;
  386. width: 40upx;
  387. }
  388. &:first-child {
  389. border-bottom: 1px dashed #F8F8F8;
  390. .createDate {
  391. color: #666;
  392. font-size: 26upx;
  393. margin-left: 10upx;
  394. }
  395. }
  396. &:last-child {
  397. border-top: 1px dashed #F8F8F8;
  398. }
  399. >view {
  400. &:first-child {
  401. flex: 1;
  402. }
  403. }
  404. // 抄送标记
  405. .mark {
  406. color: #00C1DE;
  407. padding: 6upx;
  408. font-size: 24upx;
  409. border: 1px solid #00C1DE;
  410. border-radius: 6upx;
  411. margin-right: 10upx;
  412. }
  413. // 状态
  414. .status {
  415. display: inline-block;
  416. width: 200upx;
  417. }
  418. .dsh {
  419. color: #ffaa00;
  420. }
  421. .dzg {
  422. color: #ff736e;
  423. }
  424. .ygq {
  425. color: #999;
  426. }
  427. .ywc {
  428. color: #10c71e;
  429. }
  430. }
  431. }
  432. }
  433. }
  434. </style>