|
|
@@ -326,7 +326,8 @@ export default {
|
|
|
showOverflowTooltip: true
|
|
|
}
|
|
|
],
|
|
|
- isProduct: false
|
|
|
+ isProduct: false, // 判断是否是产品
|
|
|
+ isProductUpdate:null, // 1 新增, 2编辑
|
|
|
|
|
|
};
|
|
|
},
|
|
|
@@ -404,20 +405,25 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
this.loading = true;
|
|
|
- if (!this.isUpdate) {
|
|
|
+ if (!this.isUpdate && this.isProductUpdate == null) {
|
|
|
delete this.form.id;
|
|
|
}
|
|
|
- const saveOrUpdate = this.isUpdate
|
|
|
+ let saveOrUpdate = this.isUpdate
|
|
|
? parameter.update
|
|
|
: parameter.save;
|
|
|
|
|
|
+ if(this.isProductUpdate != null) {
|
|
|
+ saveOrUpdate = this.isProductUpdate == 2
|
|
|
+ ? parameter.update
|
|
|
+ : parameter.save;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
saveOrUpdate(this.form)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.form = {};
|
|
|
- const info = this.isUpdate ? '修改成功' : '新增成功'
|
|
|
- this.$message.success(info);
|
|
|
+ this.$message.success(msg);
|
|
|
this.updateVisible(false);
|
|
|
this.$emit('done');
|
|
|
})
|
|
|
@@ -474,20 +480,38 @@ export default {
|
|
|
this.taskParam = res.taskParam
|
|
|
this.isUpdate = true;
|
|
|
} else if (this.paramData) {
|
|
|
- this.isProduct = true
|
|
|
+ this.isProduct = true
|
|
|
+
|
|
|
let param = {
|
|
|
categoryId: this.paramData.id,
|
|
|
- categoryName:this.paramData.name,
|
|
|
+ categoryName: this.paramData.name,
|
|
|
categoryCode: this.paramData.code,
|
|
|
- categoryModelType:this.paramData.modelType,
|
|
|
+ categoryModelType: this.paramData.modelType,
|
|
|
categoryBrandNum: this.paramData.brandNum,
|
|
|
categorySpecification: this.paramData.specification,
|
|
|
-
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ const res = await parameter.getCategoryParam(this.paramData.id);
|
|
|
+
|
|
|
+ if (res) {
|
|
|
+ this.isProductUpdate = 2
|
|
|
+ this.$util.assignObject(this.form, {
|
|
|
+ ...res
|
|
|
+ });
|
|
|
+
|
|
|
+ this.$refs.table.setData(res.produceParam)
|
|
|
+ this.taskParam = res.taskParam
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ this.$util.assignObject(this.form, {
|
|
|
+ ...param
|
|
|
+ });
|
|
|
+ this.isProductUpdate = 1
|
|
|
}
|
|
|
|
|
|
- this.$util.assignObject(this.form, {
|
|
|
- ...param
|
|
|
- });
|
|
|
}
|
|
|
|
|
|
else {
|