2023-03-28 07:29:32 +08:00
|
|
|
|
<template>
|
2023-04-14 21:32:11 +08:00
|
|
|
|
<el-card v-loading="loading" class="box-card">
|
2023-03-28 07:29:32 +08:00
|
|
|
|
<template #header>
|
|
|
|
|
<span class="el-icon-picture-outline">审批记录</span>
|
|
|
|
|
</template>
|
2024-03-18 18:41:11 +08:00
|
|
|
|
<el-col :offset="3" :span="17">
|
2023-03-28 07:29:32 +08:00
|
|
|
|
<div class="block">
|
|
|
|
|
<el-timeline>
|
|
|
|
|
<el-timeline-item
|
|
|
|
|
v-for="(item, index) in tasks"
|
|
|
|
|
:key="index"
|
|
|
|
|
:icon="getTimelineItemIcon(item)"
|
|
|
|
|
:type="getTimelineItemType(item)"
|
|
|
|
|
>
|
2023-10-08 22:35:50 +08:00
|
|
|
|
<p style="font-weight: 700">
|
|
|
|
|
任务:{{ item.name }}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.status" />
|
2023-10-08 22:35:50 +08:00
|
|
|
|
<el-button
|
|
|
|
|
style="margin-left: 5px"
|
|
|
|
|
v-if="!isEmpty(item.children)"
|
|
|
|
|
@click="openChildrenTask(item)"
|
|
|
|
|
>
|
2024-03-18 18:41:11 +08:00
|
|
|
|
<Icon icon="ep:memo" /> 子任务
|
2023-10-08 22:35:50 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</p>
|
2023-03-28 07:29:32 +08:00
|
|
|
|
<el-card :body-style="{ padding: '10px' }">
|
2023-08-04 21:33:00 +08:00
|
|
|
|
<label v-if="item.assigneeUser" style="margin-right: 30px; font-weight: normal">
|
2023-03-28 07:29:32 +08:00
|
|
|
|
审批人:{{ item.assigneeUser.nickname }}
|
2023-04-14 21:32:11 +08:00
|
|
|
|
<el-tag size="small" type="info">{{ item.assigneeUser.deptName }}</el-tag>
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</label>
|
2023-04-14 21:32:11 +08:00
|
|
|
|
<label v-if="item.createTime" style="font-weight: normal">创建时间:</label>
|
2023-08-04 21:33:00 +08:00
|
|
|
|
<label style="font-weight: normal; color: #8a909c">
|
2023-04-04 11:19:58 +08:00
|
|
|
|
{{ formatDate(item?.createTime) }}
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</label>
|
|
|
|
|
<label v-if="item.endTime" style="margin-left: 30px; font-weight: normal">
|
|
|
|
|
审批时间:
|
|
|
|
|
</label>
|
2023-08-04 21:33:00 +08:00
|
|
|
|
<label v-if="item.endTime" style="font-weight: normal; color: #8a909c">
|
2023-04-04 11:19:58 +08:00
|
|
|
|
{{ formatDate(item?.endTime) }}
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</label>
|
|
|
|
|
<label v-if="item.durationInMillis" style="margin-left: 30px; font-weight: normal">
|
|
|
|
|
耗时:
|
|
|
|
|
</label>
|
2023-08-04 21:33:00 +08:00
|
|
|
|
<label v-if="item.durationInMillis" style="font-weight: normal; color: #8a909c">
|
2023-03-28 07:29:32 +08:00
|
|
|
|
{{ formatPast2(item?.durationInMillis) }}
|
|
|
|
|
</label>
|
2024-03-18 20:45:39 +08:00
|
|
|
|
<p v-if="item.reason"> 审批建议:{{ item.reason }} </p>
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</el-card>
|
|
|
|
|
</el-timeline-item>
|
|
|
|
|
</el-timeline>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
2024-03-19 01:31:51 +08:00
|
|
|
|
|
|
|
|
|
<!-- 弹窗:子任务 -->
|
|
|
|
|
<TaskSignList ref="taskSignListRef" @success="refresh" />
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</el-card>
|
|
|
|
|
</template>
|
2023-06-21 19:14:34 +08:00
|
|
|
|
<script lang="ts" setup>
|
2023-04-04 11:19:58 +08:00
|
|
|
|
import { formatDate, formatPast2 } from '@/utils/formatTime'
|
2023-03-28 07:29:32 +08:00
|
|
|
|
import { propTypes } from '@/utils/propTypes'
|
2023-10-08 22:35:50 +08:00
|
|
|
|
import { DICT_TYPE } from '@/utils/dict'
|
|
|
|
|
import { isEmpty } from '@/utils/is'
|
2024-03-19 01:31:51 +08:00
|
|
|
|
import TaskSignList from './dialog/TaskSignList.vue'
|
2023-03-28 07:29:32 +08:00
|
|
|
|
|
2023-06-21 19:14:34 +08:00
|
|
|
|
defineOptions({ name: 'BpmProcessInstanceTaskList' })
|
|
|
|
|
|
2023-03-28 07:29:32 +08:00
|
|
|
|
defineProps({
|
|
|
|
|
loading: propTypes.bool, // 是否加载中
|
2023-06-21 19:14:34 +08:00
|
|
|
|
tasks: propTypes.arrayOf(propTypes.object) // 流程任务的数组
|
2023-03-28 07:29:32 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
/** 获得任务对应的 icon */
|
2024-03-19 01:31:51 +08:00
|
|
|
|
// TODO @芋艿:对应的 icon 需要调整
|
2023-03-28 07:29:32 +08:00
|
|
|
|
const getTimelineItemIcon = (item) => {
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 1) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'el-icon-time'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 2) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'el-icon-check'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 3) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'el-icon-close'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 4) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'el-icon-remove-outline'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 5) {
|
2023-09-23 14:52:40 +08:00
|
|
|
|
return 'el-icon-back'
|
|
|
|
|
}
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** 获得任务对应的颜色 */
|
2024-03-18 18:41:11 +08:00
|
|
|
|
const getTimelineItemType = (item: any) => {
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 1) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'primary'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 2) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'success'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 3) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'danger'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 4) {
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return 'info'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 5) {
|
2023-09-23 14:52:40 +08:00
|
|
|
|
return 'warning'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 6) {
|
2023-09-24 15:44:02 +08:00
|
|
|
|
return 'default'
|
|
|
|
|
}
|
2024-03-17 17:25:40 +08:00
|
|
|
|
if (item.status === 7 || item.status === 8) {
|
2023-10-08 22:35:50 +08:00
|
|
|
|
return 'warning'
|
|
|
|
|
}
|
2023-03-28 07:29:32 +08:00
|
|
|
|
return ''
|
|
|
|
|
}
|
2023-10-08 22:35:50 +08:00
|
|
|
|
|
2024-03-19 01:31:51 +08:00
|
|
|
|
/** 子任务 */
|
|
|
|
|
const taskSignListRef = ref()
|
|
|
|
|
const openChildrenTask = (item: any) => {
|
|
|
|
|
taskSignListRef.value.open(item)
|
|
|
|
|
}
|
2023-10-08 22:35:50 +08:00
|
|
|
|
|
2024-03-19 01:31:51 +08:00
|
|
|
|
/** 刷新数据 */
|
|
|
|
|
const emit = defineEmits(['refresh']) // 定义 success 事件,用于操作成功后的回调
|
|
|
|
|
const refresh = () => {
|
|
|
|
|
emit('refresh')
|
2023-10-08 22:35:50 +08:00
|
|
|
|
}
|
2023-03-28 07:29:32 +08:00
|
|
|
|
</script>
|