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

View File

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