流程图时间和结果,流程审核表单默认勾选
This commit is contained in:
@@ -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) => {
|
||||
<p>Elemet type: ${element.value.type}</p>
|
||||
</div>` // 默认值
|
||||
if (element.value.type === 'bpmn:StartEvent' && processInstance.value) {
|
||||
|
||||
html = `<p>发起人:${processInstance.value.startUser.name}</p>
|
||||
<p>部门:${processInstance.value.startUser.deptName}</p>
|
||||
<p>创建时间:${formatDate(processInstance.value.createTime)}`
|
||||
<p>创建时间:${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 = `<p>审批人:${task.assigneeUser.name}</p>
|
||||
<p>部门:${task.assigneeUser.deptName}</p>
|
||||
<p>结果:${dataResult}</p>
|
||||
<p>结果:${getTaskNameItemType(task.status)}</p>
|
||||
<p>创建时间:${formatDate(task.createTime)}</p>`
|
||||
// html = `<p>审批人:${task.assigneeUser.nickname}</p>
|
||||
// <p>部门:${task.assigneeUser.deptName}</p>
|
||||
@@ -369,20 +391,20 @@ const elementHover = (element) => {
|
||||
html += `<p>结束时间:${formatDate(activity.endTime)}</p>`
|
||||
}
|
||||
} 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 = `<p>结果:${dataResult}</p>`
|
||||
// let optionData = getIntDictOptions(DICT_TYPE.BPM_TASK_STATUS)
|
||||
// let dataResult = ''
|
||||
// optionData.forEach((element) => {
|
||||
// if (element.value == processInstance.value.status) {
|
||||
// dataResult = element.label
|
||||
// }
|
||||
// })
|
||||
// html = `<p>结果:${dataResult}</p>`
|
||||
// html = `<p>结果:${getIntDictOptions(
|
||||
// DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT,
|
||||
// processInstance.value.status
|
||||
// )}</p>`
|
||||
if (processInstance.value.endTime) {
|
||||
html += `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
||||
html = `<p>结束时间:${formatDate(processInstance.value.endTime)}</p>`
|
||||
}
|
||||
}
|
||||
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%);
|
||||
|
||||
@@ -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([])
|
||||
//字典获取行业类型
|
||||
|
||||
@@ -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({}) // 占位,避免为空
|
||||
|
||||
Reference in New Issue
Block a user