学生员工等修改

dev_2022-05-11
yujialong 3 years ago
parent 14020ff2db
commit 897ebcb03d
  1. 13
      src/pages/station/preview/index.vue
  2. 158
      src/pages/student/list/index.vue
  3. 94
      src/pages/system/list/staff.vue

@ -296,19 +296,14 @@ export default {
let roleId = this.roleId == 4 ? 0 : 1; let roleId = this.roleId == 4 ? 0 : 1;
let userName = window.btoa(encodeURIComponent(this.userName)); let userName = window.btoa(encodeURIComponent(this.userName));
if (id == 11) { if (id == 11) {
//
location.href = `${Setting.bankPath}/#/index/list?token=${token}&cid=${this.courseId}&systemId=${this.assessmentList[0].systemId}&projectId=&assessmentId=&classId=&stopTime=&test=true` location.href = `${Setting.bankPath}/#/index/list?token=${token}&cid=${this.courseId}&systemId=${this.assessmentList[0].systemId}&projectId=&assessmentId=&classId=&stopTime=&test=true`
} else if (id == 21) { } else if (id == 21) {
window.open(`http://121.37.29.24:80/yyyflogin?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=3989a0ad671849b99dcbdcc208782333&caseId=9681f86902314b10bc752909121f9ab9&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=7ff5d4715b114b7398b6f26c20fac460`); window.open(`http://121.37.29.24:80/yyyflogin?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=3989a0ad671849b99dcbdcc208782333&caseId=9681f86902314b10bc752909121f9ab9&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=7ff5d4715b114b7398b6f26c20fac460`);
} else if (id == 22) { } else if (id == 22) {
window.open(`https://danbao.czcyedu.com/#/loginFromYyyf?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=eb7d8355119d449184c548b07dc01ed9&caseId=1198241070647873538&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=faaedd82adb9444285a5785e4a3dd4f9`); window.open(`https://danbao.czcyedu.com/#/loginFromYyyf?userId=${this.userId}&userName=${userName}&userType=${roleId}&reqType=1&reqId=eb7d8355119d449184c548b07dc01ed9&caseId=1198241070647873538&authorization=87DIVy348Oxzj3ha&classId=1876&courserId=faaedd82adb9444285a5785e4a3dd4f9`);
} else { } else {
if(process.env.NODE_ENV === 'development') { // python
href = 'http://192.168.31.125:8080/#/'
} else {
href = `${location.origin}/pyTrials` // 8pythoncookiesystemId
}
}
if (id != 21 && id != 22 && id != 11) {
util.cookies.set("assessmentId", "", -1); util.cookies.set("assessmentId", "", -1);
util.cookies.set("projectId", "", -1); util.cookies.set("projectId", "", -1);
util.cookies.set("startTime", "", -1); util.cookies.set("startTime", "", -1);
@ -317,7 +312,9 @@ export default {
util.cookies.set("courseId", this.courseId); util.cookies.set("courseId", this.courseId);
util.cookies.set("curriculumName", escape(this.curriculumName)); util.cookies.set("curriculumName", escape(this.curriculumName));
util.cookies.set("systemId", id); util.cookies.set("systemId", id);
location.href = href; location.href = process.env.NODE_ENV === 'development' ?
`http://${location.hostname}:8080/#/` :
`${location.origin}/pyTrials` // 8pythoncookiesystemId
} }
} }
} }

