Browse Source

编辑角色设置添加人员弹窗

dev
超级管理员 3 years ago
parent
commit
a842dc2d6b
  1. 17
      src/api/systemaccredit/systemapi.js
  2. 20
      src/api/systemaccredit/systemhrapi.js
  3. 6
      src/router/index.js
  4. 3
      src/views/basicCont/departTarget.vue
  5. 777
      src/views/purview/manage.vue
  6. 46
      src/views/purview/manage_black.vue
  7. 112
      src/views/purview/organdmanliste.vue
  8. 132
      src/views/purview/organdmanthree.vue
  9. 2
      vue.config.js

17
src/api/systemaccredit/systemapi.js

@ -74,3 +74,20 @@ export const editRoleInfo = (data) => {
data: data data: data
}) })
} }
//角色相关人员列表
export const roleAboutPeople = (data) => {
return request({
url: '/powerpc/role_about_people_list',
method: 'post',
data: data
})
}
//批量删除角色相关人员
export const delAboutPeople = (data) => {
return request({
url: '/powerpc/batch_del_roleman',
method: 'post',
data: data
})
}

20
src/api/systemaccredit/systemhrapi.js

@ -0,0 +1,20 @@
import request from '@/utils/request1'
//获取行政组织与人员混杂树列表
export const getOrgAndManlist = (data) => {
return request({
url: '/org/govthreeaboutman',
method: 'post',
data: data
})
}
//获取行政组织与人员混杂搜索列表
export const getOrgAndManSearchlist = (data) => {
return request({
url: '/org/search_org_people',
method: 'post',
data: data
})
}

6
src/router/index.js

@ -465,7 +465,11 @@ export const constantRoutes = [
component: () => import('@/views/purview/rolepower'), component: () => import('@/views/purview/rolepower'),
meta: { title: '角色配权'} meta: { title: '角色配权'}
}, },
{
path: 'manage',
component: () => import('@/views/purview/manage'),
meta: { title: '角色设置'}
},
], ],
}, },

3
src/views/basicCont/departTarget.vue

@ -162,7 +162,8 @@
background background
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
layout="prev, pager, next" layout="prev, pager, next"
:total="total"> :total="total"
>
</el-pagination> </el-pagination>
</el-col> </el-col>
</el-row> </el-row>

777
src/views/purview/manage.vue

