123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <view class="pagesCons">
- <view class="tab-body">
- <view class="uTabs"><u-tabs-swiper ref="uTabs" :list="tabList" name="dispName" :active-color="$config('primaryColors')" :current="current" @change="tabsChange" :is-scroll="false" swiperWidth="750"></u-tabs-swiper></view>
- <swiper class="check-list" :current="swiperCurrent" @transition="transition" @change="swiperChange" @animationfinish="animationfinish">
- <swiper-item
- class="swiper-item"
- style="height: 100%;width: 100%;overflow: hidden;"
- v-for="(tabs, index) in tabList"
- :key="index">
- <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
- <view class="check-order-list"
- v-if="index==current"
- v-for="(item, sindex) in list"
- :key="item.id">
- <view class="check-row" @click="viewRow(item)">
- <view>{{ item.storeName }}</view>
- <u-tag size="mini" mode="plain" shape="circle" class="item-c-type" :text="item.statusDictValue" :type="item.status | statusCls" />
- </view>
- <view class="check-row" @click="viewRow(item)">
- <view>
- <view style="font-size: 30upx;margin-bottom: 15upx;">{{ item.name }}</view>
- <view class="createDate">{{ item.createDate }}</view>
- </view>
- <view>
- <text v-if="item.status=='PENDING'" style="color:#333;">开始点检</text>
- <text v-if="item.status=='FINISHED'" style="color:#333;">查看结果</text>
- <u-icon v-if="item.status!='EXPIRED'" name="icon-xian-11" custom-prefix="xd-icon" size="28" color="#888888"></u-icon>
- </view>
- </view>
- </view>
- <u-empty style="height: auto;padding-top: 10vh;" :text="noDataText" img-width="120" v-if="list.length == 0 && status != 'loading'" mode="list"></u-empty>
- <view v-if="index==current" style="padding: 20upx;"><u-loadmore v-if="total > pageSize || status == 'loading'" :status="status" /></view>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- import { getTasksList } from '@/api/task.js';
- import { findStoreVsDevice } from '@/api/store.js'
- import { clzConfirm } from '@/libs/tools.js';
- export default {
- data() {
- return {
- status: 'loadmore',
- noDataText: '暂无数据',
- tabList: [],
- typeId:'1',
- current: 0,
- swiperCurrent: 0,
- pageNo: 1,
- pageSize: 10,
- list: [],
- total: 0,
- action:'swiperChange', // 操作类型,上划分页,或左右滑动
- };
- },
- onLoad() {
- // 获取任务状态 对象深度克隆
- this.tabList = this.$u.deepClone(this.$store.state.vuex_spotCheckStatus)
- this.tabList.unshift({dispName: '全部', code: ''})
- // 加载列表
- this.resetPage();
- uni.$on("updatePointTaskList",()=>{
- this.resetPage();
- })
- },
- onUnload() {
- uni.$off("updatePointTaskList")
- },
- filters: {
- // 状态颜色标记
- statusCls(val){
- let str = ''
- if(val == 'PENDING'){
- str = 'error'
- }else if(val == 'RUNNING'){
- str = 'primary'
- }else if(val == 'FINISHED'){
- str = 'success'
- }else if(val == 'EXPIRED'){
- str = 'warning'
- }
- return str
- },
- },
- methods: {
- message(title) {
- uni.showToast({
- icon: 'none',
- title: title
- });
- },
- // tabs通知swiper切换
- tabsChange(index) {
- this.swiperCurrent = index;
- },
- swiperChange(e) {
- console.log('swiperChange')
- this.action = 'swiperChange'
- this.status = 'loading';
- this.typeId = this.tabList[e.detail.current].code
- },
- // swiper-item左右移动,通知tabs的滑块跟随移动
- transition(e) {
- let dx = e.detail.dx;
- this.$refs.uTabs.setDx(dx);
- },
- // 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
- // swiper滑动结束,分别设置tabs和swiper的状态
- animationfinish(e) {
- let current = e.detail.current;
- let isCurtab = this.current == current
- if(this.status!="nomore"){
- let loadData = this.action == 'swiperChange' ? !isCurtab : isCurtab;
- if(loadData){
- this.$refs.uTabs.setFinishCurrent(current);
- this.swiperCurrent = current;
- this.current = current;
- this.resetPage();
- }
- }
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- this.action = 'onreachBottom'
- if (this.list.length < this.total) {
- this.pageNo += 1;
- } else {
- uni.showToast({
- title: '已经到底了',
- icon: 'none'
- });
- this.status = 'nomore';
- }
- },
- resetPage(){
- this.status = 'loading';
- // 上划分页
- if(this.action == 'onreachBottom'){
- this.getRow();
- }
- // 左右切换tab
- if(this.action == 'swiperChange'){
- this.list = [];
- this.getRow(1);
- }
- },
- // 查询列表
- getRow(pageNo) {
- let _this = this;
- if (pageNo) {
- this.pageNo = pageNo;
- }
- let params = {
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- type: 'POINT_INSPECTION', // 任务类型
- status: this.typeId=='1'?'':this.typeId ,// 任务状态
- inspectorId: 1
- };
- this.status = 'loading';
- getTasksList(params).then(res => {
- if (res.status == 200) {
- if (_this.pageNo > 1) {
- _this.list = _this.list.concat(res.data.list || []);
- } else {
- _this.list = res.data.list || [];
- }
- _this.total = res.data.count || 0;
- } else {
- _this.list = [];
- _this.total = 0;
- _this.noDataText = res.message || '暂无数据';
- }
- _this.status = 'loadmore';
- });
- },
- // 开始点检
- toSpotCheck(item){
- console.log(item)
- // 判断当前门店是否已绑定设备
- findStoreVsDevice({storeCode:item.storeCode}).then(res=>{
- // 门店下的设备
- this.$u.vuex('vuex_storeVideoList',res.data.length?res.data:[])
- const types = res.data.length?"video":"scene"
- uni.navigateTo({
- url: '/pages/spotCheck/spotCheck?taskId=' + item.id + '&types='+types+'&storeId='+item.storeId+'&storeName='+item.storeName
- });
- if(res.data.length==0){
- uni.showToast({
- icon: 'none',
- title: '未绑定摄像设备,请核实实际情况后再操作点检任务!',
- duration: 5000
- })
- }
- })
- },
- //判断状态,待处理的跳转的开始点检页面,已完成的查看点检结果,已过期的不处理
- viewRow(item) {
- // 已完成的
- if(item.status == 'FINISHED'){
- uni.navigateTo({
- url: '/pages/spotCheckCenter/spotCheckResult?id=' + item.id
- });
- }
- // 待处理,开始点检
- if(item.status == 'PENDING'){
- this.toSpotCheck(item)
- }
- },
- }
- };
- </script>
- <style lang="scss">
- page {
- height: 100vh;
- background: #F8F8F8;
- }
- .pagesCons {
- height: 100%;
- display: flex;
- flex-direction: column;
- .tab-body {
- height: 100%;
- display: flex;
- flex-direction: column;
- .uTabs{
- border-bottom: 1px solid #EEEEEE;
- box-shadow: 1px 1px 3px #eeeeee;
- }
- .check-list {
- flex-grow: 1;
- padding: 25upx;
- }
- .check-order-list {
- background: #ffffff;
- padding: 10upx 20upx;
- margin-bottom: 25upx;
- border-radius: 6upx;
- box-shadow: 1px 1px 3px #eeeeee;
- .check-row {
- display: flex;
- align-items: center;
- padding: 20upx 10upx;
- font-size: 28upx;
- &:first-child {
- border-bottom: 1px solid #f8f8f8;
- }
- &:last-child {
- border-top: 1px solid #f8f8f8;
- font-size: 26upx;
- }
- .createDate{
- color: #999;
- }
- > view {
- &:first-child {
- flex-grow: 1;
- width: 50%;
- }
- }
- .item-c-type{
- flex-shrink: 0;
- }
- .action {
- margin: 0 6rpx;
- padding: 0 20rpx;
- color: #fff;
- }
- .dcl {
- color: #f72525;
- }
- .jxz{
- color: #007AFF;
- }
- .ygq {
- color: #999;
- }
- .ywc {
- color: #10c71e;
- }
- .check-btns {
- width: '50%';
- display: flex;
- align-items: center;
- justify-content: flex-end;
- > view {
- margin-left: 35upx;
- font-size: 28upx;
- }
- }
- .uni-icons {
- margin: 0 5upx;
- }
- }
- }
- }
- }
- </style>
|