fix:无聊复制只要表单中的字段
This commit is contained in:
parent
23fdd0f466
commit
52b8d2764f
|
|
@ -255,33 +255,30 @@ export default {
|
|||
},
|
||||
//提交
|
||||
submit() {
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
let that = this;
|
||||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.isSaveing = true;
|
||||
if (this.mode == "add") {
|
||||
this.$API.mtm.material.create
|
||||
.req(this.form)
|
||||
.then((res) => {
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
that.isSaveing = true;
|
||||
if (that.mode == "add") {
|
||||
that.$API.mtm.material.create.req(that.form).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
})
|
||||
.catch(() => {
|
||||
this.isSaveing = false;
|
||||
this.visible = false;
|
||||
that.isSaveing = false;
|
||||
that.visible = false;
|
||||
});
|
||||
} else if (this.mode == "edit") {
|
||||
this.$API.mtm.material.update
|
||||
.req(this.form.id, this.form)
|
||||
.then((res) => {
|
||||
this.isSaveing = false;
|
||||
this.$emit("success", this.form, this.mode);
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功");
|
||||
} else if (that.mode == "edit") {
|
||||
that.$API.mtm.material.update.req(that.form.id, that.form).then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
})
|
||||
.catch(() => {
|
||||
this.isSaveing = false;
|
||||
that.isSaveing = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -289,7 +286,24 @@ export default {
|
|||
},
|
||||
//表单注入数据
|
||||
setData(data) {
|
||||
let that = this;
|
||||
if(that.mode=="add"){
|
||||
that.form.name = data.name;
|
||||
that.form.type = data.type;
|
||||
that.form.number = data.number;
|
||||
that.form.specification = data.specification;
|
||||
that.form.model = data.model;
|
||||
that.form.unit = data.unit;
|
||||
that.form.process = data.process;
|
||||
that.form.tracking = data.tracking;
|
||||
that.form.count_safe = data.count_safe;
|
||||
that.form.is_hidden = data.is_hidden;
|
||||
that.form.unit_price = data.unit_price;
|
||||
that.form.photo = data.photo;
|
||||
that.form.photo_number = data.photo_number;
|
||||
}else{
|
||||
Object.assign(this.form, data);
|
||||
}
|
||||
this.getMaterial(data.type);
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue