diff --git a/src/views/index/vehicleAdd.vue b/src/views/index/vehicleAdd.vue index fc8508a4..73832839 100644 --- a/src/views/index/vehicleAdd.vue +++ b/src/views/index/vehicleAdd.vue @@ -723,18 +723,8 @@ export default { }, methods:{ async initPage() { - // 重置图片槽位,避免 keep-alive 缓存复用时残留上一辆车的图片 - this.vehicleLicenseFrontList = [] - this.vehicleLicenseBackList = [] - this.vehicleLicenseCarPhotoList = [] - this.vehicleFrontPhotoList = [] - this.insurancePictureFiles = [] - this.vehicleLicenseFront = '' - this.vehicleLicenseBack = '' - this.vehicleLicenseCarPhoto = '' - this.vehicleFrontPhoto = '' - this.insurancePicturePhoto = '' - this.vehicleLicenseBackOcrFlag = false + // 整体重置为初始 data(keep-alive 缓存复用时清空上一次的新增/修改数据,含 watcher 改过的 vehicleTypes.disabled),再按当前模式初始化 + Object.assign(this.$data, this.$options.data.call(this, this)) this.id=this.$route.params?.id this.approvalForm.supplierId=this.$route.params?.supplierId const urlParams = new URLSearchParams(window.location.search); @@ -745,6 +735,10 @@ export default { if( this.id){ await this.vehicleInfo() }else{ + // 新增:清空 el-tree 勾选状态(缓存复用时可能残留上一辆车的服务种类勾选) + this.$nextTick(() => { + this.$refs.tree && this.$refs.tree.setCheckedKeys([]) + }) this.originData={ vehicleType:'', vehicleStatus:'',