2024-09-14 02:26:50 +00:00
|
|
|
<template>
|
|
|
|
<view :class="['content',{'gray':store.isgray==1}]">
|
2024-10-25 03:26:14 +00:00
|
|
|
<extendCom title="我的任务" img="process" :list="todoArr" :total="todoTotal" type="0"></extendCom>
|
|
|
|
<extendCom title="历史任务" img="done" :list="doneArr" :total="doneTotal" type="1"></extendCom>
|
|
|
|
<extendCom title="我发起流程" img="self" :list="selfArr" :total="selfTotal" type="2"></extendCom>
|
2024-09-14 02:26:50 +00:00
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2024-09-24 09:21:34 +00:00
|
|
|
import extendCom from '../../bpm/extendCom.vue';
|
2024-09-14 02:26:50 +00:00
|
|
|
import {
|
|
|
|
ref
|
|
|
|
} from 'vue';
|
|
|
|
import {
|
|
|
|
taskListApi,
|
|
|
|
myApplyProcessListApi,
|
|
|
|
taskHistoryListApi
|
2024-09-19 07:12:58 +00:00
|
|
|
} from '@/api/api.js';
|
2024-09-14 02:26:50 +00:00
|
|
|
import {
|
|
|
|
onLoad,
|
|
|
|
onReachBottom
|
|
|
|
} from '@dcloudio/uni-app';
|
|
|
|
import {
|
|
|
|
useStore
|
|
|
|
} from '@/store'
|
|
|
|
const store = useStore()
|
|
|
|
onLoad(() => {
|
|
|
|
taskList()
|
|
|
|
taskHistoryList()
|
|
|
|
myApplyProcessList()
|
|
|
|
})
|
|
|
|
const todoArr = ref([])
|
|
|
|
const todoTotal = ref(0)
|
|
|
|
/**待办事项*/
|
|
|
|
const taskList = () => {
|
|
|
|
taskListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 4,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res) => {
|
|
|
|
if (res?.success) {
|
|
|
|
if (res?.result?.total > 4) {
|
|
|
|
taskListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: res?.result?.total,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res1) => {
|
|
|
|
if (res1?.success) {
|
|
|
|
todoArr.value = [...todoArr.value, ...handleData(res1?.result?.records)]
|
|
|
|
todoTotal.value = res1?.result?.total
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log('err', err);
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
todoArr.value = [...todoArr.value, ...handleData(res?.result?.records)]
|
|
|
|
todoTotal.value = res?.result?.total
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
const doneArr = ref([])
|
|
|
|
const doneTotal = ref(0)
|
|
|
|
/**已办事项*/
|
|
|
|
const taskHistoryList = () => {
|
|
|
|
taskHistoryListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 4,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
if (res.result.total > 4) {
|
|
|
|
taskHistoryListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: res.result.total,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res1) => {
|
|
|
|
if (res1.success) {
|
|
|
|
doneArr.value = [...doneArr.value, ...handleData(res1.result.records)]
|
|
|
|
doneTotal.value = res1.result.total
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
doneArr.value = [...doneArr.value, ...handleData(res.result.records)]
|
|
|
|
doneTotal.value = res.result.total
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
const selfArr = ref([])
|
|
|
|
const selfTotal = ref(0)
|
2024-10-25 03:02:31 +00:00
|
|
|
const selfArrquery = ref([])
|
2024-09-14 02:26:50 +00:00
|
|
|
/**本人发起*/
|
|
|
|
const myApplyProcessList = () => {
|
|
|
|
myApplyProcessListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 4,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res) => {
|
|
|
|
if (res.success) {
|
|
|
|
if (res.result.total > 4) {
|
|
|
|
myApplyProcessListApi({
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: res.result.total,
|
|
|
|
_t: new Date().getTime()
|
|
|
|
}).then((res1) => {
|
|
|
|
if (res1.success) {
|
|
|
|
// selfArrquery.value=res1.result.records
|
|
|
|
selfArr.value = [...selfArr.value, ...handleData(res1.result.records)]
|
|
|
|
selfTotal.value = res1.result.total
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
selfArr.value = [...selfArr.value, ...handleData(res.result.records)]
|
|
|
|
selfTotal.value = res.result.total
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
const handleData = (titlearr) => {
|
|
|
|
let titleArr = titlearr.length ? titlearr.map(item => item.processDefinitionName || item
|
|
|
|
.prcocessDefinitionName) : []
|
|
|
|
let res = titleArr.reduce((obj, title) => {
|
|
|
|
if (title in obj) {
|
|
|
|
obj[title]++
|
|
|
|
} else {
|
|
|
|
obj[title] = 1
|
|
|
|
}
|
|
|
|
return obj
|
|
|
|
}, {})
|
|
|
|
return Object.entries(res).map(([k, v]) => ({
|
|
|
|
title: k,
|
|
|
|
num: v
|
|
|
|
}))
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
page {
|
|
|
|
background-color: #F8F8F8;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
|
|
|
</style>
|