@ -0,0 +1,777 @@
<template>
<el-container>
<!-- 角色列表 -->
<el-aside width="300px">
<el-scrollbar >
<div style=" border-bottom: 1px solid #EEEEEE;">
<el-select v-model="selectNAme" filterable placeholder="搜索" style="width:94%; margin-top: 5px; margin-bottom:10px;" @change="selectRoleNAme">
<el-option key="0" label="全部" value=""></el-option>
<el-option
v-for="item in rolelistAll"
:key="item.id"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</div>
<el-row v-for="(rItem,rIndex) in rolelist" :key="rIndex" class="role_body" :class="listBlackColor[rIndex]== true?'active':''">
<el-col :span="2" class="font_centent">
<span class="el-icon-s-unfold"></span>
</el-col>
<el-col :span="18" class="font_left">
<div class="roleTitle " @click="setupEmpower(rItem,rIndex)">{{rItem.name}}</div>
</el-col>
<el-col :span="4" class="font_right">
<el-dropdown trigger="click">
<span class="el-icon-more incon_body"></span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="editcont(rItem)">编辑</el-dropdown-item>
<el-dropdown-item @click.native="delcont(rItem)">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-col>
</el-row>
<el-button type="primary" @click="addSystemRole" icon="el-icon-plus" style="width:94%; margin: 15px 0 15px 0;">添加角色</el-button>
</el-scrollbar>
</el-aside>
<el-main>
<el-row>
<el-col :span="18" class="role_title_left">
{{tableName}}{{total}}
</el-col>
<el-col :span="6" class="role_title_right">
<span>角色详情</span>
</el-col>
</el-row>
<el-row style="border-bottom: 1px solid #EEEEEE;">
<el-col :span="12">
<el-button-group>
<el-button type="primary" size="mini" @click="addSystemRolePeople" icon="el-icon-plus" >添加成员</el-button>
<el-button type="danger" size="mini" @click="batchdeletion()" icon="el-icon-position" >批量移除</el-button>
</el-button-group>
</el-col>
<el-col :span="12">
<el-form ref="searchForm" :inline="true" :model="searchFormData" label-width="80px" style="text-align: right;">
<el-form-item style="margin-right:5px; margin-bottom:5px">
<el-input style="width:130px" v-model="searchFormData.name" size="mini" placeholder="请输入姓名/工号"></el-input>
</el-form-item>
<el-form-item style="margin-right:0px; margin-bottom:5px">
<el-button type="primary" size="mini" icon="el-icon-search" @click="searchSubmit">搜索</el-button>
</el-form-item>
</el-form>
</el-col>
</el-row>
<template>
<el-table
ref="multipleTable"
:data="peopleList"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column
prop="number"
label="工号"
width="120">
</el-table-column>
<el-table-column
prop="name"
label="姓名"
width="120">
</el-table-column>
<el-table-column
prop="departmenttitle"
label="部门"
show-overflow-tooltip>
</el-table-column>
</el-table>
</template>
<template>
<el-pagination
@current-change="handleCurrentChange"
layout="prev, pager, next"
:page-size="searchFormData.pagesize"
:total="total">
</el-pagination>
</template>
</el-main>
<!--新增角色-->
<el-dialog :close-on-click-modal="false" :visible.sync="addDialogForm" :before-close="closeAddDialog" title="新增" width="30%">
<el-form ref="addForm" :model="addDiaFormDatal" :rules="addrules" label-width="80px" >
<el-form-item label="角色名称" prop="name">
<el-input v-model="addDiaFormDatal.name" autocomplete="off" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="排序" style="margin-top:10px">
<el-input-number v-model="addDiaFormDatal.sort" controls-position="right" :min="1" :max="999999999999" value="50" placeholder="请输入序号" ></el-input-number>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="closeAddDialog"> </el-button>
<el-button size="small" type="primary" @click="enterAddDialog"> </el-button>
</div>
</template>
</el-dialog>
<!--编辑角色-->
<el-dialog :close-on-click-modal="false" :visible.sync="editDialogForm" :before-close="closeEditDialog" title="新增" width="30%">
<el-form ref="editForm" :model="editSystemRoleCont" :rules="addrules" label-width="80px" >
<el-form-item label="角色名称" prop="name">
<el-input v-model="editSystemRoleCont.name" autocomplete="off" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="排序" style="margin-top:10px">
<el-input-number v-model="editSystemRoleCont.sort" controls-position="right" :min="1" :max="999999999999" value="50" placeholder="请输入序号" ></el-input-number>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="closeEditDialog"> </el-button>
<el-button size="small" type="primary" @click="enterEditDialog"> </el-button>
</div>
</template>
</el-dialog>
<!--添加成员-->
<el-dialog :close-on-click-modal="false" :visible.sync="addRolePeople" :before-close="closeAddRolePeople" title="添加成员" width="50%" custom-class="dialogtop">
<el-row type="flex" justify="space-between">
<el-col class="biankuang" :span="12" style="padding-right: 10px;">
<el-row type="flex" justify="space-between">
<el-col :span="24">
<el-input
@input="searchOrgMan"
@clear="clearSearchOrgMan"
size="mini"
placeholder="搜索成员或部门"
v-model="searchDepartOrPeople"
clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
</el-col>
</el-row>
<div class="look_hight" v-show="orgTreeOrOrgList">
<organdmanthree ref="organdmanthree" @changeNum="sunThreeSend" :checkedList="checkedList" :addRolePeople="addRolePeople"></organdmanthree>
</div>
<div class="look_hight" v-show="!orgTreeOrOrgList">
<organdmanliste @changeListNum="sunListSend" :searchDepartOrPeople="searchDepartOrPeople"></organdmanliste>
</div>
</el-col>
<!-- <el-col :span="1" class="biankuang"></el-col>
<el-col :span="1" class="biankuang left_line"></el-col> -->
<el-col class="biankuang yZhou left_line" :span="12">
<el-row v-for="(item,index) in checkCont" type="flex" justify="space-between" :key="index" class="orgManListcss">
<el-col :span="3">
<div >
<i class="el-icon-s-finance" v-if="item.icon==''" ></i>
<el-image v-if="item.icon!=''" style="width: 20px; height: 20px; margin-top:5px" :src="item.icon" :preview-src-list="srcList">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</el-col>
<el-col :span="19"><span>{{item.name}}</span></el-col>
<el-col :span="2" style="cursor: pointer;"><i @click="delChackOegMan(item,index)" class="el-icon-close"></i></el-col>
</el-row>
</el-col>
</el-row>
<template #footer class="el_dialog__footer">
<div class="dialog-footer ">
<el-button size="small" type="primary" @click="addOrgManData"> </el-button>
<el-button size="small" @click="closeAddRolePeople"> </el-button>
</div>
</template>
</el-dialog>
</el-container>
</template>
<script>
import { getRoleList,editRoleCont,addRoleCont,editRoleInfo,roleAboutPeople,delAboutPeople } from "@/api/systemaccredit/systemapi"; //
import { MessageBox, Message } from 'element-ui'
//
import organdmanthree from "@/views/purview/organdmanthree.vue";
import organdmanliste from "@/views/purview/organdmanliste.vue";
export default {
components: {
organdmanthree,
organdmanliste
},
data() {
return {
checkedList:new Array, //
orgTreeOrOrgList:true, //truefalse
searchDepartOrPeople:'',
checkCont:new Array,
srcList:new Array, //
total: 0, //
searchFormData:{
id:"",
name:'',
page:1,
pagesize:10,
}, //
// countPeople:0, //
selectNAme:"",
rolelistAll:new Array, //
rolelist:new Array, //
addDialogForm:false, //
editDialogForm:false, //
addRolePeople:false, //
listBlackColor:new Array,
tableName:"",
addDiaFormDatal:{
name:"",
sort:50
}, //
//
addrules: {
name: [{ required: true, message: '必填', trigger: 'blur' }],
},
editSystemRoleCont:{
id:"",
name:"",
sort:50
},
peopleList:new Array, //
multipleSelection: new Array
}
},
created() {
this.getRoleList()
// this.getRoleListAll()
},
methods:{
handleSelectionChange(val) {
this.multipleSelection = val;
},
//
async getRoleList(){
const from = {
name: this.selectNAme,
};
const res = await getRoleList(from);
res.data.forEach((item,index)=>{
if(index == 0){
this.listBlackColor[index] = true
this.tableName = item.name
this.getRolePeopelList(item.id)
}else{
this.listBlackColor[index] = false
}
})
this.rolelist = res.data
if(this.rolelistAll.length <= 0){
this.rolelistAll = res.data
}
// console.log("----",res.data,this.listBlackColor)
},
async getRoleListAll(){
const res = await getRoleList();
this.rolelistAll = res.data
// console.log("----",res.data)
},
//
selectRoleNAme(){
this.getRoleList()
},
//
setupEmpower(data,index){
this.tableName = data.name
// console.log("----",data,index)
// this.listBlackColor[index] = true
this.listBlackColor.forEach((item,ind)=>{
if(index != ind){
this.listBlackColor[ind] = false
}else{
this.listBlackColor[ind] = true
}
})
this.getRolePeopelList(data.id)
// console.log("----",this.listBlackColor)
this.$forceUpdate(); //
},
//
addSystemRole(){
this.addDialogForm = true
},
//
closeAddDialog() {
this.initAddForm()
this.editSystemRoleCont.sort=50
this.addDialogForm = false
},
//
initAddForm() {
this.$refs.addForm.resetFields()
this.editSystemRoleCont = {
name:"",
sort:50
}
},
//
enterAddDialog(){
this.$refs.addForm.validate(async valid => {
if (valid) {
this.addDiaFormDatal.sort =parseInt(this.addDiaFormDatal.sort)
const res = await addRoleCont(this.addDiaFormDatal)
if (res.code === 0) {
this.$message({
type: 'success',
message: '添加成功',
showClose: true
})
}
this.getRoleList();
this.closeAddDialog();
this.getRoleListAll()
}
})
},
//
editcont(data){
// console.log("--->")
this.editDialogForm = true
this.editSystemRoleCont = {
id:data.id.toString(),
name:data.name,
sort:data.sort
}
},
//
closeEditDialog() {
this.iniEditForm()
this.addDiaFormDatal.sort=50
this.editDialogForm = false
},
//
iniEditForm() {
this.$refs.editForm.resetFields()
this.editSystemRoleCont = {
id:"",
name:"",
sort:50
}
},
//
enterEditDialog(){
this.$refs.editForm.validate(async valid => {
if (valid) {
this.editSystemRoleCont.sort =parseInt(this.editSystemRoleCont.sort)
this.editSystemRoleCont.id = this.editSystemRoleCont.id.toString()
const res = await editRoleInfo(this.editSystemRoleCont)
if (res.code === 0) {
this.$message({
type: 'success',
message: res.msg,
showClose: true
})
}
this.getRoleList();
this.closeEditDialog();
}
})
},
//
delcont(data){
this.$confirm('此操作将永久删除该角色, 是否继续操作?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
center: true
}).then(() => {
const delfrom = {
id: data.id.toString(),
state:3,
istrue:2
};
this.delSystemRoleCont(delfrom)
});
},
//
async delSystemRoleCont(data){
const res = await editRoleCont(data);
if (res.code === 0) {
this.$message({
type: 'success',
message: res.msg,
showClose: true
})
}
this.getRoleList();
this.getRoleListAll()
},
//
async getRolePeopelList(roleId){
if(roleId){
this.searchFormData.id = roleId.toString()
}
const res = await roleAboutPeople(this.searchFormData);
// console.log("--->",res.data)
this.peopleList = res.data.list
this.total= res.data.total
if(!this.total){
this.total=0
}
if(res.data.count == 0){
if(this.searchFormData.page > 1){
this.searchFormData.page =this.searchFormData.page - 1
}
}
if(res.code != 0){
if(this.searchFormData.page > 1){
this.searchFormData.page =this.searchFormData.page - 1
this.getRolePeopelList()
}
}
},
// page
handleCurrentChange(val) {
this.searchFormData.page=val
this.getRolePeopelList()
},
//
searchSubmit(){
this.getRolePeopelList()
},
//
batchdeletion(){
let peopleList = this.$refs.multipleTable.selection
// console.log(", ?",peopleList)
this.$confirm('此操作将永久删除, 是否继续?', '是否删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
if(!peopleList || peopleList.length <= 0){
this.$message({
type: 'warning',
message: "您没有选择要删除的数据!",
showClose: true
})
}else{
let manKsy = new Array
peopleList.forEach((item,id)=>{
manKsy.push(item.key)
});
const sendData = {
id:this.searchFormData.id,
mankey:manKsy
}
const res = await delAboutPeople(sendData);
if (res.code === 0) {
this.$message({
type: 'success',
message: res.msg,
showClose: true
})
this.getRolePeopelList()
}
}
})
//
},
//
searchOrgMan(){
// console.log("",this.searchDepartOrPeople)
if(this.searchDepartOrPeople){
this.orgTreeOrOrgList = false
// console.log("11111111")
}else{
this.orgTreeOrOrgList = true
this.$emit('sendSunData')
// console.log("22222",this.checkedList)
this.$refs.organdmanthree.setCheckedKeysChange(this.checkedList)
}
},
//
async clearSearchOrgMan(){
// console.log("",this.searchDepartOrPeople)
},
//
closeAddRolePeople(){
this.addRolePeople = false;
},
//
async addSystemRolePeople(){
// const res = await getOrgAndManlist()
// console.log("",res)
this.addRolePeople = true;
},
//
async addOrgManData(){},
//
sunThreeSend(contList,idList){
this.checkCont = contList
this.checkedList = idList
// console.log("-------1------>",contList,idList)
},
//
sunListSend(val){
// console.log("-------1------>",val)
if(this.checkedList && this.checkedList.length > 0){
if(this.checkedList.indexOf(val.id) == -1){ //
this.checkedList.push(val.id)
this.checkCont.push(val)
}
}else{
this.checkedList.push(val.id)
this.checkCont.push(val)
}
this.searchDepartOrPeople=""
this.searchOrgMan()
},
//
delChackOegMan(val,index){
// this.checkCont.splice(index,1)
// console.log("-------333333------>",val,index,this.checkedList)
let guoDuId = new Array //ID
let guoDuList = new Array //
let superiorId = new Array //
let sunId = new Array //
superiorId.push(val.parentId)
sunId.push(val.id)
// console.log("-------5555555----->",superiorId)
this.checkCont.forEach(item=>{
//
// console.log("-------444444444----->",val,item)
if(item.id != val.id){
//
if(superiorId.indexOf(item.id) == -1){ //
if(sunId.indexOf(item.parentId) == -1){ //
guoDuId.push(item.id)
guoDuList.push(item)
}else{
if(sunId.indexOf(item.id) == -1){ //
sunId.push(item.id) //
}
}
if(superiorId.indexOf(item.parentId) == -1){
superiorId.push(item.parentId)
}
}else{
// superiorId.push(item.parentId)
}
}
});
this.checkCont= guoDuList
this.checkedList = guoDuId
// console.log("-------22222------>",guoDuList,guoDuId,superiorId)
}
},
}
</script>
<style>
.el-aside {
text-align: center;
height: calc(103% - 2px);
overflow: hidden;
overflow-y: auto;
overflow-x: hidden;
border-right: 1px solid rgb(220, 223, 230);
margin: 2px 0 0 0;
padding-bottom: 10px;
}
.el-main{
height: 105%;
}
.el-container {
height:calc(100% - 50px);
overflow: hidden;
}
.el-scrollbar {
height: 100%;
}
.el-scrollbar__wrap {
overflow: hidden;
overflow-y: auto;
overflow: scroll;
}
.xxCard{
padding: 10px 0;
}
.roleTitle{
color: #000000;
cursor: pointer;
}
.el-table__row:hover > td {
background-color: transparent;
}
/* 用来设置当前页面element全局table 选中某行时的背景色*/
.el-table__body tr.current-row>td{
background-color: #ff784a !important;
color: #fff;
}
.incon_body{
position: relative;
font-size: 25px;
transform:rotate(90deg);
margin-top: 5px;
color: #FFFFFF;
}
.role_body{
height: 35px;
cursor: pointer;
}
.role_body:hover{
background-color: #EEF0F3;
}
.role_body:hover .incon_body{
color: #7FA5D2;
}
.role_body.active{
background-color:#4A77AC;
}
.role_body.active{
color:#FFFFFF;
}
.role_body.active .incon_body{
color:#7FA5D2;
}
.role_body.active:hover .incon_body{
color:#7FA5D2;
}
.role_body.active .roleTitle{
color:#FFFFFF;
}
.role_body.active .font_centent{
color:#7FA5D2;
}
.font_left{
line-height: 35px;
text-align: left;
}
.font_centent{
line-height: 35px;
color: #7DA4D2;
}
.font_right{
text-align: right;
}
.role_title_left{
font-size: 20px;
text-align: left;
line-height: 35px;
}
.role_title_right{
font-size: 12px;
text-align: right;
color: #0C4C7F;
line-height: 35px;
cursor: pointer;
}
.biankuang{
height: 450px;
}
.yZhou{
overflow: hidden;
overflow-y: auto;
padding-left: 5px;
}
div::-webkit-scrollbar {
width: 5px;
height: 5px;
}
div::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
opacity: 0.2;
}
div::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
}
.left_line{
border-left: 1px solid #EEEEEE;
}
.look_hight{
height: 410px;
margin-top: 10px;
overflow: auto;
overflow-x: auto;
}
.el-dialog__body{
padding: 0 10px;
}
.el_dialog__footer{
background-color: #F8F8F8;
border-top: 1px solid #E4E6E9;
padding: 5px 10px;
}
.orgManListcss{
height: 30px;
line-height: 30px;
background-color: #fff;
}
.orgManListcss:hover{
height: 30px;
line-height: 30px;
background-color: #F5F7FA;
}
</style>

