!251 【工作流】回退fix

Merge pull request !251 from Youkehai/master
This commit is contained in:
芋道源码 2023-09-24 14:45:54 +00:00 committed by Gitee
commit ada93a160b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 31 additions and 13 deletions

View File

@ -54,6 +54,6 @@ export const getReturnList = async (params) => {
* 退 * 退
* @param params * @param params
*/ */
export const okRollback = async (data) => { export const okReturnTask = async (data) => {
return await request.put({ url: '/bpm/task/rollback', data }) return await request.put({ url: '/bpm/task/return', data })
} }

View File

@ -11,6 +11,7 @@ import BpmnViewer from 'bpmn-js/lib/Viewer'
import DefaultEmptyXML from './plugins/defaultEmpty' import DefaultEmptyXML from './plugins/defaultEmpty'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime' import { formatDate } from '@/utils/formatTime'
import { isEmpty } from '@/utils/is'
defineOptions({ name: 'MyProcessViewer' }) defineOptions({ name: 'MyProcessViewer' })
@ -85,6 +86,7 @@ const createNewDiagram = async (xml) => {
// console.error(`[Process Designer Warn]: ${e?.message || e}`); // console.error(`[Process Designer Warn]: ${e?.message || e}`);
} }
} }
/* 高亮流程图 */ /* 高亮流程图 */
// TODO endActivity https://www.jdon.com/workflow/multi-events.html // TODO endActivity https://www.jdon.com/workflow/multi-events.html
const highlightDiagram = async () => { const highlightDiagram = async () => {
@ -97,6 +99,9 @@ const highlightDiagram = async () => {
let canvas = bpmnModeler.get('canvas') let canvas = bpmnModeler.get('canvas')
let todoActivity: any = activityList.find((m: any) => !m.endTime) // let todoActivity: any = activityList.find((m: any) => !m.endTime) //
let endActivity: any = activityList[activityList.length - 1] // let endActivity: any = activityList[activityList.length - 1] //
let findProcessTask = false //
// key taskList Hover
let removeTaskDefinitionKeyList = []
// debugger // debugger
bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n: any) => { bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n: any) => {
let activity: any = activityList.find((m: any) => m.key === n.id) // let activity: any = activityList.find((m: any) => m.key === n.id) //
@ -110,9 +115,17 @@ const highlightDiagram = async () => {
if (!task) { if (!task) {
return return
} }
//
if (findProcessTask) {
removeTaskDefinitionKeyList.push(n.id)
return
}
// //
canvas.addMarker(n.id, getResultCss(task.result)) canvas.addMarker(n.id, getResultCss(task.result))
//
if (task.result === 1) {
findProcessTask = true
}
// 线 // 线
if (task.result !== 2) { if (task.result !== 2) {
return return
@ -212,6 +225,11 @@ const highlightDiagram = async () => {
} }
} }
}) })
if (!isEmpty(removeTaskDefinitionKeyList)) {
taskList.value = taskList.value.filter(
(item) => !removeTaskDefinitionKeyList.includes(item.definitionKey)
)
}
} }
const getActivityHighlightCss = (activity) => { const getActivityHighlightCss = (activity) => {
return activity.endTime ? 'highlight' : 'highlight-todo' return activity.endTime ? 'highlight' : 'highlight-todo'
@ -276,9 +294,9 @@ const elementHover = (element) => {
console.log(element.value, 'element.value') console.log(element.value, 'element.value')
const activity = activityLists.value.find((m) => m.key === element.value.id) const activity = activityLists.value.find((m) => m.key === element.value.id)
console.log(activity, 'activityactivityactivityactivity') console.log(activity, 'activityactivityactivityactivity')
// if (!activity) { if (!activity) {
// return return
// } }
if (!elementOverlayIds.value[element.value.id] && element.value.type !== 'bpmn:Process') { if (!elementOverlayIds.value[element.value.id] && element.value.type !== 'bpmn:Process') {
let html = `<div class="element-overlays"> let html = `<div class="element-overlays">
<p>Elemet id: ${element.value.id}</p> <p>Elemet id: ${element.value.id}</p>

View File

@ -11,9 +11,9 @@
<el-select v-model="formData.targetDefinitionKey" clearable style="width: 100%"> <el-select v-model="formData.targetDefinitionKey" clearable style="width: 100%">
<el-option <el-option
v-for="item in returnList" v-for="item in returnList"
:key="item.taskDefinitionKey" :key="item.definitionKey"
:label="item.name" :label="item.name"
:value="item.taskDefinitionKey" :value="item.definitionKey"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -68,7 +68,7 @@ const submitForm = async () => {
// //
formLoading.value = true formLoading.value = true
try { try {
await TaskApi.okRollback(formData.value) await TaskApi.okReturnTask(formData.value)
message.success('回退成功') message.success('回退成功')
dialogVisible.value = false dialogVisible.value = false
// //

View File

@ -92,7 +92,7 @@
<!-- 弹窗转派审批人 --> <!-- 弹窗转派审批人 -->
<TaskUpdateAssigneeForm ref="taskUpdateAssigneeFormRef" @success="getDetail" /> <TaskUpdateAssigneeForm ref="taskUpdateAssigneeFormRef" @success="getDetail" />
<!-- 弹窗回退节点 --> <!-- 弹窗回退节点 -->
<TaskRollbackDialog ref="taskRollbackRef" @success="getDetail" /> <TaskReturnDialog ref="taskReturnDialogRef" @success="getDetail" />
</ContentWrap> </ContentWrap>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -105,7 +105,7 @@ import * as TaskApi from '@/api/bpm/task'
import TaskUpdateAssigneeForm from './TaskUpdateAssigneeForm.vue' import TaskUpdateAssigneeForm from './TaskUpdateAssigneeForm.vue'
import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue' import ProcessInstanceBpmnViewer from './ProcessInstanceBpmnViewer.vue'
import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue' import ProcessInstanceTaskList from './ProcessInstanceTaskList.vue'
import TaskRollbackDialog from './TaskRollbackDialogForm.vue' import TaskReturnDialog from './TaskReturnDialogForm.vue'
import { registerComponent } from '@/utils/routerHelper' import { registerComponent } from '@/utils/routerHelper'
defineOptions({ name: 'BpmProcessInstanceDetail' }) defineOptions({ name: 'BpmProcessInstanceDetail' })
@ -176,10 +176,10 @@ const handleDelegate = async (task) => {
} }
//退 //退
const taskRollbackRef = ref() const taskReturnDialogRef = ref()
/** 处理审批退回的操作 */ /** 处理审批退回的操作 */
const handleBack = async (task) => { const handleBack = async (task) => {
taskRollbackRef.value.open(task.id) taskReturnDialogRef.value.open(task.id)
} }
/** 获得详情 */ /** 获得详情 */