This commit is contained in:
曹辉 2023-01-29 15:08:48 +08:00
parent 28b2ee91b2
commit bc9fa82eba
3 changed files with 25 additions and 8 deletions

View File

@ -204,6 +204,7 @@
style="width: 340px" style="width: 340px"
:show-all-levels="false" :show-all-levels="false"
ref="cascader" ref="cascader"
:key="isResouceShow"
:placeholder="form.parentName ? form.parentName : ''" :placeholder="form.parentName ? form.parentName : ''"
> >
</el-cascader> </el-cascader>
@ -278,6 +279,7 @@ export default {
components: { stationAcatar }, components: { stationAcatar },
data() { data() {
return { return {
isResouceShow: 1,
treeOption: { treeOption: {
lazy: true, lazy: true,
checkStrictly: true, // checkStrictly: true, //
@ -379,7 +381,7 @@ export default {
this.loading = true; this.loading = true;
this.queryParams.parentId = data.id; this.queryParams.parentId = data.id;
this.queryParams.parentName = data.goodsCategoryName; this.queryParams.parentName = data.goodsCategoryName;
this.categoryLevel = data.categoryLevel; // this.categoryLevel = data.categoryLevel;
this.handleQuery(); this.handleQuery();
getStationCategoryList(data.id).then((res) => { getStationCategoryList(data.id).then((res) => {
res.data.forEach((e) => { res.data.forEach((e) => {
@ -425,6 +427,7 @@ export default {
}, },
// //
cancel() { cancel() {
++this.isResouceShow;
if (this.form.parentId) { if (this.form.parentId) {
// //
this.$refs.cascader.$refs.panel.clearCheckedNodes(); this.$refs.cascader.$refs.panel.clearCheckedNodes();
@ -490,7 +493,7 @@ export default {
this.form.parentId = this.queryParams.parentId; this.form.parentId = this.queryParams.parentId;
// } // }
this.form.parentName = this.queryParams.parentName; this.form.parentName = this.queryParams.parentName;
this.form.categoryLevel = this.categoryLevel; // this.form.categoryLevel = this.categoryLevel;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
@ -522,6 +525,7 @@ export default {
this.$refs.cascader.$refs.panel.clearCheckedNodes(); this.$refs.cascader.$refs.panel.clearCheckedNodes();
// //
this.$refs.cascader.$refs.panel.activePath = []; this.$refs.cascader.$refs.panel.activePath = [];
++this.isResouceShow;
this.open = false; this.open = false;
this.getList(); this.getList();
this.info(); this.info();
@ -533,6 +537,7 @@ export default {
this.$refs.cascader.$refs.panel.clearCheckedNodes(); this.$refs.cascader.$refs.panel.clearCheckedNodes();
// //
this.$refs.cascader.$refs.panel.activePath = []; this.$refs.cascader.$refs.panel.activePath = [];
++this.isResouceShow;
this.open = false; this.open = false;
this.getList(); this.getList();
this.info(); this.info();

View File

@ -138,6 +138,7 @@ export default {
{ required: true, message: "请输入商品顺序", trigger: "blur" }, { required: true, message: "请输入商品顺序", trigger: "blur" },
], ],
}, },
isResouceShow: 1,
treeOption: { treeOption: {
lazy: true, lazy: true,
checkStrictly: true, // 是否可选择任意一级 checkStrictly: true, // 是否可选择任意一级
@ -245,11 +246,14 @@ export default {
); );
} }
} }
console.log(this.goodDetailsLists);
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
console.log(this.form); // 清空选中的节点
this.$refs.cascader.$refs.panel.clearCheckedNodes();
// 设置为空可以让节点不高亮显示
this.$refs.cascader.$refs.panel.activePath = [];
++this.isResouceShow;
var obj = { pictureUrlList: [] }; var obj = { pictureUrlList: [] };
if (this.imgone != this.form.goodsPictureUrl) { if (this.imgone != this.form.goodsPictureUrl) {
obj.pictureUrlList.push(this.form.goodsPictureUrl); obj.pictureUrlList.push(this.form.goodsPictureUrl);
@ -276,7 +280,6 @@ export default {
}, ], }, ],
}, ]; }, ];
}, },
handleQuery2() { handleQuery2() {
// this.getListByUserquery.pageNum = 1; // this.getListByUserquery.pageNum = 1;
this.getList2(); this.getList2();
@ -298,7 +301,6 @@ export default {
addcancel() { addcancel() {
this.resetQuery2(); this.resetQuery2();
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
@ -413,6 +415,11 @@ export default {
}); });
} }
this.imgsurl = { pictureUrlList: [] }; this.imgsurl = { pictureUrlList: [] };
// 清空选中的节点
this.$refs.cascader.$refs.panel.clearCheckedNodes();
// 设置为空可以让节点不高亮显示
this.$refs.cascader.$refs.panel.activePath = [];
++this.isResouceShow;
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -422,9 +429,12 @@ export default {
e.goodsPrice = Number(e.goodsPrice); e.goodsPrice = Number(e.goodsPrice);
}); });
addGoodsInfo(this.form).then((response) => { 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.$modal.msgSuccess("新增成功");
// this.StationName = "请选择所属护理站"; // this.StationName = "请选择所属护理站";
this.open = false; this.open = false;
this.getList(); this.getList();

View File

@ -203,6 +203,7 @@
:visible.sync="open" :visible.sync="open"
width="1200px" width="1200px"
append-to-body append-to-body
:before-close="cancel"
> >
<el-form <el-form
ref="form" ref="form"
@ -235,6 +236,7 @@
style="width: 210px" style="width: 210px"
:show-all-levels="false" :show-all-levels="false"
:clearable="true" :clearable="true"
:key="isResouceShow"
ref="cascader" ref="cascader"
:placeholder="form.goodsCategoryName ? form.goodsCategoryName : ''" :placeholder="form.goodsCategoryName ? form.goodsCategoryName : ''"
> >