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