diff --git a/src/views/system/goodsCategory/index.vue b/src/views/system/goodsCategory/index.vue index eba5505..8a723f5 100644 --- a/src/views/system/goodsCategory/index.vue +++ b/src/views/system/goodsCategory/index.vue @@ -204,6 +204,7 @@ style="width: 340px" :show-all-levels="false" ref="cascader" + :key="isResouceShow" :placeholder="form.parentName ? form.parentName : ''" > @@ -278,6 +279,7 @@ export default { components: { stationAcatar }, data() { return { + isResouceShow: 1, treeOption: { lazy: true, checkStrictly: true, // 是否可选择任意一级 @@ -379,7 +381,7 @@ export default { this.loading = true; this.queryParams.parentId = data.id; this.queryParams.parentName = data.goodsCategoryName; - this.categoryLevel = data.categoryLevel; + // this.categoryLevel = data.categoryLevel; this.handleQuery(); getStationCategoryList(data.id).then((res) => { res.data.forEach((e) => { @@ -425,6 +427,7 @@ export default { }, // 取消按钮 cancel() { + ++this.isResouceShow; if (this.form.parentId) { // 清空选中的节点 this.$refs.cascader.$refs.panel.clearCheckedNodes(); @@ -490,7 +493,7 @@ export default { this.form.parentId = this.queryParams.parentId; // } this.form.parentName = this.queryParams.parentName; - this.form.categoryLevel = this.categoryLevel; + // this.form.categoryLevel = this.categoryLevel; }, /** 修改按钮操作 */ handleUpdate(row) { @@ -522,6 +525,7 @@ export default { this.$refs.cascader.$refs.panel.clearCheckedNodes(); // 设置为空可以让节点不高亮显示 this.$refs.cascader.$refs.panel.activePath = []; + ++this.isResouceShow; this.open = false; this.getList(); this.info(); @@ -533,6 +537,7 @@ export default { this.$refs.cascader.$refs.panel.clearCheckedNodes(); // 设置为空可以让节点不高亮显示 this.$refs.cascader.$refs.panel.activePath = []; + ++this.isResouceShow; this.open = false; this.getList(); this.info(); diff --git a/src/views/system/goodsInfo/goodsInfojs.js b/src/views/system/goodsInfo/goodsInfojs.js index 4f57d88..d76827d 100644 --- a/src/views/system/goodsInfo/goodsInfojs.js +++ b/src/views/system/goodsInfo/goodsInfojs.js @@ -138,6 +138,7 @@ export default { { required: true, message: "请输入商品顺序", trigger: "blur" }, ], }, + isResouceShow: 1, treeOption: { lazy: true, checkStrictly: true, // 是否可选择任意一级 @@ -245,11 +246,14 @@ export default { ); } } - console.log(this.goodDetailsLists); }, // 取消按钮 cancel() { - console.log(this.form); + // 清空选中的节点 + this.$refs.cascader.$refs.panel.clearCheckedNodes(); + // 设置为空可以让节点不高亮显示 + this.$refs.cascader.$refs.panel.activePath = []; + ++this.isResouceShow; var obj = { pictureUrlList: [] }; if (this.imgone != this.form.goodsPictureUrl) { obj.pictureUrlList.push(this.form.goodsPictureUrl); @@ -276,7 +280,6 @@ export default { }, ], }, ]; }, - handleQuery2() { // this.getListByUserquery.pageNum = 1; this.getList2(); @@ -298,7 +301,6 @@ export default { addcancel() { this.resetQuery2(); }, - // 表单重置 reset() { this.form = { @@ -413,6 +415,11 @@ export default { }); } this.imgsurl = { pictureUrlList: [] }; + // 清空选中的节点 + this.$refs.cascader.$refs.panel.clearCheckedNodes(); + // 设置为空可以让节点不高亮显示 + this.$refs.cascader.$refs.panel.activePath = []; + ++this.isResouceShow; this.$modal.msgSuccess("修改成功"); this.open = false; this.getList(); @@ -422,9 +429,12 @@ export default { e.goodsPrice = Number(e.goodsPrice); }); addGoodsInfo(this.form).then((response) => { - console.log(this.form); + // 清空选中的节点 + this.$refs.cascader.$refs.panel.clearCheckedNodes(); + // 设置为空可以让节点不高亮显示 + this.$refs.cascader.$refs.panel.activePath = []; + ++this.isResouceShow; this.$modal.msgSuccess("新增成功"); - // this.StationName = "请选择所属护理站"; this.open = false; this.getList(); diff --git a/src/views/system/goodsInfo/index.vue b/src/views/system/goodsInfo/index.vue index c8ce644..8b13049 100644 --- a/src/views/system/goodsInfo/index.vue +++ b/src/views/system/goodsInfo/index.vue @@ -203,6 +203,7 @@ :visible.sync="open" width="1200px" append-to-body + :before-close="cancel" >