diff --git a/src/views/system/goodsCategory/index.vue b/src/views/system/goodsCategory/index.vue index 672fbab..0e8739b 100644 --- a/src/views/system/goodsCategory/index.vue +++ b/src/views/system/goodsCategory/index.vue @@ -196,7 +196,7 @@ label="父级分类名称" prop="parentName" :required="true" - v-if="form.parentId" + v-show="form.parentId" > { 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("新增成功");