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();