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

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

http://zentao.jdshangmen.com/bug-view-8.html
parent 6fc8b14b
...@@ -548,39 +548,35 @@ export default { ...@@ -548,39 +548,35 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
// this.$refs["contactForm"].validate(valid => { this.$refs["contactForm"].validate(valid1 => {
// if (!valid) { this.$refs["form"].validate(valid2 => {
// return; if (!valid1 || !valid2) {
// } return;
// // todo }
// console.log(1) if (this.form.customerContacts.length === 0){
// }) this.$modal.msgError("至少填写一个联系人信息");
this.$refs["form"].validate(valid => { return
if (!valid) { }
return; // 修改的提交
} if (this.form.id != null) {
if (this.form.customerContacts.length === 0){ this.form.customerContacts.forEach(e => {
this.$modal.msgError("至少填写一个联系人信息"); e.customerId = this.customerId
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
})
updateCustomer(this.form).then(response => { updateCustomer(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); 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.open = false;
// this.getList(); // this.getList();
const obj = { path: "/customer/customer" }; const obj = { path: "/customer/customer" };
...@@ -588,19 +584,8 @@ export default { ...@@ -588,19 +584,8 @@ export default {
}).catch(e => { }).catch(e => {
this.$modal.msgError(e.msg || '添加客户失败,请联系管理员') 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() { 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