学生员工学号相关修改

dev_2022-05-11
yujialong 3 years ago
parent d45115be4d
commit 14020ff2db
  1. 1
      src/api/index.js
  2. 23
      src/layouts/header/index.vue
  3. 55
      src/pages/student/list/index.vue
  4. 128
      src/pages/system/list/staff.vue
  5. 4
      src/store/modules/user.js

@ -10,6 +10,7 @@ export default {
verification: `${host}users/users/user/captcha`,// 验证码图片 verification: `${host}users/users/user/captcha`,// 验证码图片
isClient: `users/users/user/isClient`,// 是否为客户 isClient: `users/users/user/isClient`,// 是否为客户
getUserAllRoleByToken : `users/role/getUserAllRoleByToken`, getUserAllRoleByToken : `users/role/getUserAllRoleByToken`,
getSchoolIdByToken : `users/users/data/user/getSchoolIdByToken`,
//实验台 //实验台
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情 curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情

@ -38,7 +38,7 @@
</div> </div>
</template> </template>
<script> <script>
import { mapState, mapActions } from "vuex"; import { mapState, mapMutations, mapActions } from "vuex";
import util from "@/libs/util"; import util from "@/libs/util";
export default { export default {
@ -62,17 +62,26 @@ export default {
this.getUserDetail(); this.getUserDetail();
}, },
methods: { methods: {
...mapMutations("user", [
'SET_SCHOOLID'
]),
...mapActions("user", [ ...mapActions("user", [
"setTitle", "setLogoUrl", "setAvatar", "setUserName", 'logout' "setTitle", "setLogoUrl", "setAvatar", "setUserName", 'logout'
]), ]),
getSystemDetail() { // logo getSystemDetail() { // logo
this.$get(this.api.logoDetail).then(res => { this.$get(this.api.logoDetail).then(res => {
if (res.data) { const { data } = res
this.setTitle(res.data.title); if (data) {
this.setLogoUrl(res.data.logoUrl); this.setTitle(data.title)
} this.setLogoUrl(data.logoUrl)
}).catch(res => { this.SET_SCHOOLID(data.schoolId)
}); } else {
// schoolId
this.$post(this.api.getSchoolIdByToken).then(res => {
this.SET_SCHOOLID(res.schoolId)
}).catch(res => {})
}
}).catch(res => {})
}, },
getUserDetail() { // getUserDetail() { //
this.$get(this.api.queryUserInfoDetails).then(res => { this.$get(this.api.queryUserInfoDetails).then(res => {

@ -158,9 +158,6 @@
<el-form-item prop="roleId" label="账号角色"> <el-form-item prop="roleId" label="账号角色">
学生 学生
</el-form-item> </el-form-item>
<el-form-item prop="account" label="学生账号">
<el-input v-model="form.account" placeholder="请输入学生账号"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号"> <el-form-item prop="phone" label="手机号">
<el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11" @blur="phoneChange"></el-input> <el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11" @blur="phoneChange"></el-input>
@ -171,6 +168,9 @@
<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="所在班级">
@ -180,7 +180,7 @@
style="margin-bottom: 10px" style="margin-bottom: 10px"
> >
</el-input> </el-input>
<div style="height: 300px; max-height: 300px; border: 1px solid #DCDFE6; border-radius: 4px; padding: 10px 10px 10px 0px; overflow: auto"> <div style="max-height: 245px; border: 1px solid #DCDFE6; border-radius: 4px; padding: 10px 10px 10px 0px; overflow: auto">
<org-tree <org-tree
v-if="showTree && treeVisible" v-if="showTree && treeVisible"
ref="classTree" ref="classTree"
@ -256,6 +256,7 @@
import util from "@/libs/util"; import util from "@/libs/util";
import Setting from "@/setting"; import Setting from "@/setting";
import OrgTree from "@/components/org-tree/src/tree"; import OrgTree from "@/components/org-tree/src/tree";
import { mapState } from "vuex";
export default { export default {
components: { OrgTree }, components: { OrgTree },
data() { data() {
@ -263,13 +264,8 @@ export default {
if (value === '') { if (value === '') {
callback(new Error('请输入账号')); callback(new Error('请输入账号'));
} else { } else {
var pattern = /^[A-Za-z0-9]*$/; this.accountChange();
if(pattern.test(value)){ callback();
this.accountChange();
callback();
}else{
callback(new Error('请输入正确账号格式'));
}
} }
}; };
var workNumberPass = (rule, value, callback) => { var workNumberPass = (rule, value, callback) => {
@ -413,7 +409,13 @@ export default {
submiting: false // submiting: false //
}; };
}, },
computed: {
...mapState("user", [
'schoolId'
])
},
mounted() { mounted() {
console.log(55, this.schoolId)
this.getData(); this.getData();
// this.auth(); // this.auth();
}, },
@ -786,6 +788,12 @@ export default {
}); });
} }
}, },
//
renderAccount() {
const form = this.form
// id-id-schoolId-workNumber
form.account = `${Setting.platformId}-1-${this.schoolId}-${form.workNumber}`
},
worknumberChange() { worknumberChange() {
if (this.form.workNumber) { if (this.form.workNumber) {
let url = ""; let url = "";
@ -795,20 +803,19 @@ export default {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`; url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=1&accountId=${this.form.accountId}&workNumber=${this.form.workNumber}&account=`;
} }
this.$post(url).then(res => { this.$post(url).then(res => {
if (res.status === 200) { this.workNumberReapeat = false;
this.workNumberReapeat = false; this.renderAccount()
}
}).catch(err => { }).catch(err => {
this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => { this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=1`).then(res => {
const { data } = res const { data } = res
this.showTree = true; this.showTree = true;
let classId = data.classList.map(e => e.id).toString(); const classId = data.classList.map(e => e.id).toString();
this.form = data this.form = data
this.form.classId = classId this.form.classId = classId
this.defaultCheckedKeys = classId.split(",").map(i => Number(i)); this.defaultCheckedKeys = classId.split(",").map(i => Number(i));
delete this.form.classList;
this.accountReapeat = false; this.accountReapeat = false;
this.$refs.form.clearValidate(); this.$refs.form.clearValidate();
this.renderAccount()
}).catch(res => {}); }).catch(res => {});
this.workNumberReapeat = true; this.workNumberReapeat = true;
}); });
@ -902,15 +909,13 @@ export default {
if (valid) { if (valid) {
if (this.submiting) return false if (this.submiting) return false
let nodes = this.$refs.classTree.getCheckedNodes(); let nodes = this.$refs.classTree.getCheckedNodes();
if (nodes.length) { let tempArr = [];
let tempArr = []; nodes.forEach(i => {
nodes.forEach(i => { if (i.level === 3) {
if (i.level === 3) { tempArr.push(i.id);
tempArr.push(i.id); }
} });
}); this.form.classId = tempArr.toString() || 1
this.form.classId = tempArr.toString();
}
if (this.form.accountId) { if (this.form.accountId) {
this.submiting = true this.submiting = true
this.$post(this.api.modifyStudent, this.form).then(res => { this.$post(this.api.modifyStudent, this.form).then(res => {

@ -45,15 +45,15 @@
<el-dialog :title="isDetail ? '查看员工' : (isAdd ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible" <el-dialog :title="isDetail ? '查看员工' : (isAdd ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible"
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="teacherForm" :model="teacherForm" :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="account" label="账号"> <el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="teacherForm.account" placeholder="请输入职工号"></el-input> <el-input v-model.trim="form.workNumber" placeholder="请输入职工号"></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="teacherForm.userName" placeholder="请输入员工姓名"></el-input> <el-input v-model.trim="form.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="roleValue" label="账号角色"> <el-form-item prop="roleValue" label="账号角色">
<el-select v-model="teacherForm.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;height: 32px"> <el-select v-model="form.roleValue" @change="roleChange" @remove-tag="roleRemove" multiple style="width: 100%;height: 32px">
<el-option <el-option
v-for="item in roleList" v-for="item in roleList"
:key="item.id" :key="item.id"
@ -63,12 +63,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识"> <el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model.trim="teacherForm.uniqueIdentification" placeholder="请输入职工工号获取唯一标识"></el-input> <el-input disabled v-model.trim="form.uniqueIdentification" placeholder="请输入职工工号获取唯一标识"></el-input>
</el-form-item>
<el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="teacherForm.workNumber" placeholder="请输入职工工号"></el-input>
</el-form-item> </el-form-item>
<el-form-item v-for="item in teacherForm.roleAndDeptList" :label="`${item.roleName}所属部门`" :rules="{ <el-form-item v-for="item in form.roleAndDeptList" :label="`${item.roleName}所属部门`" :rules="{
required: true, message: '请选择', trigger: 'change' required: true, message: '请选择', trigger: 'change'
}"> }">
<el-cascader <el-cascader
@ -79,15 +76,18 @@
></el-cascader> ></el-cascader>
</el-form-item> </el-form-item>
<el-form-item prop="phone" label="手机号"> <el-form-item prop="phone" label="手机号">
<el-input v-model.trim="teacherForm.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input> <el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="email" label="邮箱"> <el-form-item prop="email" label="邮箱">
<el-input v-model.trim="teacherForm.email" placeholder="请输入邮箱" @blur="emailChange"></el-input> <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-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>
<el-button type="primary" @click="saveSure('teacherForm')"> </el-button> <el-button type="primary" @click="saveSure('form')"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -165,7 +165,7 @@ export default {
casProps: { casProps: {
value: 'id' value: 'id'
}, },
teacherForm: { form: {
accountId: "", accountId: "",
account: "", account: "",
userName: "", userName: "",
@ -289,7 +289,7 @@ export default {
}).catch(res => {}); }).catch(res => {});
}, },
closeTeacher() { // / closeTeacher() { // /
this.teacherForm = { this.form = {
accountId: "", accountId: "",
account: "", account: "",
userName: "", userName: "",
@ -300,7 +300,7 @@ export default {
phone: "", phone: "",
email: "" email: ""
}; };
this.$refs.teacherForm.clearValidate(); this.$refs.form.clearValidate();
this.teacherVisible = false; this.teacherVisible = false;
}, },
addTeacher() { // addTeacher() { //
@ -312,13 +312,13 @@ export default {
getStaffDetail(accountId) { // getStaffDetail(accountId) { //
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => { this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => {
let { data } = res; let { data } = res;
this.teacherForm = data; this.form = data;
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId); this.form.roleValue = data.roleAndDeptList.map(i => i.roleId);
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => { this.form.roleAndDeptList = data.roleAndDeptList.map(i => {
i.cascaderValue = [i.staffArchitectureId, i.gradeId] i.cascaderValue = [i.staffArchitectureId, i.gradeId]
return i; return i;
}); });
console.log(22, this.teacherForm) console.log(22, this.form)
}).catch(res => {}); }).catch(res => {});
}, },
resetPassword(row) { // resetPassword(row) { //
@ -345,12 +345,12 @@ export default {
this.getStaffDetail(row.accountId); this.getStaffDetail(row.accountId);
}, },
accountChange() { // accountChange() { //
if (this.teacherForm.account) { if (this.form.account) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.teacherForm.account}&workNumber=`; url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&account=${this.form.account}&workNumber=`;
} else { } else {
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&account=${this.teacherForm.account}&workNumber=`; url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.form.accountId}&account=${this.form.account}&workNumber=`;
} }
this.$post(url).then(res => { this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -362,30 +362,20 @@ export default {
} }
}, },
workNumberChange() { // workNumberChange() { //
if (this.teacherForm.workNumber) { if (this.form.workNumber) {
let url = ""; this.$post(`${this.api.getDetailByAccount}?workNumber=${this.form.workNumber}&platformId=${Setting.platformId}&type=0`).then(res => {
if (this.isAdd) { this.form = res.data
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&workNumber=${this.teacherForm.workNumber}&account=`; }).catch(res => {})
} else { }
url = `${this.api.checkWorkNumOrAccount}?platformId=${Setting.platformId}&type=${Setting.platformType}&accountId=${this.teacherForm.accountId}&workNumber=${this.teacherForm.workNumber}&account=`;
}
this.$post(url).then(res => {
if (res.status === 200) {
this.workNumberReapeat = false;
}
}).catch( err => {
this.workNumberReapeat = true;
});
}
}, },
phoneChange() { // phoneChange() { //
let regex = /^1[3456789]\d{9}$/; let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.teacherForm.phone)) { if (regex.test(this.form.phone)) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
url = `${this.api.checkEmailOrPhone}?phone=${this.teacherForm.phone}&email=`; url = `${this.api.checkEmailOrPhone}?phone=${this.form.phone}&email=`;
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&phone=${this.teacherForm.phone}&email=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&phone=${this.form.phone}&email=`;
} }
this.$post(url).then(res => { this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -398,12 +388,12 @@ export default {
}, },
emailChange() { // emailChange() { //
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/; let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.teacherForm.email)) { if (regex.test(this.form.email)) {
let url = ""; let url = "";
if (this.isAdd) { if (this.isAdd) {
url = `${this.api.checkEmailOrPhone}?email=${this.teacherForm.email}&phone=`; url = `${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`;
} else { } else {
url = `${this.api.checkEmailOrPhone}?accountId=${this.teacherForm.accountId}&email=${this.teacherForm.email}&phone=`; url = `${this.api.checkEmailOrPhone}?accountId=${this.form.accountId}&email=${this.form.email}&phone=`;
} }
this.$post(url).then(res => { this.$post(url).then(res => {
if (res.status === 200) { if (res.status === 200) {
@ -415,9 +405,9 @@ export default {
} }
}, },
roleChange(value) { // roleChange(value) { //
console.log(this.teacherForm.roleValue) console.log(this.form.roleValue)
if (value.length) { if (value.length) {
let ids = this.teacherForm.roleAndDeptList.map(e => e.roleId); let ids = this.form.roleAndDeptList.map(e => e.roleId);
this.roleList.forEach(i => { this.roleList.forEach(i => {
let obj = { let obj = {
roleId: "", roleId: "",
@ -428,26 +418,26 @@ export default {
console.log(i) console.log(i)
obj.roleId = i.id; obj.roleId = i.id;
obj.roleName = i.roleName; obj.roleName = i.roleName;
this.teacherForm.roleAndDeptList.push(obj); this.form.roleAndDeptList.push(obj);
} }
}); });
} else { } else {
this.teacherForm.roleAndDeptList.splice(0); this.form.roleAndDeptList.splice(0);
} }
}, },
roleRemove(value) { // roleRemove(value) { //
let list = []; let list = [];
for(var i=0;i<this.teacherForm.roleAndDeptList.length;i++){ for(var i=0;i<this.form.roleAndDeptList.length;i++){
if (this.teacherForm.roleAndDeptList[i].roleId == value){ if (this.form.roleAndDeptList[i].roleId == value){
}else{ }else{
list.push(this.teacherForm.roleAndDeptList[i]) list.push(this.form.roleAndDeptList[i])
} }
} }
this.teacherForm.roleAndDeptList = list this.form.roleAndDeptList = list
}, },
async saveSure(teacherForm) { async saveSure(form) {
this.$refs[teacherForm].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.accountReapeat) return util.warningMsg("该账号已存在");
@ -455,32 +445,32 @@ export default {
if (this.phoneRepeat) return util.warningMsg("该手机号已存在"); if (this.phoneRepeat) return util.warningMsg("该手机号已存在");
if (this.emailRepeat) return util.warningMsg("该邮箱已存在"); if (this.emailRepeat) return util.warningMsg("该邮箱已存在");
let data = { let data = {
accountId: this.teacherForm.accountId, accountId: this.form.accountId,
account: this.teacherForm.account, account: this.form.account,
userName: this.teacherForm.userName, userName: this.form.userName,
roleAndDeptList: [], roleAndDeptList: [],
uniqueIdentification: this.teacherForm.uniqueIdentification ? this.teacherForm.uniqueIdentification : new Date().getTime(), uniqueIdentification: this.form.uniqueIdentification ? this.form.uniqueIdentification : new Date().getTime(),
workNumber: this.teacherForm.workNumber, workNumber: this.form.workNumber,
phone: this.teacherForm.phone, phone: this.form.phone,
email: this.teacherForm.email email: this.form.email
}; };
if (this.teacherForm.roleAndDeptList.length){ if (this.form.roleAndDeptList.length){
for (let i = 0; i < this.teacherForm.roleAndDeptList.length; i++) { for (let i = 0; i < this.form.roleAndDeptList.length; i++) {
if (this.teacherForm.roleAndDeptList[i].cascaderValue.length < 2) { if (this.form.roleAndDeptList[i].cascaderValue.length < 2) {
util.warningMsg(`请选择${this.teacherForm.roleAndDeptList[i].roleName}所属部门`) util.warningMsg(`请选择${this.form.roleAndDeptList[i].roleName}所属部门`)
return; return;
} else { } else {
let obj = { let obj = {
roleId: this.teacherForm.roleAndDeptList[i].roleId, roleId: this.form.roleAndDeptList[i].roleId,
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0], staffArchitectureId: this.form.roleAndDeptList[i].cascaderValue[0],
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1] gradeId: this.form.roleAndDeptList[i].cascaderValue[1]
}; };
data.roleAndDeptList.push(obj); data.roleAndDeptList.push(obj);
} }
} }
} }
this.submiting = true this.submiting = true
if (this.teacherForm.accountId) { if (this.form.accountId) {
this.$post(this.api.modifyStaff, data).then(res => { this.$post(this.api.modifyStaff, data).then(res => {
util.successMsg("编辑成功"); util.successMsg("编辑成功");
this.closeTeacher(); this.closeTeacher();

@ -20,6 +20,7 @@ export default {
roleId: "", roleId: "",
dataTime: "", dataTime: "",
roleName: '', roleName: '',
schoolId: '',
fromClient: false // 是否从学生端登录 fromClient: false // 是否从学生端登录
}, },
mutations: { mutations: {
@ -53,6 +54,9 @@ export default {
}, },
SET_FROM: (state, fromClient) => { SET_FROM: (state, fromClient) => {
state.fromClient = fromClient state.fromClient = fromClient
},
SET_SCHOOLID: (state, schoolId) => {
state.schoolId = schoolId
} }
}, },
actions: { actions: {

Loading…
Cancel
Save