From 7b9f5302d08e321616757629782b12d56fa4542c Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Tue, 16 Dec 2025 11:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=81=E7=A8=8B=E5=9B=BE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=92=8C=E7=BB=93=E6=9E=9C=EF=BC=8C=E6=B5=81=E7=A8=8B=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E8=A1=A8=E5=8D=95=E9=BB=98=E8=AE=A4=E5=8B=BE=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../package/designer/ProcessViewer.vue | 64 +++++++++++++------ .../components/undocumented/addForm.vue | 2 +- .../bpm/processInstance/detail/index.vue | 29 ++++++++- 3 files changed, 71 insertions(+), 24 deletions(-) diff --git a/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue b/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue index ac07acfb..c5295e0a 100644 --- a/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue +++ b/src/components/bpmnProcessDesigner/package/designer/ProcessViewer.vue @@ -279,6 +279,27 @@ const getResultCss = (status) => { return '' } +const getTaskNameItemType = (itemStatus: any) => { + if (itemStatus === 1) { + return '审批中' + }else if (itemStatus === 2) { + return '审批通过' + }else if (itemStatus === 3) { + return '审批不通过' + }else if (itemStatus === 4) { + return '已取消' + }else if (itemStatus === 5) { + return '退回' + } else if (itemStatus === 6) { + return '委派' + } else if (itemStatus === 7) { + return '审批通过中' + } else if (itemStatus === 0) { + return '待审批' + } + return '' +} + const getActivityOutgoing = (activity) => { // 如果有 outgoing,则直接使用它 if (activity.outgoing && activity.outgoing.length > 0) { @@ -316,7 +337,9 @@ const elementHover = (element) => { !overlays.value && (overlays.value = bpmnModeler.get('overlays')) // 展示信息 // console.log(activityLists.value, 'activityLists.value') - // console.log(element.value, 'element.value') + if (element.value.type === 'bpmn:SequenceFlow') { + return + } const activity = activityLists.value.find((m) => m.key === element.value.id) // console.log(activity, 'activityactivityactivityactivity') if (!activity) { @@ -328,25 +351,24 @@ const elementHover = (element) => {

Elemet type: ${element.value.type}

` // 默认值 if (element.value.type === 'bpmn:StartEvent' && processInstance.value) { - html = `

发起人:${processInstance.value.startUser.name}

部门:${processInstance.value.startUser.deptName}

-

创建时间:${formatDate(processInstance.value.createTime)}` +

创建时间:${formatDate(processInstance.value.startTime)}` } else if (element.value.type === 'bpmn:UserTask') { let task = taskList.value.find((m) => m.id === activity.taskId) // 找到活动对应的 taskId if (!task) { return } - let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) - let dataResult = '' - optionData.forEach((element) => { - if (element.value == task.status) { - dataResult = element.label - } - }) + // let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) + // let dataResult = '' + // optionData.forEach((element) => { + // if (element.value == task.status) { + // dataResult = element.label + // } + // }) html = `

审批人:${task.assigneeUser.name}

部门:${task.assigneeUser.deptName}

-

结果:${dataResult}

+

结果:${getTaskNameItemType(task.status)}

创建时间:${formatDate(task.createTime)}

` // html = `

审批人:${task.assigneeUser.nickname}

//

部门:${task.assigneeUser.deptName}

@@ -369,20 +391,20 @@ const elementHover = (element) => { html += `

结束时间:${formatDate(activity.endTime)}

` } } else if (element.value.type === 'bpmn:EndEvent' && processInstance.value) { - let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) - let dataResult = '' - optionData.forEach((element) => { - if (element.value == processInstance.value.status) { - dataResult = element.label - } - }) - html = `

结果:${dataResult}

` + // let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS) + // let dataResult = '' + // optionData.forEach((element) => { + // if (element.value == processInstance.value.status) { + // dataResult = element.label + // } + // }) + // html = `

结果:${dataResult}

` // html = `

结果:${getIntDictOptions( // DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, // processInstance.value.status // )}

` if (processInstance.value.endTime) { - html += `

结束时间:${formatDate(processInstance.value.endTime)}

` + html = `

结束时间:${formatDate(processInstance.value.endTime)}

` } } elementOverlayIds.value[element.value.id] = toRaw(overlays.value)?.add(element.value, { @@ -661,7 +683,7 @@ watch( } .element-overlays { - width: 200px; + width: 250px; padding: 8px; color: #fafafa; background: rgb(0 0 0 / 60%); diff --git a/src/views/pqs/supervise_hn/interfere/components/undocumented/addForm.vue b/src/views/pqs/supervise_hn/interfere/components/undocumented/addForm.vue index 9cc2601d..86daa43c 100644 --- a/src/views/pqs/supervise_hn/interfere/components/undocumented/addForm.vue +++ b/src/views/pqs/supervise_hn/interfere/components/undocumented/addForm.vue @@ -368,7 +368,7 @@ const areaOptionList = dictData //字典获取敏感电能质量指标 // const energyQualityIndexList = dictData.getBasicData('Indicator_Type') const energyQualityIndexList = dictData.getBasicData('Problem_Indicators') -console.log('0000',energyQualityIndexList.values) + const devIdList: any = ref([]) const lineIdList: any = ref([]) //字典获取行业类型 diff --git a/src/views/system/bpm/processInstance/detail/index.vue b/src/views/system/bpm/processInstance/detail/index.vue index 1db56531..8bb48b09 100644 --- a/src/views/system/bpm/processInstance/detail/index.vue +++ b/src/views/system/bpm/processInstance/detail/index.vue @@ -150,7 +150,7 @@ defineOptions({ name: 'BpmProcessInstanceDetail' }) const { query } = useRoute() // 查询参数 const { proxy } = getCurrentInstance() as any const states = history.state -console.log(states, '888888888888') + const userId = JSON.parse(window.localStorage.getItem('adminInfo')).id // 当前登录的编号 const id = (states.id as unknown as string) || query.id // 流程实例的编号 const historyInstanceId = states.historyInstanceId as unknown as string // 历史流程实例的编号 @@ -421,7 +421,32 @@ const loadRunningTask = tasks => { // 2.4 处理 approve 表单 if (task.formId && task.formConf) { const approveForm = {} - setConfAndFields2(approveForm, task.formConf, task.formFields, task.formVariable) + // 创建包含默认值的表单变量 + const formVariablesWithDefaults = { ...task.formVariable } + + // 解析 formFields 并设置默认值 + let processedFormFields = task.formFields; + if (task.formFields && Array.isArray(task.formFields)) { + processedFormFields = task.formFields.map(field => { + // 如果是字符串,需要先解析为对象 + let fieldObj = typeof field === 'string' ? JSON.parse(field) : field; + + // 为 radio 类型设置默认值 + if (fieldObj.type === 'radio' && fieldObj.options && fieldObj.options.length > 0) { + // 如果表单变量中还没有该字段的值,则设置默认值 + if (!(fieldObj.field in formVariablesWithDefaults)) { + formVariablesWithDefaults[fieldObj.field] = fieldObj.defaultValue !== undefined ? + fieldObj.defaultValue : fieldObj.options[0].value; + } + // 设置字段的默认值 + fieldObj.value = formVariablesWithDefaults[fieldObj.field]; + } + + // 将处理后的对象重新转换为JSON字符串(如果是原始字符串) + return typeof field === 'string' ? JSON.stringify(fieldObj) : fieldObj; + }); + } + setConfAndFields2(approveForm, task.formConf, processedFormFields, task.formVariable) approveForms.value.push(approveForm) } else { approveForms.value.push({}) // 占位,避免为空