fix: 创建/修改流程页面-恢复填写流程标识与流程名称才可以切换到第三步逻辑

This commit is contained in:
GoldenZqqqq
2024-12-14 15:43:06 +08:00
parent 21c28c3665
commit 746aeaff35
2 changed files with 17 additions and 25 deletions

View File

@@ -245,10 +245,3 @@ watch(
} }
) )
</script> </script>
<style lang="scss">
.process-panel__container {
position: absolute;
top: 90px;
right: 60px;
}
</style>

View File

@@ -550,34 +550,33 @@ const handleDesignSuccess = (bpmnXml?: string) => {
const handleStepClick = async (index: number) => { const handleStepClick = async (index: number) => {
// 如果是切换到第三步流程设计需要校验key和name // 如果是切换到第三步流程设计需要校验key和name
if (index === 2) { if (index === 2) {
if (!formData.value.id) { if (!formData.value.key || !formData.value.name) {
// 新增时才校验 message.warning('请先填写流程标识和流程名称')
try { return
await formRef.value?.validateField(['key', 'name'])
// 确保数据已经准备好
await nextTick()
} catch (error) {
message.warning('请先填写流程标识和流程名称')
return
}
} }
// 确保数据已经准备好再切换
await nextTick()
} }
currentStep.value = index currentStep.value = index
} }
// 添加一个计算属性来判断是否显示设计器 // 添加一个计算属性来判断是否显示设计器
const showDesigner = computed(() => { const showDesigner = computed(() => {
return currentStep.value === 2 && Boolean(formData.value.id || (formData.value.key && formData.value.name)) return (
currentStep.value === 2 &&
Boolean(formData.value.id || (formData.value.key && formData.value.name))
)
}) })
// 监听步骤变化,确保数据准备完成 // 监听步骤变化,确保数据准备完成
watch(() => currentStep.value, async (newStep) => { watch(
if (newStep === 2) { () => currentStep.value,
await nextTick() async (newStep) => {
} if (newStep === 2) {
}, { immediate: false }) await nextTick()
}
},
{ immediate: false }
)
// 在组件卸载时清理 // 在组件卸载时清理
onBeforeUnmount(() => { onBeforeUnmount(() => {