This commit is contained in:
曹辉 2023-01-29 16:58:26 +08:00
parent aef35e3408
commit 6394c0f4bd

View File

@ -196,7 +196,7 @@
label="父级分类名称" label="父级分类名称"
prop="parentName" prop="parentName"
:required="true" :required="true"
v-if="form.parentId" v-show="form.parentId"
> >
<el-cascader <el-cascader
:props="treeOption" :props="treeOption"
@ -332,11 +332,16 @@ export default {
goodsCategoryPicture: null, goodsCategoryPicture: null,
categoryRemark: null, categoryRemark: null,
sort: null, sort: null,
parentId: 0, parentId: "",
parentName: "", parentName: "",
}, },
// //
form: {}, form: {
goodsCategoryName: null,
goodsCategoryPicture: null,
categoryRemark: null,
sort: null,
},
// //
rules: { rules: {
goodsCategoryName: [ goodsCategoryName: [
@ -381,8 +386,10 @@ 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.form.parentId = data.id;
this.form.parentName = data.goodsCategoryName;
// this.categoryLevel = data.categoryLevel; // this.categoryLevel = data.categoryLevel;
this.handleQuery(); this.getList();
getStationCategoryList(data.id).then((res) => { getStationCategoryList(data.id).then((res) => {
res.data.forEach((e) => { res.data.forEach((e) => {
e.children = [ e.children = [
@ -419,6 +426,7 @@ export default {
}, },
getList() { getList() {
this.loading = true; this.loading = true;
this.queryParams.pageNum = 1;
listGoodsCategory(this.queryParams).then((response) => { listGoodsCategory(this.queryParams).then((response) => {
this.goodsCategoryList = response.rows; this.goodsCategoryList = response.rows;
this.total = response.total; this.total = response.total;
@ -430,7 +438,9 @@ export default {
++this.isResouceShow; ++this.isResouceShow;
var obj = { pictureUrlList: [] }; var obj = { pictureUrlList: [] };
if (this.imgone != this.form.goodsCategoryPicture) { if (this.imgone != this.form.goodsCategoryPicture) {
obj.pictureUrlList.push(this.form.goodsCategoryPicture); if (this.form.goodsCategoryPicture) {
obj.pictureUrlList.push(this.form.goodsCategoryPicture);
}
} }
if (obj.pictureUrlList.length > 0) { if (obj.pictureUrlList.length > 0) {
updatePicture(obj).then((res) => {}); updatePicture(obj).then((res) => {});
@ -440,25 +450,32 @@ export default {
}, },
// //
reset() { reset() {
this.form = { this.form.goodsCategoryName = null;
id: null, this.form.goodsCategoryPicture = null;
goodsCategoryName: null, this.form.categoryRemark = null;
goodsCategoryCode: null, this.form.sort = null;
goodsCategoryPicture: null,
categoryRemark: null, // this.form = {
sort: null, // id: null,
createBy: null, // goodsCategoryName: null,
createTime: null, // goodsCategoryCode: null,
updateBy: null, // goodsCategoryPicture: null,
updateTime: null, // categoryRemark: null,
parentId: null, // sort: null,
parentName: null, // createBy: null,
}; // createTime: null,
this.resetForm("form"); // updateBy: null,
// updateTime: null,
// parentId: null,
// parentName: null,
// };
// this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.queryParams.parentId = null;
this.queryParams.parentName = null;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -466,7 +483,6 @@ export default {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
parentId: 0,
}; };
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
@ -479,14 +495,11 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); // this.reset();
this.open = true; this.open = true;
this.title = "添加商品分类信息"; this.title = "添加商品分类信息";
console.log(this.queryParams);
// if (this.queryParams.parentId != 0) { // if (this.queryParams.parentId != 0) {
this.form.parentId = this.queryParams.parentId;
// } // }
this.form.parentName = this.queryParams.parentName;
// this.form.categoryLevel = this.categoryLevel; // this.form.categoryLevel = this.categoryLevel;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
@ -519,7 +532,7 @@ export default {
this.open = false; this.open = false;
this.getList(); this.getList();
this.info(); this.info();
}); });
} else { } else {
addGoodsCategory(this.form).then((response) => { addGoodsCategory(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");