fix: 修改流程时,修改了流程设计保存不生效问题修复

pull/631/head
GoldenZqqq 2024-12-25 14:10:16 +08:00
parent f86bd0df0b
commit a82862be47
2 changed files with 25 additions and 10 deletions

View File

@ -47,11 +47,15 @@ const modelData = computed({
})
// modelValue,XML
watch(() => props.modelValue, (newVal) => {
if (newVal.bpmnXml) {
xmlString.value = newVal.bpmnXml
}
}, { immediate: true, deep: true })
watch(
() => props.modelValue,
(newVal) => {
if (newVal.bpmnXml) {
xmlString.value = newVal.bpmnXml
}
},
{ immediate: true, deep: true }
)
/** 处理设计器保存成功 */
const handleDesignSuccess = (bpmnXml?: string) => {
@ -67,6 +71,11 @@ const handleDesignSuccess = (bpmnXml?: string) => {
/** 表单校验 */
const validate = async () => {
// modelData.bpmnXml
if (modelData.value.id && modelData.value.bpmnXml) {
return true
}
// bpmnXml
if (!xmlString.value) {
throw new Error('请设计流程')
}
@ -75,11 +84,17 @@ const validate = async () => {
/** 是否显示设计器 */
const showDesigner = computed(() => {
return Boolean(modelData.value.key && modelData.value.name)
return Boolean(modelData.value?.key && modelData.value?.name)
})
/** 获取当前XML字符串 */
const getXmlString = () => {
// xmlString
return xmlString.value || modelData.value?.bpmnXml
}
defineExpose({
validate,
getXmlString: () => xmlString.value
getXmlString
})
</script>
</script>

View File

@ -52,7 +52,7 @@
<!-- 主体内容 -->
<div class="mt-50px">
<!-- 第一步基本信息 -->
<div v-if="currentStep === 0" class="mx-auto" style="max-width: 1024px">
<div v-if="currentStep === 0" class="mx-auto max-w-1024px">
<BasicInfo
v-model="formData"
:categoryList="categoryList"
@ -62,7 +62,7 @@
</div>
<!-- 第二步表单设计 -->
<div v-if="currentStep === 1" class="mx-auto w-1024px">
<div v-if="currentStep === 1" class="mx-auto max-w-1024px">
<FormDesign v-model="formData" :formList="formList" ref="formDesignRef" />
</div>