|
|
@ -76,6 +76,9 @@ const resetBaseInfo = () => { |
|
|
|
// elementBaseInfo.value = JSON.parse(JSON.stringify(bpmnElement.value.businessObject)) |
|
|
|
console.log(elementBaseInfo.value, 'elementBaseInfo22222222222') |
|
|
|
} |
|
|
|
const timer1 = ref<NodeJS.Timeout | number>() |
|
|
|
const timer2 = ref<NodeJS.Timeout | number>() |
|
|
|
const timer3 = ref<NodeJS.Timeout | number>() |
|
|
|
const handleKeyUpdate = (value) => { |
|
|
|
// 校验 value 的值,只有 XML NCName 通过的情况下,才进行赋值。否则,会导致流程图报错,无法绘制的问题 |
|
|
|
if (!value) { |
|
|
@ -90,8 +93,12 @@ const handleKeyUpdate = (value) => { |
|
|
|
// 在 BPMN 的 XML 中,流程标识 key,其实对应的是 id 节点 |
|
|
|
elementBaseInfo.value['id'] = value |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
timer1.value = setTimeout(() => { |
|
|
|
updateBaseInfo('id') |
|
|
|
if(timer1.value){ |
|
|
|
clearTimeout(timer1.value) |
|
|
|
timer1.value = 0 |
|
|
|
} |
|
|
|
}, 100) |
|
|
|
} |
|
|
|
const handleNameUpdate = (value) => { |
|
|
@ -101,8 +108,12 @@ const handleNameUpdate = (value) => { |
|
|
|
} |
|
|
|
elementBaseInfo.value['name'] = value |
|
|
|
|
|
|
|
setTimeout(() => { |
|
|
|
timer2.value = setTimeout(() => { |
|
|
|
updateBaseInfo('name') |
|
|
|
if(timer2.value){ |
|
|
|
clearTimeout(timer2.value) |
|
|
|
timer2.value = 0 |
|
|
|
} |
|
|
|
}, 100) |
|
|
|
} |
|
|
|
// const handleDescriptionUpdate=(value)=> { |
|
|
@ -140,10 +151,14 @@ const updateBaseInfo = (key) => { |
|
|
|
} |
|
|
|
onMounted(() => { |
|
|
|
// 针对上传的 bpmn 流程图时,需要延迟 1 秒的时间,保证 key 和 name 的更新 |
|
|
|
setTimeout(() => { |
|
|
|
timer3.value = setTimeout(() => { |
|
|
|
console.log(props.model, 'props.model') |
|
|
|
handleKeyUpdate(props.model.key) |
|
|
|
handleNameUpdate(props.model.name) |
|
|
|
if(timer3.value){ |
|
|
|
clearTimeout(timer3.value) |
|
|
|
timer3.value = 0 |
|
|
|
} |
|
|
|
console.log(props, 'propsssssssssssssssssssss') |
|
|
|
}, 1000) |
|
|
|
}) |
|
|
@ -180,5 +195,17 @@ watch( |
|
|
|
// } |
|
|
|
onBeforeUnmount(() => { |
|
|
|
bpmnElement.value = null |
|
|
|
if(timer1.value){ |
|
|
|
clearTimeout(timer1.value) |
|
|
|
timer1.value = 0 |
|
|
|
} |
|
|
|
if(timer2.value){ |
|
|
|
clearTimeout(timer2.value) |
|
|
|
timer2.value = 0 |
|
|
|
} |
|
|
|
if(timer3.value){ |
|
|
|
clearTimeout(timer3.value) |
|
|
|
timer3.value = 0 |
|
|
|
} |
|
|
|
}) |
|
|
|
</script> |
|
|
|