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