diff --git a/package.json b/package.json index eb34ec17..22334907 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yudao-ui-admin-vue3", - "version": "1.8.1-snapshot", + "version": "1.8.2-snapshot", "description": "基于vue3、vite4、element-plus、typesScript", "author": "xingyu", "private": false, diff --git a/src/api/bpm/task/index.ts b/src/api/bpm/task/index.ts index f6763720..ccd5c4ee 100644 --- a/src/api/bpm/task/index.ts +++ b/src/api/bpm/task/index.ts @@ -41,3 +41,20 @@ export const getTaskListByProcessInstanceId = async (processInstanceId) => { export const exportTask = async (params) => { return await request.download({ url: '/bpm/task/export', params }) } + +// 获取所有可回退的节点 +export const getReturnList = async (params) => { + return await request.get({ url: '/bpm/task/get-return-list', params }) +} + +// 回退 +export const returnTask = async (data) => { + return await request.put({ url: '/bpm/task/return', data }) +} + +/** + * 委派 + */ +export const delegateTask = async (data) => { + return await request.put({ url: '/bpm/task/delegate', data }) +} diff --git a/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue b/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue index 856fb2d7..e2cd4679 100644 --- a/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue +++ b/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue @@ -11,6 +11,7 @@ import BpmnViewer from 'bpmn-js/lib/Viewer' import DefaultEmptyXML from './plugins/defaultEmpty' import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' import { formatDate } from '@/utils/formatTime' +import { isEmpty } from '@/utils/is' defineOptions({ name: 'MyProcessViewer' }) @@ -85,6 +86,7 @@ const createNewDiagram = async (xml) => { // console.error(`[Process Designer Warn]: ${e?.message || e}`); } } + /* 高亮流程图 */ // TODO 芋艿:如果多个 endActivity 的话,目前的逻辑可能有一定的问题。https://www.jdon.com/workflow/multi-events.html const highlightDiagram = async () => { @@ -97,6 +99,9 @@ const highlightDiagram = async () => { let canvas = bpmnModeler.get('canvas') let todoActivity: any = activityList.find((m: any) => !m.endTime) // 找到待办的任务 let endActivity: any = activityList[activityList.length - 1] // 获得最后一个任务 + let findProcessTask = false //是否已经高亮了进行中的任务 + //进行中高亮之后的任务 key 集合,用于过滤掉 taskList 进行中后面的任务,避免进行中后面的数据 Hover 还有数据 + let removeTaskDefinitionKeyList = [] // debugger bpmnModeler.getDefinitions().rootElements[0].flowElements?.forEach((n: any) => { let activity: any = activityList.find((m: any) => m.key === n.id) // 找到对应的活动 @@ -110,9 +115,17 @@ const highlightDiagram = async () => { if (!task) { return } + //进行中的任务已经高亮过了,则不高亮后面的任务了 + if (findProcessTask) { + removeTaskDefinitionKeyList.push(n.id) + return + } // 高亮任务 canvas.addMarker(n.id, getResultCss(task.result)) - + //标记是否高亮了进行中任务 + if (task.result === 1) { + findProcessTask = true + } // 如果非通过,就不走后面的线条了 if (task.result !== 2) { return @@ -212,6 +225,11 @@ const highlightDiagram = async () => { } } }) + if (!isEmpty(removeTaskDefinitionKeyList)) { + taskList.value = taskList.value.filter( + (item) => !removeTaskDefinitionKeyList.includes(item.definitionKey) + ) + } } const getActivityHighlightCss = (activity) => { return activity.endTime ? 'highlight' : 'highlight-todo' @@ -229,6 +247,9 @@ const getResultCss = (result) => { } else if (result === 4) { // 已取消 return 'highlight-cancel' + } else if (result === 5) { + // 退回 + return 'highlight-return' } return '' } @@ -273,9 +294,9 @@ const elementHover = (element) => { console.log(element.value, 'element.value') const activity = activityLists.value.find((m) => m.key === element.value.id) console.log(activity, 'activityactivityactivityactivity') - // if (!activity) { - // return - // } + if (!activity) { + return + } if (!elementOverlayIds.value[element.value.id] && element.value.type !== 'bpmn:Process') { let html = `

