|
|
@ -150,7 +150,7 @@ |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="workNumber" label="学生学号"> |
|
|
|
<el-form-item prop="workNumber" label="学生学号"> |
|
|
|
<el-input v-model="form.workNumber" placeholder="学生学号"></el-input> |
|
|
|
<el-input v-model="form.workNumber" placeholder="学生学号" @blur="workNumberChange"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="userName" label="学生姓名"> |
|
|
|
<el-form-item prop="userName" label="学生姓名"> |
|
|
|
<el-input v-model="form.userName" placeholder="请输入学生姓名"></el-input> |
|
|
|
<el-input v-model="form.userName" placeholder="请输入学生姓名"></el-input> |
|
|
@ -168,9 +168,6 @@ |
|
|
|
<el-form-item prop="uniqueIdentification" label="唯一标识"> |
|
|
|
<el-form-item prop="uniqueIdentification" label="唯一标识"> |
|
|
|
<el-input disabled v-model="form.uniqueIdentification"></el-input> |
|
|
|
<el-input disabled v-model="form.uniqueIdentification"></el-input> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item prop="account" label="学生账号"> |
|
|
|
|
|
|
|
<el-input disabled v-model="form.account" placeholder="请输入学生账号"></el-input> |
|
|
|
|
|
|
|
</el-form-item> --> |
|
|
|
|
|
|
|
</el-col> |
|
|
|
</el-col> |
|
|
|
<el-col :span="10"> |
|
|
|
<el-col :span="10"> |
|
|
|
<el-form-item prop="classId" label="所在班级"> |
|
|
|
<el-form-item prop="classId" label="所在班级"> |
|
|
@ -260,27 +257,6 @@ import { mapState } from "vuex"; |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
components: { OrgTree }, |
|
|
|
components: { OrgTree }, |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
var accountPass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value === '') { |
|
|
|
|
|
|
|
callback(new Error('请输入账号')); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.accountChange(); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
var workNumberPass = (rule, value, callback) => { |
|
|
|
|
|
|
|
if (value === '') { |
|
|
|
|
|
|
|
callback(new Error('请输入学生学号')); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
var pattern = /^[A-Za-z0-9]*$/; |
|
|
|
|
|
|
|
if(pattern.test(value)){ |
|
|
|
|
|
|
|
this.worknumberChange(); |
|
|
|
|
|
|
|
callback(); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
callback(new Error('请输入正确学生学号格式')); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
let that = this; |
|
|
|
let that = this; |
|
|
|
return { |
|
|
|
return { |
|
|
|
isRemove: false, // 是否可以移除 |
|
|
|
isRemove: false, // 是否可以移除 |
|
|
@ -331,6 +307,7 @@ export default { |
|
|
|
treeResolve: [], |
|
|
|
treeResolve: [], |
|
|
|
isDetail: false, |
|
|
|
isDetail: false, |
|
|
|
keyWord: "", |
|
|
|
keyWord: "", |
|
|
|
|
|
|
|
originForm: {}, |
|
|
|
form: { |
|
|
|
form: { |
|
|
|
userName: "", |
|
|
|
userName: "", |
|
|
|
phone: "", |
|
|
|
phone: "", |
|
|
@ -344,29 +321,18 @@ export default { |
|
|
|
organizationName: [ |
|
|
|
organizationName: [ |
|
|
|
{ required: true, message: "请输入名称", trigger: "blur" } |
|
|
|
{ required: true, message: "请输入名称", trigger: "blur" } |
|
|
|
], |
|
|
|
], |
|
|
|
account: [ |
|
|
|
|
|
|
|
{ required: true,validator: accountPass, trigger: 'blur' } |
|
|
|
|
|
|
|
// { required: true, message: "请输入账号", trigger: "blur" }, |
|
|
|
|
|
|
|
// { |
|
|
|
|
|
|
|
// pattern: /^[A-Za-z0-9]*$/, |
|
|
|
|
|
|
|
// message: "请输入正确的账号", |
|
|
|
|
|
|
|
// trigger: "blur" |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
userName: [ |
|
|
|
userName: [ |
|
|
|
{ required: true, message: "请输入学生姓名", trigger: "blur" } |
|
|
|
{ required: true, message: "请输入学生姓名", trigger: "blur" } |
|
|
|
], |
|
|
|
], |
|
|
|
workNumber: [ |
|
|
|
workNumber: [ |
|
|
|
{ required: true,validator: workNumberPass, trigger: 'blur' } |
|
|
|
{ required: true, message: "请输入学号", trigger: 'blur' }, |
|
|
|
// { required: true, message: "请输入学生学号", trigger: "blur" }, |
|
|
|
{ |
|
|
|
// { |
|
|
|
pattern: /^[A-Za-z0-9]*$/, |
|
|
|
// pattern: /^[A-Za-z0-9]*$/, |
|
|
|
message: "请输入正确的学号", |
|
|
|
// message: "请输入正确的学号", |
|
|
|
trigger: "blur" |
|
|
|
// trigger: "blur" |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
phone: [ |
|
|
|
phone: [ |
|
|
|
// { required: true, message: '请输入职工手机号', trigger: 'blur' }, |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
pattern: /^1[3456789]\d{9}$/, |
|
|
|
pattern: /^1[3456789]\d{9}$/, |
|
|
|
message: "请输入正确的手机号", |
|
|
|
message: "请输入正确的手机号", |
|
|
@ -374,7 +340,6 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
], |
|
|
|
], |
|
|
|
email: [ |
|
|
|
email: [ |
|
|
|
// { required: true, message: '请输入邮箱', trigger: 'blur' }, |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, |
|
|
|
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/, |
|
|
|
message: "请输入正确的邮箱", |
|
|
|
message: "请输入正确的邮箱", |
|
|
@ -390,7 +355,6 @@ export default { |
|
|
|
|
|
|
|
|
|
|
|
isAdd: true, |
|
|
|
isAdd: true, |
|
|
|
studentVisible: false, |
|
|
|
studentVisible: false, |
|
|
|
accountReapeat: false, |
|
|
|
|
|
|
|
workNumberReapeat: false, |
|
|
|
workNumberReapeat: false, |
|
|
|
phoneRepeat: false, |
|
|
|
phoneRepeat: false, |
|
|
|
emailRepeat: false, |
|
|
|
emailRepeat: false, |
|
|
@ -415,9 +379,8 @@ export default { |
|
|
|
]) |
|
|
|
]) |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
mounted() { |
|
|
|
console.log(55, this.schoolId) |
|
|
|
this.originForm = JSON.parse(JSON.stringify(this.form)) |
|
|
|
this.getData(); |
|
|
|
this.getData(); |
|
|
|
// this.auth(); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
keyWord: function(val) { |
|
|
|
keyWord: function(val) { |
|
|
@ -752,73 +715,41 @@ export default { |
|
|
|
this.showTree = true; |
|
|
|
this.showTree = true; |
|
|
|
}).catch(res => {}); |
|
|
|
}).catch(res => {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
accountChange() { // 切换账号 |
|
|
|
|
|
|
|
if (this.form.account) { |
|
|
|
|
|
|
|
let url = ""; |
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&account=${this.form.account}&workNumber=`; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$post(url).then(res => { |
|
|
|
|
|
|
|
this.disableds = 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 => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.isAdd) { |
|
|
|
|
|
|
|
this.showTree = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.accountReapeat = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 组合账号 |
|
|
|
// 组合账号 |
|
|
|
renderAccount() { |
|
|
|
renderAccount() { |
|
|
|
const form = this.form |
|
|
|
const form = this.form |
|
|
|
// 平台id-端id-schoolId-workNumber组成账号 |
|
|
|
// 平台id-端id-schoolId-workNumber组成账号 |
|
|
|
form.account = `${Setting.platformId}-1-${this.schoolId}-${form.workNumber}` |
|
|
|
form.account = `${Setting.platformId}-1-${this.schoolId}-${form.workNumber}` |
|
|
|
}, |
|
|
|
}, |
|
|
|
worknumberChange() { |
|
|
|
workNumberChange() { |
|
|
|
if (this.form.workNumber) { |
|
|
|
const form = this.form |
|
|
|
let url = ""; |
|
|
|
const { workNumber } = form |
|
|
|
if (this.isAdd && !this.form.accountId) { |
|
|
|
// 只有输入了学号并且是新增才需要根据学号查询其他信息 |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&workNumber=${this.form.workNumber}&account=`; |
|
|
|
if (workNumber && this.isAdd && /^[A-Za-z0-9]*$/.test(workNumber)) { |
|
|
|
} else { |
|
|
|
this.$post(`${this.api.getDetailByAccount}?workNumber=${workNumber}&platformId=${Setting.platformId}&type=1`).then(({ data }) => { |
|
|
|
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`; |
|
|
|
if (data) { |
|
|
|
} |
|
|
|
this.showTree = true; |
|
|
|
this.$post(url).then(res => { |
|
|
|
const classId = data.classList.map(e => e.id).toString(); |
|
|
|
this.workNumberReapeat = false; |
|
|
|
this.form = data |
|
|
|
|
|
|
|
this.form.classId = classId |
|
|
|
this.renderAccount() |
|
|
|
this.renderAccount() |
|
|
|
}).catch(err => { |
|
|
|
// 无指定范围的classId为1,即没有班级,如果没有班级则直接清空班级选择 |
|
|
|
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => { |
|
|
|
if (classId === '1') { |
|
|
|
const { data } = res |
|
|
|
this.$refs.classTree.setCheckedKeys([]) |
|
|
|
this.showTree = true; |
|
|
|
} else { |
|
|
|
const classId = data.classList.map(e => e.id).toString(); |
|
|
|
this.defaultCheckedKeys = classId.split(",").map(i => Number(i)) |
|
|
|
this.form = data |
|
|
|
} |
|
|
|
this.form.classId = classId |
|
|
|
this.$refs.form.clearValidate() |
|
|
|
this.defaultCheckedKeys = classId.split(",").map(i => Number(i)); |
|
|
|
} else { |
|
|
|
this.accountReapeat = false; |
|
|
|
// 如果该学号没有对应的学生,则清空所有信息,除了学号 |
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
this.form = JSON.parse(JSON.stringify(this.originForm)) |
|
|
|
this.renderAccount() |
|
|
|
this.form.workNumber = workNumber |
|
|
|
}).catch(res => {}); |
|
|
|
this.renderAccount() |
|
|
|
this.workNumberReapeat = true; |
|
|
|
this.$refs.classTree.setCheckedKeys([]) |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(res => {}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.renderAccount() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
phoneChange() { |
|
|
|
phoneChange() { |
|
|
@ -837,6 +768,8 @@ export default { |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
this.phoneRepeat = true; |
|
|
|
this.phoneRepeat = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.phoneRepeat = false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
emailChange() { |
|
|
|
emailChange() { |
|
|
@ -855,6 +788,8 @@ export default { |
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
this.emailRepeat = true; |
|
|
|
this.emailRepeat = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.emailRepeat = false |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
filterNode(value, data) { |
|
|
|
filterNode(value, data) { |
|
|
@ -939,7 +874,6 @@ export default { |
|
|
|
}, 2000) |
|
|
|
}, 2000) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (this.accountReapeat) return util.warningMsg("该账号已存在"); |
|
|
|
|
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该学生学号已存在"); |
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该学生学号已存在"); |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在"); |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在"); |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在"); |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在"); |
|
|
@ -971,6 +905,12 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 判重重置 |
|
|
|
|
|
|
|
resetRepeat() { |
|
|
|
|
|
|
|
this.workNumberReapeat = false |
|
|
|
|
|
|
|
this.phoneRepeat = false |
|
|
|
|
|
|
|
this.emailRepeat = false |
|
|
|
|
|
|
|
}, |
|
|
|
resetStudent() { // 重置新增学生对话框 |
|
|
|
resetStudent() { // 重置新增学生对话框 |
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
this.$refs.form.clearValidate(); |
|
|
|
this.form = { |
|
|
|
this.form = { |
|
|
@ -982,7 +922,8 @@ export default { |
|
|
|
email: "", |
|
|
|
email: "", |
|
|
|
classId: "" |
|
|
|
classId: "" |
|
|
|
}; |
|
|
|
}; |
|
|
|
this.$refs.classTree.setCheckedKeys([]); |
|
|
|
this.$refs.classTree.setCheckedKeys([]) |
|
|
|
|
|
|
|
this.resetRepeat() |
|
|
|
if (this.studentType) { |
|
|
|
if (this.studentType) { |
|
|
|
this.getData(); |
|
|
|
this.getData(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1004,6 +945,7 @@ export default { |
|
|
|
this.isDetail = false; |
|
|
|
this.isDetail = false; |
|
|
|
this.showTree = false; |
|
|
|
this.showTree = false; |
|
|
|
this.studentVisible = false; |
|
|
|
this.studentVisible = false; |
|
|
|
|
|
|
|
this.resetRepeat() |
|
|
|
}, |
|
|
|
}, |
|
|
|
batchImport() { // 批量导入 |
|
|
|
batchImport() { // 批量导入 |
|
|
|
this.importVisible = true; |
|
|
|
this.importVisible = true; |
|
|
|