|
|
@ -1,199 +1,198 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div class="wrap"> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<!-- 左边的组织 --> |
|
|
|
<el-col :span="4"> |
|
|
|
<div class="side"> |
|
|
|
<div class="page"> |
|
|
|
<div class="m-b-20"> |
|
|
|
<div class="m-b-20"> |
|
|
|
<h6 class="p-title">后台员工账号</h6> |
|
|
|
<h6 class="p-title">后台员工账号</h6> |
|
|
|
<el-radio-group v-model="studentType" @change="changeType"> |
|
|
|
<el-radio-group v-model="studentType" @change="initData"> |
|
|
|
<div class="m-b-20"> |
|
|
|
<div class="m-b-20"> |
|
|
|
<el-radio :label="1">所有员工</el-radio> |
|
|
|
<el-radio :label="1">所有员工</el-radio> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<el-radio :label="2">未加入部门的员工</el-radio> |
|
|
|
<el-radio :label="2">未加入部门的员工</el-radio> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-radio-group> |
|
|
|
</el-radio-group> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<el-divider></el-divider> |
|
|
|
<el-divider></el-divider> |
|
|
|
<div> |
|
|
|
<div> |
|
|
|
<div class="flex-between"> |
|
|
|
<div class="flex-between"> |
|
|
|
<h6 class="p-title" style="margin-bottom: 0">组织架构</h6> |
|
|
|
<h6 class="p-title" style="margin-bottom: 0">组织架构</h6> |
|
|
|
<el-button type="text" @click="addOrg">添加</el-button> |
|
|
|
<el-button type="text" @click="addOrg">添加</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div style="height: 504px; max-height: 504px; overflow: auto"> |
|
|
|
<div style="height: 504px; max-height: 504px; overflow: auto"> |
|
|
|
<el-tree |
|
|
|
<el-tree |
|
|
|
:data="orgList" |
|
|
|
:data="orgList" |
|
|
|
default-expand-all |
|
|
|
default-expand-all |
|
|
|
ref="orgTree" |
|
|
|
ref="orgTree" |
|
|
|
node-key="id" |
|
|
|
node-key="id" |
|
|
|
highlight-current |
|
|
|
highlight-current |
|
|
|
:expand-on-click-node="false" |
|
|
|
:expand-on-click-node="false" |
|
|
|
@node-click="handleNodeClick" |
|
|
|
@node-click="handleNodeClick" |
|
|
|
:props="{children: 'children', label: 'organizationName', isLeaf: 'leaf'}" |
|
|
|
:props="{children: 'children', label: 'organizationName', isLeaf: 'leaf'}" |
|
|
|
> |
|
|
|
> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }"> |
|
|
|
<span class="org-name">{{ node.label }}</span> |
|
|
|
<span class="org-name">{{ node.label }}</span> |
|
|
|
<span> |
|
|
|
<span> |
|
|
|
<el-button |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
icon="el-icon-edit-outline" |
|
|
|
icon="el-icon-circle-plus-outline" |
|
|
|
@click="() => editOrg(node, data)"> |
|
|
|
@click="() => addOrg(node, data)"> |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
<el-button |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
type="text" |
|
|
|
icon="el-icon-circle-plus-outline" |
|
|
|
icon="el-icon-edit-outline" |
|
|
|
@click="() => addOrg(node, data)"> |
|
|
|
@click="() => editOrg(node, data)"> |
|
|
|
</el-button> |
|
|
|
</el-button> |
|
|
|
</span> |
|
|
|
<el-button |
|
|
|
</span> |
|
|
|
type="text" |
|
|
|
</el-tree> |
|
|
|
icon="el-icon-delete" |
|
|
|
</div> |
|
|
|
@click="() => delOrg(node, data)"> |
|
|
|
</div> |
|
|
|
</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-tree> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog |
|
|
|
<el-dialog |
|
|
|
:title="orgForm.id ? '编辑' : '新增' + '部门'" |
|
|
|
:title="orgForm.id ? '编辑' : '新增' + '部门'" |
|
|
|
:visible.sync="orgVisible" |
|
|
|
:visible.sync="orgVisible" |
|
|
|
:close-on-click-modal="false" |
|
|
|
:close-on-click-modal="false" |
|
|
|
width="50%" |
|
|
|
width="50%" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<el-form v-if="orgVisible" ref="orgForm" :model="orgForm" :rules="orgRules" label-width="100px"> |
|
|
|
|
|
|
|
<el-form-item label="部门名称" prop="organizationName"> |
|
|
|
|
|
|
|
<el-input v-model.trim="orgForm.organizationName" placeholder="请输入"></el-input> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="上级部门"> |
|
|
|
|
|
|
|
<span v-if="orgForm.parentName">{{ orgForm.parentName }}</span> |
|
|
|
|
|
|
|
<el-cascader |
|
|
|
|
|
|
|
v-else |
|
|
|
|
|
|
|
:options="orgListDia" |
|
|
|
|
|
|
|
v-model="cascaderValue" |
|
|
|
|
|
|
|
:props="cascaderProps" |
|
|
|
|
|
|
|
clearable |
|
|
|
|
|
|
|
style="width: 100%" |
|
|
|
> |
|
|
|
> |
|
|
|
<el-form v-if="orgVisible" ref="orgForm" :model="orgForm" :rules="rules" label-width="100px"> |
|
|
|
</el-cascader> |
|
|
|
<el-form-item label="部门名称" prop="organizationName"> |
|
|
|
</el-form-item> |
|
|
|
<el-input v-model.trim="orgForm.organizationName" placeholder="请输入"></el-input> |
|
|
|
</el-form> |
|
|
|
</el-form-item> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-form-item label="上级部门"> |
|
|
|
<el-button @click="closeOrg">取 消</el-button> |
|
|
|
<span v-if="orgForm.parentName">{{ orgForm.parentName }}</span> |
|
|
|
<el-button type="primary" @click="orgSubmit">确 定</el-button> |
|
|
|
<el-cascader |
|
|
|
</span> |
|
|
|
v-else |
|
|
|
</el-dialog> |
|
|
|
:options="orgListDia" |
|
|
|
</div> |
|
|
|
v-model="cascaderValue" |
|
|
|
<!-- 右边的员工 --> |
|
|
|
:props="cascaderProps" |
|
|
|
<div class="right"> |
|
|
|
clearable |
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
style="width: 100%" |
|
|
|
<div class="tool"> |
|
|
|
> |
|
|
|
<ul class="filter"> |
|
|
|
</el-cascader> |
|
|
|
<li> |
|
|
|
</el-form-item> |
|
|
|
<el-input style="width: 250px;" placeholder="请输入员工姓名/手机号" prefix-icon="el-icon-search" v-model="keyWord" clearable></el-input> |
|
|
|
</el-form> |
|
|
|
</li> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
</ul> |
|
|
|
<el-button v-if="!orgForm.id" @click="closeOrg">取 消</el-button> |
|
|
|
<div> |
|
|
|
<el-button v-else type="danger" plain @click="delOrg">删除</el-button> |
|
|
|
<el-button type="primary" @click="addStaff">新增员工</el-button> |
|
|
|
<el-button type="primary" @click="orgSubmit">确 定</el-button> |
|
|
|
<el-button type="primary" @click="batchImport">批量导入</el-button> |
|
|
|
</span> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="accountId"> |
|
|
|
</el-col> |
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
<el-col :span="20"> |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
<div class="page"> |
|
|
|
<el-table-column prop="userName" label="员工姓名" align="center" min-width="100"></el-table-column> |
|
|
|
<h6 class="p-title">筛选</h6> |
|
|
|
<el-table-column prop="account" label="账号" align="center" min-width="100"></el-table-column> |
|
|
|
<div class="tool"> |
|
|
|
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column> |
|
|
|
<ul class="filter"> |
|
|
|
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column> |
|
|
|
<li> |
|
|
|
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column> |
|
|
|
<el-input style="width: 250px;" placeholder="请输入员工姓名/手机号" prefix-icon="el-icon-search" v-model="keyWord" clearable></el-input> |
|
|
|
<el-table-column label="操作" align="center" width="300"> |
|
|
|
</li> |
|
|
|
<template slot-scope="scope"> |
|
|
|
</ul> |
|
|
|
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button> |
|
|
|
<div> |
|
|
|
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button> |
|
|
|
<el-button type="primary" @click="addStaff">新增员工</el-button> |
|
|
|
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button> |
|
|
|
<el-button type="primary" @click="batchImport">批量导入</el-button> |
|
|
|
<el-button type="text" @click="delStaff(scope.row)">删除</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</el-table-column> |
|
|
|
|
|
|
|
</el-table> |
|
|
|
|
|
|
|
<div class="pagination"> |
|
|
|
|
|
|
|
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-table :data="listData" class="table" ref="table" stripe header-align="center" @selection-change="handleSelectionChange" row-key="accountId"> |
|
|
|
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false" @close="closeStaff"> |
|
|
|
<el-table-column type="selection" width="55" align="center" :reserve-selection="true"></el-table-column> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> |
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
<el-form-item prop="workNumber" label="工号"> |
|
|
|
<el-table-column prop="userName" label="员工姓名" align="center" min-width="100"></el-table-column> |
|
|
|
<el-input v-model.trim="form.workNumber" placeholder="请输入工号"></el-input> |
|
|
|
<el-table-column prop="account" label="账号" align="center" min-width="100"></el-table-column> |
|
|
|
</el-form-item> |
|
|
|
<el-table-column prop="phone" label="手机号" align="center" width="120"></el-table-column> |
|
|
|
<el-form-item prop="userName" label="姓名"> |
|
|
|
<el-table-column prop="staffArchitectureName" label="所在部门" align="center" min-width="100"></el-table-column> |
|
|
|
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
<el-table-column prop="roleName" label="授权角色" align="center" width="100"></el-table-column> |
|
|
|
</el-form-item> |
|
|
|
<el-table-column label="操作" align="center" width="300"> |
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input> |
|
|
|
<el-button type="text" @click="queryStaff(scope.row,true)">查看</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-button type="text" @click="queryStaff(scope.row,false)">编辑</el-button> |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
<el-button type="text" @click="resetPassword(scope.row)">重置密码</el-button> |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input> |
|
|
|
<el-button type="text" @click="delStaff(scope.row)">删除</el-button> |
|
|
|
</el-form-item> |
|
|
|
</template> |
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
</el-table-column> |
|
|
|
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input> |
|
|
|
</el-table> |
|
|
|
</el-form-item> |
|
|
|
<div class="pagination"> |
|
|
|
<el-form-item prop="roleList" label="授权角色"> |
|
|
|
<el-pagination background @current-change="currentChange" :current-page="page" layout="total, prev, pager, next" :total="total"></el-pagination> |
|
|
|
<el-select class="w-100" v-model="form.roleList" multiple> |
|
|
|
</div> |
|
|
|
<template v-for="item in roleList"> |
|
|
|
|
|
|
|
<!-- 不显示超管 --> |
|
|
|
|
|
|
|
<el-option |
|
|
|
|
|
|
|
v-if="item.roleName !== '超级管理员'" |
|
|
|
|
|
|
|
:key="item.id" |
|
|
|
|
|
|
|
:label="item.roleName" |
|
|
|
|
|
|
|
:value="item.id"> |
|
|
|
|
|
|
|
</el-option> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="所在部门"> |
|
|
|
|
|
|
|
<el-cascader |
|
|
|
|
|
|
|
class="w-100" |
|
|
|
|
|
|
|
v-model="form.staffArchitectureId" |
|
|
|
|
|
|
|
:options="orgList" |
|
|
|
|
|
|
|
:props="casProps" |
|
|
|
|
|
|
|
></el-cascader> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
|
|
|
<el-button @click="staffVisible = false">取消</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" @click="submitStaff">确定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog :title="isDetail ? '查看' : (form.accountId ? '编辑' : '新增') + '员工'" :visible.sync="staffVisible" width="580px" class="dialog" :close-on-click-modal="false" @close="closeStaff"> |
|
|
|
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false"> |
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="150px" :disabled="isDetail" style='margin-right: 80px;'> |
|
|
|
<div style="text-align: center"> |
|
|
|
<el-form-item prop="workNumber" label="工号"> |
|
|
|
<div style="margin-bottom: 10px;"> |
|
|
|
<el-input v-model.trim="form.workNumber" placeholder="请输入工号"></el-input> |
|
|
|
<el-button type="primary" @click="downLoad">模板下载<i class="el-icon-download el-icon--right"></i></el-button> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
<el-form-item prop="userName" label="姓名"> |
|
|
|
<el-upload |
|
|
|
<el-input v-model.trim="form.userName" placeholder="请输入姓名"></el-input> |
|
|
|
name="file" |
|
|
|
</el-form-item> |
|
|
|
accept=".xls,.xlsx" |
|
|
|
<el-form-item prop="account" label="账号"> |
|
|
|
:on-remove="handleRemove" |
|
|
|
<el-input v-model.trim="form.account" placeholder="请输入账号"></el-input> |
|
|
|
:on-error="uploadError" |
|
|
|
</el-form-item> |
|
|
|
:on-success="uploadSuccess" |
|
|
|
<el-form-item prop="phone" label="手机号"> |
|
|
|
:before-remove="beforeRemove" |
|
|
|
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input> |
|
|
|
:limit="1" |
|
|
|
</el-form-item> |
|
|
|
:on-exceed="handleExceed" |
|
|
|
<el-form-item prop="email" label="邮箱"> |
|
|
|
:action="this.api.importStaff" |
|
|
|
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input> |
|
|
|
:file-list="uploadList" |
|
|
|
</el-form-item> |
|
|
|
:headers="headers" |
|
|
|
<el-form-item prop="roleList" label="授权角色"> |
|
|
|
> |
|
|
|
<el-select class="w-100" v-model="form.roleList" multiple> |
|
|
|
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button> |
|
|
|
<template v-for="item in roleList"> |
|
|
|
</el-upload> |
|
|
|
<!-- 不显示超管 --> |
|
|
|
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败,查看失败原因</el-link> |
|
|
|
<el-option |
|
|
|
</div> |
|
|
|
v-if="item.roleName !== '超级管理员'" |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
:key="item.id" |
|
|
|
<el-button size="small" @click="importVisible = false">取 消</el-button> |
|
|
|
:label="item.roleName" |
|
|
|
<el-button size="small" type="primary" @click="uploadSure">确 定</el-button> |
|
|
|
:value="item.id"> |
|
|
|
</span> |
|
|
|
</el-option> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
</el-select> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="所在部门"> |
|
|
|
|
|
|
|
<el-cascader |
|
|
|
|
|
|
|
class="w-100" |
|
|
|
|
|
|
|
v-model="form.staffArchitectureId" |
|
|
|
|
|
|
|
:options="orgList" |
|
|
|
|
|
|
|
:props="casProps" |
|
|
|
|
|
|
|
></el-cascader> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer" v-if="!isDetail"> |
|
|
|
|
|
|
|
<el-button @click="staffVisible = false">取消</el-button> |
|
|
|
|
|
|
|
<el-button type="primary" @click="submitStaff">确定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-dialog title="批量导入" :visible.sync="importVisible" width="24%" :close-on-click-modal="false"> |
|
|
|
|
|
|
|
<div style="text-align: center"> |
|
|
|
|
|
|
|
<div style="margin-bottom: 10px;"> |
|
|
|
|
|
|
|
<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" |
|
|
|
|
|
|
|
:on-success="uploadSuccess" |
|
|
|
|
|
|
|
:before-remove="beforeRemove" |
|
|
|
|
|
|
|
:limit="1" |
|
|
|
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
|
|
|
:action="this.api.importStudent" |
|
|
|
|
|
|
|
:file-list="uploadList" |
|
|
|
|
|
|
|
:headers="headers" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<el-button type="primary" class="ml20">上传文件<i class="el-icon-upload2 el-icon--right"></i></el-button> |
|
|
|
|
|
|
|
</el-upload> |
|
|
|
|
|
|
|
<el-link v-if="uploadFaild" type="primary" @click="showFaild">部分数据导入失败,查看失败原因</el-link> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
|
|
|
<el-button size="small" @click="importVisible = false">取 消</el-button> |
|
|
|
|
|
|
|
<el-button size="small" type="primary" @click="uploadSure">确 定</el-button> |
|
|
|
|
|
|
|
</span> |
|
|
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</el-col> |
|
|
|
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
|
@ -288,6 +287,11 @@ export default { |
|
|
|
account: '', |
|
|
|
account: '', |
|
|
|
staffArchitectureId: [] |
|
|
|
staffArchitectureId: [] |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
orgRules: { |
|
|
|
|
|
|
|
organizationName: [ |
|
|
|
|
|
|
|
{ required: true, message: "请输入部门名称", trigger: "blur" } |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
}, |
|
|
|
rules: { |
|
|
|
rules: { |
|
|
|
account: [ |
|
|
|
account: [ |
|
|
|
{ required: true,validator: accountPass, trigger: 'blur' } |
|
|
|
{ required: true,validator: accountPass, trigger: 'blur' } |
|
|
@ -325,7 +329,8 @@ export default { |
|
|
|
multiple: true, |
|
|
|
multiple: true, |
|
|
|
checkStrictly: true, |
|
|
|
checkStrictly: true, |
|
|
|
label: 'organizationName', |
|
|
|
label: 'organizationName', |
|
|
|
value: 'id' |
|
|
|
value: 'id', |
|
|
|
|
|
|
|
isLeaf: 'leaf' |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
importVisible: false, |
|
|
|
importVisible: false, |
|
|
@ -354,6 +359,17 @@ export default { |
|
|
|
async getOrg() { |
|
|
|
async getOrg() { |
|
|
|
const res = await this.$post(this.api.treeListArch) |
|
|
|
const res = await this.$post(this.api.treeListArch) |
|
|
|
const list = res.treeList |
|
|
|
const list = res.treeList |
|
|
|
|
|
|
|
// 没有子级,删除children属性 |
|
|
|
|
|
|
|
const handleLeaf = list => { |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
if (e.children.length) { |
|
|
|
|
|
|
|
handleLeaf(e.children) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
delete e.children |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
handleLeaf(list) |
|
|
|
this.orgList = list |
|
|
|
this.orgList = list |
|
|
|
this.handleOrgId(list) |
|
|
|
this.handleOrgId(list) |
|
|
|
this.getStaff() |
|
|
|
this.getStaff() |
|
|
@ -362,9 +378,13 @@ export default { |
|
|
|
handleOrgId(list, ids) { |
|
|
|
handleOrgId(list, ids) { |
|
|
|
list.forEach(e => { |
|
|
|
list.forEach(e => { |
|
|
|
e.ids = ids ? [...ids, e.id] : [e.id] |
|
|
|
e.ids = ids ? [...ids, e.id] : [e.id] |
|
|
|
this.handleOrgId(e.children, e.ids) |
|
|
|
e.children && this.handleOrgId(e.children, e.ids) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 组织类别筛选回调 |
|
|
|
|
|
|
|
changeType() { |
|
|
|
|
|
|
|
this.initData(true) |
|
|
|
|
|
|
|
}, |
|
|
|
// 添加部门 |
|
|
|
// 添加部门 |
|
|
|
addOrg(node, data) { |
|
|
|
addOrg(node, data) { |
|
|
|
this.orgForm = { |
|
|
|
this.orgForm = { |
|
|
@ -397,25 +417,25 @@ export default { |
|
|
|
// 如果是已经找到了要禁选的层级,则直接改变disabled,并递归 |
|
|
|
// 如果是已经找到了要禁选的层级,则直接改变disabled,并递归 |
|
|
|
if (disabled) { |
|
|
|
if (disabled) { |
|
|
|
e.disabled = true |
|
|
|
e.disabled = true |
|
|
|
this.handleOrg(e.children, id, 1) |
|
|
|
e.children && this.handleOrg(e.children, id, 1) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (e.id === id) { |
|
|
|
if (e.id === id) { |
|
|
|
e.disabled = true |
|
|
|
e.disabled = true |
|
|
|
this.handleOrg(e.children, id, 1) |
|
|
|
e.children && this.handleOrg(e.children, id, 1) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.handleOrg(e.children, id, 0) |
|
|
|
e.children && this.handleOrg(e.children, id, 0) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除部门 |
|
|
|
// 删除部门 |
|
|
|
delOrg() { |
|
|
|
delOrg(node, data) { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
this.$confirm("确定要删除吗?", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}).then(() => { |
|
|
|
}).then(() => { |
|
|
|
this.$post(`${this.api.deleteArch}?id=${this.orgForm.id}`).then(res => { |
|
|
|
this.$post(`${this.api.deleteArch}?id=${data.id}`).then(res => { |
|
|
|
util.successMsg("删除成功") |
|
|
|
util.successMsg("删除成功") |
|
|
|
this.closeOrg() |
|
|
|
this.getOrg() |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
}, |
|
|
@ -459,10 +479,11 @@ export default { |
|
|
|
this.getOrg() |
|
|
|
this.getOrg() |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 员工列表 |
|
|
|
// 员工列表 |
|
|
|
getStaff() { |
|
|
|
getStaff(fromType) { |
|
|
|
|
|
|
|
const orgId = this.$refs.orgTree.getCurrentKey() || '' |
|
|
|
this.$post(this.api.staffList, { |
|
|
|
this.$post(this.api.staffList, { |
|
|
|
type: this.studentType || 1, |
|
|
|
type: this.studentType || 1, |
|
|
|
staffArchitectureId: this.$refs.orgTree.getCurrentKey() || '', |
|
|
|
staffArchitectureId: fromType ? '' : orgId, |
|
|
|
keyWord: this.keyWord, |
|
|
|
keyWord: this.keyWord, |
|
|
|
pageNum: this.page, |
|
|
|
pageNum: this.page, |
|
|
|
pageSize: this.pageSize |
|
|
|
pageSize: this.pageSize |
|
|
@ -479,10 +500,10 @@ export default { |
|
|
|
handleSelectionChange(val) { // 多选 |
|
|
|
handleSelectionChange(val) { // 多选 |
|
|
|
this.multipleSelection = val |
|
|
|
this.multipleSelection = val |
|
|
|
}, |
|
|
|
}, |
|
|
|
initData() { |
|
|
|
initData(fromType) { |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.page = 1 |
|
|
|
this.page = 1 |
|
|
|
this.getStaff() |
|
|
|
this.getStaff(fromType) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 删除 |
|
|
|
// 删除 |
|
|
|
delStaff(row) { |
|
|
|
delStaff(row) { |
|
|
@ -506,14 +527,34 @@ export default { |
|
|
|
// 添加员工 |
|
|
|
// 添加员工 |
|
|
|
addStaff() { |
|
|
|
addStaff() { |
|
|
|
this.staffVisible = true |
|
|
|
this.staffVisible = true |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
|
|
this.$refs.form.clearValidate() |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 编辑/查看 |
|
|
|
// 编辑/查看 |
|
|
|
queryStaff(row, isDetail) { |
|
|
|
queryStaff(row, isDetail) { |
|
|
|
|
|
|
|
const archId = [] |
|
|
|
|
|
|
|
// 处理部门id |
|
|
|
|
|
|
|
const handleArchId = (list, ids, parentId = []) => { |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
// 把部门id分割成二维数组,[[1, 2], [3, 4]],每个层级的id都要放进去,后端返回的是最后一级的id,无法回显 |
|
|
|
|
|
|
|
if (ids.includes(e.id)) { |
|
|
|
|
|
|
|
archId.push([...parentId, e.id]) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
e.children && handleArchId(e.children, ids, [...parentId, e.id]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
this.isDetail = isDetail |
|
|
|
this.isDetail = isDetail |
|
|
|
this.staffVisible = true |
|
|
|
this.staffVisible = true |
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => { |
|
|
|
this.$get(`${this.api.staffDetail}?accountId=${row.accountId}`).then(res => { |
|
|
|
const { data } = res |
|
|
|
const { data } = res |
|
|
|
data.staffArchitectureId = data.staffArchitectureId.split(',') |
|
|
|
const { staffArchitectureId, roleId } = data |
|
|
|
|
|
|
|
if (roleId) data.roleList = roleId.split(',').map(e => Number(e)) |
|
|
|
|
|
|
|
if (staffArchitectureId) { |
|
|
|
|
|
|
|
handleArchId(this.orgList, staffArchitectureId.split(',').map(e => Number(e))) |
|
|
|
|
|
|
|
data.staffArchitectureId = archId |
|
|
|
|
|
|
|
} |
|
|
|
this.form = data |
|
|
|
this.form = data |
|
|
|
this.originAccount = data.account |
|
|
|
this.originAccount = data.account |
|
|
|
this.originWorkNumber = data.workNumber |
|
|
|
this.originWorkNumber = data.workNumber |
|
|
@ -521,7 +562,6 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 获取角色数据 |
|
|
|
// 获取角色数据 |
|
|
|
getRole() { |
|
|
|
getRole() { |
|
|
|
this.roleList =[] |
|
|
|
|
|
|
|
this.$get(`${this.api.roleList}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.$get(`${this.api.roleList}?page=1&size=1000&name=&platformId=${Setting.platformId}`).then(res => { |
|
|
|
this.roleList = res.rolePage.records |
|
|
|
this.roleList = res.rolePage.records |
|
|
|
}).catch(res => {}) |
|
|
|
}).catch(res => {}) |
|
|
@ -585,44 +625,44 @@ export default { |
|
|
|
// 提交新增/编辑员工 |
|
|
|
// 提交新增/编辑员工 |
|
|
|
submitStaff() { |
|
|
|
submitStaff() { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
this.$refs.form.validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
if (valid) { |
|
|
|
if (this.submiting) return false |
|
|
|
debugger |
|
|
|
if (this.accountReapeat) return util.warningMsg("该账号已存在") |
|
|
|
if (this.submiting) return false |
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该工号已存在") |
|
|
|
if (this.accountReapeat) return util.warningMsg("该账号已存在") |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在") |
|
|
|
if (this.workNumberReapeat) return util.warningMsg("该工号已存在") |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在") |
|
|
|
if (this.phoneRepeat) return util.warningMsg("该手机号已存在") |
|
|
|
this.submiting = true |
|
|
|
if (this.emailRepeat) return util.warningMsg("该邮箱已存在") |
|
|
|
const form = this.form |
|
|
|
this.submiting = true |
|
|
|
const ids = form.staffArchitectureId |
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
form.staffArchitectureId = ids.map(e => e[e.length - 1]) |
|
|
|
const ids = form.staffArchitectureId |
|
|
|
console.log("🚀 ~ file: staff.vue ~ line 622 ~ this.$refs.form.validate ~ form", form) |
|
|
|
form.staffArchitectureId = ids.map(e => e[e.length - 1]) |
|
|
|
if (form.accountId) { |
|
|
|
if (form.accountId) { |
|
|
|
this.$post(this.api.modifyStaff, form).then(res => { |
|
|
|
this.$post(this.api.modifyStaff, form).then(res => { |
|
|
|
util.successMsg("编辑成功!") |
|
|
|
util.successMsg("编辑成功!") |
|
|
|
this.staffVisible = false |
|
|
|
this.staffVisible = false |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
|
}, 2000) |
|
|
|
}, 2000) |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
|
}, 2000) |
|
|
|
}, 2000) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
form.uniqueIdentification = new Date().getTime() |
|
|
|
form.uniqueIdentification = new Date().getTime() |
|
|
|
this.$post(this.api.saveStaff, form).then(res => { |
|
|
|
this.$post(this.api.saveStaff, form).then(res => { |
|
|
|
util.successMsg("新增成功!") |
|
|
|
util.successMsg("新增成功!") |
|
|
|
this.staffVisible = false |
|
|
|
this.staffVisible = false |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
|
}, 2000) |
|
|
|
}, 2000) |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
setTimeout(() => { |
|
|
|
setTimeout(() => { |
|
|
|
this.submiting = false |
|
|
|
this.submiting = false |
|
|
|
}, 2000) |
|
|
|
}, 2000) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 关闭新增员工对话框 |
|
|
|
// 关闭新增员工对话框 |
|
|
@ -651,7 +691,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 模板下载 |
|
|
|
// 模板下载 |
|
|
|
downLoad() { |
|
|
|
downLoad() { |
|
|
|
location.href = this.api.studentTemplate |
|
|
|
location.href = this.api.staffTemplate |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 上传文件 |
|
|
|
// 上传文件 |
|
|
|
handleExceed(files, fileList) { |
|
|
|
handleExceed(files, fileList) { |
|
|
@ -710,4 +750,19 @@ export default { |
|
|
|
.w-100 { |
|
|
|
.w-100 { |
|
|
|
width: 100%; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.wrap { |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
height: calc(100vh - 223px); |
|
|
|
|
|
|
|
padding: 0 24px; |
|
|
|
|
|
|
|
.side { |
|
|
|
|
|
|
|
width: 300px; |
|
|
|
|
|
|
|
padding: 24px 10px 24px 0; |
|
|
|
|
|
|
|
margin-right: 24px; |
|
|
|
|
|
|
|
border-right: 1px solid rgba(0, 0, 0, 0.06); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
.right { |
|
|
|
|
|
|
|
width: calc(100% - 374px); |
|
|
|
|
|
|
|
padding: 24px 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |