From bc9fa82eba2a39d04d4ff3e55a25691ebc923a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com> Date: Sun, 29 Jan 2023 15:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/system/goodsCategory/index.vue | 9 +++++++-- src/views/system/goodsInfo/goodsInfojs.js | 22 ++++++++++++++++------ src/views/system/goodsInfo/index.vue | 2 ++ 3 files changed, 25 insertions(+), 8 deletions(-) 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" >