From d2486e7c77e338cbddec4a62a679e405e5ddb47b Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 1 Nov 2021 12:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=8E=9F=E5=9E=8B=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=A4=84=E7=90=86=E6=96=B0=E5=A2=9E=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/student/list/index.vue | 65 +++++++++++++++++++++++--------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index 707058c..c5669cc 100644 --- a/src/pages/student/list/index.vue +++ b/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 => { });