Commit eab908e0 by liimin

权限id 父id 修改 新增角色分配

1 parent 6dceac3d
......@@ -2,13 +2,15 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: limin
* @Last Modified time: 2019-09-02 14:26:14
* @Last Modified time: 2019-09-03 14:07:41
*/
import request from './request'
import RequestMethods from './request.methods'
// 用户相关
const user_path = 'fims.user.'
// 角色相关
const role_path = 'fims.role.'
/**
* 用户登录
......@@ -36,3 +38,49 @@ export function UserList (data = {}) {
data.method = `${user_path}search`
return request(data, RequestMethods.GET)
}
/**
* 获取角色权限资源列表
* @param {*} data 参数
*/
export function RoleAuthData (data = {}) {
data.method = `${role_path}authority.data`
return request(data, RequestMethods.GET)
}
/**
* 创建角色
* @param {*} data 参数
*/
export function RoleReg (data = {}) {
data.method = `${role_path}register`
return request(data, RequestMethods.GET)
}
/**
* 权限修改
* @param {*} data 参数
*/
export function RoleModify (data = {}) {
data.method = `${role_path}modify`
return request(data, RequestMethods.GET)
}
/**
* 权限列表
* @param {*} data 参数
*/
export function RoleList (data = {}) {
data.method = `${role_path}list`
return request(data, RequestMethods.GET)
}
/**
* 角色详情
* @param {*} data 参数
*/
export function RoleDetail (data = {}) {
data.method = `${role_path}detail`
return request(data, RequestMethods.GET)
}
......@@ -59,7 +59,7 @@ export default {
const filter = btn => mapping ? mapping[data[mapping['field']]].includes(btn.label):true
const $store = _this.$store.getters['d2admin/auth/curBtns']
if(label){ //指定label
const __item = $store.find(btn => (btn.label === label) && filter(btn))
const __item = $store && $store.find(btn => (btn.label === label) && filter(btn))
__item && curBtns.push(__item)
}else {
/**
......@@ -72,7 +72,7 @@ export default {
return (btn.category === category) && filter(btn)
})
}
if(curBtns.length===0) return ''
if(curBtns.length===0) return h('div')
const __aBtns = []
/**
* 循环最终显示的按钮列表
......
......@@ -7,4 +7,4 @@ import authButton from './d2-auth/d2-auth-btn.js'
Vue.component('d2-container', d2Container)
Vue.component('d2-icon', () => import('./d2-icon'))
Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component('auth-button', authButton)
Vue.component([authButton.name], authButton)
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Last Modified by: limin
* @Last Modified time: 2019-09-03 09:07:46
* @Last Modified time: 2019-09-04 00:48:28
*/
const permision = {}
/**
......@@ -19,20 +19,20 @@ permision.packRoutesBtns = function (resources, idsInPermision) {
let __objResource = null
let __obj = null
idsInPermision.forEach(obj => {
__objResource = resources[obj.id]
__objResource = resources[obj.authId]
if (__objResource) { // 直接能取到的为路由 (也可以在routes 中定标识变量)
__aRouteInPermision.push(resources[obj.id]) // push 进 路由数组
__aRouteInPermision.push(resources[obj.authId]) // push 进 路由数组
} else { // 如果取不到 判断是否有父节点 并且父节点是否有auth属性 有 则视为按钮 (同样可以定义标识变量)
__objResource = resources[obj.pid]
__objResource = resources[obj.parentId]
if (__objResource && __objResource.auth) {
__obj =__objResource.auth.find(o => o.id === obj.id)
if (__oBtnInPermision[obj.pid] && __oBtnInPermision[obj.pid].length) {
__oBtnInPermision[obj.pid].push(__obj)
__obj = __objResource.auth.find(o => o.authId === obj.authId)
if (__oBtnInPermision[obj.parentId] && __oBtnInPermision[obj.parentId].length) {
__oBtnInPermision[obj.parentId].push(__obj)
} else {
__oBtnInPermision[obj.pid] = [__obj]
__oBtnInPermision[obj.parentId] = [__obj]
}
// __oBtnInPermision[obj.pid] = __objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.id),...__objResource.auth.operation.map(o=>o.id)])
// __oBtnInPermision[obj.parentId] = __objResource.auth
// __aBtnIdAll = __aBtnIdAll.concat([...__objResource.auth.action.map(o=>o.authId),...__objResource.auth.operation.map(o=>o.authId)])
}
}
})
......@@ -57,11 +57,11 @@ permision.packAsideMenus = function (resources, idsInPermision) {
* 第一次循环 分出一级菜单与所有子菜单
*/
idsInPermision.forEach(obj => {
const __oMenu = permision.format2Menu(resources[obj.id])
const __oMenu = permision.format2Menu(resources[obj.authId])
if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true
}
if (obj.pid === '0') { // 取出1级菜单
if (obj.parentId === '0') { // 取出1级菜单
__aMenusInPermision.push(__oMenu)
} else { // 取出子菜单
__aSub.push(__oMenu)
......@@ -72,7 +72,7 @@ permision.packAsideMenus = function (resources, idsInPermision) {
*/
let __parent = null
__aSub.forEach(obj => {
__parent = __aMenusInPermision.find(menu => menu.id === obj.pid)
__parent = __aMenusInPermision.find(menu => menu.authId === obj.parentId)
if (__parent.children) {
__parent.children.push(obj)
} else {
......@@ -83,27 +83,82 @@ permision.packAsideMenus = function (resources, idsInPermision) {
}
/**
* 打包菜单
* resources 所有资源集合
* idsInPermision 返回的权限id集合
*/
permision.packMenusBtns = function (resources) {
if (!resources) {
throw new Error('参数错误')
}
let __aParent = []
let __aSub = []
let __aAll =[]
/**
* 第一次循环 分出一级菜单与所有子菜单
*/
resources.forEach(obj => {
const __oMenu = permision.format2ResourceMenu(obj)
if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true
}
if (__oMenu.parentId === '0') { // 取出1级菜单
__aParent.push(__oMenu)
__aAll.push(__oMenu)
if (__oMenu.auth){
__aAll = [...__aAll,...__oMenu.auth]
}
} else { // 取出子菜单
__aSub.push(__oMenu)
}
})
/**
* 第二次循环所有子菜单 ,然后挂载到对应的一级菜单
*/
let __parent = null
__aSub.forEach(obj => {
__aAll.push(obj)
if (obj.auth){
__aAll = [...__aAll,...obj.auth]
}
__parent = __aParent.find(menu => menu.authId === obj.parentId)
if (__parent.children) {
__parent.children.push(obj)
} else {
__parent.children = [obj]
}
})
return {menus:__aParent,all:__aAll}
}
/**
* 格式化菜单 封装成系统所需格式
*/
permision.format2Menu = function (oMenu) {
if (!oMenu) return null
const {
icon,
path,
meta
} = oMenu
const {
title,
id,
pid
} = meta
const {icon, path, meta} = oMenu
const {title, authId, parentId} = meta
return {
title,
icon,
path,
id,
pid
}
authId,
parentId}
}
/**
* 格式化菜单 封装成系统所需格式
*/
permision.format2ResourceMenu = function (oMenu) {
if (!oMenu) return null
const {icon, meta, auth} = oMenu
const {title, authId, parentId} = meta
return {
label:title,
icon,
authId,
parentId,
auth}
}
export default permision
\ No newline at end of file
export default permision
......@@ -18,19 +18,19 @@ const frameIn = [{
* 首页
*/
export const home = {
path: '/index',
path: 'index',
name: 'index',
icon: 'desktop',
meta: {
auth: true,
title: '系统监控',
id: '101',
pid: '0'
authId: '101',
parentId: '0'
},
component: _import('systemMonitor'),
auth: [{
id: '10101',
pid: '101',
authId: '10101',
parentId: '101',
label: '导出'
}]
}
......@@ -72,8 +72,8 @@ export const resources = {
// meta: {
// auth: true,
// title: '页面',
// id: '102',
// pid: '0',
// authId: '102',
// parentId: '0',
// cache: true
// }
// },
......@@ -83,8 +83,8 @@ export const resources = {
// meta: {
// auth: true,
// title: '页面 1',
// id: '10201',
// pid: '102',
// authId: '10201',
// parentId: '102',
// cache: true
// },
// component: _import('demo/page1')
......@@ -95,18 +95,18 @@ export const resources = {
// meta: {
// auth: true,
// title: '页面 2',
// id: '10202',
// pid: '102',
// authId: '10202',
// parentId: '102',
// cache: true
// },
// component: _import('demo/page2'),
// auth: [{ // 列表操作
// id: '1020201',
// pid: '10202',
// authId: '1020201',
// parentId: '10202',
// label: '查看'
// }, { //
// id: '1020202',
// pid: '10202',
// authId: '1020202',
// parentId: '10202',
// label: '编辑'
// }],
// },
......@@ -116,42 +116,42 @@ export const resources = {
// meta: {
// auth: true,
// title: '页面 3',
// id: '10203',
// pid: '102'
// authId: '10203',
// parentId: '102'
// },
// auth: [{ // 列表操作
// id: '1020301',
// pid: '10203',
// authId: '1020301',
// parentId: '10203',
// label: '查看'
// }, { //
// id: '1020302',
// pid: '10203',
// authId: '1020302',
// parentId: '10203',
// label: '编辑'
// }],
// component: _import('demo/page3')
// },
'102': {
path: 'trafficManagement',
path: '/trafficManagement',
icon: 'train',
name: '车辆管理',
meta: {
auth: true,
title: '车辆管理',
id: '102',
pid: '0'
authId: '102',
parentId: '0'
},
component: _import('trafficManagement'),
auth: [{
id: '10201',
pid: '102',
authId: '10201',
parentId: '102',
label: '编辑'
}, {
id: '10202',
pid: '102',
authId: '10202',
parentId: '102',
label: '删除'
}, {
id: '10203',
pid: '102',
authId: '10203',
parentId: '102',
label: '添加车辆'
}]
},
......@@ -162,21 +162,21 @@ export const resources = {
meta: {
auth: true,
title: '子系统管理',
id: '103',
pid: '0'
authId: '103',
parentId: '0'
},
component: _import('subSysManagement'),
auth: [{
id: '10301',
pid: '103',
authId: '10301',
parentId: '103',
label: '编辑'
}, {
id: '10302',
pid: '103',
authId: '10302',
parentId: '103',
label: '删除'
}, {
id: '10303',
pid: '103',
authId: '10303',
parentId: '103',
label: '添加子系统'
}]
},
......@@ -187,25 +187,25 @@ export const resources = {
meta: {
auth: true,
title: '物料管理',
id: '104',
pid: '0'
authId: '104',
parentId: '0'
},
component: _import('deviceManagement'),
auth: [{
id: '10401',
pid: '104',
authId: '10401',
parentId: '104',
label: '编辑'
}, {
id: '10402',
pid: '104',
authId: '10402',
parentId: '104',
label: '删除'
}, {
id: '10403',
pid: '104',
authId: '10403',
parentId: '104',
label: '导入'
}, {
id: '10404',
pid: '104',
authId: '10404',
parentId: '104',
label: '导出'
}]
},
......@@ -217,8 +217,8 @@ export const resources = {
meta: {
auth: true,
title: '物料列表',
id: '105',
pid: '0'
authId: '105',
parentId: '0'
},
component: _import('materialList'),
},
......@@ -229,8 +229,8 @@ export const resources = {
meta: {
auth: true,
title: '单据管理',
id: '106',
pid: '0'
authId: '106',
parentId: '0'
}
},
'10601': {
......@@ -240,21 +240,21 @@ export const resources = {
meta: {
auth: true,
title: '物料订单管理',
id: '10601',
pid: '106'
authId: '10601',
parentId: '106'
},
component: _import('materiaOrderManagement'),
auth: [{
id: '1060101',
pid: '10601',
authId: '1060101',
parentId: '10601',
label: '查看详情'
}, {
id: '1060102',
pid: '10601',
authId: '1060102',
parentId: '10601',
label: '删除'
}, {
id: '1060103',
pid: '10601',
authId: '1060103',
parentId: '10601',
label: '订单下载'
}]
},
......@@ -265,29 +265,29 @@ export const resources = {
meta: {
auth: true,
title: '作业单管理',
id: '10602',
pid: '106'
authId: '10602',
parentId: '106'
},
component: _import('maintainManagement'),
auth: [{
id: '1060201',
pid: '10602',
authId: '1060201',
parentId: '10602',
label: '删除'
}, {
id: '1060202',
pid: '10602',
authId: '1060202',
parentId: '10602',
label: '导出订单'
}]
},
'107': {
path: '/userManager',
path: '/users',
icon: 'users',
name: '用户管理',
name: '帐号管理',
meta: {
auth: true,
title: '用户管理',
id: '107',
pid: '0'
authId: '107',
parentId: '0'
}
},
'10701': {
......@@ -297,38 +297,38 @@ export const resources = {
meta: {
auth: true,
title: '用户管理',
id: '10701',
pid: '107'
authId: '10701',
parentId: '107'
},
auth: [{ // 列表操作
id: '1070101',
pid: '10701',
authId: '1070101',
parentId: '10701',
label: '审核',
handle:'handleEdit'
}, { //
id: '1070102',
pid: '10701',
authId: '1070102',
parentId: '10701',
label: '重置密码'
}, { //
id: '1070103',
pid: '10701',
authId: '1070103',
parentId: '10701',
label: '编辑'
}, { //
id: '1070104',
pid: '10701',
authId: '1070104',
parentId: '10701',
label: '延期'
}, { //
id: '1070105',
pid: '10701',
authId: '1070105',
parentId: '10701',
label: '禁用',
color:'#FF0000'
}, { //
id: '1070106',
pid: '10701',
authId: '1070106',
parentId: '10701',
label: '激活'
}, { // 列表操作
id: '1070107',
pid: '10701',
authId: '1070107',
parentId: '10701',
label: '创建用户',
category:'action',
type:'button',
......@@ -337,16 +337,29 @@ export const resources = {
component: _import('userManage/user')
},
'10702': {
path: '/jurisdictionManage',
path: '/role',
name: '权限管理',
icon: 'sitemap',
meta: {
auth: true,
title: '权限管理',
id: '10702',
pid: '107'
authId: '10702',
parentId: '107'
},
component: _import('userManage/loginLogs')
auth:[{
authId:'1070201',
parentId:'10702',
label:'创建角色',
handle: "handleEdit",
type:'button'
},{
authId:'1070202',
parentId:'10702',
label:'权限编辑',
handle: "handleEdit",
type:'text'
}],
component: _import('userManage/role')
},
'10703': {
path: '/loginLogs',
......@@ -355,8 +368,8 @@ export const resources = {
meta: {
auth: true,
title: '登录日志',
id: '10703',
pid: '107'
authId: '10703',
parentId: '107'
},
component: _import('userManage/loginLogs')
},
......@@ -367,8 +380,8 @@ export const resources = {
meta: {
auth: true,
title: '上报日志',
id: '108',
pid: '0'
authId: '108',
parentId: '0'
},
component: _import('reportingLogs')
}
......
......@@ -30,8 +30,8 @@ export default {
// 如有必要 token 需要定时更新,默认保存一天
util.cookies.set('uuid', res.uuid)
util.cookies.set('token', res.token)
const { user, resources } = res
await dispatch('d2admin/auth/set', resources, { root: true })
const { user, authes } = res
await dispatch('d2admin/auth/set', authes, { root: true })
// 设置 vuex 用户信息
await dispatch('d2admin/user/set', {
name: user.name
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-27 17:25:12
* @Last Modified by: limin
* @Last Modified time: 2019-09-03 09:03:37
* @Last Modified time: 2019-09-04 10:44:27
*/
import util from '@/libs/util.js'
import router from '@/router'
......@@ -42,7 +42,7 @@ export default {
* @param {*} state
*/
curBtns (state) {
return state.btns[state.meta.id]
return state.btns[state.meta.authId]
},
/**
* 返回当前页面的btn
......@@ -118,7 +118,7 @@ export default {
// 获取权限资源点
const __source = await dispatch('load')
// 过滤资源点 并动态添加到路由
const { route, btn } = util.permision.packRoutesBtns({...sources,[home.meta.id]:home}, __source)
const { route, btn } = util.permision.packRoutesBtns({...sources,[home.meta.authId]:home}, __source)
frameInRoutes[0].children = [home, ...route, ...sys]
router.addRoutes(frameInRoutes)
state.btns = btn
......
......@@ -64,7 +64,7 @@ export default {
}
// 尝试在所有的支持多标签页的页面里找到 name 匹配的页面
const find = state.pool.find(item => {
return item.name === opened.name && __oSource.some(obj => obj.id === item.meta.id)
return item.name === opened.name && __oSource.some(obj => obj.authId === item.meta.authId)
})
// 记录有效或无效信息
valid.push(find ? 1 : 0)
......
<template>
<el-dialog
center
title="添加角色"
:visible.sync="dialogVisible"
:before-close="handleClose"
width="720px"
custom-class="edit-dialog"
>
<el-form
ref="editForm"
:model="editForm"
label-width="120px"
class="edit-dialog-form"
:rules="rules"
>
<el-form-item label="角色名:" prop="roleName">
<el-input v-model="editForm.roleName" requred maxlength="10" placeholder="请输入角色名"></el-input>
</el-form-item>
<el-form-item label="描述:">
<el-input
type="textarea"
:rows="2"
placeholder="角色描述"
v-model="editForm.description">
</el-input>
</el-form-item>
</el-form>
<span>权限设置</span>
<RoleTree :resources="resources" :checkedNodes.sync="checkedNodes" :defaultCheck="checked" :close="dialogVisible"></RoleTree>
<div slot="footer">
<el-button @click="submit" type="primary" class="button-submit">保存</el-button>
<el-button @click="handleClose" type="plain" class="button-submit">取消</el-button>
</div>
</el-dialog>
</template>
<script>
import { Reg } from '@/api/sys.account'
import { mapActions } from 'vuex'
import notice from '@/common/notice'
import RoleTree from "./roleTree"
import { resources as sources, home } from '@/router/routes'
import util from '@/libs/util.js'
export default {
name: 'editDialog',
props: {
isVisible: {
type: Boolean,
default: false
},
datas: {
type: Object,
default: {},
}
},
components:{
RoleTree
},
computed: {
dialogVisible () {
return this.isVisible
},
resources() {
return util.permision.packMenusBtns(util.deepClone(Object.values({...sources,[home.meta.id]:home})))
},
checked() {
return this.datas.roles
}
},
data () {
return {
key:new Date(),
checkedNodes:[],
editForm: {
roleName: '',
description: ''
},
rules: Object.freeze({
roleName: [
{ required: true, message: '角色名不能为空', trigger: ['blur'] }
]
})
}
},
methods: {
handleClose (done) {
this.$refs.editForm.resetFields();
this.$event.$emit('e-reg-dialog', false)
},
// 提交注册数据
submit () {
console.log(this.checkedNodes)
// this.$refs.regForm.validate(vaild => {
// if (vaild) {
// var __p = this.regForm
// Reg(__p).then(res => {
// notice.okTips('注册信息已提交,请等待管理员审核')
// this.$refs.regForm.resetFields()
// this.$event.$emit('e-reg-dialog', false)
// })
// }
// })
},
},
mounted () {
this.$event.$on('e-role-data',(data)=>{
console.log(2);
this.$event.$emit('e-default-role-check',data.roles)
})
// this.checkedNodes = this.data.roles
// console.log(this.checkedNodes);
// this.fetchData()
}
}
</script>
<style lang="scss">
.edit-dialog {
.el-dialog__footer{
.el-button{
width: 200px;
}
}
}
</style>
<!-- 车辆管理 -->
<template>
<d2-container class="role">
<el-row style="height: 40px; line-height: 40px">
<el-col :span="12">角色列表</el-col>
<el-col :span="12" style="text-align: right">
<auth-button label="创建角色"></auth-button>
</el-col>
</el-row>
<el-table :data="tableData" v-loading="tableLoading" border style="margin: 20px 0;">
<el-table-column align="center" width="60px" label="序号" type="index"></el-table-column>
<el-table-column
v-for="(item, index) in tableColumns"
:key="index"
:label="item.label"
:prop="item.prop"
:width="item.width"
align="center"
/>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<auth-button :data="scope.row" label="权限编辑"></auth-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
:total="total"
layout="sizes,total,->,prev,pager,next,jumper"
></el-pagination>
<edit-dialog
:isVisible="editVisible"
:datas="editData"
></edit-dialog>
</d2-container>
</template>
<script>
import { RoleList } from "@/api/sys.account";
import notice from "@/common/notice";
export default {
name: "FimsRoles",
components: {
'EditDialog':() => import('./editDialog')
},
data() {
return {
// 新增/编辑弹窗
editVisible: false,
editData:{
roles:[],
},
// 表格
tableLoading: false,
tableData: [],
tableColumns:Object.freeze([
{
label: "角色名称",
prop: "roleName"
},
{
label: "描述",
prop: "description"
},
{
label: "创建时间",
prop: "createTime"
}
]),
page: {
// 页码
pageCount: 1,
pageSize: 10
}
};
},
mounted() {
this.fetchData();
this.$event.$on('e-reg-dialog', res => this.editVisible = res)
},
methods: {
fetchData() {
this.loadRoleList();
},
loadRoleList() {
this.tableLoading = true;
RoleList()
.then(res => {
this.tableData = res;
// Object.freeze(this.tableData)
this.tableLoading = false;
})
.catch(err => {
notice.errorTips(err);
this.tableLoading = false;
});
},
// 页码
handleSizeChange(value) {
this.page.pageSize = value;
// 调接口
this.loadRoleList();
},
handleCurrentChange(value) {
this.page.pageCount = value;
// 调接口
this.loadRoleList();
},
handleEdit(row = {}) {
row.roles = [{authId:'101',parentId:'0'},{authId:'10601',parentId:'106'},{authId:'1060101',parentId:'10601'}]
this.editVisible = true;
this.editData = row
}
}
};
</script>
<style scoped>
</style>
<template>
<div class="role-tree">
<el-tree
:data="resources.menus"
show-checkbox
ref="tree"
node-key="authId"
default-expand-all
@check-change="checkChange"
:expand-on-click-node="false"
>
<span class="role-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<div class="role-tree-auth">
<template v-if="data.auth">
<el-checkbox-group size="mini" v-model="checked">
<el-checkbox
v-for="(btn,index) in data.auth"
:key="index"
:label="btn.authId"
@change="(sta)=>change(node,btn,sta)"
>{{btn.label}}</el-checkbox>
</el-checkbox-group>
</template>
</div>
</span>
</el-tree>
</div>
</template>
<script>
import util from "@/libs/util.js";
export default {
data() {
return { checked: [] };
},
props: {
resources: {
type: Object,
default: {}
},
defaultCheck: [],
close: false
},
mounted() {
// this.$event.$on("e-default-role-check", roles => {
// console.log(3);
// });
},
watch: {
close(value) {
// !value && this.reset();
},
defaultCheck: {
handler(value) {
let chk = [],
treeChk = [];
value.forEach(v => {
if (v.parentId.length >= 5) {
// TODO 不科学
chk.push(v.authId);
} else {
treeChk.push(v.authId);
}
});
setTimeout(() => {
this.$refs.tree.setCheckedKeys(treeChk);
this.checked = chk;
}, 0);
},
immediate: true
}
},
methods: {
checkChange(node, checked, childChecked) {
// if(node.parentId ==='0') return
// this.checked=checked?[...this.resources.all.filter(res=> res.parentId === node.authId),...this.checked]:this.checked.filter(obj=>obj.parentId!==node.authId)
this.setCheckedNodes();
},
change(node, data, sta) {
// let checked = sta //|| this.checked.some(child => child.parentId === node.key && child.authId !== data.authId);
// checked && this.$refs.tree.setChecked(node.key, checked, true);
this.setCheckedNodes();
},
setCheckedNodes() {
let checkedNodes = [
...this.$refs.tree.getCheckedKeys(),
...this.$refs.tree.getHalfCheckedKeys(),
...this.checked
];
checkedNodes = checkedNodes.map(node => {
const { authId, parentId } = this.resources.all.find(res => res.authId === node);
return { authId, parentId };
});
this.$emit("update:checkedNodes", checkedNodes);
},
reset() {
this.checked = [];
this.$refs.tree.setCheckedKeys([]);
this.$emit("update:checkedNodes", []);
}
}
};
</script>
<style lang="scss">
.role-tree {
padding-left: 30px;
.role-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding: 8px;
}
.el-tree-node__content {
height: 34px;
.el-checkbox {
margin-right: 5px;
.el-checkbox__label{
padding: 0;
}
}
}
&-auth {
word-break: break-all;
word-wrap: break-word;
white-space: normal;
position: absolute;
left: 200px;
background-color: rgba(0,0,0,.05);
padding: 5px 0;
}
}
</style>
\ No newline at end of file
......@@ -116,7 +116,7 @@ import { UserList } from "@/api/sys.account";
import notice from "@/common/notice";
import { mapActions } from "vuex";
export default {
name: "FimsUserUsers",
name: "FimsUsers",
components: {
// EditDialog
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!