jeecgBootUniapp/src/pages/process/components/myTask.vue
2025-05-16 15:04:50 +08:00

170 lines
3.7 KiB
Vue

<template>
<view class="container">
<wd-loading v-if="loading && pageNo === 1" class="loading-tip">加载中...</wd-loading>
<template v-for="(item, i) in list" :key="i">
<wd-card :title="item.bpmBizTitle" title-bold border-radius="8" use-footer-slot @click="goToPage(item)">
<view class="card-content">
<wd-row style="color: #666666;">
<wd-col :span="4">
<text>当前环节:</text>
</wd-col>
<wd-col :span="20">
{{item.taskName}}
</wd-col>
</wd-row>
<wd-row style="padding-bottom: 2px;color: #666666;">
<wd-col :span="4">
<text>流程名称:</text>
</wd-col>
<wd-col :span="20">
{{item.processDefinitionName}}
</wd-col>
</wd-row>
<view class="meta-info">
<wd-icon name="time" size="14px" color="#999"></wd-icon>
<text class="meta-text">{{item.taskBeginTime?item.taskBeginTime.substring(0,10):''}}</text>
<wd-icon name="user" size="14px" color="#999" style="margin-left: auto;"></wd-icon>
<text class="meta-text">{{item.processApplyUserName}}</text>
</view>
<wd-row style="padding-top: 10px;">
<view v-if="item.taskAssigneeName&&item.taskAssigneeName!=''">
<wd-col :span="16">
<wd-button>办理</wd-button>
</wd-col>
<wd-col :span="8">
<wd-button>委托</wd-button>
</wd-col>
</view>
<view v-else>
<wd-col :span="12">
<wd-button @click="goToPage(item)">签收</wd-button>
</wd-col>
<wd-col :span="12">
</wd-col>
</view>
</wd-row>
</view>
</wd-card>
</template>
<view class="load-more" v-if="loading && pageNo > 1">
<wd-loading size="16px">正在加载...</wd-loading>
</view>
<wd-message-box></wd-message-box>
</view>
</template>
<script setup lang="ts">
import { taskListApi,claim } from '@/api/process/api'
import {
ref
} from 'vue'
import {
onLoad,
onShow,
onReachBottom,
onPullDownRefresh
} from '@dcloudio/uni-app';
import { useToast, useMessage } from 'wot-design-uni'
defineOptions({
name: 'myTask',
options: {
styleIsolation: 'shared',
},
})
const toast = useToast()
const message = useMessage()
let pageNo = 1
let pageSize = 10
let loading = false
const list = ref([])
const getList = () => {
taskListApi({
pageNo,
pageSize
}).then((res) => {
console.log(res)
if (res.success) {
list.value = [...list.value,...res.result.records];
}
loading = false
}).catch((err) => {
loading = false
})
}
const goToPage = (item)=>{
//判断是否是签收项目,提示是否签收
if(item.taskAssigneeName&&item.taskAssigneeName!=''){
console.log(11)
//办理任务,直接进入办理页面
uni.navigateTo({
url:`/pages/process/taskHandle?data=${JSON.stringify(item)}`
})
}else{
message
.confirm({
msg: '是否签收该任务?',
title: '确认签收吗',
})
.then(() => {
claim({taskId:item.id}).then(()=>{
uni.redirectTo({
url: './approvalTabbar'
});
})
})
}
}
onReachBottom(() => {
if (loading) return
pageNo++
getList()
})
onPullDownRefresh(() => {
pageNo = 1
list.value = []
getList()
uni.stopPullDownRefresh()
})
onShow(() => {
list.value = []
pageNo = 1
pageSize = 10
loading = false
getList()
})
</script>
<style lang="scss" scoped>
.container {
padding: 5px 0 5px;
min-height: 100vh;
background-color: #f7f7f7;
}
.card-content {
padding: 8px 0;
.meta-info {
display: flex;
align-items: center;
font-size: 12px;
color: #666;
.meta-text {
margin-left: 4px;
}
}
}
::v-deep .wd-card__title-content{
border-bottom: 1px solid #efefef;
}
</style>