|
|
@@ -593,7 +593,7 @@ export default {
|
|
|
{ required: true, message: '请输入客户名称', trigger: 'blur' }
|
|
|
],
|
|
|
authorizationLimit: [
|
|
|
- { required: true, message: '请输入授信额度', trigger: 'change' }
|
|
|
+ { required: true, message: '请输入授信额度', trigger: 'blur' }
|
|
|
]
|
|
|
},
|
|
|
otherRules: {
|
|
|
@@ -705,24 +705,44 @@ export default {
|
|
|
// this.removeLinkList.push(row.id);
|
|
|
}
|
|
|
},
|
|
|
+ getValidate() {
|
|
|
+ return Promise.all([
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ this.activeName = 'base';
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ this.$refs.otherForm.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ this.activeName = 'other';
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }),
|
|
|
+ new Promise((resolve, reject) => {
|
|
|
+ if (this.tableLinkData.length === 0) {
|
|
|
+ this.$message.error("联系人信息至少有1条");
|
|
|
+ this.activeName = 'link';
|
|
|
+ reject(false);
|
|
|
+ } else {
|
|
|
+ resolve(true);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ ]);
|
|
|
+ },
|
|
|
async save() {
|
|
|
- const isBaseValid = await this.$refs.form.validate();
|
|
|
- const isOtherValid = await this.$refs.otherForm.validate();
|
|
|
- if (!isBaseValid) {
|
|
|
- this.activeName = 'base';
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!isOtherValid) {
|
|
|
- this.activeName = 'other';
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(this.tableLinkData && this.tableLinkData.length === 0){
|
|
|
- this.$message.error("联系人信息至少有1条");
|
|
|
- this.activeName = 'link';
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- this.loading = true;
|
|
|
+ try {
|
|
|
+ await this.getValidate();
|
|
|
+ // 表单验证通过,执行保存操作
|
|
|
+ this.loading = true;
|
|
|
// 基本信息处理
|
|
|
if (this.$refs.address.getCheckedNodes()) {
|
|
|
let node = this.$refs.address.getCheckedNodes()[0];
|
|
|
@@ -808,7 +828,11 @@ export default {
|
|
|
.catch((e) => {
|
|
|
//this.loading = false;
|
|
|
});
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // 表单验证未通过,不执行保存操作
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
cancel() {
|
|
|
this.$nextTick(() => {
|