Commit 41efa714 authored by 黄卓's avatar 黄卓

新建客户,至少填写一个联系人信息

http://zentao.jdshangmen.com/bug-view-8.html
parent 6fc8b14b
......@@ -548,39 +548,35 @@ export default {
},
/** 提交按钮 */
submitForm() {
// this.$refs["contactForm"].validate(valid => {
// if (!valid) {
// return;
// }
// // todo
// console.log(1)
// })
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
if (this.form.customerContacts.length === 0){
this.$modal.msgError("至少填写一个联系人信息");
return
} else {
this.form.customerContacts.forEach(e => {
if (!e.name) {
this.$modal.msgWarning('请输入联系人')
} else if (!e.areaCode) {
this.$modal.msgWarning('请选择区号')
} else if (!e.phoneNew) {
this.$modal.msgWarning('请输入联系方式')
}
})
}
// 修改的提交
if (this.form.id != null) {
this.form.customerContacts.forEach(e => {
e.customerId = this.customerId
})
this.$refs["contactForm"].validate(valid1 => {
this.$refs["form"].validate(valid2 => {
if (!valid1 || !valid2) {
return;
}
if (this.form.customerContacts.length === 0){
this.$modal.msgError("至少填写一个联系人信息");
return
}
// 修改的提交
if (this.form.id != null) {
this.form.customerContacts.forEach(e => {
e.customerId = this.customerId
})
updateCustomer(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
updateCustomer(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
// this.getList();
const obj = { path: "/customer/customer" };
this.$tab.closeOpenPage(obj);
}).catch(e => {
this.$modal.msgError(e.msg || '添加客户失败,请联系管理员')
});
return;
}
// 添加的提交
createCustomer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
// this.getList();
const obj = { path: "/customer/customer" };
......@@ -588,19 +584,8 @@ export default {
}).catch(e => {
this.$modal.msgError(e.msg || '添加客户失败,请联系管理员')
});
return;
}
// 添加的提交
createCustomer(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
// this.getList();
const obj = { path: "/customer/customer" };
this.$tab.closeOpenPage(obj);
}).catch(e => {
this.$modal.msgError(e.msg || '添加客户失败,请联系管理员')
});
});
})
},
/** 表单重置 */
reset() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment