toDoList.vue 11 KB

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