学生员工学号相关修改

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`,// 验证码图片
isClient: `users/users/user/isClient`,// 是否为客户
getUserAllRoleByToken : `users/role/getUserAllRoleByToken`,
getSchoolIdByToken : `users/users/data/user/getSchoolIdByToken`,
//实验台
curriculumDetail: `nakadai/nakadai/curriculum/curriculumDetail`, // 课程详情

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

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

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

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

Loading…
Cancel
Save