toDoList.vue 12 KB

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