toDoList.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="pagesCons">
  3. <view class="tab-body">
  4. <view>
  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 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 :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. this.pageInit()
  148. },
  149. methods:{
  150. pageInit () {
  151. this.sortIndex = 1
  152. this.searchParams = {}
  153. this.pageNo = 1
  154. this.getRow()
  155. },
  156. // tabs通知swiper切换
  157. tabsChange(index) {
  158. this.swiperCurrent = index;
  159. },
  160. swiperChange(event){
  161. this.action = 'swiperChange'
  162. this.status = 'loading'
  163. },
  164. // swiper-item左右移动,通知tabs的滑块跟随移动
  165. transition(e) {
  166. let dx = e.detail.dx;
  167. this.$refs.uTabs.setDx(dx);
  168. },
  169. // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
  170. // swiper滑动结束,分别设置tabs和swiper的状态
  171. animationfinish(e) {
  172. let current = e.detail.current;
  173. let isCurtab = this.current == current
  174. if(this.status!="nomore"){
  175. let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
  176. if(loadData){
  177. this.$refs.uTabs.setFinishCurrent(current);
  178. this.swiperCurrent = current;
  179. this.current = current;
  180. this.resetPage();
  181. }
  182. }
  183. },
  184. // 全部 排序
  185. changeSort (type) {
  186. if (type === 'createTime') {
  187. this.sortIndex = this.sortIndex === 1 ? 0 : 1
  188. }
  189. if (type === 'handleTime') {
  190. this.sortIndex = this.sortIndex === 2 ? 3 : 2
  191. }
  192. this.getRow(1)
  193. },
  194. // scroll-view到底部加载更多
  195. onreachBottom() {
  196. this.action = 'onreachBottom'
  197. if(this.list.length < this.total){
  198. this.pageNo += 1
  199. this.getRow()
  200. }else{
  201. this.status = "nomore"
  202. }
  203. },
  204. // 查询列表
  205. getRow (pageNo) {
  206. let _this = this
  207. if (pageNo) {
  208. this.pageNo = pageNo
  209. }
  210. let params = {
  211. pageNo: this.pageNo,
  212. pageSize: this.pageSize,
  213. queryLabel: this.tabList[this.current].queryLabel, // tab分类
  214. }
  215. if (params.queryLabel == 'ALL') {
  216. // 排序字段 create_time 发起时间 handle_time 处理时间
  217. params.sortField = this.sortList[this.sortIndex].sortField
  218. // asc 升序 desc 降序
  219. params.sortOrder = this.sortList[this.sortIndex].sortOrder
  220. params.statusList = this.searchParams.status ? this.searchParams.status : [] // 状态(pending 待整改 check_pending待审核 finished 整改完成 expired 已过期)
  221. params.sourceTypeList = this.searchParams.sourceType ? this.searchParams.sourceType : [] // 问题来源(远程巡店 VIDEO_INSPECTION /现场巡店 SPOT_INSPECTION/点检 POINT_INSPECTION /手动创建 MANUAL)
  222. params.putUserName = this.searchParams.putUserName ? this.searchParams.putUserName : '' // 巡店人
  223. params.storeName = this.searchParams.storeName ? this.searchParams.storeName : '' // 门店名称
  224. params.beginDate = this.searchParams.beginDate ? this.searchParams.beginDate : '' // 发起开始时间
  225. params.endDate = this.searchParams.endDate ? this.searchParams.endDate : '' // 发起结束时间
  226. }
  227. this.status = "loading"
  228. getBackLogList(params).then(res => {
  229. if (res.code == 200 || res.status == 204 || res.status == 200) {
  230. if(_this.pageNo>1){
  231. _this.list = _this.list.concat(res.data.list || [])
  232. }else{
  233. _this.list = res.data.list || []
  234. }
  235. _this.total = res.data.count || 0
  236. } else {
  237. _this.list = []
  238. _this.total = 0
  239. _this.noDataText = res.message
  240. }
  241. _this.status = "loadmore"
  242. })
  243. },
  244. resetPage(){
  245. this.status = 'loading';
  246. // 上划分页
  247. if(this.action == 'onreachBottom'){
  248. this.getRow();
  249. }
  250. // 左右切换tab
  251. if(this.action == 'swiperChange'){
  252. this.list = [];
  253. this.getRow(1);
  254. }
  255. },
  256. // 获取查询参数 刷新列表
  257. refresh(params){
  258. console.log(params,'1111111111')
  259. this.searchParams = params
  260. this.getRow(1)
  261. },
  262. // 新增页
  263. onNavigationBarButtonTap(e) {
  264. uni.navigateTo({
  265. url: "/pages/toDoList/addBacklog"
  266. })
  267. },
  268. // 详细页
  269. viewRow(item){
  270. // 已完成的
  271. uni.navigateTo({
  272. url: "/pages/toDoList/backlogDetail?id="+item.id
  273. })
  274. },
  275. // 状态颜色处理
  276. clsStatus(status){
  277. if(status == '待审核'){
  278. return 'dsh'
  279. }
  280. if(status == '待整改'){
  281. return 'dzg'
  282. }
  283. if(status == '整改完成'){
  284. return 'ywc'
  285. }
  286. if(status == '已过期'){
  287. return 'ygq'
  288. }
  289. }
  290. }
  291. }
  292. </script>
  293. <style lang="scss" scoped>
  294. page{
  295. height: 100%;
  296. }
  297. /* 自定义导航栏样式 */
  298. .slot-wrap {
  299. display: flex;
  300. align-items: center;
  301. /* 如果您想让slot内容占满整个导航栏的宽度 */
  302. flex: 1;
  303. /* 如果您想让slot内容与导航栏左右有空隙 */
  304. padding: 0 30rpx 0 0;
  305. color: #fff;
  306. font-size: 28upx;
  307. .left-icon{
  308. flex-grow: 1;
  309. font-size: 32upx;
  310. }
  311. .right-icon{
  312. padding-left:50upx;
  313. }
  314. .uni-icons{
  315. margin-right: 10upx;
  316. }
  317. }
  318. .text-right {
  319. text-align: right;
  320. }
  321. .pagesCons{
  322. height: 100%;
  323. display: flex;
  324. flex-direction: column;
  325. .tab-body{
  326. flex: 1;
  327. display: flex;
  328. flex-direction: column;
  329. .check-list{
  330. flex: 1;
  331. overflow-y: scroll;
  332. .swiper-item{
  333. width: 100%;
  334. height: 100%;
  335. overflow: hidden;
  336. .scroll-view {
  337. width: 100%;
  338. height: 100%;
  339. overflow: auto;
  340. }
  341. }
  342. }
  343. // 全部筛选
  344. .all-filter{
  345. width: 100%;
  346. height: 100upx;
  347. display: flex;
  348. align-items: center;
  349. justify-content: space-around;
  350. box-shadow: 1px 1px 3px #EEEEEE;
  351. .filter-icon{
  352. display: flex;
  353. flex-direction: column;
  354. // margin-left: 10upx;
  355. padding: 20upx;
  356. }
  357. }
  358. // 列表样式
  359. .check-order-list{
  360. background: #ffffff;
  361. padding: 10upx 20upx;
  362. margin: 25upx;
  363. border-radius: 6upx;
  364. box-shadow: 1px 1px 3px #EEEEEE;
  365. .check-row{
  366. display: flex;
  367. align-items: center;
  368. padding: 20upx 10upx;
  369. font-size: 28upx;
  370. .icon-xian{
  371. text-align: right;
  372. width: 40upx;
  373. }
  374. &:first-child{
  375. border-bottom: 1px dashed #F8F8F8;
  376. .createDate{
  377. // color: #666;
  378. font-size: 26upx;
  379. margin-left: 10upx;
  380. }
  381. }
  382. &:last-child{
  383. border-top: 1px dashed #F8F8F8;
  384. }
  385. > view{
  386. &:first-child{
  387. flex: 1;
  388. }
  389. }
  390. // 抄送标记
  391. .mark {
  392. color: #00C1DE;
  393. padding: 6upx;
  394. font-size: 24upx;
  395. border: 1px solid #00C1DE;
  396. border-radius: 6upx;
  397. margin-right: 10upx;
  398. }
  399. // 状态
  400. .status {
  401. display: inline-block;
  402. width: 200upx;
  403. }
  404. .dsh{
  405. color: red;
  406. }
  407. .dzg{
  408. color: #007AFF;
  409. }
  410. .ygq {
  411. color: #999;
  412. }
  413. .ywc {
  414. color: #10c71e;
  415. }
  416. }
  417. }
  418. }
  419. }
  420. </style>