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

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

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

Loading…
Cancel
Save