|
@@ -51,10 +51,10 @@
|
|
|
<el-form-item>
|
|
|
<div style="color:#999;font-size:13px;">共{{total}}人</div>
|
|
|
</el-form-item>
|
|
|
- <el-form-item style="float:right;">
|
|
|
+ <el-form-item style="float:right;" v-if="permissions.structureExport">
|
|
|
<el-link type="primary" :underline="false" @click="showExportDialog">导出人员</el-link>
|
|
|
</el-form-item>
|
|
|
- <el-form-item style="float:right;" v-if="!isDingShow">
|
|
|
+ <el-form-item style="float:right;" v-if="!isDingShow && permissions.structureAdd">
|
|
|
<el-link type="primary" :underline="false" @click="openInsertDialog(null)">添加人员</el-link>
|
|
|
</el-form-item>
|
|
|
<!-- 原来的 -->
|
|
@@ -63,13 +63,13 @@
|
|
|
<el-link type="primary" :underline="false">批量导入</el-link>
|
|
|
</el-upload>
|
|
|
</el-form-item> -->
|
|
|
- <el-form-item style="float:right;" v-if="!isDingShow">
|
|
|
+ <el-form-item style="float:right;" v-if="!isDingShow && permissions.structureImport">
|
|
|
<el-upload ref="upload" action="#" :limit="1" :http-request="importUser" :show-file-list="false">
|
|
|
<el-link type="primary" :underline="false">批量导入</el-link>
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item style="float:right;" v-if="!isDingShow">
|
|
|
+ <el-form-item style="float:right;" v-if="!isDingShow && permissions.structureImport">
|
|
|
<el-link type="primary" :underline="false" href="./upload/人员导入模板.xlsx" download="人员导入模板.xlsx">模板下载</el-link>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item v-if="depData != null && depData.id != -1 && depData.id != 0" style="float:right;border: 0.5px solid #20a0ff;height: 27px;margin-top: 6px;">
|
|
@@ -82,13 +82,14 @@
|
|
|
</el-form-item> -->
|
|
|
<el-form-item style="float:right;">
|
|
|
<span style="color: #666666">角色</span>
|
|
|
- <el-select v-model="role" placeholder="请选择" @change="getUser()" style="width: 120px">
|
|
|
- <el-option
|
|
|
+ <el-select v-model="roleId" placeholder="请选择" @change="getUser()" style="width: 120px" clearable>
|
|
|
+ <!-- <el-option
|
|
|
v-for="item in rolesa"
|
|
|
:key="item.value"
|
|
|
:label="item.label"
|
|
|
:value="item.value">
|
|
|
- </el-option>
|
|
|
+ </el-option> -->
|
|
|
+ <el-option v-for="item in acquireRoleList" :key="item.id" :label="item.rolename" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item style="float:right;">
|
|
@@ -124,17 +125,17 @@
|
|
|
<el-table-column prop="phone" label="手机" width="120"></el-table-column>
|
|
|
<el-table-column prop="departmentName" label="部门" sortable></el-table-column>
|
|
|
<el-table-column label="角色" width="100">
|
|
|
- <template slot-scope="scope">{{roleArray[scope.row.role]}}</template>
|
|
|
+ <template slot-scope="scope">{{scope.row.roleId | acquireRoleName}}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="monthCost" label="月成本" sortable>
|
|
|
+ <el-table-column prop="monthCost" label="月成本" sortable v-if="permissions.structurePersonnel">
|
|
|
<template slot-scope="scope">{{scope.row.monthCost==null?0:scope.row.monthCost}} 元</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="cost" label="时薪" sortable>
|
|
|
+ <el-table-column prop="cost" label="时薪" sortable v-if="permissions.structurePersonnel">
|
|
|
<template slot-scope="scope">{{scope.row.cost==null?0:scope.row.cost}} 元
|
|
|
<el-link @click.native="showSalaryList(scope.row)"><i class="iconfont firerock-iconrecord"></i></el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="330">
|
|
|
+ <el-table-column label="操作" width="330" v-if="permissions.structurePersonnel">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-button size="small" v-if="scope.row.role == 0 && user.role == 1" @click="switchRole(scope.$index)">切换为管理员</el-button>
|
|
|
<el-button size="small" v-if="scope.row.role == 2 && user.role == 1" @click="switchRole(scope.$index)">切换为员工</el-button> -->
|
|
@@ -158,6 +159,7 @@
|
|
|
<el-button size="small" type="primary" @click="handleSelectionZzjgbtn2">修改</el-button> -->
|
|
|
|
|
|
<el-button size="small" type="primary" @click="handleSelectionZzjgbtn3">批量修改部门</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="handJue">批量修改角色</el-button>
|
|
|
|
|
|
|
|
|
|
|
@@ -189,6 +191,21 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 批量修改角色弹出框 -->
|
|
|
+ <el-dialog title="批量修改" :visible.sync="handljues" v-if="handljues" width="30%">
|
|
|
+ <el-form model="" label-width="20%">
|
|
|
+ <el-form-item label="修改角色">
|
|
|
+ <el-select v-model="xiuRoleId" placeholder="请选择" style="width: 120px" clearable>
|
|
|
+ <el-option v-for="(item, index) in acquireRoleLists" :key="index" :label="item.rolename" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="handljues = false">取消</el-button>
|
|
|
+ <el-button type="primary" @click="handTrue">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
<!-- 新增部门 -->
|
|
|
<el-dialog :title="depTitle" :visible.sync="departmentVisible" width="400px" >
|
|
|
<el-form ref="depForm" :model="depForm" :rules="depRules" label-width="80px">
|
|
@@ -246,8 +263,8 @@
|
|
|
<el-cascader v-model="insertForm.departmentId" placeholder="请选择部门" style="width: 100%"
|
|
|
:options="option" :props="{ checkStrictly: true,expandTrigger: 'hover' }" :show-all-levels="false" clearable></el-cascader>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="角色" prop="role">
|
|
|
- <el-select v-model="insertForm.role" placeholder="请选择角色" style="width: 100%">
|
|
|
+ <el-form-item label="角色" prop="roleId">
|
|
|
+ <el-select v-model="insertForm.roleId" placeholder="请选择角色" style="width: 100%">
|
|
|
<!-- <el-option label="普通员工" :value="0">
|
|
|
<span style="float: left">普通员工</span>
|
|
|
<span style="float: right; color: #8492a6; font-size: 13px">具有填报日报,参与项目协作基础功能</span>
|
|
@@ -259,9 +276,13 @@
|
|
|
<el-option label="公司高层" :value="3"></el-option>
|
|
|
<el-option label="财务管理员" :value="4"></el-option>
|
|
|
<el-option label="项目管理员" :value="5"></el-option> -->
|
|
|
- <el-option v-for="item in roleDescArray" :label="item.label" :disabled="item.value==2&&user.role != 1" :value="item.value" :key="item.name">
|
|
|
+ <!-- <el-option v-for="item in roleDescArray" :label="item.label" :disabled="item.value==2&&user.role != 1" :value="item.value" :key="item.name">
|
|
|
<span style="float: left">{{item.label}}</span>
|
|
|
<span style="float: right; color: #8492a6; font-size: 13px">{{item.desc}}</span>
|
|
|
+ </el-option> -->
|
|
|
+ <el-option v-for="item in acquireRoleList" :label="item.rolename" :disabled="item.value==2&&user.role != 1" :value="item.id" :key="item.name">
|
|
|
+ <span style="float: left">{{item.rolename}}</span>
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">{{item.roleDescribe}}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -389,11 +410,14 @@
|
|
|
|
|
|
<script>
|
|
|
import util from "../../common/js/util";
|
|
|
+ let that
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ permissions: JSON.parse(sessionStorage.getItem("permissions")),
|
|
|
isDingShow : false,
|
|
|
handleSelectionZzjgshow: false,
|
|
|
+ handljues: false,
|
|
|
submitLoading:false,
|
|
|
deactiveUser:null,
|
|
|
deactiveDate:null,
|
|
@@ -450,7 +474,8 @@
|
|
|
id: null,
|
|
|
name: null,
|
|
|
phone: null,
|
|
|
- role: null,
|
|
|
+ // role: null,
|
|
|
+ roleId: null,
|
|
|
monthCost:null,
|
|
|
cost: null,
|
|
|
departmentId: null,
|
|
@@ -460,7 +485,8 @@
|
|
|
rules: {
|
|
|
name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
|
|
|
// phone: [{ required: true, message: "请输入电话", trigger: "blur" }],
|
|
|
- role: [{ required: true, message: "请选择角色", trigger: "blur" }],
|
|
|
+ // role: [{ required: true, message: "请选择角色", trigger: "blur" }],
|
|
|
+ roleId: [{ required: true, message: "请选择角色", trigger: "blur" }],
|
|
|
cost: [{ required: true, message: "请输入成本", trigger: "blur" }],
|
|
|
monthCost:[{ required: true, message: "请输入月成本", trigger: "blur" }]
|
|
|
},
|
|
@@ -513,11 +539,26 @@
|
|
|
role: '',
|
|
|
jDarr: [],
|
|
|
handleSelectionZzjgDate:[],
|
|
|
- handleSelectionZzjgwillchange : null
|
|
|
+ handleSelectionZzjgwillchange : null,
|
|
|
+ acquireRoleList: [], // 角色列表
|
|
|
+ acquireRoleLists: [], // 没有超级管理员
|
|
|
+ roleId: '',
|
|
|
+ xiuRoleId: ''
|
|
|
};
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ acquireRoleName(value) {
|
|
|
+ for(var i in that.acquireRoleList) {
|
|
|
+ if(that.acquireRoleList[i].id == value) {
|
|
|
+ return that.acquireRoleList[i].rolename
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeCreate: function () {
|
|
|
+ that = this;
|
|
|
+ },
|
|
|
methods: {
|
|
|
-
|
|
|
// 批量修改部门
|
|
|
handleSelectionZzjg(e){
|
|
|
// if (e.length == 0) {
|
|
@@ -586,7 +627,46 @@
|
|
|
}
|
|
|
this.handleSelectionZzjgshow = true
|
|
|
},
|
|
|
-
|
|
|
+ handJue() {
|
|
|
+ if(this.handleSelectionZzjgDate.length == 0){
|
|
|
+ this.$message('请选择');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.xiuRoleId = this.acquireRoleList[0].id
|
|
|
+ this.handljues = true
|
|
|
+ console.log('触发了')
|
|
|
+ },
|
|
|
+ handTrue() {
|
|
|
+ var arr = []
|
|
|
+ for(var i in this.handleSelectionZzjgDate) {
|
|
|
+ arr.push(this.handleSelectionZzjgDate[i].id)
|
|
|
+ }
|
|
|
+ this.http.post('/user/batchUpdateRole', {
|
|
|
+ userIds: JSON.stringify(arr),
|
|
|
+ roleId: this.xiuRoleId
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ this.handljues = false
|
|
|
+ this.getUser()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
deleteUser(targetUser) {
|
|
|
this.$confirm("确定要删除该员工吗?", "提示", {
|
|
@@ -928,7 +1008,8 @@
|
|
|
pageSize: this.size,
|
|
|
keyword: this.keyword,
|
|
|
status: this.status,
|
|
|
- role: this.role
|
|
|
+ // role: this.role
|
|
|
+ roleId: this.roleId
|
|
|
},
|
|
|
res => {
|
|
|
this.listLoading = false;
|
|
@@ -1002,7 +1083,8 @@
|
|
|
id: list.id,
|
|
|
name: list.name,
|
|
|
phone: list.phone,
|
|
|
- role: list.role,
|
|
|
+ // role: list.role,
|
|
|
+ roleId: list.roleId,
|
|
|
monthCost:list.monthCost,
|
|
|
cost: list.cost,
|
|
|
departmentId: array.reverse(),
|
|
@@ -1016,7 +1098,8 @@
|
|
|
id: null,
|
|
|
name: null,
|
|
|
phone: null,
|
|
|
- role: null,
|
|
|
+ // role: null,
|
|
|
+ roleId: null,
|
|
|
monthCost:null,
|
|
|
cost: null,
|
|
|
departmentId: null,
|
|
@@ -1036,7 +1119,8 @@
|
|
|
form = {
|
|
|
name: this.insertForm.name,
|
|
|
phone: this.insertForm.phone,
|
|
|
- role: this.insertForm.role,
|
|
|
+ // role: this.insertForm.role,
|
|
|
+ roleId: this.insertForm.roleId,
|
|
|
monthCost: this.insertForm.monthCost,
|
|
|
cost: this.insertForm.cost,
|
|
|
salaryType: this.insertForm.salaryType,
|
|
@@ -1186,7 +1270,8 @@
|
|
|
id: this.insertForm.id,
|
|
|
name: this.insertForm.name,
|
|
|
phone: this.insertForm.phone,
|
|
|
- role: this.insertForm.role,
|
|
|
+ // role: this.insertForm.role,
|
|
|
+ roleId: this.insertForm.roleId,
|
|
|
monthCost: this.insertForm.monthCost,
|
|
|
cost: this.insertForm.cost
|
|
|
};
|
|
@@ -1533,6 +1618,37 @@
|
|
|
type: "error"
|
|
|
});
|
|
|
});
|
|
|
+ },
|
|
|
+ // 获取角色
|
|
|
+ acquireRole() {
|
|
|
+ // this.http.post('/permission/getFrontRoleList', {
|
|
|
+ this.http.post('/permission/getFrontRoleList', {
|
|
|
+ companyId: this.user.companyId
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if (res.code == "ok") {
|
|
|
+ console.log(res.data, '获取角色')
|
|
|
+ this.acquireRoleList = res.data
|
|
|
+ var arr = []
|
|
|
+ for(var i in res.data) {
|
|
|
+ if(res.data[i].rolename != '系统管理员') {
|
|
|
+ arr.push(res.data[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.acquireRoleLists = arr
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error => {
|
|
|
+ this.$message({
|
|
|
+ message: error,
|
|
|
+ type: "error"
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -1550,6 +1666,7 @@
|
|
|
this.getUser();
|
|
|
this.getCompanyTimeSetting();
|
|
|
this.getUsers();
|
|
|
+ this.acquireRole();
|
|
|
this.isDingShow = this.$store.state.isDing;
|
|
|
}
|
|
|
};
|