|
|
@ -17,7 +17,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
import { ref, onMounted } from 'vue' |
|
|
|
import { ref, onMounted } from 'vue' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { useI18n } from 'vue-i18n' |
|
|
|
import { uniqBy } from 'lodash' |
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
querySimpleList, |
|
|
|
querySimpleList, |
|
|
|
queryProcessDefinitionByCode |
|
|
|
queryProcessDefinitionByCode |
|
|
@ -46,69 +45,25 @@ export function useChildNode({ |
|
|
|
if (loading.value) return |
|
|
|
if (loading.value) return |
|
|
|
loading.value = true |
|
|
|
loading.value = true |
|
|
|
const res = await querySimpleList(projectCode) |
|
|
|
const res = await querySimpleList(projectCode) |
|
|
|
options.value = res.map((option: { name: string; code: number }) => ({ |
|
|
|
options.value = res |
|
|
|
label: option.name, |
|
|
|
.filter((option: { name: string; code: number }) => option.code !== code) |
|
|
|
value: option.code |
|
|
|
.map((option: { name: string; code: number }) => ({ |
|
|
|
})) |
|
|
|
label: option.name, |
|
|
|
|
|
|
|
value: option.code |
|
|
|
|
|
|
|
})) |
|
|
|
loading.value = false |
|
|
|
loading.value = false |
|
|
|
|
|
|
|
if (!model.processDefinitionCode) { |
|
|
|
|
|
|
|
model.processDefinitionCode = options.value[0].value |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
const getProcessListByCode = async (processCode: number) => { |
|
|
|
const getProcessListByCode = async (processCode: number) => { |
|
|
|
if (!processCode) return |
|
|
|
if (!processCode) return |
|
|
|
const res = await queryProcessDefinitionByCode(processCode, projectCode) |
|
|
|
const res = await queryProcessDefinitionByCode(processCode, projectCode) |
|
|
|
getTaskOptions(res) |
|
|
|
model.definition = res |
|
|
|
} |
|
|
|
|
|
|
|
const getTaskOptions = (processDefinition: { |
|
|
|
|
|
|
|
processTaskRelationList: [] |
|
|
|
|
|
|
|
taskDefinitionList: [] |
|
|
|
|
|
|
|
}) => { |
|
|
|
|
|
|
|
const { processTaskRelationList = [], taskDefinitionList = [] } = |
|
|
|
|
|
|
|
processDefinition |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const preTaskOptions: { code: number; name: string }[] = [] |
|
|
|
|
|
|
|
const tasks: { [field: number]: string } = {} |
|
|
|
|
|
|
|
taskDefinitionList.forEach( |
|
|
|
|
|
|
|
(task: { code: number; taskType: string; name: string }) => { |
|
|
|
|
|
|
|
tasks[task.code] = task.name |
|
|
|
|
|
|
|
if (task.code === code) return |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
task.taskType === 'CONDITIONS' && |
|
|
|
|
|
|
|
processTaskRelationList.filter( |
|
|
|
|
|
|
|
(relation: { preTaskCode: number }) => |
|
|
|
|
|
|
|
relation.preTaskCode === task.code |
|
|
|
|
|
|
|
).length >= 2 |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
preTaskOptions.push({ |
|
|
|
|
|
|
|
code: task.code, |
|
|
|
|
|
|
|
name: task.name |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
model.preTaskOptions = uniqBy(preTaskOptions, 'code') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!code) return |
|
|
|
|
|
|
|
const preTasks: number[] = [] |
|
|
|
|
|
|
|
const postTaskOptions: { code: number; name: string }[] = [] |
|
|
|
|
|
|
|
processTaskRelationList.forEach( |
|
|
|
|
|
|
|
(relation: { preTaskCode: number; postTaskCode: number }) => { |
|
|
|
|
|
|
|
if (relation.preTaskCode === code) { |
|
|
|
|
|
|
|
postTaskOptions.push({ |
|
|
|
|
|
|
|
code: relation.postTaskCode, |
|
|
|
|
|
|
|
name: tasks[relation.postTaskCode] |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (relation.postTaskCode === code && relation.preTaskCode !== 0) { |
|
|
|
|
|
|
|
preTasks.push(relation.preTaskCode) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
model.preTasks = preTasks |
|
|
|
|
|
|
|
model.postTaskOptions = postTaskOptions |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const onChange = (code: number) => { |
|
|
|
const onChange = (code: number, options: { label: string }) => { |
|
|
|
getProcessListByCode(code) |
|
|
|
model.name = options.label |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|