diff --git a/src/views/business/businessHandling/index.vue b/src/views/business/businessHandling/index.vue index 0936f9c6..3a7dfd40 100644 --- a/src/views/business/businessHandling/index.vue +++ b/src/views/business/businessHandling/index.vue @@ -586,22 +586,48 @@ export default { } // 重置表单验证状态,避免旧的错误提示残留 this.$refs.maForm.clearValidate('deviceType') + }, + + // 监听一下路由的type + $route: { + handler(newVal) { + if (newVal.query.type == 'edit') { + this.isEdit = true + this.isDetail = false + this.id = newVal.query.id + const obj = Object.assign({}, newVal, { title: '领用申请编辑' }) + this.$tab.updatePage(obj) + } else if (newVal.query.type == 'detail') { + this.isEdit = false + this.isDetail = true + this.id = newVal.query.id + const obj = Object.assign({}, this.$route, { title: '领用申请详情' }) + this.$tab.updatePage(obj) + } + + if (this.isEdit || this.isDetail) { + console.log('isEdit', this.isEdit) + this.getTaskInfo() + } + }, + deep: true, + immediate: true } }, created() { // getCode() if (this.$route.query.type == 'edit') { - this.isEdit = true - this.isDetail = false - this.id = this.$route.query.id - const obj = Object.assign({}, this.$route, { title: '领用申请编辑' }) - this.$tab.updatePage(obj) + // this.isEdit = true + // this.isDetail = false + // this.id = this.$route.query.id + // const obj = Object.assign({}, this.$route, { title: '领用申请编辑' }) + // this.$tab.updatePage(obj) } else if (this.$route.query.type == 'detail') { - this.isEdit = false - this.isDetail = true - this.id = this.$route.query.id - const obj = Object.assign({}, this.$route, { title: '领用申请详情' }) - this.$tab.updatePage(obj) + // this.isEdit = false + // this.isDetail = true + // this.id = this.$route.query.id + // const obj = Object.assign({}, this.$route, { title: '领用申请详情' }) + // this.$tab.updatePage(obj) } else { this.isEdit = false this.isDetail = false @@ -613,10 +639,10 @@ export default { this.equipmentType() //机具类型下拉选 this.getStandardConfigList() // 标准配置下拉选 this.getMaTypeNameOpt() // 类型名称下拉选 - if (this.isEdit || this.isDetail) { - console.log('isEdit', this.isEdit) - this.getTaskInfo() - } + // if (this.isEdit || this.isDetail) { + // console.log('isEdit', this.isEdit) + // this.getTaskInfo() + // } console.log('🚀 ~ created ~ this.isDetail:', this.isDetail) console.log(this.$store, 'this.$store.getters') console.log(this.$route.query, 'this.$route.query')