系统管理开发,bug修复

dev_2022-05-11
yujialong 3 years ago
parent 188891de52
commit abd8350b60
  1. 31
      src/api/index.js
  2. 30
      src/layouts/header/index.vue
  3. 1
      src/main.js
  4. 5
      src/pages/course/add/index.vue
  5. 2
      src/pages/course/contentSettings/index.vue
  6. 2
      src/pages/course/preview/index.vue
  7. 3
      src/pages/evaluation/list/index.vue
  8. 3
      src/pages/match/manage/matchProgress.vue
  9. 37
      src/pages/setting/list/index.vue
  10. 20
      src/pages/student/list/index.vue
  11. 26
      src/pages/system/list/index.vue
  12. 154
      src/pages/system/list/role.vue
  13. 774
      src/pages/system/list/staff.vue
  14. 190
      src/pages/system/list/staffSide.vue
  15. 3
      src/pages/system/list/stafftree.vue
  16. 4
      src/router/index.js
  17. 27
      src/router/permission.js
  18. 9
      src/router/routes.js
  19. 4
      src/setting.js

@ -173,7 +173,38 @@ export default {
sendPhoneOrEmailCode: `${host}/users/users/userAccount/sendPhoneOrEmailCode`,// 更换手机号或邮箱--发送手机验证码
// 系统设置
// 员工组织架构
professionalList: `${host}occupationlab/staff/professionalList`, //查询专业列表
staffGradeList: `${host}occupationlab/staff/staffGradeList`, //根据专业id查询年级
saveProfessional: `${host}occupationlab/staff/saveProfessional`, //新增专业
updateProfessional: `${host}occupationlab/staff/updateProfessional`, //编辑专业
deleteProfessional: `${host}occupationlab/staff/deleteProfessional`, //删除专业
saveGrade: `${host}occupationlab/staff/saveGrade`, //新增年级
updateGrade: `${host}occupationlab/staff/updateGrade`, //编辑年级
deleteGrade: `${host}occupationlab/staff/deleteGrade`, //删除年级
// 员工管理
saveStaff: `${host}occupationlab/staff/saveStaff`, //新增员工
staffDetail: `${host}occupationlab/staff/staffDetail`, //员工详情
modifyStaff: `${host}occupationlab/staff/modifyStaff`, //编辑员工
delStaff: `${host}occupationlab/staff/delStaff`, //删除员工
staffList: `${host}occupationlab/staff/staffList`, //员工列表
staffTemplate: `http://39.108.250.202/template/职站员工用户导入模板.xlsx`, //职站员工用户导入模板
exportFailureStaff: `${host}occupationlab/staff/exportFailure`, //批量导入员工失败数据导出
importStaff: `${host}occupationlab/staff/importStaff`, //批量导入员工
// 角色管理
batchRemove: `${host}users/role/batchRemove`, //批量删除角色
checkRoleIsExist: `${host}users/role/checkRoleIsExist`, //判断该角色是否存在
delRoleByAccountId: `${host}users/role/delRoleByAccountId`, //删除某用户下的某个角色
roleList: `${host}users/role/list`, //角色分页列表查询
obtainDetails: `${host}users/role/obtainDetails`, //获取角色详情
saveOrUpdate: `${host}users/role/saveOrUpdate`, //新增或更新角色
queryAllMenus: `${host}users/users/permission/queryAllMenus`, //查询所有菜单
// 系统logo设置
logoDetail: `${host}occupationlab/sys/logo/detail`, //查看系统设置信息
logoSave: `${host}occupationlab/sys/logo/save`, //新增系统设置信息
logoUpdate: `${host}occupationlab/sys/logo/update`, //编辑系统设置信息

@ -1,7 +1,9 @@
<template>
<div class="header">
<img class="logo hh" v-if="isHh" src="@/assets/img/logo-hh.png" />
<img class="logo" v-else src="@/assets/img/logo.png" />
<div>
<img class="logo" :src="logoUrl" />
<span class="title">{{title}}</span>
</div>
<div class="action">
<div class="user" @click="toPersonal">
<el-avatar :size="40" :src="avatar"></el-avatar>
@ -15,12 +17,12 @@
<script>
import { mapState, mapActions } from "vuex";
import util from "@/libs/util";
import Setting from "@/setting";
export default {
data() {
return {
isHh: Setting.isHh
title: "",
logoUrl: ""
};
},
computed: {
@ -32,7 +34,7 @@ export default {
])
},
mounted() {
this.getSystemDetail();
},
methods: {
...mapActions("user", [
@ -40,7 +42,17 @@ export default {
]),
toPersonal() {
this.$router.push("/setting/person");
},
getSystemDetail () {
this.$get(this.api.logoDetail).then(res => {
if (res.status === 200 && res.data) {
this.title = res.data.title;
this.logoUrl = res.data.logoUrl;
} else {
util.errorMsg(res.message);
}
}).catch(res => {});
},
}
};
</script>
@ -57,11 +69,11 @@ export default {
.logo {
height: 50px;
margin-left: 20px;
&.hh {
width: 220px;
margin: 0 20px;
}
.title {
font-size: 18px;
font-weight: bold;
}
.action {

@ -12,7 +12,6 @@ import { post, get, del, put } from "@/plugins/requests/index.js";
import api from "@/api";
import store from "@/store";
import Setting from "@/setting";
import permission from "@/router/permission";
// 插件
import plugins from "@/plugins";

@ -164,8 +164,7 @@ export default {
});
},
//
handleExceed(files, fileList) {
handleExceed(files, fileList) { //
util.warningMsg("当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!");
},
uploadSuccess(res, file, fileList) {
@ -189,7 +188,7 @@ export default {
}).catch(res => {
});
},
goback() {
goback() { //
if (this.isDetail) {
this.$router.back();
} else {

@ -462,7 +462,7 @@ export default {
// console.log(JSON.stringify(row));
if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.playAuth;
this.playAuth = res.data.playAuth;
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);
} else {

@ -155,7 +155,7 @@ export default {
this.iframeSrc = "";
if (this.transferType(row.fileType) == "视频") {
this.$get(`${this.api.getPlayAuth}/${row.fileId}`).then(res => {
this.playAuth = res.playAuth;
this.playAuth = res.data.playAuth;
this.$nextTick(() => {
if (this.player) {
this.player.replayByVidAndPlayAuth(row.fileId, this.playAuth);

@ -15,8 +15,7 @@
</el-radio-group>
</li>
<li>
<el-input placeholder="请输入题干" prefix-icon="el-icon-search" v-model="keyword"
clearable></el-input>
<el-input placeholder="请输入题干" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
</li>
</ul>
<div>

@ -96,9 +96,6 @@ export default {
util.warningMsg("请填写标题");
}
},
entry() {
this.$router.push("/permission");
},
handleSelectionChange(val) {
this.multipleSelection = val;
},

@ -1,5 +1,8 @@
<template>
<div class="wrap">
<div class="topBack">
<div class="back" @click="goBack"><i class="el-icon-arrow-left"></i>返回</div>
</div>
<!-- 头像部分 -->
<div class="header">
<el-avatar :size="80" :src="this.avatar" class="Headtop"></el-avatar>
@ -7,7 +10,7 @@
<el-upload
class="upload-demo"
:headers="{token}"
:action="this.api.updateUserAvatars"
:action="this.api.uploadUserAvatars"
name="file"
:limit="1"
:on-success="getRes"
@ -383,6 +386,7 @@
</template>
<script>
import Setting from "@/setting";
import util from "@/libs/util";
import { mapState, mapActions } from "vuex";
@ -1045,12 +1049,42 @@ export default {
}
}).catch(res => {
});
},
goBack() {
this.$router.go(-1);
}
}
};
</script>
<style lang="scss" scoped>
.topBack {
position: absolute;
top: 0;
left: 0;
right: 0;
background-color: #ffffff;
display: flex;
justify-content: space-between;
align-items: center;
box-sizing: border-box;
width: 100%;
height: 60px;
font-size: 16px;
color: #333;
.back {
cursor: pointer;
line-height: 60px;
height: 60px;
font-size: 16px;
font-weight: bold;
margin-left: 20px;
i {
color: #9278ff;
font-size: 20px;
}
}
}
.arrowTransform {
transition: 0.5s;
transform-origin: center;
@ -1066,6 +1100,7 @@ export default {
.wrap {
margin: -24px -24px 20px;
padding-top: 170px;
padding-bottom: 40px;
display: flex;
align-items: center;
flex-direction: column;

@ -155,7 +155,7 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item prop="account" label="学生账号">
<el-input v-model="form.account" placeholder="请输入学生账号" @change="accountChange"></el-input>
<el-input v-model="form.account" placeholder="请输入学生账号" @blur="accountChange"></el-input>
</el-form-item>
<el-form-item prop="userName" label="学生姓名">
<el-input v-model="form.userName" placeholder="请输入学生姓名"></el-input>
@ -164,13 +164,13 @@
学生
</el-form-item>
<el-form-item prop="workNumber" label="学生学号">
<el-input v-model="form.workNumber" placeholder="" @change="worknumberChange"></el-input>
<el-input v-model="form.workNumber" placeholder="" @blur="worknumberChange"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11" @change="phoneChange"></el-input>
<el-input v-model="form.phone" placeholder="可用于登录平台,以及找回密码" maxlength="11" @blur="phoneChange"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="form.email" placeholder="可用于登录平台,以及找回密码" @change="emailChange"></el-input>
<el-input v-model="form.email" placeholder="可用于登录平台,以及找回密码" @blur="emailChange"></el-input>
</el-form-item>
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model="form.uniqueIdentification"></el-input>
@ -211,6 +211,7 @@
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
@ -219,9 +220,8 @@
:limit="1"
:on-exceed="handleExceed"
:action="this.api.importStudent"
:headers="headers"
:file-list="uploadList"
name="file"
:headers="headers"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
@ -664,6 +664,7 @@ export default {
});
},
async accountChange() {
if (this.form.account) {
let res = await this.$post(`${this.api.checkWorkNumOrAccount}?account=${this.form.account}&workNumber=`);
if (res.status === 200) {
this.accountReapeat = false;
@ -671,8 +672,10 @@ export default {
util.warningMsg("该账号已存在");
this.accountReapeat = true;
}
}
},
async worknumberChange() {
if (this.form.workNumber) {
let res = await this.$post(`${this.api.checkWorkNumOrAccount}?workNumber=${this.form.workNumber}&account=`);
if (res.status === 200) {
this.workNumberReapeat = false;
@ -680,6 +683,7 @@ export default {
util.warningMsg("该学生学号已存在");
this.workNumberReapeat = true;
}
}
},
async phoneChange() {
let regex = /^1[3456789]\d{9}$/;
@ -698,10 +702,10 @@ export default {
if (regex.test(this.form.email)) {
let res = await this.$post(`${this.api.checkEmailOrPhone}?email=${this.form.email}&phone=`);
if (res.status === 200) {
this.accountReapeat = false;
this.emailRepeat = false;
} else {
util.warningMsg("该邮箱已存在");
this.accountReapeat = true;
this.emailRepeat = true;
}
}
},

@ -5,37 +5,36 @@
</div>
<staff v-if="active == 'staff'"></staff>
<role v-else></role>
<role v-if="active == 'role'"></role>
<logo v-if="active == 'logo'"></logo>
</div>
</template>
<script>
import Setting from "@/setting";
import { mapState } from "vuex";
import staff from "./staff";
import role from "./role";
import logo from "./logo";
export default {
data() {
return {
active: "staff",
tabs: {
staff: "员工管理",
role: "角色权限"
role: "角色权限",
logo: "系统logo设置",
}
};
},
computed: {
...mapState("auth", [
"routes"
])
},
components: {
staff,
role
role,
logo
},
created() {
console.log("routes===", this.routes);
Setting.dynamicRoute && this.initTabs();
},
methods: {
@ -43,9 +42,9 @@ export default {
this.active = index;
},
initTabs() {
let btnPermissions = this.routes;
let tab1 = btnPermissions.includes("系统设置:员工管理");
let tab2 = btnPermissions.includes("系统设置:角色权限");
let tab1 = this.auth("员工管理");
let tab2 = this.auth("角色权限");
let tab3 = this.auth("系统logo设置");
if (!tab1) {
delete this.tabs.staff;
@ -53,6 +52,9 @@ export default {
if (!tab2) {
delete this.tabs.role;
}
if (!tab3) {
// delete this.tabs.logo;
}
}
}
};

@ -1,33 +1,32 @@
<template>
<div class="page">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
<el-input placeholder="请输入角色名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</li>
</ul>
<div>
<!-- <el-button type="primary" round @click="addRole">新增角色</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button> -->
<el-button type="primary" round @click="addRole">新增角色</el-button>
<el-button type="primary" round @click="delAllSelection">批量删除</el-button>
</div>
</div>
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" :row-key="getRowKeys">
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column>
<el-table-column type="index" width="100" label="序号" align="center">
</el-table-column>
<el-table-column prop="name" label="角色名称" align="center" width="100">
</el-table-column>
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column>
<el-table-column prop="roleName" label="角色名称" align="center" width="100"></el-table-column>
<el-table-column label="角色描述" align="center">
<template slot-scope="scope">
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.description" disabled></el-input>
<el-input placeholder="该角色用于管理全部功能权限" v-model="scope.row.remark" disabled></el-input>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showRole(scope.row)">查看</el-button>
<el-button type="text" @click="editRole(scope.row)">编辑</el-button>
<!-- <el-button type="text" @click="handleDelete(scope.row)">删除</el-button> -->
<el-button type="text" @click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -36,19 +35,20 @@
</div>
<el-dialog :title="isDetail ? '查看角色' : (isAdd ? '新增角色' : '编辑角色')" :visible.sync="roleVisible" width="30%" @close="closeRole" class="dialog" :close-on-click-modal="false">
<el-form ref="form" label-width="100px" :disabled="isDetail">
<el-form ref="form" label-width="80px" :disabled="isDetail">
<el-form-item label="角色名称">
<el-input v-model="form.name " ref="account" placeholder="请输入角色名称"></el-input>
<el-input v-model="form.roleName" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="角色描述">
<el-input v-model="form.description " placeholder="请输入角色描述" type="textarea" rows="5"></el-input>
<el-input v-model="form.remark" placeholder="请输入角色描述" type="textarea" rows="5"></el-input>
</el-form-item>
<el-form-item prop="role" label="角色权限">
<div class="per-wrap">
<div style="max-height: 300px; overflow: auto">
<el-tree
ref="per"
:data="permissions"
show-checkbox
default-expand-all
node-key="id"
:default-expanded-keys="checkedIds"
:default-checked-keys="checkedIds"
@ -66,9 +66,7 @@
</template>
<script>
import Setting from "@/setting";
import util from "@/libs/util";
import { mapState, mapActions } from "vuex";
export default {
data() {
@ -77,9 +75,9 @@ export default {
searchTimer: null,
isDetail: false,
form: {
roleId: "",
name: "",
description: ""
id: "",
roleName: "",
remark: ""
},
listData: [],
defaultProps: {
@ -93,7 +91,8 @@ export default {
isAdd: true,
roleVisible: false,
permissions: [],
checkedIds: []
checkedIds: [],
roleNameReapeat: false //
};
},
watch: {
@ -109,16 +108,10 @@ export default {
},
methods: {
getData() {
let data = {
name: util.encodeStr(this.keyword),
page: this.page,
size: this.pageSize
};
this.$get(this.api.rolePermissionList, data).then(res => {
this.listData = res.data.list;
this.total = res.data.totalCount;
}).catch(res => {
});
this.$get(`${this.api.roleList}?page=${this.page}&size=${this.pageSize}&name=${util.encodeStr(this.keyword)}`).then(res => {
this.listData = res.rolePage.records;
this.total = res.rolePage.total;
}).catch(res => {});
},
currentChange(val) {
this.page = val;
@ -127,49 +120,33 @@ export default {
handleDelete(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
})
.then(() => {
let data = {
roleIds: [row.roleId]
};
this.$post(`${this.api.delRolePermission}`, data).then(res => {
}).then(() => {
this.$post(`${this.api.batchRemove}?roleIds=${row.id}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
}).catch(res => {});
}).catch(() => {});
},
getRowKeys(row) {
return row.roleId;
return row.id;
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
delAllSelection() {
if (this.multipleSelection.length) {
let newArr = this.multipleSelection;
let delList = newArr.map(item => {
return item.roleId;
});
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
})
.then(() => {
let data = {
roleIds: delList
};
this.$post(`${this.api.delRolePermission}`, data).then(res => {
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.id;
});
this.$post(`${this.api.batchRemove}?roleIds=${ids.toString()}`).then(res => {
this.$refs.table.clearSelection();
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
}).catch(res => {});
}).catch(() => {});
} else {
util.errorMsg("请先选择数据!");
}
@ -177,9 +154,9 @@ export default {
closeRole() {
this.isDetail = false;
this.form = {
roleId: "",
name: "",
description: ""
id: "",
roleName: "",
remark: ""
};
this.checkedIds = [];
this.permissions = [];
@ -187,8 +164,8 @@ export default {
//
getPer(row) {
if (!this.permissions.length) {
this.$get(this.api.roleTree).then(res => {
let data = res.data;
this.$get(this.api.queryAllMenus).then(res => {
let data = res.children;
//
let yw = data.findIndex(n => n.name == "业务后台");
yw != -1 && data.splice(yw, 1);
@ -231,12 +208,12 @@ export default {
}
return result;
},
async getDetail(row) {
let res = await this.$get(`${this.api.queryPermissionArrById}?roleId=${row.roleId}`);
if (res.success) {
this.form = res.data;
this.form.roleId = row.roleId;
this.checkedIds = this.handleRolePer(res.data.permissionIds, this.permissions);
async getDetail(row) { //
let res = await this.$get(`${this.api.obtainDetails}?id=${row.id}`);
if (res.status === 200) {
this.form = res.role;
this.form.id = row.id;
this.checkedIds = this.handleRolePer(res.permissionList, this.permissions);
this.$refs.per.setCheckedNodes(this.checkedIds);
}
},
@ -251,32 +228,45 @@ export default {
this.getPer(row);
this.roleVisible = true;
},
async roleNameChange() {
let res = await this.$post(`${this.api.checkRoleIsExist}?roleName=${this.form.roleName}`);
if (res.status === 200) {
this.roleNameReapeat = false;
} else {
util.warningMsg("该角色已存在");
this.roleNameReapeat = true;
}
},
async saveData() {
if (!this.form.name) return util.warningMsg("请填写角色名称");
if (!this.form.description) return util.warningMsg("请填写角色描述");
if (!this.form.roleName) return util.warningMsg("请填写角色名称");
if (!this.form.remark) return util.warningMsg("请填写角色描述");
if (!this.$refs.per.getCheckedKeys().length) return util.warningMsg("请选择角色权限");
// ,(),
let permissionIds = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()];
let permissionId = [...this.$refs.per.getHalfCheckedKeys(), ...this.$refs.per.getCheckedKeys()];
let data = {
roleId: this.form.roleId,
name: this.form.name,
description: this.form.description,
permissionIds
...this.form,
permissionId
};
if (this.form.roleId) {
this.$post(this.api.updateRolePermission, data).then(res => {
if (this.form.id) {
this.$post(this.api.saveOrUpdate, data).then(res => {
if (res.status === 200) {
util.successMsg("修改成功");
this.getData();
this.roleVisible = false;
}).catch(res => {
});
} else {
this.$post(this.api.saveRolePermission, data).then(res => {
util.errorMsg(res.message);
}
}).catch(res => {});
} else {
this.$post(this.api.saveOrUpdate, data).then(res => {
if (res.status === 200) {
util.successMsg("新增成功");
this.getData();
this.roleVisible = false;
}).catch(res => {
});
} else {
util.errorMsg(res.message);
}
}).catch(res => {});
}
}
}

@ -1,14 +1,15 @@
<template>
<div class="wrap">
<div class="side">
<TeacherSide ref="getSelectData" @fircheck="fircheck" @twocheck="twocheck" @getData="getData" @delDep="delDep"></TeacherSide>
<TeacherSide ref="getSelectData" @fircheck="fircheck" @twocheck="twocheck" @getData="initData" @delDep="delDep"></TeacherSide>
</div>
<div class="right">
<h6 class="p-title">筛选</h6>
<div class="tool">
<ul class="filter">
<li>
<el-input placeholder="请输入员工账号/姓名/工号" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input>
<el-input placeholder="请输入员工账号/姓名/工号" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</li>
</ul>
<div>
@ -20,24 +21,13 @@
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="55" align="center">
</el-table-column>
<el-table-column prop="account" label="账号" align="center">
</el-table-column>
<el-table-column prop="userName" label="职工姓名" align="center">
</el-table-column>
<el-table-column prop="workNumber" label="职工工号" align="center">
</el-table-column>
<el-table-column prop="staffProfessionalArchitectureName" label="一级部门" align="center">
</el-table-column>
<el-table-column prop="staffGradeName" label="二级部门" align="center">
</el-table-column>
<el-table-column prop="NewaccountRole" label="账号角色" align="center">
</el-table-column>
<el-table-column prop="logInNumber" label="登录次数" align="center">
</el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" align="center">
</el-table-column>
<el-table-column type="index" label="序号" width="55" align="center"></el-table-column>
<el-table-column prop="userName" label="职工姓名" align="center"></el-table-column>
<el-table-column prop="workNumber" label="职工工号" align="center"></el-table-column>
<el-table-column prop="dept" label="部门" align="center"></el-table-column>
<el-table-column prop="roleName" label="账号角色" align="center"></el-table-column>
<el-table-column prop="logInNumber" label="登录次数" align="center"></el-table-column>
<el-table-column prop="lastLoginTime" label="上次登录时间" align="center"></el-table-column>
<el-table-column label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showTeacher(scope.row)">查看</el-button>
@ -52,73 +42,50 @@
</div>
</div>
<el-dialog :title="isDetail ? '查看员工' : (isAddteacher ? '新增员工' : '编辑员工')" :visible.sync="teacherVisible" width="30%" @close="closeTeacher" class="dialog" :close-on-click-modal="false">
<el-form ref="teacherForm" :model="teacherForm" :rules="rules" label-width="120px" :disabled="isDetail">
<el-form-item prop="userAccount" label="账号">
<el-input v-model="teacherForm.userAccount" ref="account" placeholder="请输入职工账号" @change="accountChange"></el-input>
<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="140px" :disabled="isDetail">
<el-form-item prop="account" label="账号">
<el-input v-model.trim="teacherForm.account" placeholder="请输入职工账号" @blur="accountChange"></el-input>
</el-form-item>
<el-form-item prop="userName" label="用户姓名">
<el-input v-model="teacherForm.userName" placeholder="请输入员工姓名"></el-input>
<el-input v-model.trim="teacherForm.userName" placeholder="请输入员工姓名"></el-input>
</el-form-item>
<el-form-item prop="roleValue" label="账号角色">
<el-checkbox-group v-model="teacherForm.roleValue">
<el-checkbox label="老师"></el-checkbox>
<el-checkbox label="管理员"></el-checkbox>
<!-- <el-checkbox label="学生" disabled></el-checkbox> -->
</el-checkbox-group>
</el-form-item>
<el-form-item prop="uniqueIdentificationAccount" label="唯一标识">
<el-input disabled v-model="teacherForm.uniqueIdentificationAccount" placeholder="请输入职工工号获取唯一标识"></el-input>
</el-form-item>
<template v-if="teacherForm.roleValue.some((n) => n == '老师')">
<el-form-item prop="teacherWorkNumber" label="老师职工工号">
<el-input v-model="teacherForm.teacherWorkNumber" placeholder="请输入老师职工工号" @change="OnlyId(14)"></el-input>
</el-form-item>
<el-form-item prop="teacherMajor" label="老师一级部门">
<el-select v-model="teacherForm.teacherMajor" placeholder="请选择一级部门" @change="getDepartment(14)">
<el-option v-for="(item,index) in majorList" :key="index"
:label="item.staffProfessionalArchitectureName" :value="item.staffProfessionalArchitectureId"></el-option>
<el-select v-model="teacherForm.roleValue" @change="roleChange" multiple placeholder="请选择" style="width: 100%">
<el-option
v-for="item in roleList"
:key="item.id"
:label="item.roleName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item prop="teacherDepartment" label="老师二级部门">
<el-select v-model="teacherForm.teacherDepartment" placeholder="请选择二级部门" :disabled="teacherForm.teacherMajor ? false : true">
<el-option v-for="(item,index) in teacherDepartmentList" :key="index"
:label="item.staffGradeName" :value="item.staffGradeId"></el-option>
</el-select>
<el-form-item prop="uniqueIdentification" label="唯一标识">
<el-input disabled v-model.trim="teacherForm.uniqueIdentification" placeholder="请输入职工工号获取唯一标识"></el-input>
</el-form-item>
</template>
<template v-if="teacherForm.roleValue.some((n) => n == '管理员')">
<el-form-item prop="managerWorkNumber" label="管理员职工工号">
<el-input v-model="teacherForm.managerWorkNumber" placeholder="请输入管理员职工工号" @change="OnlyId(13)"></el-input>
<el-form-item prop="workNumber" label="工号">
<el-input v-model.trim="teacherForm.workNumber" placeholder="请输入职工工号" @blur="workNumberChange"></el-input>
</el-form-item>
<el-form-item prop="managerMajor" label="管理员一级部门">
<el-select v-model="teacherForm.managerMajor" placeholder="请选择一级部门" @change="getDepartment(13)">
<el-option v-for="(item,index) in majorList" :key="index"
:label="item.staffProfessionalArchitectureName" :value="item.staffProfessionalArchitectureId"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="managerDepartment" label="管理员二级部门">
<el-select v-model="teacherForm.managerDepartment" placeholder="请选择二级部门" :disabled="teacherForm.managerMajor ? false : true">
<el-option v-for="(item,index) in managerDepartmentList" :key="index"
:label="item.staffGradeName" :value="item.staffGradeId"></el-option>
</el-select>
<template v-for="item in teacherForm.roleAndDeptList">
<el-form-item :label="`${item.roleName}所属部门`">
<el-cascader
v-model="item.cascaderValue"
:options="majorList"
style="width: 100%"
></el-cascader>
</el-form-item>
</template>
<el-form-item prop="phone" label="手机号">
<el-input v-model="teacherForm.phone" placeholder="请输入手机号" maxlength="11" @change="phoneChange"></el-input>
<el-input v-model.trim="teacherForm.phone" placeholder="请输入手机号" maxlength="11" @blur="phoneChange"></el-input>
</el-form-item>
<el-form-item prop="email" label="邮箱">
<el-input v-model="teacherForm.email" placeholder="请输入邮箱" @change="emailChange"></el-input>
</el-form-item>
<el-form-item prop="schoolId" label="所在院校">
<el-select v-model="teacherForm.schoolId" placeholder="默认为当前院校(可修改)" filterable disabled>
<el-option v-for="(item,index) in schoolList" :key="index" :label="item.schoolName" :value="item.schoolId"></el-option>
</el-select>
<el-input v-model.trim="teacherForm.email" placeholder="请输入邮箱" @blur="emailChange"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer" v-if="!isDetail">
<el-button @click="teacherVisible = false"> </el-button>
<el-button @click="closeTeacher"> </el-button>
<el-button type="primary" @click="saveSure('teacherForm')"> </el-button>
</span>
</el-dialog>
@ -129,6 +96,7 @@
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button>
</div>
<el-upload
name="file"
accept=".xls,.xlsx"
:on-remove="handleRemove"
:on-error="uploadError"
@ -136,9 +104,9 @@
:before-remove="beforeRemove"
:limit="1"
:on-exceed="handleExceed"
:action="this.api.uploadFileStaff"
:action="this.api.importStaff"
:file-list="uploadList"
name="file"
:headers="headers"
>
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button>
</el-upload>
@ -154,36 +122,33 @@
<script>
import Setting from "@/setting";
import util from "@/libs/util";
import { mapState, mapActions } from "vuex";
import TeacherSide from "./staffSide";
export default {
data() {
return {
exportCode: "",
headers: {
token: util.local.get(Setting.tokenKey)
},
isDetail: false,
isAddteacher: false,
isAdd: false,
teacherVisible: false,
schoolId: Setting.schoolId,
roleList: [], //
majorList: [], //
teacherForm: {
teacherId: "",
accountId: "",
account: "",
userName: "",
roleValue: [],
tearcherAccount: "",
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
uniqueIdentificationAccount: "",
teacherWorkNumber: "",
managerWorkNumber: "",
email: "",
teacherMajor: "",
teacherDepartment: "",
managerMajor: "",
managerDepartment: "",
userAccount: "",
major: "",
schoolId: Setting.schoolId
email: ""
},
rules: {
userAccount: [
account: [
{ required: true, message: "请输入职工账号", trigger: "blur" },
{
pattern: /^[A-Za-z0-9]*$/,
@ -197,52 +162,16 @@ export default {
roleValue: [
{ required: true, message: "请选择账号角色", trigger: "change" }
],
tearcherAccount: [
{ required: true, message: "请输入老师职工工号", trigger: "blur" },
{
pattern: /^[0-9]*$/,
message: "职工工号必须为数字",
trigger: "blur"
}
workNumber: [
{ required: true, message: "请输入职工工号", trigger: "blur" },
// { pattern: /^[0-9]*$/, message: "", trigger: "blur"}
],
uniqueIdentificationAccount: [
uniqueIdentification: [
// { required: true, message: '', trigger: 'blur' },
],
teacherWorkNumber: [
{ required: true, message: "请输入老师职工工号", trigger: "blur" },
{
pattern: /^[A-Za-z0-9]+$/,
message: "请输入正确的职工工号",
trigger: "blur"
}
],
teacherDepartment: [
{ required: true, message: "请选择老师二级部门", trigger: "change" }
],
managerMajor: [
{ required: true, message: "请选择管理员一级部门", trigger: "change" }
],
managerWorkNumber: [
{ required: true, message: "请输入管理员职工工号", trigger: "blur" },
{
pattern: /^[A-Za-z0-9]+$/,
message: "请输入正确的职工工号",
trigger: "blur"
}
],
managerDepartment: [
{ required: true, message: "请选择管理员二级部门", trigger: "change" }
],
teacherMajor: [
{ required: true, message: "请选择老师一级部门", trigger: "change" }
],
phone: [
// { required: true, message: '', trigger: 'blur' },
{
pattern: /^1[3456789]\d{9}$/,
message: "请输入正确的手机号",
trigger: "blur"
}
{ pattern: /^1[3456789]\d{9}$/, message: "请输入正确的手机号", trigger: "blur"}
],
email: [
// { required: true, message: '', trigger: 'blur' },
@ -252,43 +181,28 @@ export default {
trigger: "blur"
}
],
schoolId: [
{ required: true, message: "请选择所在院校", trigger: "change" }
]
},
listData: [],
importVisible: false,
accountReapeat: false,
workNumberReapeat: false,
phoneRepeat: false,
emailRepeat: false,
listData: [], //
keyword: "",
page: 1,
pageSize: 10,
total: 0,
managerDepartmentList: [],
teacherDepartmentList: [],
staffstateProfessId: "",
staffGradeId: "",
multipleSelection: [],
uploadList: [],
provinceId: this.$store.state.provinceId,
cityId: this.$store.state.cityId,
userId: this.$store.state.userId,
multipleSelection: [], //
importVisible: false, //
uploadList: [], //
uploadFaild: false, //
oneDepartmentIds: "",
twoDepartmentIds: "",
ProfessionalClassList: [],
subjectList: [],
ProfessionalList: [],
NoAdd: "",
AccountNoAdd: "",
emailNoAdd: "",
managerNumberNoAdd: true,
teacherNumberNoAdd: true,
platformId: this.$store.state.platformId,
isManager: false,
isTeacher: false,
isNewUser: 1,
schoolList: [],
uploadFaild: false,
token: "",
accountMsg: ""
gradeId: "", // ID
staffArchitectureId: "", // ID
};
},
components: {
@ -298,26 +212,23 @@ export default {
keyword: function(val) {
clearTimeout(this.searchTimer);
this.searchTimer = setTimeout(() => {
this.getData();
this.initData();
}, 500);
}
},
mounted() {
this.getRoleData();
this.getData();
this.teacherForm.schoolId = Setting.schoolId;
console.log(33, this.schoolId, this.teacherForm.schoolId);
this.getSchoolData();
},
methods: {
handleCheck(data) {
let oneDepartmentIds = [];
let twoDepartmentIds = [];
data.forEach(e => {
if (e.ischeck) {
oneDepartmentIds.push(e.staffProfessionalArchitectureId);
oneDepartmentIds.push(e.staffArchitectureId);
} else {
this.removeByValue(oneDepartmentIds, e.staffProfessionalArchitectureId);
this.removeByValue(oneDepartmentIds, e.staffArchitectureId);
}
e.children.forEach(r => {
if (r.ischeck) {
@ -329,7 +240,7 @@ export default {
});
this.oneDepartmentIds = oneDepartmentIds.toString();
this.twoDepartmentIds = twoDepartmentIds.toString();
this.getData();
this.initData();
},
fircheck(val, val2) {
val.ischeck = !val.ischeck;
@ -354,359 +265,209 @@ export default {
delDep(val, val2) {
this.handleCheck(val2);
},
getData() {
let data = {
staffProfessionalArchitectureIds: (this.oneDepartmentIds && this.twoDepartmentIds) ? "" : this.oneDepartmentIds,
staffGradeIds: this.twoDepartmentIds,
searchContent: util.encodeStr(this.keyword),
page: this.page,
size: this.pageSize,
schoolId: this.schoolId
};
this.$post(this.api.queryStaff, data).then(res => {
this.listData = res.data.list;
this.total = res.data.totalCount;
this.listData.forEach(e => {
if (e.roleId.length > 1) {
let NewaccountRole = [];
let roleIds = e.roleId.split(",");
roleIds.forEach((n, k) => {
NewaccountRole.push(util.getRoleName(n));
});
e.NewaccountRole = NewaccountRole.join(",");
} else {
e.NewaccountRole = util.getRoleName(e.roleId);
}
});
}).catch(res => {
});
initData() {
this.$refs.table.clearSelection();
this.page = 1;
this.getData();
},
getSchoolData() {
getData() { //
let data = {
schoolName: "",
provinceId: "",
cityId: ""
keyWord: this.keyword,
pageNum: this.page,
pageSize: this.pageSize,
staffArchitectureId: this.staffArchitectureId,
gradeId: this.gradeId
};
this.$get(this.api.querySchool, data).then(res => {
this.schoolList = res.message;
}).catch(res => {
});
this.$post(this.api.staffList, data).then(res => {
this.listData = res.page.records;
this.total = res.page.total;
}).catch(res => {});
},
getRoleData() { //
this.$get(`${this.api.roleList}?page=1&size=100&name=`).then(res => {
this.roleList = res.rolePage.records;
}).catch(res => {});
},
closeTeacher() {
closeTeacher() { // /
this.teacherForm = {
teacherId: "",
accountId: "",
account: "",
userName: "",
roleValue: [],
tearcherAccount: "",
roleAndDeptList: [],
uniqueIdentification: "",
workNumber: "",
phone: "",
uniqueIdentificationAccount: "",
teacherWorkNumber: "",
managerWorkNumber: "",
email: "",
teacherMajor: "",
teacherDepartment: "",
managerMajor: "",
managerDepartment: "",
userAccount: "",
major: "",
schoolId: this.schoolId
email: ""
};
this.isManager = false;
this.isTeacher = false;
this.$refs.teacherForm.clearValidate();
this.teacherVisible = false;
},
addTeacher() {
addTeacher() { //
this.isDetail = false;
this.isAdd = true;
this.teacherVisible = true;
this.isAddteacher = true;
this.teacherForm.teacherId = "";
this.majorList = this.$refs.getSelectData.majorList;
this.$refs.teacherForm.clearValidate();
},
getStaffDetail(userId) {
let data = {
userId: userId
};
this.$get(this.api.querystaffDetail, data).then(res => {
let user = res.data.userInfo;
let or = res.data.staffInfo;
this.teacherForm.userName = user.userName;
this.teacherForm.phone = user.phone;
this.teacherForm.email = user.email;
this.teacherForm.userAccount = user.account;
this.teacherForm.userId = user.userId;
this.teacherForm.schoolId = user.schoolId;
this.teacherForm.uniqueIdentificationAccount = user.uniqueIdentificationAccount;
or.forEach((n, i) => {
this.teacherForm.roleValue.push(util.getRoleName(n.roleId));
if (n.roleId == 13) {
this.teacherForm.managerMajor = n.staffProfessionalArchitectureId;
this.teacherForm.managerDepartment = n.staffGradeId;
this.teacherForm.managerWorkNumber = n.workNumber;
this.isManager = true;
this.teacherForm.managerStaffId = n.staffId;
this.getDepartment(13);
} else if (n.roleId == 14) {
this.teacherForm.teacherMajor = n.staffProfessionalArchitectureId;
this.teacherForm.teacherDepartment = n.staffGradeId;
this.teacherForm.teacherWorkNumber = n.workNumber;
this.isTeacher = true;
this.teacherForm.teacherStaffId = n.staffId;
this.getDepartment(14);
}
// console.log(JSON.stringify(this.majorList));
},
getStaffDetail(accountId) { //
this.$get(`${this.api.staffDetail}?accountId=${accountId}`).then(res => {
let { data, status} = res;
if (status === 200) {
this.teacherForm = data;
this.teacherForm.roleValue = data.roleAndDeptList.map(i => i.roleId);
this.teacherForm.roleAndDeptList = data.roleAndDeptList.map(i => {
i.cascaderValue = [i.staffArchitectureId, i.gradeId]
return i;
});
}).catch(res => {
});
},
editTeacher(row) {
this.isDetail = false;
this.teacherVisible = true;
this.isAddteacher = false;
this.AccountNoAdd = false;
this.teacherForm.teacherId = row.userId;
this.majorList = this.$refs.getSelectData.majorList;
this.isNewUser = 0;
this.getStaffDetail(row.userId);
}
}).catch(res => {});
},
resetPassword(row) {
this.$confirm(`重置后的密码为:${this.$config.initialPassword},确定重置?`, "提示", {}).then(() => {
let data = {
newPwd: this.$config.initialPassword,
userId: row.userId
};
this.$get(this.api.resetPwd, data).then(res => {
if (res.errmessage == "success") {
resetPassword(row) { //
this.$confirm(`重置后的密码为:${Setting.initialPassword},确定重置?`, "提示", { type: "warning" }).then(() => {
this.$get(`${this.api.resetPassword}?userId=${row.accountId}&newPwd=111aaa`).then(res => {
if (res.status === 200) {
util.successMsg("重置成功");
} else {
util.errorMsg("重置失败");
util.errorMsg(res.message);
}
}).catch(res => {
});
}).catch(() => {
});
},
showTeacher(row) {
editTeacher(row) { //
this.isDetail = false;
this.isAdd = false;
this.teacherVisible = true;
this.majorList = this.$refs.getSelectData.majorList;
this.getStaffDetail(row.accountId);
},
showTeacher(row) { //
this.isDetail = true;
this.isAdd = false;
this.teacherVisible = true;
this.isAddteacher = false;
this.AccountNoAdd = false;
this.teacherForm.teacherId = row.userId;
this.majorList = this.$refs.getSelectData.majorList;
this.isNewUser = 0;
this.getStaffDetail(row.userId);
this.getStaffDetail(row.accountId);
},
getDepartment(type) {
let data = {
staffProfessionalArchitectureId: type == 13 ? this.teacherForm.managerMajor : this.teacherForm.teacherMajor
};
this.$get(this.api.queryStaffGrade, data).then(res => {
if (type == 13) {
this.managerDepartmentList = res.message;
async accountChange() { //
if (this.teacherForm.account) {
let res = await this.$post(`${this.api.checkWorkNumOrAccount}?account=${this.teacherForm.account}&workNumber=`);
if (res.status === 200) {
this.accountReapeat = false;
} else {
this.teacherDepartmentList = res.message;
util.warningMsg("该账号已存在");
this.accountReapeat = true;
}
}
}).catch(res => {
});
},
async phoneChange() {
let res = await this.$get(this.api.queryPhone, { phone: this.teacherForm.phone });
if (res.message.length != 0) {
util.warningMsg("该手机号已存在");
this.NoAdd = false;
async workNumberChange() { //
if (this.teacherForm.workNumber) {
let res = await this.$post(`${this.api.checkWorkNumOrAccount}?workNumber=${this.teacherForm.workNumber}&account=`);
if (res.status === 200) {
this.workNumberReapeat = false;
} else {
this.NoAdd = true;
util.warningMsg("该员工工号已存在");
this.workNumberReapeat = true;
}
}
},
async emailChange() {
let res = await this.$get(this.api.queryEmail, { email: this.teacherForm.email });
if (res.message.length != 0) {
util.warningMsg("该邮箱已存在");
this.emailNoAdd = false;
async phoneChange() { //
let regex = /^1[3456789]\d{9}$/;
if (regex.test(this.teacherForm.phone)) {
let res = await this.$post(`${this.api.checkEmailOrPhone}?phone=${this.teacherForm.phone}&email=`);
if (res.status === 200) {
this.phoneRepeat = false;
} else {
this.emailNoAdd = true;
util.warningMsg("该手机号已存在");
this.phoneRepeat = true;
}
}
},
async accountChange() {
let res = await this.$get(this.api.queryAccountIsExist, {
account: util.encodeStr(this.teacherForm.userAccount),
schoolId: this.schoolId
});
if (this.isAddteacher) {
this.isManager = false;
this.isTeacher = false;
}
if (res.message.user.length != 0) {
let user = res.message.user[0];
let or = res.message.OR;
if (user.roleId) {
this.accountMsg = user.roleId.includes(",") ? "该账号已绑定老师和管理员" : `该账号已绑定${util.getRoleName(user.roleId)}`;
async emailChange() { //
let regex = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
if (regex.test(this.teacherForm.email)) {
let res = await this.$post(`${this.api.checkEmailOrPhone}?email=${this.teacherForm.email}&phone=`);
if (res.status === 200) {
this.emailRepeat = false;
} else {
this.accountMsg = "该账号已存在";
util.warningMsg("该邮箱已存在");
this.emailRepeat = true;
}
util.warningMsg(this.accountMsg);
this.teacherForm.email = user.email;
this.teacherForm.phone = user.phone;
this.teacherForm.uniqueIdentificationAccount = user.uniqueIdentificationAccount;
this.teacherForm.userName = user.userName;
// this.teacherForm.schoolId = user.schoolId
this.teacherForm.userId = user.userId;
this.isNewUser = 0;
or.forEach((n, i) => {
this.teacherForm.roleValue.push(util.getRoleName(n.roleId));
if (n.roleId == 13) {
this.teacherForm.managerMajor = n.oneDepartmentId;
this.teacherForm.managerDepartment = n.twoDepartmentId;
this.teacherForm.managerWorkNumber = n.workNumber;
this.teacherForm.managerSchoolId = n.schoolId;
this.teacherForm.managerSchoolName = n.schoolName;
this.isManager = true;
this.getDepartment(13);
} else if (n.roleId == 14) {
this.teacherForm.teacherMajor = n.oneDepartmentId;
this.teacherForm.teacherDepartment = n.twoDepartmentId;
this.teacherForm.teacherWorkNumber = n.workNumber;
this.teacherForm.teacherSchoolId = n.schoolId;
this.teacherForm.tacherSchoolName = n.schoolName;
this.isTeacher = true;
this.getDepartment(14);
}
});
this.AccountNoAdd = false;
} else {
this.isNewUser = 1;
this.AccountNoAdd = true;
this.teacherForm.userName = "";
}
},
async submitOnlyId() {
if (this.teacherForm.managerWorkNumber != "") {
this.OnlyId(13);
} else if (this.teacherForm.teacherWorkNumber != "") {
this.OnlyId(14);
}
},
async OnlyId(type) {
let data = {};
let msg = "";
if (type == 13) {
data = {
workNumber: util.encodeStr(this.teacherForm.managerWorkNumber),
roleId: 13,
schoolId: this.teacherForm.schoolId
};
msg = "该管理员工号已存在";
} else if (type == 14) {
data = {
workNumber: util.encodeStr(this.teacherForm.teacherWorkNumber),
roleId: 14,
schoolId: this.teacherForm.schoolId
},
roleChange(value) { //
// console.log(value);
if (value.length) {
this.teacherForm.roleAndDeptList.splice(0);
this.roleList.forEach(i => {
let obj = {
roleId: "",
roleName: "",
cascaderValue: []
};
msg = "该老师工号已存在";
if (value.includes(i.id)) {
obj.roleId = i.id;
obj.roleName = i.roleName;
this.teacherForm.roleAndDeptList.push(obj);
}
let res = await this.$get(this.api.queryWorkNumberIsExist, data);
if (JSON.stringify(res.message) != "{}") {
util.warningMsg(msg);
type == 13 ? (this.managerNumberNoAdd = false) : (this.teacherNumberNoAdd = false);
});
} else {
let timestamp = Date.parse(new Date());
this.teacherForm.uniqueIdentificationAccount = `${this.schoolId}${this.teacherForm.uniqueIdentificationAccount}${timestamp}`;
type == 13 ? (this.managerNumberNoAdd = true) : (this.teacherNumberNoAdd = true);
this.teacherForm.roleAndDeptList.splice(0);
}
},
async saveSure(teacherForm) {
this.$refs[teacherForm].validate((valid) => {
if (valid) {
if (this.isAddteacher) {
if (this.isManager && this.isTeacher) return util.warningMsg("该用户已经是老师和管理员,请重新添加");
if (this.isManager && !this.teacherForm.roleValue.some((n) => n == "老师")) return util.warningMsg("该用户已经是管理员");
if (this.isTeacher && !this.teacherForm.roleValue.some((n) => n == "管理员")) return util.warningMsg("该用户已经是老师");
if (!this.AccountNoAdd) return util.warningMsg(this.accountMsg);
if (this.NoAdd == "" && this.teacherForm.phone) {
this.phoneChange();
if (!this.NoAdd) return false;
} else if (this.NoAdd === false) {
return util.warningMsg("该手机号已存在");
} else if (this.emailNoAdd === false) {
return util.warningMsg("该邮箱已存在");
}
}
if (!this.managerNumberNoAdd) return util.warningMsg("该管理员工号已存在");
if (!this.teacherNumberNoAdd) return util.warningMsg("该老师工号已存在");
let roleId = [];
this.teacherForm.roleValue.includes("管理员") && roleId.push(13);
this.teacherForm.roleValue.includes("老师") && roleId.push(14);
if (this.accountReapeat) return util.warningMsg("该账号已存在");
if (this.workNumberReapeat) return util.warningMsg("该员工工号已存在");
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,
account: this.teacherForm.userAccount,
schoolId: this.teacherForm.schoolId,
roleId: roleId.join(","),
roleAndDeptList: [],
uniqueIdentification: this.teacherForm.uniqueIdentification ? this.teacherForm.uniqueIdentification : new Date().getTime(),
workNumber: this.teacherForm.workNumber,
phone: this.teacherForm.phone,
email: this.teacherForm.email,
uniqueIdentificationAccount: this.teacherForm.uniqueIdentificationAccount ? this.teacherForm.uniqueIdentificationAccount : Date.parse(new Date()),
userId: this.teacherForm.userId ? this.teacherForm.userId : ""
};
data.staff = [];
if ((!this.isAddteacher && this.teacherForm.managerWorkNumber && roleId.includes(13)) || (this.isAddteacher && !this.isManager && this.teacherForm.managerWorkNumber)) {
let oneDepartmentName = "";
for (let i in this.majorList) {
if (this.majorList[i].staffProfessionalArchitectureId == this.teacherForm.managerMajor) {
oneDepartmentName = this.majorList[i].staffProfessionalArchitectureName;
break;
}
}
let twoDepartmentName = this.managerDepartmentList.find((n) => {
return n.staffGradeId == this.teacherForm.managerDepartment;
}).staffGradeName;
let orList = {
roleId: 13,
staffId: this.teacherForm.managerStaffId,
workNumber: this.teacherForm.managerWorkNumber,
staffProfessionalArchitectureId: this.teacherForm.managerMajor,
staffGradeId: this.teacherForm.managerDepartment,
staffProfessionalArchitectureName: oneDepartmentName,
staffGradeName: twoDepartmentName
email: this.teacherForm.email
};
data.staff.push(orList);
}
if ((!this.isAddteacher && this.teacherForm.teacherWorkNumber && roleId.includes(14)) || (this.isAddteacher && !this.isTeacher && this.teacherForm.teacherWorkNumber)) {
let oneDepartmentName = "";
for (let i in this.majorList) {
if (this.majorList[i].staffProfessionalArchitectureId == this.teacherForm.teacherMajor) {
oneDepartmentName = this.majorList[i].staffProfessionalArchitectureName;
break;
}
}
let twoDepartmentName = this.teacherDepartmentList.find((n) => {
return n.staffGradeId == this.teacherForm.teacherDepartment;
}).staffGradeName;
let orList = {
roleId: 14,
staffId: this.teacherForm.teacherStaffId,
workNumber: this.teacherForm.teacherWorkNumber,
staffProfessionalArchitectureId: this.teacherForm.teacherMajor,
staffGradeId: this.teacherForm.teacherDepartment,
staffProfessionalArchitectureName: oneDepartmentName,
staffGradeName: twoDepartmentName
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}所属部门`)
return;
} else {
let obj = {
roleId: this.teacherForm.roleAndDeptList[i].roleId,
staffArchitectureId: this.teacherForm.roleAndDeptList[i].cascaderValue[0],
gradeId: this.teacherForm.roleAndDeptList[i].cascaderValue[1]
};
data.staff.push(orList);
data.roleAndDeptList.push(obj);
}
if (this.teacherForm.teacherId) {
this.$put(this.api.updateStaff, data).then(res => {
this.teacherVisible = false;
}
}
if (this.teacherForm.accountId) {
this.$post(this.api.modifyStaff, data).then(res => {
if (res.status === 200) {
util.successMsg("编辑成功");
this.closeTeacher();
this.getData();
}).catch(res => {
});
} else {
this.$post(this.api.addStaff, data).then(res => {
this.teacherVisible = false;
util.errorMsg(res.message);
}
}).catch(res => {});
} else {
this.$post(this.api.saveStaff, data).then(res => {
if (res.status === 200) {
util.successMsg("添加成功");
this.closeTeacher();
this.getData();
}).catch(res => {
});
} else {
util.errorMsg(res.message);
}
}).catch(res => {});
}
} else {
return false;
@ -716,35 +477,28 @@ export default {
delTeacher(row) {
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
})
.then(() => {
this.$post(this.api.daleteBatchStaff, [row.userId]).then(res => {
}).then(() => {
this.$post(`${this.api.delStaff}?accountIds=${row.accountId}`).then(res => {
util.successMsg("删除成功");
this.getData();
}).catch(res => {
});
})
.catch(() => {
});
}).catch(res => {});
}).catch(() => {});
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
delAllSelection() {
if (this.multipleSelection.length != "") {
let newArr = this.multipleSelection;
let delList = newArr.map(item => {
return item.userId;
});
if (this.multipleSelection.length) {
//
this.$confirm("确定要删除吗?", "提示", {
type: "warning"
})
.then(() => {
let data = delList;
this.$post(this.api.daleteBatchStaff, data).then(res => {
this.$refs.table.clearSelection();
}).then(() => {
let ids = this.multipleSelection.map(item => {
return item.accountId;
});
this.$post(`${this.api.delStaff}?accountIds=${ids.toString()}`).then(res => {
this.multipleSelection = [];
this.$refs.table.clearSelection();
util.successMsg("删除成功");
this.getData();
}).catch(res => {
@ -772,7 +526,7 @@ export default {
location.href = this.api.staffTemplate;
},
showFaild() {
location.href = `${this.api.export_failureStaff}?token=${this.token}`;
location.href = `${this.api.exportFailureStaff}?exportCode=${this.exportCode}`;
},
//
handleExceed(files, fileList) {
@ -781,14 +535,14 @@ export default {
);
},
uploadSuccess(res, file, fileList) {
console.log(res);
this.uploadFaild = false;
if (res.errmessage == "success") {
if (res.data.token) {
this.token = res.data.token;
if (res.status === 200) {
if (res.data.exportCode) {
this.exportCode = res.data.exportCode;
this.uploadFaild = true;
} else {
util.successMsg("上传成功");
}
util.successMsg(`上传成功${res.data.successNum},上传失败${res.data.failureNum}`);
} else {
res.message ? util.errorMsg(res.message) : util.errorMsg("上传失败,请检查数据");
}
@ -812,54 +566,6 @@ export default {
this.page = 1;
this.keyword = "";
this.getData();
},
//
getSubject() {
this.$get(this.api.queryCourseDiscipline).then(res => {
this.subjectList = res.message;
}).catch(res => {
});
},
//
clearClass() {
this.teacherForm.professionalClassId = "",
this.teacherForm.professionalId = "";
},
//
getProfessionalClass() {
this.clearClass();
if (this.teacherForm.disciplineId) {
this.getProfessionalClassData();
}
},
getProfessionalClassData() {
let data = {
disciplineId: this.teacherForm.disciplineId
};
this.$get(this.api.queryCourseProfessionalClass, data).then(res => {
this.ProfessionalClassList = res.message;
}).catch(res => {
});
},
//
clearProfess() {
this.teacherForm.professionalId = "";
},
//
getProfessional() {
this.clearProfess();
if (this.teacherForm.professionalClassId) {
this.getProfessionalData();
}
},
getProfessionalData() {
let data = {
professionalClassId: this.teacherForm.professionalClassId
};
this.$get(this.api.queryCourseProfessional, data).then(res => {
this.ProfessionalList = res.message;
}).catch(res => {
});
}
}
};

@ -8,10 +8,10 @@
></lctree>
</div>
<el-dialog :title="Form.MajorId ? '编辑专业' : '新增专业'" :visible.sync="isaddMajor" width="24%" center @close="closeAdd" :close-on-click-modal="false">
<el-dialog :title="Form.staffArchitectureId ? '编辑专业' : '新增专业'" :visible.sync="isaddMajor" width="24%" center @close="closeAdd" :close-on-click-modal="false">
<el-form ref="Form" :model="Form" :rules="rules">
<el-form-item prop="majorName">
<el-input placeholder="请输入专业名称" v-model="Form.majorName" @change="majorChange"></el-input>
<el-form-item prop="staffArchitectureName">
<el-input placeholder="请输入专业名称" v-model="Form.staffArchitectureName" @change="majorChange"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -20,10 +20,10 @@
</span>
</el-dialog>
<el-dialog :title="Form.departmentId ? '编辑部门' : '新增部门'" :visible.sync="isAddDepartment" width="24%" center @close="closeAdd" :close-on-click-modal="false">
<el-dialog :title="Form.gradeId ? '编辑部门' : '新增部门'" :visible.sync="isAddDepartment" width="24%" center @close="closeAdd" :close-on-click-modal="false">
<el-form ref="Form" :model="Form" :rules="rules">
<el-form-item prop="departmentName">
<el-input placeholder="请输入部门名称" v-model="Form.departmentName"></el-input>
<el-form-item prop="gradeName">
<el-input placeholder="请输入部门名称" v-model="Form.gradeName"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@ -36,7 +36,6 @@
<script>
import Setting from "@/setting";
import util from "@/libs/util";
import { mapState, mapActions } from "vuex";
import lctree from "./stafftree";
export default {
@ -50,16 +49,16 @@ export default {
isAddDepartment: false,
schoolId: Setting.schoolId,
Form: {
MajorId: "",
majorName: "",
departmentId: "",
departmentName: ""
staffArchitectureId: "", // ID
staffArchitectureName: "", // //
gradeId: "",
gradeName: ""
},
rules: {
majorName: [
staffArchitectureName: [
{ required: true, message: "请输入专业名称", trigger: "blur" }
],
departmentName: [
gradeName: [
{ required: true, message: "请输入部门名称", trigger: "blur" }
]
},
@ -76,27 +75,24 @@ export default {
},
methods: {
getStaff() {
this.$get(this.api.professionalList).then(res => {
if (res.data && res.data.length) {
res.data.map(e => {
(e.ifVisible = false), (e.ischeck = false), (e.label = e.staffArchitectureName), (e.value = e.staffArchitectureId);
let data = {
schoolId: this.schoolId
staffArchitectureId: e.staffArchitectureId
};
this.$get(this.api.queryStaffPro, data).then(res => {
if (res.message) {
res.message.map(e => {
(e.ifVisible = false), (e.ischeck = false), (e.label = e.staffProfessionalArchitectureName);
let data = {
staffProfessionalArchitectureId: e.staffProfessionalArchitectureId
};
this.$get(this.api.queryStaffGrade, data).then(res => {
res.message.map(e => {
(e.ischeck = false), (e.label = e.staffGradeName);
this.$get(this.api.staffGradeList, data).then(res => {
res.data.map(e => {
(e.ischeck = false), (e.label = e.gradeName), (e.value = e.gradeId);
});
e.children = res.message;
e.children = res.data;
}).catch(res => {
});
});
}
setTimeout(() => {
this.majorList = res.message;
this.majorList = res.data;
}, 500);
}).catch(res => {
});
@ -114,17 +110,17 @@ export default {
},
//
addMajor() {
this.Form.MajorId = "";
this.Form.majorName = "";
this.Form.staffArchitectureId = "";
this.Form.staffArchitectureName = "";
this.isaddMajor = true;
},
editMajor(item) {
this.Form.MajorId = item.staffProfessionalArchitectureId,
this.Form.majorName = item.staffProfessionalArchitectureName;
this.Form.staffArchitectureId = item.staffArchitectureId;
this.Form.staffArchitectureName = item.staffArchitectureName;
this.isaddMajor = true;
},
async majorChange() {
let res = await this.$get(this.api.queryStaffPAN, { name: this.Form.majorName, schoolId: this.schoolId });
let res = await this.$get(this.api.queryStaffPAN, { name: this.Form.staffArchitectureName, schoolId: this.schoolId });
if (res.message.length != 0) {
util.warningMsg("该一级部门已存在");
this.majorNoAdd = false;
@ -132,41 +128,50 @@ export default {
this.majorNoAdd = true;
}
},
sure(Form) {
sure(Form) { // /
this.$refs[Form].validate((valid) => {
if (valid) {
if (!this.majorNoAdd) return util.warningMsg("该一级部门已存在");
let data = {
staffProfessionalArchitectureName: this.Form.majorName,
staffProfessionalArchitectureId: this.Form.MajorId,
schoolId: this.schoolId
staffArchitectureName: this.Form.staffArchitectureName,
staffArchitectureId: this.Form.staffArchitectureId,
isDel: 0 // (0 1)
};
if (this.Form.MajorId) {
this.$post(this.api.updateStaffPro, data).then(res => {
if (this.Form.staffArchitectureId) {
this.$post(this.api.updateProfessional, data).then(res => {
if (res.status === 200) {
util.successMsg("编辑成功");
this.isaddMajor = false;
this.majorList.map(e => {
if (e.staffProfessionalArchitectureId == this.Form.MajorId) {
e.staffProfessionalArchitectureName = this.Form.majorName;
e.label = this.Form.majorName;
if (e.staffArchitectureId == this.Form.staffArchitectureId) {
e.staffArchitectureName = this.Form.staffArchitectureName;
e.label = this.Form.staffArchitectureName;
}
});
this.$emit("getData");
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
} else {
this.$post(this.api.addStaffPro, data).then(res => {
this.$post(this.api.saveProfessional, data).then(res => {
if (res.status === 200) {
util.successMsg("添加成功");
this.isaddMajor = false;
let newData = {
staffProfessionalArchitectureId: res.message,
staffProfessionalArchitectureName: this.Form.majorName,
label: this.Form.majorName,
staffArchitectureId: res.staffArchitectureId,
staffArchitectureName: this.Form.staffArchitectureName,
label: this.Form.staffArchitectureName,
value: res.staffArchitectureId,
ifVisible: false,
ischeck: false,
children: []
};
this.majorList.push(newData);
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
}
@ -177,62 +182,71 @@ export default {
},
//
addDepartment(item) {
this.Form.departmentId = "";
this.Form.departmentName = "";
this.Form.gradeId = "";
this.Form.gradeName = "";
this.isAddDepartment = true;
this.Form.MajorId = item.staffProfessionalArchitectureId;
this.Form.staffArchitectureId = item.staffArchitectureId;
},
editDepartment(item) {
this.Form.departmentId = item.staffGradeId,
this.Form.departmentName = item.staffGradeName;
this.Form.gradeId = item.gradeId;
this.Form.gradeName = item.gradeName;
this.isAddDepartment = true;
for (let j = 0; j < this.majorList.length; j++) {
for (let k = 0; k < this.majorList[j].children.length; k++) {
if (this.majorList[j].children[k].staffGradeName == item.staffGradeName) {
this.Form.MajorId = this.majorList[j].staffProfessionalArchitectureId;
if (this.majorList[j].children[k].gradeName == item.gradeName) {
this.Form.staffArchitectureId = this.majorList[j].staffArchitectureId;
}
}
}
},
sureDepartment(Form) {
sureDepartment(Form) { //
this.$refs[Form].validate((valid) => {
if (valid) {
let data = {
staffGradeName: this.Form.departmentName,
staffProfessionalArchitectureId: this.Form.MajorId,
staffGradeId: this.Form.departmentId
gradeId: this.Form.gradeId,
gradeName: this.Form.gradeName,
staffArchitectureId: this.Form.staffArchitectureId
};
if (this.Form.departmentId) {
this.$post(this.api.updateStaffGrade, data).then(res => {
if (this.Form.gradeId) {
this.$post(this.api.updateGrade, data).then(res => {
if (res.status === 200) {
util.successMsg("编辑成功");
this.isAddDepartment = false;
this.majorList.map(e => {
e.children.map(r => {
if (r.staffGradeId == this.Form.departmentId) {
r.staffGradeName = this.Form.departmentName;
r.label = this.Form.departmentName;
if (r.gradeId == this.Form.gradeId) {
r.gradeName = this.Form.gradeName;
r.label = this.Form.gradeName;
}
});
});
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
} else {
this.$post(this.api.addStaffGrade, data).then(res => {
this.$post(this.api.saveGrade, data).then(res => {
if (res.status === 200) {
util.successMsg("添加成功");
this.isAddDepartment = false;
let newData = {
staffGradeId: res.message,
staffGradeName: this.Form.departmentName,
label: this.Form.departmentName,
gradeId: res.gradeId,
gradeName: this.Form.gradeName,
label: this.Form.gradeName,
value: res.gradeId,
ifVisible: false,
ischeck: false
};
this.majorList.map(e => {
if (e.staffProfessionalArchitectureId == this.Form.MajorId) {
if (e.staffArchitectureId == this.Form.staffArchitectureId) {
e.ifVisible = true;
e.children.push(newData);
}
});
} else {
util.errorMsg(res.message);
}
}).catch(res => {
});
}
@ -244,38 +258,28 @@ export default {
delMajor(item, index) {
this.$confirm("确定要删除该专业吗?该操作将会删除该组织下的用户账号。", "提示", {
type: "warning"
})
.then(() => {
let data = {
staffProfessionalArchitectureId: item.staffProfessionalArchitectureId
};
this.$post(this.api.deleteStaffPro, data).then(res => {
}).then(() => {
this.$post(`${this.api.deleteProfessional}?staffArchitectureId=${item.staffArchitectureId}`).then(res => {
util.successMsg("删除成功");
this.majorList.splice(index, 1);
this.$emit("getData");
this.$get(`${this.api.dalStaffByProfessionalId}?staffProfessionalArchitectureId=${item.staffProfessionalArchitectureId}`).then(res => {
}).catch(res => {
});
}).catch(res => {
});
})
.catch(() => {
});
// this.$get(`${this.api.dalStaffByProfessionalId}?staffArchitectureId=${item.staffArchitectureId}`).then(res => {
// }).catch(res => {
// });
}).catch(res => {});
}).catch(() => {});
},
delDepartment(item, indx) {
delDepartment(item, index) {
console.log(item);
this.$confirm("确定要删除该部门吗?该操作将会删除该组织下的用户账号。", "提示", {
type: "warning"
})
.then(() => {
let data = {
staffGradeId: item.staffGradeId
};
this.$post(this.api.deleteStaffGrade, data).then(res => {
}).then(() => {
this.$post(`${this.api.deleteGrade}?gradeId=${item.gradeId}`).then(res => {
util.successMsg("删除成功");
this.majorList.map(e => {
e.children.map(r => {
if (r.staffGradeId == item.staffGradeId) {
e.children.splice(indx, 1);
if (r.gradeId == item.gradeId) {
e.children.splice(index, 1);
if (e.children.length == 0) {
e.ifVisible = false;
}
@ -284,14 +288,12 @@ export default {
});
this.$emit("delDep", item, this.majorList);
this.$emit("getData");
this.$get(`${this.api.dalStaffByStaffGradeId}?staffGradeId=${item.staffGradeId}`).then(res => {
// this.$get(`${this.api.dalStaffByStaffGradeId}?gradeId=${item.gradeId}`).then(res => {
// }).catch(res => {
// });
}).catch(res => {
});
}).catch(res => {
});
})
.catch(() => {
});
}).catch(() => {});
}
}
};

@ -113,9 +113,6 @@ export default {
addClass(item) {
this.$emit("addClass", item);
},
editDepartment(item) {
this.$emit("editDepartment", item);
},
delDepartment(item, index) {
this.$emit("delDepartment", item, index);
},

@ -5,7 +5,6 @@ import Setting from "@/setting";
import { get } from "@/plugins/requests/index.js";
import api from "@/api";
import util from "@/libs/util";
import { permission } from "@/router/permission";
import BasicLayout from "@/layouts/home";
Vue.use(Router);
@ -63,7 +62,6 @@ function getPermission() {
let data = res.permissionMenu[0].children;
if (data.length > 0) {
data.forEach(e => {
// 第一级路由,需要根据匹配到的path,塞进对应的路由children里
let str = e.path.split("/")[1];
@ -113,6 +111,7 @@ function getPermission() {
}
}
// permissionRouters.push(obj) // path是页面,要塞入上一级同级里,需要单独push进去生成路由
meta.push(i.name);
} else {
meta.push(i.name);
}
@ -151,6 +150,7 @@ function getPermission() {
}
}
// permissionRouters.push(obj) // path是页面,要塞入上一级同级里,需要单独push进去生成路由
meta.push(i.name+"-"+j.name);
} else {
meta.push(i.name+"-"+j.name);
}

@ -1,27 +0,0 @@
import router from "./index";
import Setting from "@/setting";
import util from "@/libs/util";
// router.beforeEach((to, from, next) => {
// document.title = Setting.titleSuffix;
// const role = util.local.get(Setting.tokenKey);
// if (!role && to.path !== "/login") {
// next("/login");
// } else if (role && to.path == "/login") {
// next("/index");
// } else {
// let mg = from.query.mg;
// if (mg) {
// if (!to.query.mg) {
// next({
// path: to.path,
// query: { mg }
// });
// } else {
// next();
// }
// } else {
// next();
// }
// }
// });

@ -17,6 +17,7 @@ const frameIn = [
meta: { title: "首页" },
children: []
},
];
/**
@ -32,6 +33,14 @@ const frameOut = [
title: "登录"
},
component: () => import("@/pages/account/login")
},
{
path: "/setting/person",
name: "person",
meta: {
title: "个人中心"
},
component: () => import("@/pages/setting/list")
}
];

@ -42,8 +42,8 @@ if (isHh) {
schoolId = 2105;
} else if (isDev) {
jumpPath = "http://192.168.31.154:8087/";
host = "http://39.108.250.202:9000/"; // 中台测试服
// host = "http://192.168.31.151:9000/"; // 榕
// host = "http://39.108.250.202:9000/"; // 中台测试服
host = "http://192.168.31.151:9000/"; // 榕
// host = "http://192.168.31.125:9000/"; // 坤
// host = 'http://192.168.31.137:9000/'; // 赓
title = "职站服务端管理系统";

Loading…
Cancel
Save