46
src/views/purview/manage_black.vue

@ -0,0 +1,46 @@
<template>
<div>
<el-card class="box-card">
<el-form ref="searchForm" :model="searchFormData" label-width="80px">
<el-form-item label="角色名称">
<el-input v-model="searchFormData.name" placeholder="请输入角色名称"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="form.region" placeholder="请选择角色状态">
<el-option label="启用" value="1"></el-option>
<el-option label="禁用" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searckClick">查询</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="box-card">
</el-card>
</div>
</template>
<script>
export default {
data() {
return {
searchFormData:{
name:""
}, //
}
},
methods:{
//
searckClick(){},
},
}
</script>
<style>
.box-card{
width: 100%;
}
</style>

112
src/views/purview/organdmanliste.vue

@ -0,0 +1,112 @@
<template>
<div>
<!--人员列表-->
<template v-if="peopleList">
<el-row type="flex" justify="space-between">
<el-col class="listHead" :span="24">人员</el-col>
</el-row>
<el-row type="flex" justify="space-between" class="row_body" v-for="item in peopleList" :key="item.identify">
<el-col class="listTitle" :span="3">
<div @click="chackData(item)">
<i class="el-icon-s-finance" v-if="item.icon==''" ></i>
<el-image v-if="item.icon!=''" style="width: 20px; height: 20px; margin-top:5px" :src="item.icon" :preview-src-list="srcList" @click="lookIcon(item.icon)" class="imgDiv">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</el-col>
<el-col :span="15"><div @click="chackData(item)">{{ item.name }}</div></el-col>
<el-col :span="6">
{{ item.number }}
</el-col>
</el-row>
</template>
<!--部门列表-->
<template v-if="orgList">
<el-row type="flex" justify="space-between">
<el-col class="listHead" :span="24">部门</el-col>
</el-row>
<el-row type="flex" justify="space-between" class="row_body" v-for="item in orgList" :key="item.identify">
<el-col class="listTitle" :span="24">
<span @click="chackData(item)">{{item.all_name}}</span>
</el-col>
</el-row>
</template>
</div>
</template>
<script>
import { getOrgAndManSearchlist } from "@/api/systemaccredit/systemhrapi"; //HrAPI
export default {
props:["searchDepartOrPeople"],
data() {
return {
srcList:[], //
isChack:[], //
fenGeLine:false, //线
peopleList:[], //
orgList:[], //
}
},
created() {
},
watch:{
searchDepartOrPeople(){
this.getOrgAndPeoList() //
}
},
methods:{
//
lookIcon(data){
this.srcList=[];
this.srcList.push(data)
},
//
async getOrgAndPeoList(){
if(this.searchDepartOrPeople){
const sendData = {
name:this.searchDepartOrPeople
}
const res = await getOrgAndManSearchlist(sendData)
this.peopleList = res.data.people
this.orgList = res.data.org
// if(this.peopleList.length > 0 && this.orgList.length > 0) {
// this.fenGeLine = true
// }
// console.log("",res.data)
}
},
//
chackData(val){
// console.log("",val)
this.$emit('changeListNum',val)
}
}
}
</script>
<style>
.row_body{
line-height: 30px;
padding: 0px 0 0px 0;
white-space:nowrap;
}
.row_body:hover{
background-color: #4A77AC;
color: #FFFFFF;
}
.listTitle{
padding-left: 10px;
cursor: pointer;
}
.listHead{
font-size: 16px;
line-height: 40px;
font-weight: bold;
}
</style>

