Commit a94af4bc by 李伟康

```

fix(addHandover): 优化交付组件状态管理

- 将showAgree和agree状态从step-2.vue移至父组件addHandover.vue
- 修复步骤切换时agree状态未重置的问题
- 重构数据获取逻辑,统一状态管理
- 移除未使用的代码注释
```
1 parent e0dbc8f4
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
</div> </div>
</div> </div>
<template #footerCustom> <template #footerCustom>
<template v-if="step == 2 && step2Ref.showAgree"> <template v-if="step == 2 && showAgree">
<div class="agree-box"> <div class="agree-box">
<el-checkbox v-model="step2Ref.agree">我确认以上已上传的凭证真实有效,并知晓系统将同步变更拍卖平台上的交付人信息。</el-checkbox> <el-checkbox v-model="agree">我确认以上已上传的凭证真实有效,并知晓系统将同步变更拍卖平台上的交付人信息。</el-checkbox>
</div> </div>
</template> </template>
</template> </template>
...@@ -107,6 +107,13 @@ export default { ...@@ -107,6 +107,13 @@ export default {
}, },
step2Ref () { step2Ref () {
return this.$refs.step2 return this.$refs.step2
},
showAgree () {
const { tableData } = this
let flag = false
let len = tableData.findIndex(item => item.signCustodyStatus)
if (len != -1) flag = true
return flag
} }
}, },
mounted () { }, mounted () { },
...@@ -116,6 +123,7 @@ export default { ...@@ -116,6 +123,7 @@ export default {
if (val) { if (val) {
this.step = 1 this.step = 1
this.loading = true this.loading = true
this.agree = false
this.$nextTick(() => { this.$nextTick(() => {
this.step1Ref.init() this.step1Ref.init()
}) })
...@@ -141,7 +149,7 @@ export default { ...@@ -141,7 +149,7 @@ export default {
loading: true, loading: true,
tableData: [], tableData: [],
btnLoding: false, btnLoding: false,
viewKey: Date.now(), agree: false
} }
}, },
methods: { methods: {
...@@ -155,8 +163,6 @@ export default { ...@@ -155,8 +163,6 @@ export default {
const { step } = this const { step } = this
if (step == 1) this.queryAssets() if (step == 1) this.queryAssets()
if (step == 2) this.createStaffHandover() if (step == 2) this.createStaffHandover()
// this.step = step + 1
// if (this.step == 2) this.$refs.step2.init()
}, },
async queryAssets () { async queryAssets () {
try { try {
...@@ -184,7 +190,8 @@ export default { ...@@ -184,7 +190,8 @@ export default {
try { try {
this.btnLoding = true this.btnLoding = true
const { formObj } = this.step1Ref, const { formObj } = this.step1Ref,
{ showAgree, agree, filterArr } = this.step2Ref { filterArr } = this.step2Ref,
{ showAgree, agree } = this
let num = 0 let num = 0
const assets = filterArr() const assets = filterArr()
let agreeFlag = false let agreeFlag = false
......
...@@ -130,27 +130,16 @@ export default { ...@@ -130,27 +130,16 @@ export default {
}, },
] ]
}, },
agree: false,
listData: [], listData: [],
currentIndex: 0, currentIndex: 0,
currentImgUrls: [] currentImgUrls: []
} }
}, },
computed: {
showAgree () {
const { tableData } = this
let flag = false
let len = tableData.findIndex(item => item.signCustodyStatus)
if (len != -1) flag = true
return flag
}
},
watch: { watch: {
tableData: { tableData: {
handler (val) { handler (val) {
this.imgViewerVisible = false this.imgViewerVisible = false
this.currentImgUrls = [] this.currentImgUrls = []
this.agree = false
this.listData = val || [] this.listData = val || []
this.GlOssApi = new GlOssApi({ this.GlOssApi = new GlOssApi({
baseConfig baseConfig
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!