@ -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 => { // classId1
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;

@ -47,7 +47,7 @@
width="30%" @close="closeTeacher" class="dialog" :close-on-click-modal="false"> width="30%" @close="closeTeacher" class="dialog" :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> <el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'>
<el-form-item prop="workNumber" label="工号"> <el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="form.workNumber" placeholder="请输入职工工号"></el-input> <el-input v-model.trim="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.trim="form.userName" placeholder="请输入员工姓名"></el-input> <el-input v-model.trim="form.userName" placeholder="请输入员工姓名"></el-input>
@ -81,9 +81,6 @@
<el-form-item prop="email" label="邮箱"> <el-form-item prop="email" label="邮箱">
<el-input v-model.trim="form.email" placeholder="请输入邮箱" @blur="emailChange"></el-input> <el-input v-model.trim="form.email" placeholder="请输入邮箱" @blur="emailChange"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="account" label="账号">
<el-input disabled v-model.trim="form.account" placeholder="请输入职工账号"></el-input>
</el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail"> <span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="closeTeacher"> </el-button> <el-button @click="closeTeacher"> </el-button>
@ -124,34 +121,9 @@
import Setting from "@/setting"; import Setting from "@/setting";
import util from "@/libs/util"; import util from "@/libs/util";
import org from "./staffSide" import org from "./staffSide"
import { mapState } from "vuex";
export default { export default {
data() { data() {
var accountPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入账号'));
} else {
var pattern = /^[A-Za-z0-9]*$/;
if(pattern.test(value)){
this.accountChange();
callback();
}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();
callback();
}else{
callback(new Error('职工工号必须为数字或英文'));
}
}
};
return { return {
exportCode: "", exportCode: "",
headers: { headers: {
@ -165,6 +137,7 @@ export default {
casProps: { casProps: {
value: 'id' value: 'id'
}, },
originForm: {},
form: { form: {
accountId: "", accountId: "",
account: "", account: "",
@ -177,9 +150,6 @@ export default {
email: "" email: ""
}, },
rules: { rules: {
account: [
{ required: true, validator: accountPass, trigger: 'blur' }
],
userName: [ userName: [
{ required: true, message: "请输入用户姓名", trigger: "blur" } { required: true, message: "请输入用户姓名", trigger: "blur" }
], ],
@ -187,17 +157,20 @@ export default {
{ required: true, message: "请选择账号角色", trigger: "change" } { required: true, message: "请选择账号角色", trigger: "change" }
], ],
workNumber: [ workNumber: [
{ required: true, validator: workNumberPass , trigger: 'blur' } { required: true, message: "请输入工号", trigger: 'blur' },
{
pattern: /^[A-Za-z0-9]*$/,
message: "职工工号必须为数字或英文",
trigger: "blur"
}
], ],
uniqueIdentification: [ uniqueIdentification: [
// { required: true, message: '', trigger: 'blur' }, // { required: true, message: '', trigger: 'blur' },
], ],
phone: [ phone: [
// { required: true, message: '', trigger: 'blur' },
{ pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号", trigger: "blur"} { pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号", trigger: "blur"}
], ],
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: "请输入正确的邮箱",
@ -205,7 +178,6 @@ export default {
} }
], ],
}, },
accountReapeat: false,
workNumberReapeat: false, workNumberReapeat: false,
phoneRepeat: false, phoneRepeat: false,
emailRepeat: false, emailRepeat: false,
@ -229,6 +201,11 @@ export default {
components: { components: {
org org
}, },
computed: {
...mapState("user", [
'schoolId'
])
},
watch: { watch: {
keyword: function(val) { keyword: function(val) {
clearTimeout(this.searchTimer); clearTimeout(this.searchTimer);
@ -238,6 +215,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.originForm = JSON.parse(JSON.stringify(this.form))
this.getRoleData() this.getRoleData()
this.getData() this.getData()
}, },
@ -344,28 +322,31 @@ export default {
this.orgList = this.$refs.org.orgList; this.orgList = this.$refs.org.orgList;
this.getStaffDetail(row.accountId); this.getStaffDetail(row.accountId);
}, },
accountChange() { // //
if (this.form.account) { renderAccount() {
let url = ""; const form = this.form
if (this.isAdd) { // id-id-schoolId-workNumber
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.form.account}&workNumber=`; form.account = `${Setting.platformId}-0-${this.schoolId}-${form.workNumber}`
} else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.accountReapeat = false;
}
}).catch( err => {
this.accountReapeat = true;
});
}
}, },
workNumberChange() { // workNumberChange() { //
if (this.form.workNumber) { const form = this.form
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=0`).then(res => { const { workNumber } = form
this.form = res.data //
if (workNumber && this.isAdd && /^[A-Za-z0-9]*$/.test(workNumber)) {
this.$post(`${this.api.getDetailByAccount}?workNumber=${workNumber}&platformId=${Setting.platformId}&type=0`).then(({ data }) => {
if (data) {
this.form = data
this.renderAccount()
this.$refs.form.clearValidate()
} else {
//
this.form = JSON.parse(JSON.stringify(this.originForm))
this.form.workNumber = workNumber
this.renderAccount()
}
}).catch(res => {}) }).catch(res => {})
} else {
this.renderAccount()
} }
}, },
phoneChange() { // phoneChange() { //
@ -440,7 +421,6 @@ export default {
this.$refs[form].validate((valid) => { this.$refs[form].validate((valid) => {
if (valid) { if (valid) {
if (this.submiting) return false if (this.submiting) return false
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("该邮箱已存在");

Loading…
Cancel
Save