From 10eec719479f006e62987605de6d520732611459 Mon Sep 17 00:00:00 2001 From: e <2432808546@qq.com> Date: Thu, 4 Nov 2021 14:19:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B4=A6=E6=88=B7=E5=92=8C?= =?UTF-8?q?=E5=AD=A6=E5=8F=B7=E5=88=A4=E6=96=AD=E6=AD=A3=E5=88=99=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/student/list/index.vue | 61 +++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/src/pages/student/list/index.vue b/src/pages/student/list/index.vue index 6ed4b56..49b94c8 100644 --- a/src/pages/student/list/index.vue +++ b/src/pages/student/list/index.vue @@ -150,8 +150,8 @@ - - + + @@ -159,9 +159,10 @@ 学生 - - + + + @@ -259,6 +260,30 @@ import OrgTree from "@/components/org-tree/src/tree"; export default { components: { OrgTree }, data() { + var accountPass = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入账号')); + } else { + var pattern = /^[A-Za-z0-9]*$/; + if(pattern.test(value)){ + this.accountChange() + }else{ + callback(new Error('请输入正确账号格式')); + } + } + }; + var workNumberPass = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入学生学号')); + } else { + var pattern = /^[A-Za-z0-9]*$/; + if(pattern.test(value)){ + this.worknumberChange() + }else{ + callback(new Error('请输入正确学生学号格式')); + } + } + }; let that = this; return { isRemove: false, // 是否可以移除 @@ -319,23 +344,25 @@ export default { { required: true, message: "请输入名称", trigger: "blur" } ], account: [ - { required: true, message: "请输入账号", trigger: "blur" }, - { - pattern: /^[A-Za-z0-9]*$/, - message: "请输入正确的账号", - trigger: "blur" - } + { validator: accountPass, trigger: 'blur' } + // { required: true, message: "请输入账号", trigger: "blur" }, + // { + // pattern: /^[A-Za-z0-9]*$/, + // message: "请输入正确的账号", + // trigger: "blur" + // } ], userName: [ { required: true, message: "请输入学生姓名", trigger: "blur" } ], workNumber: [ - { required: true, message: "请输入学生学号", trigger: "blur" }, - { - pattern: /^[A-Za-z0-9]*$/, - message: "请输入正确的学号", - trigger: "blur" - } + { validator: workNumberPass, trigger: 'blur' } + // { required: true, message: "请输入学生学号", trigger: "blur" }, + // { + // pattern: /^[A-Za-z0-9]*$/, + // message: "请输入正确的学号", + // trigger: "blur" + // } ], phone: [ // { required: true, message: '请输入职工手机号', trigger: 'blur' }, @@ -731,7 +758,7 @@ export default { }).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.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&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();