学生员工等修改

dev_2022-05-11
yujialong 3 years ago
parent 14020ff2db
commit 897ebcb03d
  1. 13
      src/pages/station/preview/index.vue
  2. 150
      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 userName = window.btoa(encodeURIComponent(this.userName));
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`
} 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`);
} 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`);
} else {
if(process.env.NODE_ENV === 'development') {
href = 'http://192.168.31.125:8080/#/'
} else {
href = `${location.origin}/pyTrials` // 8pythoncookiesystemId
}
}
if (id != 21 && id != 22 && id != 11) {
// python
util.cookies.set("assessmentId", "", -1);
util.cookies.set("projectId", "", -1);
util.cookies.set("startTime", "", -1);
@ -317,7 +312,9 @@ export default {
util.cookies.set("courseId", this.courseId);
util.cookies.set("curriculumName", escape(this.curriculumName));
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-col :span="12">
<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 prop="userName" label="学生姓名">
<el-input v-model="form.userName" placeholder="请输入学生姓名"></el-input>
@ -168,9 +168,6 @@
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model="form.uniqueIdentification"></el-input>
</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 :span="10">
<el-form-item prop="classId" label="所在班级">
@ -260,27 +257,6 @@ import { mapState } from "vuex";
export default {
components: { OrgTree },
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;
return {
isRemove: false, //
@ -331,6 +307,7 @@ export default {
treeResolve: [],
isDetail: false,
keyWord: "",
originForm: {},
form: {
userName: "",
phone: "",
@ -344,29 +321,18 @@ export default {
organizationName: [
{ 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: [
{ required: true, message: "请输入学生姓名", trigger: "blur" }
],
workNumber: [
{ required: true,validator: workNumberPass, trigger: 'blur' }
// { required: true, message: "", trigger: "blur" },
// {
// pattern: /^[A-Za-z0-9]*$/,
// message: "",
// trigger: "blur"
// }
{ required: true, message: "请输入学号", trigger: 'blur' },
{
pattern: /^[A-Za-z0-9]*$/,
message: "请输入正确的学号",
trigger: "blur"
}
],
phone: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^1[3456789]\d{9}$/,
message: "请输入正确的手机号",
@ -374,7 +340,6 @@ export default {
}
],
email: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/,
message: "请输入正确的邮箱",
@ -390,7 +355,6 @@ export default {
isAdd: true,
studentVisible: false,
accountReapeat: false,
workNumberReapeat: false,
phoneRepeat: false,
emailRepeat: false,
@ -415,9 +379,8 @@ export default {
])
},
mounted() {
console.log(55, this.schoolId)
this.originForm = JSON.parse(JSON.stringify(this.form))
this.getData();
// this.auth();
},
watch: {
keyWord: function(val) {
@ -752,73 +715,41 @@ export default {
this.showTree = true;
}).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() {
const form = this.form
// id-id-schoolId-workNumber
form.account = `${Setting.platformId}-1-${this.schoolId}-${form.workNumber}`
},
worknumberChange() {
if (this.form.workNumber) {
let url = "";
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=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
}
this.$post(url).then(res => {
this.workNumberReapeat = false;
this.renderAccount()
}).catch(err => {
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => {
const { data } = res
workNumberChange() {
const form = this.form
const { workNumber } = form
//
if (workNumber && this.isAdd && /^[A-Za-z0-9]*$/.test(workNumber)) {
this.$post(`${this.api.getDetailByAccount}?workNumber=${workNumber}&platformId=${Setting.platformId}&type=1`).then(({ data }) => {
if (data) {
this.showTree = true;
const classId = data.classList.map(e => e.id).toString();
this.form = data
this.form.classId = classId
this.defaultCheckedKeys = classId.split(",").map(i => Number(i));
this.accountReapeat = false;
this.$refs.form.clearValidate();
this.renderAccount()
}).catch(res => {});
this.workNumberReapeat = true;
});
// classId1
if (classId === '1') {
this.$refs.classTree.setCheckedKeys([])
} else {
this.defaultCheckedKeys = classId.split(",").map(i => Number(i))
}
this.$refs.form.clearValidate()
} else {
//
this.form = JSON.parse(JSON.stringify(this.originForm))
this.form.workNumber = workNumber
this.renderAccount()
this.$refs.classTree.setCheckedKeys([])
}
}).catch(res => {})
} else {
this.renderAccount()
}
},
phoneChange() {
@ -837,6 +768,8 @@ export default {
}).catch(err => {
this.phoneRepeat = true;
});
} else {
this.phoneRepeat = false
}
},
emailChange() {
@ -855,6 +788,8 @@ export default {
}).catch(err => {
this.emailRepeat = true;
});
} else {
this.emailRepeat = false
}
},
filterNode(value, data) {
@ -939,7 +874,6 @@ export default {
}, 2000)
})
} else {
if (this.accountReapeat) return util.warningMsg("该账号已存在");
if (this.workNumberReapeat) return util.warningMsg("该学生学号已存在");
if (this.phoneRepeat) 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() { //
this.$refs.form.clearValidate();
this.form = {
@ -982,7 +922,8 @@ export default {
email: "",
classId: ""
};
this.$refs.classTree.setCheckedKeys([]);
this.$refs.classTree.setCheckedKeys([])
this.resetRepeat()
if (this.studentType) {
this.getData();
} else {
@ -1004,6 +945,7 @@ export default {
this.isDetail = false;
this.showTree = false;
this.studentVisible = false;
this.resetRepeat()
},
batchImport() { //
this.importVisible = true;

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

Loading…
Cancel
Save