bonus-Certificate-app/pages/certificateReturnManage/certificatePersonalTask/index.vue

284 lines
7.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
<view class="certificate-list">
<Navbar title="我的任务" :showRightText="false" :isBack="false"/>
<view style="width: 94%;height: 80rpx;margin: 10rpx auto;">
<u-search shape="square" placeholder="搜索" v-model="keyword" :showAction="true" actionText="搜索" :animation="false" @custom="searchList"></u-search>
</view>
<!-- <view style="width:92%;height: 80rpx;display: flex;align-items: center;">
<view @click="checkedAll" class="button-view" style="background: #00337A;margin-right: 10px;">全选</view>
<view @click="handleBatchBack" class="button-view" style="background: #ff4949;">撤回任务</view>
</view> -->
<scroll-view style="width: 100%;height: 82vh;" @scrolltolower="onScrollTolower" scroll-y="true">
<view class="info-item" v-for="(item, index) in infoList" :key="index">
<view style="width: 100%;height: 100%;padding-top: 10rpx;font-size: 24rpx;">
<view class="label-box">
<!-- <view style="width: 10%;" @click="checkSelect(item)">
<u-checkbox-group v-model="item.checked">
<u-checkbox :customStyle="{margin: '0rpx 10rpx'}" :disabled="item.disabled" :label="''" :name="item.taskNo"></u-checkbox>
</u-checkbox-group>
</view> -->
<view class="label-view" style="width: 90%;">
<view class="label">任务编号</view>
<view class="text">{{item.taskNo}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">姓名</view>
<view class="text">{{item.name}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">身份证号</view>
<view class="text">{{item.idNumber}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">证件编号</view>
<view class="text">{{item.certificateNo}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">出生日期</view>
<view class="text">{{item.birthday}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">出生地点</view>
<view class="text">{{item.birthAddr}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">证件类型</view>
<view class="text">{{item.certificateTypeName}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">签发地</view>
<view class="text">{{item.issueAddr}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">签发日期</view>
<view class="text">{{item.issueDay}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">有效期至</view>
<view class="text">{{item.issueLifespan}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">任务截止时间</view>
<view class="text">{{item.processDate}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">设备位置</view>
<view class="text">{{item.deviceName}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">设备地址</view>
<view class="text">{{item.deviceAddr}}</view>
</view>
<view class="label-view" style="width: 50%;">
<view class="label">操作类型</view>
<view class="text">{{item.typeName}}</view>
</view>
</view>
<view class="label-box">
<view class="label-view" style="width: 50%;">
<view class="label">处理结果</view>
<view class="text">{{item.stateName}}</view>
</view>
</view>
</view>
</view>
<view style="margin: 20px 0" v-if="infoList.length > 0">
<u-loadmore :status="status" nomoreText="没有更多数据了" />
</view>
<view v-else class="flex justify-center align-center" style="height: 50vh">
<u-empty icon="../../static/images/not_order.png" text="暂无数据" textColor="#000" />
</view>
</scroll-view>
</view>
</template>
<script>
import { certificateTaskListApi,returnCertificateTaskApi } from '@/api/certificateReturnManage/index.js';
export default {
data() {
return {
fontValue:uni.getStorageSync('fontSize') || 8,
keyword:"",
pageNum: 1,
pageSize: 10,
total: 0,
infoList: [],
status: 'loadmore',
isCheckAll:false,
chosenList:[]
}
},
onLoad() {
},
onShow(){
this.getList()
},
methods: {
//搜索
searchList(value){
this.pageNum=1
this.infoList=[]
this.getList()
},
// 翻页
onScrollTolower(){
console.log(this.infoList.length)
if(this.total>this.infoList.length){
this.pageNum++
this.getList()
}
},
//获取列表
async getList() {
console.log('获取列表')
const params = {
pageNum: this.pageNum,
pageSize: this.pageSize,
keyword: this.keyword,
userId:uni.getStorageSync("userId")
}
try {
const res = await certificateTaskListApi(params)
console.log('?? ~ getList ~ res:', res)
this.total = res.total;
res.rows.forEach(item=>{
if(item.processState=="1"||item.processState=="2"){
item.disabled=true;
item.checked=[];
}else{
item.disabled=false;
item.checked=[];
}
})
if(this.pageNum==1){
this.infoList = res.rows
}else{
this.infoList.push(...res.rows)
}
this.status = this.total == this.infoList.length ? 'nomore' : 'loadmore'
} catch (error) {
console.log(error)
}
},
// 单选
checkSelect(chosen){
this.infoList.forEach(item=>{
if(item.taskNo==chosen.taskNo){
if(item.checked.length==0){
if(!item.disabled){
item.checked=[item.taskNo]
}
}else{
item.checked=[]
}
}
})
},
// 全选
checkedAll(){
this.isCheckAll=!this.isCheckAll
if(this.isCheckAll){
this.infoList.forEach(item=>{
if(!item.disabled){
item.checked=[item.taskNo]
}
})
}else{
this.infoList.forEach(item=>{
item.checked=[]
})
}
},
/** 批量撤回 */
handleBatchBack(){
this.chosenList=[]
this.infoList.forEach(item=>{
if(item.checked.length>0){
if(!item.disabled){
this.chosenList.push(item.taskNo)
}
}
})
console.log(this.chosenList)
if(this.chosenList.length>0){
uni.showModal({
title: `确认撤回所选任务?`,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
this.batchBack();
}
}
});
}else{
uni.$u.toast(`未勾选任务!`)
}
},
async batchBack() {
console.log(this.chosenList)
const params = {"certificateNos":this.chosenList}
try {
const res = await returnCertificateTaskApi(params)
console.log('?? ~ getList ~ res:', res)
} catch (error) {
console.log(error)
}
},
}
}
</script>
<style lang="scss" scoped>
.certificate-list {
height: 100vh;
background-color: #f8f8f8;
padding: 30rpx;
}
.info-item{
width: 100%;
height: auto;
display: flex;
align-items: center;
margin: 10rpx auto;
border-bottom: 1px solid #ccc;
}
.label-box{
width: 100%;
height: auto;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2px;
}
.label-view{
width: 100%;
display: flex;
align-items: center;
}
.label{
font-weight: 600;
}
.text{
}
.button-view{
width:20%;height:50rpx;line-height: 50rpx;text-align: center;
color: #FFF;border-radius: 10rpx;font-size: 22rpx;
}
</style>