Elemet id: ${element.value.id}

@@ -564,6 +585,45 @@ watch( stroke: grey !important; } +/** 回退 */ +.highlight-return.djs-shape .djs-visual > :nth-child(1) { + fill: #e6a23c !important; + stroke: #e6a23c !important; + fill-opacity: 0.2 !important; +} +.highlight-return.djs-shape .djs-visual > :nth-child(2) { + fill: #e6a23c !important; +} +.highlight-return.djs-shape .djs-visual > path { + fill: #e6a23c !important; + fill-opacity: 0.2 !important; + stroke: #e6a23c !important; +} +.highlight-return.djs-connection > .djs-visual > path { + stroke: #e6a23c !important; +} + +.highlight-return:not(.djs-connection) .djs-visual > :nth-child(1) { + fill: #e6a23c !important; /* color elements as green */ +} + +:deep(.highlight-return.djs-shape .djs-visual > :nth-child(1)) { + fill: #e6a23c !important; + stroke: #e6a23c !important; + fill-opacity: 0.2 !important; +} +:deep(.highlight-return.djs-shape .djs-visual > :nth-child(2)) { + fill: #e6a23c !important; +} +:deep(.highlight-return.djs-shape .djs-visual > path) { + fill: #e6a23c !important; + fill-opacity: 0.2 !important; + stroke: #e6a23c !important; +} +:deep(.highlight-return.djs-connection > .djs-visual > path) { + stroke: #e6a23c !important; +} + .element-overlays { width: 200px; padding: 8px; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 6f3ded5c..80bb3e9d 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -278,12 +278,16 @@ export const PromotionDiscountTypeEnum = { */ export const BrokerageBindModeEnum = { ANYTIME: { - mode: 0, - name: '没有推广人' + mode: 1, + name: '首次绑定' }, REGISTER: { - mode: 1, - name: '新用户' + mode: 2, + name: '注册绑定' + }, + OVERRIDE: { + mode: 3, + name: '覆盖绑定' } } /** @@ -291,11 +295,11 @@ export const BrokerageBindModeEnum = { */ export const BrokerageEnabledConditionEnum = { ALL: { - condition: 0, + condition: 1, name: '人人分销' }, ADMIN: { - condition: 1, + condition: 2, name: '指定分销' } } diff --git a/src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue b/src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue index f45846d9..6f4557ae 100644 --- a/src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue +++ b/src/views/bpm/processInstance/detail/ProcessInstanceTaskList.vue @@ -69,6 +69,9 @@ const getTimelineItemIcon = (item) => { if (item.result === 4) { return 'el-icon-remove-outline' } + if (item.result === 5) { + return 'el-icon-back' + } return '' } @@ -86,6 +89,12 @@ const getTimelineItemType = (item) => { if (item.result === 4) { return 'info' } + if (item.result === 5) { + return 'warning' + } + if (item.result === 6) { + return 'default' + } return '' } diff --git a/src/views/bpm/processInstance/detail/TaskDelegateForm.vue b/src/views/bpm/processInstance/detail/TaskDelegateForm.vue new file mode 100644 index 00000000..dc757a0c --- /dev/null +++ b/src/views/bpm/processInstance/detail/TaskDelegateForm.vue @@ -0,0 +1,86 @@ + + diff --git a/src/views/bpm/processInstance/detail/TaskReturnDialogForm.vue b/src/views/bpm/processInstance/detail/TaskReturnDialogForm.vue new file mode 100644 index 00000000..f93bf2c5 --- /dev/null +++ b/src/views/bpm/processInstance/detail/TaskReturnDialogForm.vue @@ -0,0 +1,90 @@ + + diff --git a/src/views/bpm/processInstance/detail/index.vue b/src/views/bpm/processInstance/detail/index.vue index 64369181..585c60db 100644 --- a/src/views/bpm/processInstance/detail/index.vue +++ b/src/views/bpm/processInstance/detail/index.vue @@ -91,6 +91,10 @@ + + + +