根据原型重新处理新增学生逻辑

dev_2022-05-11
yujialong 3 years ago
parent 6cbd22e378
commit d2486e7c77
  1. 65
      src/pages/student/list/index.vue

@ -701,33 +701,58 @@ export default {
this.$post(`${this.api.getStudentInfoByAccountId}?stuAccountId=${row.accountId}`).then(res => {
this.form = res.data;
this.showTree = true;
}).catch(res => {
});
}).catch(res => {});
},
accountChange() {
accountChange() { //
if (this.form.account) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.form.account}&workNumber=`;
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&account=${this.form.account}&workNumber=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.accountReapeat = false;
if (this.isAdd && this.form.accountId) {
this.$refs.form.clearValidate();
this.form = {
account: this.form.account,
userName: "",
phone: "",
uniqueIdentification: "",
workNumber: "",
email: "",
classId: ""
};
this.$refs.classTree.setCheckedKeys([]);
} else {
this.$refs.form.clearValidate();
}
this.accountReapeat = false;
}).catch(err => {
this.accountReapeat = true;
if (this.isAdd) {
this.showTree = false;
this.$post(`${this.api.getDetailByAccount}?account=${this.form.account}&platformId=${Setting.platformId}&type=1`).then(res => {
this.form = res.data;
let classId = res.data.classList.map(e => e.id);
this.form.classId = classId.toString();
delete this.form.classList;
this.showTree = true;
this.accountReapeat = false;
this.$refs.form.clearValidate();
}).catch(res => {});
} else {
this.accountReapeat = true;
}
});
}
},
worknumberChange() {
if (this.form.workNumber) {
let url = "";
if (this.isAdd) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&workNumber=${this.form.workNumber}&account=`;
if (this.isAdd && !this.form.accountId) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&workNumber=${this.form.workNumber}&account=`;
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
@ -742,7 +767,7 @@ export default {
let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.form.phone)) {
let url = "";
if (this.isAdd) {
if (this.isAdd && !this.form.accountId) {
url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`;
@ -760,7 +785,7 @@ export default {
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.form.email)) {
let url = "";
if (this.isAdd) {
if (this.isAdd && !this.form.accountId) {
url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`;
} else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`;
@ -814,7 +839,7 @@ export default {
i.leaf = false;
i.showCheckbox = false;
}
console.log(JSON.stringify(i));
// console.log(JSON.stringify(i));
result.push(i);
});
return resolve(result);
@ -845,11 +870,15 @@ export default {
if (this.form.accountId) {
this.$post(this.api.modifyStudent, this.form).then(res => {
util.successMsg("编辑成功!");
this.closeStudent();
if (this.studentType) {
this.getData();
if (type) {
this.resetStudent();
} else {
this.getOrgStudentData();
this.closeStudent();
if (this.studentType) {
this.getData();
} else {
this.getOrgStudentData();
}
}
}).catch(res => {
});

Loading…
Cancel
Save