From ab8e574c5e7386158e1fbb35f0723dca1435ef64 Mon Sep 17 00:00:00 2001 From: liangbin <15536829364@163.com> Date: Mon, 19 Jan 2026 15:03:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor(WorkOrderEdit):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E9=80=BB=E8=BE=91=E5=B9=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E5=88=87=E6=8D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将返回上一页和返回主页的逻辑分离为独立的函数 修复步骤切换时的条件判断错误 移除未使用的参数并统一函数命名 --- src/pages/WorkOrderEdit/index.vue | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/pages/WorkOrderEdit/index.vue b/src/pages/WorkOrderEdit/index.vue index 18fe82f..af7b361 100644 --- a/src/pages/WorkOrderEdit/index.vue +++ b/src/pages/WorkOrderEdit/index.vue @@ -4,9 +4,9 @@ - + - + {{ currentStep.Title }} @@ -24,7 +24,7 @@ - + @@ -90,8 +90,24 @@ const stepList = ref([ ]) // 返回上一步 -const prevStep = (id) => { - if (id == '3a') { +const goBack = () => { + if (currentStep.value.id == '3a') { + currentStep.value = stepList.value.find(item => item.id == 3); + } if (currentStep.value.id == 1) { + goHome(); + } else { + currentStep.value = stepList.value.find(item => item.id == currentStep.value.id - 1); + } +} + +// 返回主页 +const goHome = () => { + uni.switchTab({ url: '/pages/WorkOrderApproval/index' }) +} + +// 点击上一步 +const prevStep = () => { + if (currentStep.value.id == '3a') { currentStep.value = stepList.value.find(item => item.id == 3); } else { currentStep.value = stepList.value.find(item => item.id == currentStep.value.id - 1); @@ -99,7 +115,7 @@ const prevStep = (id) => { } // 点击下一步 -const nextStep = (id) => { +const nextStep = () => { if (currentStep.value.id == 1) { console.log(basicsInfoRef.value.getFormData()); allData.value.BasicsInfo = basicsInfoRef.value.getFormData();