Commit ab11818c by GoldenZqqqq

feat: 优化切换步骤时的必填校验,限制往后切换时才触发必填校验优化用户体验

parent a6461da0
...@@ -228,14 +228,20 @@ const handleStepClick = async (index: number) => { ...@@ -228,14 +228,20 @@ const handleStepClick = async (index: number) => {
return return
} }
} }
// 校验当前步骤
try { // 只有在向后切换时才进行校验
if (typeof steps[currentStep.value].validator === 'function') { if (index > currentStep.value) {
await steps[currentStep.value].validator() try {
if (typeof steps[currentStep.value].validator === 'function') {
await steps[currentStep.value].validator()
}
currentStep.value = index
} catch (error) {
message.warning('请先完善当前步骤必填信息')
} }
} else {
// 向前切换时直接切换
currentStep.value = index currentStep.value = index
} catch (error) {
message.warning('请先完善当前步骤必填信息')
} }
} }
...@@ -244,6 +250,7 @@ const handleDesignSuccess = (bpmnXml?: string) => { ...@@ -244,6 +250,7 @@ const handleDesignSuccess = (bpmnXml?: string) => {
if (bpmnXml) { if (bpmnXml) {
formData.value.bpmnXml = bpmnXml formData.value.bpmnXml = bpmnXml
} }
handleSave() // 自动保存
message.success('保存成功') message.success('保存成功')
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment