refactor(WorkOrderEdit): 重构导航逻辑并修复步骤切换问题
将返回上一页和返回主页的逻辑分离为独立的函数 修复步骤切换时的条件判断错误 移除未使用的参数并统一函数命名
This commit is contained in:
parent
478c5cfc1a
commit
ab8e574c5e
|
|
@ -4,9 +4,9 @@
|
|||
<view class="TopBox FlexBox">
|
||||
<view class="iconBox FlexBox">
|
||||
<!-- 返回上一页 -->
|
||||
<u-icon name="arrow-leftward" size="24" @click="prevStep"></u-icon>
|
||||
<u-icon name="arrow-leftward" size="24" @click="goBack"></u-icon>
|
||||
<!-- 返回主页 -->
|
||||
<u-icon name="home" size="24"></u-icon>
|
||||
<u-icon name="home" size="24" @click="goHome"></u-icon>
|
||||
</view>
|
||||
<view class="Title">{{ currentStep.Title }}</view>
|
||||
<view class="informBox">
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
</ApplyForMachine>
|
||||
</view>
|
||||
<view class="FootBox">
|
||||
<u-button :text="currentStep.PrevBtnName" type="info"></u-button>
|
||||
<u-button :text="currentStep.PrevBtnName" type="info" @click="prevStep"></u-button>
|
||||
<u-button :text="currentStep.NextBtnName" color="#2979ff" @click="nextStep"></u-button>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue