mirror of
https://gitee.com/hhyykk/ipms-sjy-ui.git
synced 2025-07-15 19:35:07 +08:00
feat: 优化切换步骤时的必填校验,限制往后切换时才触发必填校验优化用户体验
This commit is contained in:
@ -228,14 +228,20 @@ const handleStepClick = async (index: number) => {
|
||||
return
|
||||
}
|
||||
}
|
||||
// 校验当前步骤
|
||||
try {
|
||||
if (typeof steps[currentStep.value].validator === 'function') {
|
||||
await steps[currentStep.value].validator()
|
||||
|
||||
// 只有在向后切换时才进行校验
|
||||
if (index > currentStep.value) {
|
||||
try {
|
||||
if (typeof steps[currentStep.value].validator === 'function') {
|
||||
await steps[currentStep.value].validator()
|
||||
}
|
||||
currentStep.value = index
|
||||
} catch (error) {
|
||||
message.warning('请先完善当前步骤必填信息')
|
||||
}
|
||||
} else {
|
||||
// 向前切换时直接切换
|
||||
currentStep.value = index
|
||||
} catch (error) {
|
||||
message.warning('请先完善当前步骤必填信息')
|
||||
}
|
||||
}
|
||||
|
||||
@ -244,6 +250,7 @@ const handleDesignSuccess = (bpmnXml?: string) => {
|
||||
if (bpmnXml) {
|
||||
formData.value.bpmnXml = bpmnXml
|
||||
}
|
||||
handleSave() // 自动保存
|
||||
message.success('保存成功')
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user