BPM:简化 task 接口的 VO,做一些合并。虽然字段上有冗余,但是读代码难度降低
This commit is contained in:
parent
59c7c49efa
commit
de29528165
@ -43,12 +43,12 @@ export const exportTask = async (params) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取所有可回退的节点
|
// 获取所有可回退的节点
|
||||||
export const getReturnList = async (params) => {
|
export const getTaskListByReturn = async (id: string) => {
|
||||||
return await request.get({ url: '/bpm/task/return-list', params })
|
return await request.get({ url: '/bpm/task/list-by-return', params: { id } })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 回退
|
// 回退
|
||||||
export const returnTask = async (data) => {
|
export const returnTask = async (data: any) => {
|
||||||
return await request.put({ url: '/bpm/task/return', data })
|
return await request.put({ url: '/bpm/task/return', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ export const taskAddSign = async (data) => {
|
|||||||
* 获取减签任务列表
|
* 获取减签任务列表
|
||||||
*/
|
*/
|
||||||
export const getChildrenTaskList = async (id: string) => {
|
export const getChildrenTaskList = async (id: string) => {
|
||||||
return await request.get({ url: '/bpm/task/children-list?taskId=' + id })
|
return await request.get({ url: '/bpm/task/children-list?parentId=' + id })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,13 +121,13 @@ const highlightDiagram = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 高亮任务
|
// 高亮任务
|
||||||
canvas.addMarker(n.id, getResultCss(task.result))
|
canvas.addMarker(n.id, getResultCss(task.status))
|
||||||
//标记是否高亮了进行中任务
|
//标记是否高亮了进行中任务
|
||||||
if (task.result === 1) {
|
if (task.status === 1) {
|
||||||
findProcessTask = true
|
findProcessTask = true
|
||||||
}
|
}
|
||||||
// 如果非通过,就不走后面的线条了
|
// 如果非通过,就不走后面的线条了
|
||||||
if (task.result !== 2) {
|
if (task.status !== 2) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 处理 outgoing 出线
|
// 处理 outgoing 出线
|
||||||
@ -205,10 +205,10 @@ const highlightDiagram = async () => {
|
|||||||
})
|
})
|
||||||
} else if (n.$type === 'bpmn:EndEvent') {
|
} else if (n.$type === 'bpmn:EndEvent') {
|
||||||
// 结束节点
|
// 结束节点
|
||||||
if (!processInstance.value || processInstance.value.result === 1) {
|
if (!processInstance.value || processInstance.value.status === 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
canvas.addMarker(n.id, getResultCss(processInstance.value.result))
|
canvas.addMarker(n.id, getResultCss(processInstance.value.status))
|
||||||
} else if (n.$type === 'bpmn:ServiceTask') {
|
} else if (n.$type === 'bpmn:ServiceTask') {
|
||||||
//服务任务
|
//服务任务
|
||||||
if (activity.startTime > 0 && activity.endTime === 0) {
|
if (activity.startTime > 0 && activity.endTime === 0) {
|
||||||
@ -226,6 +226,7 @@ const highlightDiagram = async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (!isEmpty(removeTaskDefinitionKeyList)) {
|
if (!isEmpty(removeTaskDefinitionKeyList)) {
|
||||||
|
// TODO 芋艿:后面 .definitionKey 再看
|
||||||
taskList.value = taskList.value.filter(
|
taskList.value = taskList.value.filter(
|
||||||
(item) => !removeTaskDefinitionKeyList.includes(item.definitionKey)
|
(item) => !removeTaskDefinitionKeyList.includes(item.definitionKey)
|
||||||
)
|
)
|
||||||
@ -321,7 +322,7 @@ const elementHover = (element) => {
|
|||||||
let optionData = getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)
|
let optionData = getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)
|
||||||
let dataResult = ''
|
let dataResult = ''
|
||||||
optionData.forEach((element) => {
|
optionData.forEach((element) => {
|
||||||
if (element.value == task.result) {
|
if (element.value == task.status) {
|
||||||
dataResult = element.label
|
dataResult = element.label
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -333,7 +334,7 @@ const elementHover = (element) => {
|
|||||||
// <p>部门:${task.assigneeUser.deptName}</p>
|
// <p>部门:${task.assigneeUser.deptName}</p>
|
||||||
// <p>结果:${getIntDictOptions(
|
// <p>结果:${getIntDictOptions(
|
||||||
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
|
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
|
||||||
// task.result
|
// task.status
|
||||||
// )}</p>
|
// )}</p>
|
||||||
// <p>创建时间:${formatDate(task.createTime)}</p>`
|
// <p>创建时间:${formatDate(task.createTime)}</p>`
|
||||||
if (task.endTime) {
|
if (task.endTime) {
|
||||||
@ -354,14 +355,14 @@ const elementHover = (element) => {
|
|||||||
let optionData = getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)
|
let optionData = getIntDictOptions(DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT)
|
||||||
let dataResult = ''
|
let dataResult = ''
|
||||||
optionData.forEach((element) => {
|
optionData.forEach((element) => {
|
||||||
if (element.value == processInstance.value.result) {
|
if (element.value == processInstance.value.status) {
|
||||||
dataResult = element.label
|
dataResult = element.label
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
html = `<p>结果:${dataResult}</p>`
|
html = `<p>结果:${dataResult}</p>`
|
||||||
// html = `<p>结果:${getIntDictOptions(
|
// html = `<p>结果:${getIntDictOptions(
|
||||||
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
|
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
|
||||||
// processInstance.value.result
|
// processInstance.value.status
|
||||||
// )}</p>`
|
// )}</p>`
|
||||||
if (processInstance.value.endTime) {
|
if (processInstance.value.endTime) {
|
||||||
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
<el-table :data="baseTask.children" style="width: 100%" row-key="id" border>
|
<el-table :data="baseTask.children" style="width: 100%" row-key="id" border>
|
||||||
<el-table-column prop="assigneeUser.nickname" label="审批人" />
|
<el-table-column prop="assigneeUser.nickname" label="审批人" />
|
||||||
<el-table-column prop="assigneeUser.deptName" label="所在部门" />
|
<el-table-column prop="assigneeUser.deptName" label="所在部门" />
|
||||||
<el-table-column label="审批状态" prop="result">
|
<el-table-column label="审批状态" prop="status">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result" />
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
@ -88,7 +88,7 @@ const handleSubSign = (item) => {
|
|||||||
const isSubSignButtonVisible = (task: any) => {
|
const isSubSignButtonVisible = (task: any) => {
|
||||||
if (task && task.children && !isEmpty(task.children)) {
|
if (task && task.children && !isEmpty(task.children)) {
|
||||||
// 有子任务,且子任务有任意一个是 待处理 和 待前置任务完成 则显示减签按钮
|
// 有子任务,且子任务有任意一个是 待处理 和 待前置任务完成 则显示减签按钮
|
||||||
const subTask = task.children.find((item) => item.result === 1 || item.result === 9)
|
const subTask = task.children.find((item) => item.status === 1 || item.status === 9)
|
||||||
return !isEmpty(subTask)
|
return !isEmpty(subTask)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
>
|
>
|
||||||
<p style="font-weight: 700">
|
<p style="font-weight: 700">
|
||||||
任务:{{ item.name }}
|
任务:{{ item.name }}
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.result" />
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="item.status" />
|
||||||
<el-button
|
<el-button
|
||||||
style="margin-left: 5px"
|
style="margin-left: 5px"
|
||||||
v-if="!isEmpty(item.children)"
|
v-if="!isEmpty(item.children)"
|
||||||
@ -73,19 +73,19 @@ defineProps({
|
|||||||
|
|
||||||
/** 获得任务对应的 icon */
|
/** 获得任务对应的 icon */
|
||||||
const getTimelineItemIcon = (item) => {
|
const getTimelineItemIcon = (item) => {
|
||||||
if (item.result === 1) {
|
if (item.status === 1) {
|
||||||
return 'el-icon-time'
|
return 'el-icon-time'
|
||||||
}
|
}
|
||||||
if (item.result === 2) {
|
if (item.status === 2) {
|
||||||
return 'el-icon-check'
|
return 'el-icon-check'
|
||||||
}
|
}
|
||||||
if (item.result === 3) {
|
if (item.status === 3) {
|
||||||
return 'el-icon-close'
|
return 'el-icon-close'
|
||||||
}
|
}
|
||||||
if (item.result === 4) {
|
if (item.status === 4) {
|
||||||
return 'el-icon-remove-outline'
|
return 'el-icon-remove-outline'
|
||||||
}
|
}
|
||||||
if (item.result === 5) {
|
if (item.status === 5) {
|
||||||
return 'el-icon-back'
|
return 'el-icon-back'
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
@ -93,25 +93,25 @@ const getTimelineItemIcon = (item) => {
|
|||||||
|
|
||||||
/** 获得任务对应的颜色 */
|
/** 获得任务对应的颜色 */
|
||||||
const getTimelineItemType = (item) => {
|
const getTimelineItemType = (item) => {
|
||||||
if (item.result === 1) {
|
if (item.status === 1) {
|
||||||
return 'primary'
|
return 'primary'
|
||||||
}
|
}
|
||||||
if (item.result === 2) {
|
if (item.status === 2) {
|
||||||
return 'success'
|
return 'success'
|
||||||
}
|
}
|
||||||
if (item.result === 3) {
|
if (item.status === 3) {
|
||||||
return 'danger'
|
return 'danger'
|
||||||
}
|
}
|
||||||
if (item.result === 4) {
|
if (item.status === 4) {
|
||||||
return 'info'
|
return 'info'
|
||||||
}
|
}
|
||||||
if (item.result === 5) {
|
if (item.status === 5) {
|
||||||
return 'warning'
|
return 'warning'
|
||||||
}
|
}
|
||||||
if (item.result === 6) {
|
if (item.status === 6) {
|
||||||
return 'default'
|
return 'default'
|
||||||
}
|
}
|
||||||
if (item.result === 7 || item.result === 8) {
|
if (item.status === 7 || item.status === 8) {
|
||||||
return 'warning'
|
return 'warning'
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
:rules="formRules"
|
:rules="formRules"
|
||||||
label-width="110px"
|
label-width="110px"
|
||||||
>
|
>
|
||||||
<el-form-item label="退回节点" prop="targetDefinitionKey">
|
<el-form-item label="退回节点" prop="targetTaskDefinitionKey">
|
||||||
<el-select v-model="formData.targetDefinitionKey" clearable style="width: 100%">
|
<el-select v-model="formData.targetTaskDefinitionKey" clearable style="width: 100%">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in returnList"
|
v-for="item in returnList"
|
||||||
:key="item.definitionKey"
|
:key="item.taskDefinitionKey"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.definitionKey"
|
:value="item.taskDefinitionKey"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -35,19 +35,19 @@ const dialogVisible = ref(false) // 弹窗的是否展示
|
|||||||
const formLoading = ref(false) // 表单的加载中
|
const formLoading = ref(false) // 表单的加载中
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
id: '',
|
id: '',
|
||||||
targetDefinitionKey: undefined,
|
targetTaskDefinitionKey: undefined,
|
||||||
reason: ''
|
reason: ''
|
||||||
})
|
})
|
||||||
const formRules = ref({
|
const formRules = ref({
|
||||||
targetDefinitionKey: [{ required: true, message: '必须选择回退节点', trigger: 'change' }],
|
targetTaskDefinitionKey: [{ required: true, message: '必须选择回退节点', trigger: 'change' }],
|
||||||
reason: [{ required: true, message: '回退理由不能为空', trigger: 'blur' }]
|
reason: [{ required: true, message: '回退理由不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
|
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const returnList = ref([])
|
const returnList = ref([] as any)
|
||||||
/** 打开弹窗 */
|
/** 打开弹窗 */
|
||||||
const open = async (id: string) => {
|
const open = async (id: string) => {
|
||||||
returnList.value = await TaskApi.getReturnList({ taskId: id })
|
returnList.value = await TaskApi.getTaskListByReturn(id)
|
||||||
if (returnList.value.length === 0) {
|
if (returnList.value.length === 0) {
|
||||||
message.warning('当前没有可回退的节点')
|
message.warning('当前没有可回退的节点')
|
||||||
return false
|
return false
|
||||||
@ -82,7 +82,7 @@ const submitForm = async () => {
|
|||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
id: '',
|
id: '',
|
||||||
targetDefinitionKey: undefined,
|
targetTaskDefinitionKey: undefined,
|
||||||
reason: ''
|
reason: ''
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
|
@ -254,7 +254,7 @@ const getTaskList = async () => {
|
|||||||
tasks.value = []
|
tasks.value = []
|
||||||
// 1.1 移除已取消的审批
|
// 1.1 移除已取消的审批
|
||||||
data.forEach((task) => {
|
data.forEach((task) => {
|
||||||
if (task.result !== 4) {
|
if (task.status !== 4) {
|
||||||
tasks.value.push(task)
|
tasks.value.push(task)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -291,7 +291,10 @@ const loadRunningTask = (tasks) => {
|
|||||||
loadRunningTask(task.children)
|
loadRunningTask(task.children)
|
||||||
}
|
}
|
||||||
// 2.1 只有待处理才需要
|
// 2.1 只有待处理才需要
|
||||||
if (task.result !== 1 && task.result !== 6) {
|
// if (task.status !== 1 && task.status !== 6) {
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
if (task.status !== 1 && task.status !== 6) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 2.2 自己不是处理人
|
// 2.2 自己不是处理人
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
{{ detailData.processInstance.startUserNickname }}
|
{{ detailData.processInstance.startUserNickname }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="状态">
|
<el-descriptions-item label="状态">
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="detailData.result" />
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="detailData.status" />
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="原因">
|
<el-descriptions-item label="原因">
|
||||||
{{ detailData.reason }}
|
{{ detailData.reason }}
|
||||||
|
@ -50,9 +50,9 @@
|
|||||||
<el-table-column align="center" label="任务名称" prop="name" />
|
<el-table-column align="center" label="任务名称" prop="name" />
|
||||||
<el-table-column align="center" label="所属流程" prop="processInstance.name" />
|
<el-table-column align="center" label="所属流程" prop="processInstance.name" />
|
||||||
<el-table-column align="center" label="流程发起人" prop="processInstance.startUserNickname" />
|
<el-table-column align="center" label="流程发起人" prop="processInstance.startUserNickname" />
|
||||||
<el-table-column align="center" label="状态" prop="result">
|
<el-table-column align="center" label="审批状态" prop="status">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result" />
|
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.status" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column align="center" label="原因" prop="reason" />
|
<el-table-column align="center" label="原因" prop="reason" />
|
||||||
|
@ -46,27 +46,33 @@
|
|||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column align="center" label="任务编号" prop="id" width="300px" />
|
<el-table-column align="center" label="流程" prop="processInstance.name" width="180" />
|
||||||
<el-table-column align="center" label="任务名称" prop="name" />
|
<el-table-column
|
||||||
<el-table-column align="center" label="所属流程" prop="processInstance.name" />
|
align="center"
|
||||||
<el-table-column align="center" label="流程发起人" prop="processInstance.startUserNickname" />
|
label="发起人"
|
||||||
|
prop="processInstance.startUser.nickname"
|
||||||
|
width="100"
|
||||||
|
/>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
:formatter="dateFormatter"
|
:formatter="dateFormatter"
|
||||||
align="center"
|
align="center"
|
||||||
label="创建时间"
|
label="发起时间"
|
||||||
prop="createTime"
|
prop="createTime"
|
||||||
width="180"
|
width="180"
|
||||||
/>
|
/>
|
||||||
<el-table-column label="任务状态" prop="suspensionState">
|
<el-table-column align="center" label="当前任务" prop="name" width="180" />
|
||||||
|
<el-table-column
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
align="center"
|
||||||
|
label="任务时间"
|
||||||
|
prop="createTime"
|
||||||
|
width="180"
|
||||||
|
/>
|
||||||
|
<el-table-column align="center" label="流程编号" prop="id" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column align="center" label="任务编号" prop="id" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column align="center" label="操作" fixed="right" width="80">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag v-if="scope.row.suspensionState === 1" type="success">激活</el-tag>
|
<el-button link type="primary" @click="handleAudit(scope.row)">办理</el-button>
|
||||||
<el-tag v-if="scope.row.suspensionState === 2" type="warning">挂起</el-tag>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column align="center" label="操作">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" @click="handleAudit(scope.row)">审批进度</el-button>
|
|
||||||
<el-button link type="primary" @click="handleCC(scope.row)">抄送</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -77,16 +83,14 @@
|
|||||||
:total="total"
|
:total="total"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
<TaskCCDialogForm ref="taskCCDialogForm" />
|
|
||||||
</ContentWrap>
|
</ContentWrap>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as TaskApi from '@/api/bpm/task'
|
import * as TaskApi from '@/api/bpm/task'
|
||||||
import TaskCCDialogForm from '../../processInstance/detail/TaskCCDialogForm.vue'
|
|
||||||
|
|
||||||
defineOptions({ name: 'BpmDoneTask' })
|
defineOptions({ name: 'BpmTodoTask' })
|
||||||
|
|
||||||
const { push } = useRouter() // 路由
|
const { push } = useRouter() // 路由
|
||||||
|
|
||||||
@ -126,7 +130,7 @@ const resetQuery = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 处理审批按钮 */
|
/** 处理审批按钮 */
|
||||||
const handleAudit = (row) => {
|
const handleAudit = (row: any) => {
|
||||||
push({
|
push({
|
||||||
name: 'BpmProcessInstanceDetail',
|
name: 'BpmProcessInstanceDetail',
|
||||||
query: {
|
query: {
|
||||||
@ -135,12 +139,6 @@ const handleAudit = (row) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const taskCCDialogForm = ref()
|
|
||||||
/** 处理抄送按钮 */
|
|
||||||
const handleCC = (row) => {
|
|
||||||
taskCCDialogForm.value.open(row)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 初始化 **/
|
/** 初始化 **/
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getList()
|
getList()
|
||||||
|
Loading…
Reference in New Issue
Block a user