132
src/views/purview/organdmanthree.vue

@ -0,0 +1,132 @@
<template>
<div>
<el-tree
:data="orgPeopleData"
:props="defaultProps"
@check-change="handleNodeClick"
show-checkbox
node-key="id"
ref="tree"
highlight-current
:expand-on-click-node="false"
:check-on-click-node="true"
>
<el-row slot-scope="{ node, data }">
<el-col :span="20">
<i class="el-icon-s-finance" v-if="data.icon==''" ></i>
<el-image v-if="data.icon!=''" :src="data.icon" :preview-src-list="srcList" @click="lookIcon(data.icon)" class="imgDiv">
<div slot="placeholder" class="image-slot">
加载中<span class="dot">...</span>
</div>
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
</div>
</el-image>
{{ node.label }}
</el-col>
<el-col :span="4">
</el-col>
</el-row>
</el-tree>
</div>
</template>
<script>
import { getOrgAndManlist } from "@/api/systemaccredit/systemhrapi"; //HrAPI
export default {
props:['checkedList','addRolePeople'],
data() {
return {
defaultProps: {
children: 'child',
label: 'name',
icon:'icon'
},
orgPeopleData:[], //
srcList:[], //
allOrgAndMan:{}, //
setKeyVal:[]
}
},
created() {
this.getOrgAndPeoplelist()
// console.log("checkedList-------------------->",this.setKeyVal)
},
watch:{
checkedList:{
handler(newVal){
// console.log("newVal");
// console.log(newVal);
this.setKeyVal=newVal;
this.setCheckedKeysChange(newVal)
},
deep: true
},
addRolePeople(){
this.resetChecked()
}
},
methods: {
//
async getOrgAndPeoplelist(){
const sendData = {
id:"313",
level:0,
all:1
}
const res = await getOrgAndManlist(sendData)
// console.log("-------------->",res.data)
this.orgPeopleData = res.data.three
this.allOrgAndMan = res.data.list
// console.log("---------234234----->",this.orgPeopleData)
},
handleNodeClick(res){
// console.log("-----3333------>",res)
let xuanze = this.$refs.tree.getCheckedKeys()
// console.log("-----44444------>",xuanze)
// console.log("-----5555------>",this.$refs.tree)
let giveParentData = new Array
this.allOrgAndMan.forEach((item,index) =>{
if(xuanze.indexOf(item.id) != -1){
giveParentData.push(item)
}
});
this.$emit('changeNum',giveParentData,xuanze)
},
//
lookIcon(data){
this.srcList=[];
this.srcList.push(data)
// console.log("")
},
//
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
},
//Key
setCheckedKeysChange(newVal) {
// console.log("Key------------->3")
if(newVal.length > 0) {
// console.log("Key------------->1",newVal)
this.$refs.tree.setCheckedKeys(newVal);
}else{
// console.log("Key------------->2")
this.resetChecked();
}
},
},
}
</script>
<style>
.imgDiv{
width: 20px;
height: 20px;
}
</style>

2
vue.config.js

@ -6,7 +6,7 @@ function resolve(dir) {
return path.join(__dirname, dir) return path.join(__dirname, dir)
} }
const name = defaultSettings.title || 'vue Admin Template' // page title const name = defaultSettings.title || '恒信高科' // page title
// If your port is set to 80, // If your port is set to 80,
// use administrator privileges to execute the command line. // use administrator privileges to execute the command line.

Loading…
Cancel
Save