| | |
| | | <!-- 巡检任务 --> |
| | | <template> |
| | | <z-paging ref="pagingRef" v-model="dataList" @query="queryList"> |
| | | <view v-for="(item, index) in dataList" :key="index"> |
| | | <u-cell :title="`列表长度-${index + 1}`"> |
| | | <template #icon> |
| | | <u-avatar |
| | | shape="square" |
| | | size="35" |
| | | :src="item" |
| | | custom-style="margin: -3px 5px -3px 0" |
| | | /> |
| | | </template> |
| | | </u-cell> |
| | | </view> |
| | | </z-paging> |
| | | <TaskDetails v-model:active="active" v-if="active"/> |
| | | <view v-else v-for="(item, index) in list" :key="index"> |
| | | <view @click="taskClick(item)">{{item.name}} - {{item.status}}</view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {onShow} from "@dcloudio/uni-app"; |
| | | import {getJobListApi} from "@/api/inspectionTask.js"; |
| | | import TaskDetails from "@/pages/inspectionTask/TaskDetails/TaskDetails.vue"; |
| | | |
| | | const pagingRef = ref(null); |
| | | |
| | | const dataList = ref([]); |
| | |
| | | |
| | | pagingRef.value?.complete(list); |
| | | }, 1000); |
| | | // this.$request |
| | | // .queryList({ pageNo, pageSize }) |
| | | // .then(res => { |
| | | // // 请勿在网络请求回调中给dataList赋值!!只需要调用complete就可以了 |
| | | // pagingRef.value.complete(res.data.list); |
| | | // }) |
| | | // .catch(res => { |
| | | // // 如果请求失败写pagingRef.value.complete(false),会自动展示错误页面 |
| | | // // 注意,每次都需要在catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理 |
| | | // // 在底层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可 |
| | | // pagingRef.value.complete(false); |
| | | // }); |
| | | } |
| | | |
| | | const params = ref({ |
| | | device_sn: null, |
| | | order_by_create_time: false, |
| | | }) |
| | | const sizeParams = ref({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const list = ref([]) |
| | | function getJobList() { |
| | | getJobListApi(params.value,sizeParams.value).then(res =>{ |
| | | list.value = res.data.data.records |
| | | }) |
| | | } |
| | | |
| | | const active = ref(null) |
| | | function taskClick(row) { |
| | | active.value = row |
| | | // uni.redirectTo({ |
| | | // url: '/pages/inspectionTask/taskDetails/index' |
| | | // }) |
| | | } |
| | | |
| | | onShow(()=>{ |
| | | getJobList() |
| | | }) |
| | | </script> |