|
|
@ -41,10 +41,16 @@ interface Options { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
export function useTaskEdit(options: Options) { |
|
|
|
export function useTaskEdit(options: Options) { |
|
|
|
const { graph, definition } = options |
|
|
|
const { graph, definition } = options |
|
|
|
const { addNode, removeNode, getSources, setNodeName, setNodeEdge } = |
|
|
|
const { |
|
|
|
useCellUpdate({ |
|
|
|
addNode, |
|
|
|
graph |
|
|
|
removeNode, |
|
|
|
}) |
|
|
|
getSources, |
|
|
|
|
|
|
|
getTargets, |
|
|
|
|
|
|
|
setNodeName, |
|
|
|
|
|
|
|
setNodeEdge |
|
|
|
|
|
|
|
} = useCellUpdate({ |
|
|
|
|
|
|
|
graph |
|
|
|
|
|
|
|
}) |
|
|
|
const processDefinition = ref( |
|
|
|
const processDefinition = ref( |
|
|
|
definition?.value || { |
|
|
|
definition?.value || { |
|
|
|
processDefinition: {}, |
|
|
|
processDefinition: {}, |
|
|
@ -107,6 +113,13 @@ export function useTaskEdit(options: Options) { |
|
|
|
processDefinition.value.taskDefinitionList.filter( |
|
|
|
processDefinition.value.taskDefinitionList.filter( |
|
|
|
(task) => !codes.includes(task.code) |
|
|
|
(task) => !codes.includes(task.code) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
codes.forEach((code: number) => { |
|
|
|
|
|
|
|
remove( |
|
|
|
|
|
|
|
processDefinition.value.processTaskRelationList, |
|
|
|
|
|
|
|
(process) => |
|
|
|
|
|
|
|
process.postTaskCode === code || process.preTaskCode === code |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function openTaskModal(task: NodeData) { |
|
|
|
function openTaskModal(task: NodeData) { |
|
|
@ -126,6 +139,7 @@ export function useTaskEdit(options: Options) { |
|
|
|
currTask.value = definition |
|
|
|
currTask.value = definition |
|
|
|
} |
|
|
|
} |
|
|
|
updatePreTasks(getSources(String(code)), code) |
|
|
|
updatePreTasks(getSources(String(code)), code) |
|
|
|
|
|
|
|
updatePostTasks(code) |
|
|
|
taskModalVisible.value = true |
|
|
|
taskModalVisible.value = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -191,6 +205,28 @@ export function useTaskEdit(options: Options) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updatePostTasks(code: number) { |
|
|
|
|
|
|
|
const targets = getTargets(String(code)) |
|
|
|
|
|
|
|
targets.forEach((target: number) => { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
!processDefinition.value?.processTaskRelationList.find( |
|
|
|
|
|
|
|
(relation) => |
|
|
|
|
|
|
|
relation.postTaskCode === target && relation.preTaskCode === code |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
processDefinition.value?.processTaskRelationList.push({ |
|
|
|
|
|
|
|
postTaskCode: target, |
|
|
|
|
|
|
|
preTaskCode: code, |
|
|
|
|
|
|
|
name: '', |
|
|
|
|
|
|
|
preTaskVersion: 1, |
|
|
|
|
|
|
|
postTaskVersion: 1, |
|
|
|
|
|
|
|
conditionType: 'NONE', |
|
|
|
|
|
|
|
conditionParams: {} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
onMounted(() => { |
|
|
|
if (graph.value) { |
|
|
|
if (graph.value) { |
|
|
|
graph.value.on('cell:dblclick', ({ cell }) => { |
|
|
|
graph.value.on('cell:dblclick', ({ cell }) => { |
|
|
|