commit
This commit is contained in:
@@ -3,7 +3,12 @@
|
|||||||
* @author: xx
|
* @author: xx
|
||||||
* @date: 2018-09-01 15:11:57
|
* @date: 2018-09-01 15:11:57
|
||||||
*/
|
*/
|
||||||
|
/deep/.el-tree-node:focus > .el-tree-node__content {
|
||||||
|
color: #409EFF !important;
|
||||||
|
}
|
||||||
|
.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
|
||||||
|
color: #409EFF !important;
|
||||||
|
}
|
||||||
.ellipsis () {
|
.ellipsis () {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ export default {
|
|||||||
{
|
{
|
||||||
title: '我的板块',
|
title: '我的板块',
|
||||||
path: '/plate',
|
path: '/plate',
|
||||||
menuId: '971d576ef9bce3bddd6f0d6bcc55d184'
|
menuId: 'e4a94f03223df6f4ad70732b96f07221'
|
||||||
}
|
}
|
||||||
// {
|
// {
|
||||||
// title: '个人信息',
|
// title: '个人信息',
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
|
highlight-current
|
||||||
ref="tree"
|
ref="tree"
|
||||||
|
:expand-on-click-node="false"
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,8 +111,10 @@
|
|||||||
:props="props"
|
:props="props"
|
||||||
:data="postList"
|
:data="postList"
|
||||||
:default-checked-keys="nodeList"
|
:default-checked-keys="nodeList"
|
||||||
|
highlight-current
|
||||||
check-strictly
|
check-strictly
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:expand-on-click-node="false"
|
||||||
show-checkbox>
|
show-checkbox>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<div id="roleFormButton" class="demo-drawer-footer">
|
<div id="roleFormButton" class="demo-drawer-footer">
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
:data="treeData"
|
:data="treeData"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
highlight-current
|
||||||
ref="tree"
|
ref="tree"
|
||||||
@node-contextmenu="rightHandleNodeClick"
|
@node-contextmenu="rightHandleNodeClick"
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
|
|||||||
@@ -105,9 +105,11 @@
|
|||||||
v-if="modalRole"
|
v-if="modalRole"
|
||||||
:props="props"
|
:props="props"
|
||||||
:data="roleList"
|
:data="roleList"
|
||||||
|
highlight-current
|
||||||
:default-checked-keys="nodeList"
|
:default-checked-keys="nodeList"
|
||||||
check-strictly
|
check-strictly
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:expand-on-click-node="false"
|
||||||
show-checkbox>
|
show-checkbox>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<div id="roleFormButton" class="demo-drawer-footer">
|
<div id="roleFormButton" class="demo-drawer-footer">
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
:data="treeData"
|
:data="treeData"
|
||||||
:props="defaultProps"
|
:props="defaultProps"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
highlight-current
|
||||||
:filter-node-method="filterNode"
|
:filter-node-method="filterNode"
|
||||||
ref="tree"
|
ref="tree"
|
||||||
@node-click="handleNodeClick">
|
@node-click="handleNodeClick">
|
||||||
@@ -35,6 +37,10 @@
|
|||||||
class="common-button-primary add-button"
|
class="common-button-primary add-button"
|
||||||
@click="roleAddData"
|
@click="roleAddData"
|
||||||
size="mini">配置数据权限</el-button>
|
size="mini">配置数据权限</el-button>
|
||||||
|
<el-button type="primary"
|
||||||
|
class="common-button-primary add-button"
|
||||||
|
@click="RolesAdd(1)"
|
||||||
|
size="mini">新增角色</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<el-table
|
<el-table
|
||||||
@@ -57,7 +63,7 @@
|
|||||||
label="角色描述">
|
label="角色描述">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="phone"
|
prop="parent"
|
||||||
label="上级角色"
|
label="上级角色"
|
||||||
width="170px">
|
width="170px">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@@ -72,10 +78,25 @@
|
|||||||
width="140px">
|
width="140px">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="operateTime.data"
|
prop="operateTime"
|
||||||
width="160px"
|
width="160px"
|
||||||
label="操作时间">
|
label="操作时间">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
width="50px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<div @click.stop style="display: inline-block">
|
||||||
|
<el-dropdown trigger="click" @command="handleCommand">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item :command="[scope.row, '编辑']">编辑</el-dropdown-item>
|
||||||
|
<el-dropdown-item :command="[scope.row, '删除']">删除</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
<loading :loading="Loading">加载中...</loading>
|
<loading :loading="Loading">加载中...</loading>
|
||||||
@@ -95,7 +116,9 @@
|
|||||||
:data="treeData2"
|
:data="treeData2"
|
||||||
:props="defaultProps2"
|
:props="defaultProps2"
|
||||||
:default-checked-keys="nodeList"
|
:default-checked-keys="nodeList"
|
||||||
|
:expand-on-click-node="false"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
highlight-current
|
||||||
show-checkbox
|
show-checkbox
|
||||||
check-strictly
|
check-strictly
|
||||||
ref="tree2">
|
ref="tree2">
|
||||||
@@ -121,6 +144,8 @@
|
|||||||
:props="defaultProps3"
|
:props="defaultProps3"
|
||||||
:default-checked-keys="nodeList2"
|
:default-checked-keys="nodeList2"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
highlight-current
|
||||||
|
:expand-on-click-node="false"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
check-strictly
|
check-strictly
|
||||||
ref="tree3">
|
ref="tree3">
|
||||||
@@ -131,6 +156,77 @@
|
|||||||
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="confirmDialogData">确定</el-button>
|
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="confirmDialogData">确定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
:title="addRoleTitle"
|
||||||
|
:visible.sync="addModel"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
@close="AddRoleCancel"
|
||||||
|
size="800px">
|
||||||
|
<div class="myDialog">
|
||||||
|
<el-form
|
||||||
|
ref="addForm"
|
||||||
|
:model="addForm"
|
||||||
|
:rules="addFormRules"
|
||||||
|
class="label-input-form"
|
||||||
|
>
|
||||||
|
<el-form-item label="角色名称" prop="name" label-width="80px" class="add-form-item">
|
||||||
|
<el-input v-model="addForm.name"
|
||||||
|
placeholder="请输入角色名称"
|
||||||
|
clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="上级角色" prop="parentId" label-width="80px" class="add-form-item">
|
||||||
|
<el-input v-model="addForm.parentId" style="display: none;"
|
||||||
|
clearable></el-input>
|
||||||
|
<el-input v-model="addForm.parent"
|
||||||
|
placeholder="请选择上级角色"
|
||||||
|
@click.native="SuperiorRole"
|
||||||
|
clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="角色描述" prop="remarks" label-width="80px" class="add-form-item">
|
||||||
|
<el-input v-model="addForm.remarks"
|
||||||
|
placeholder="请输入上级描述"
|
||||||
|
clearable></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<div slot="footer">
|
||||||
|
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="AddRoleCancel">取消</el-button>
|
||||||
|
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="AddRoleOk">确定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
<el-drawer
|
||||||
|
title="选择上级角色"
|
||||||
|
:visible.sync="SuperiorRoleModel"
|
||||||
|
:wrapperClosable="false"
|
||||||
|
@close="SuperiorRoleCancle"
|
||||||
|
size="800px"
|
||||||
|
>
|
||||||
|
<el-tree
|
||||||
|
v-if="SuperiorRoleModel"
|
||||||
|
class="filter-tree1"
|
||||||
|
:data="treeData"
|
||||||
|
:props="defaultProps"
|
||||||
|
default-expand-all
|
||||||
|
check-strictly
|
||||||
|
node-key="id"
|
||||||
|
:default-checked-keys="nodeList3"
|
||||||
|
show-checkbox
|
||||||
|
highlight-current
|
||||||
|
@check="drawerCheck"
|
||||||
|
:expand-on-click-node="false"
|
||||||
|
ref="tree4">
|
||||||
|
</el-tree>
|
||||||
|
<div id="roleFormButton" class="demo-drawer-footer">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
class="common-button-primary"
|
||||||
|
icon="el-icon-check"
|
||||||
|
type="primary"
|
||||||
|
@click="SuperiorRoleOk"
|
||||||
|
>确定</el-button>
|
||||||
|
<el-button size="mini" class="common-button-default" icon="el-icon-close" @click="SuperiorRoleCancle">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -139,6 +235,24 @@ export default {
|
|||||||
name: 'role-manage',
|
name: 'role-manage',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
type: '', // 新增/编辑状态
|
||||||
|
addRoleTitle: '',
|
||||||
|
SuperiorRoleData: {},
|
||||||
|
nodeList3: [],
|
||||||
|
SuperiorRoleModel: false,
|
||||||
|
addFormRules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: '请输入角色名称', trigger: 'blur' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
addForm: {
|
||||||
|
name: '', // 角色名称
|
||||||
|
parentId: '', // 上级ID
|
||||||
|
remarks: '', // 角色描述
|
||||||
|
parent: '',
|
||||||
|
id: ''
|
||||||
|
},
|
||||||
|
addModel: false,
|
||||||
treeData3: [],
|
treeData3: [],
|
||||||
defaultProps3: {
|
defaultProps3: {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
@@ -167,6 +281,116 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleCommand (command) {
|
||||||
|
switch (command[1]) {
|
||||||
|
case '编辑':
|
||||||
|
this.RolesAdd(0, command[0])
|
||||||
|
break
|
||||||
|
case '删除':
|
||||||
|
this.deleteRole(command[0])
|
||||||
|
break
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteRole (row) { // 删除角色
|
||||||
|
this.$confirm('此操作将永久删除该角色, 是否继续?', '提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
this.$http.delete('sarRole/role', {
|
||||||
|
roleId: row.id
|
||||||
|
}, {}, res => {
|
||||||
|
if (res.ok) {
|
||||||
|
this.$message({
|
||||||
|
type: 'success',
|
||||||
|
message: '删除成功!'
|
||||||
|
});
|
||||||
|
this.getTree()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(() => {
|
||||||
|
this.$message({
|
||||||
|
type: 'info',
|
||||||
|
message: '已取消删除'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
drawerCheck (data) {
|
||||||
|
var getlist = this.$refs.tree4.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
|
||||||
|
if(getlist.length == 1) {
|
||||||
|
}else {
|
||||||
|
this.$refs.tree4.setCheckedKeys([data.id]);
|
||||||
|
}
|
||||||
|
this.SuperiorRoleData = data
|
||||||
|
},
|
||||||
|
SuperiorRoleOk () { // 上级角色确定
|
||||||
|
this.addForm.parentId = this.SuperiorRoleData.id
|
||||||
|
this.addForm.parent = this.SuperiorRoleData.name
|
||||||
|
this.nodeList3 = []
|
||||||
|
this.nodeList3.push(this.addForm.parentId)
|
||||||
|
this.SuperiorRoleModel = false
|
||||||
|
},
|
||||||
|
SuperiorRoleCancle () { // 上级角色取消
|
||||||
|
this.SuperiorRoleModel = false
|
||||||
|
},
|
||||||
|
AddRoleCancel () { // 新增角色取消
|
||||||
|
this.$refs['addForm'].resetFields();
|
||||||
|
this.addModel = false
|
||||||
|
},
|
||||||
|
AddRoleOk () { // 新增角色确定
|
||||||
|
this.$refs['addForm'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.type === 1) { // 新增
|
||||||
|
this.$http.postData('sarRole/role',this.addForm , {}, res=> {
|
||||||
|
if (res.ok) {
|
||||||
|
this.$message.success('新增角色成功')
|
||||||
|
this.addModel = false
|
||||||
|
this.getTree()
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.message)
|
||||||
|
this.addModel = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else { // 编辑
|
||||||
|
this.$http.putData('sarRole/role',this.addForm , {}, res=> {
|
||||||
|
if (res.ok) {
|
||||||
|
this.$message.success('修改角色信息成功')
|
||||||
|
this.addModel = false
|
||||||
|
this.getTree()
|
||||||
|
} else {
|
||||||
|
this.$message.warning(res.message)
|
||||||
|
this.addModel = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.addModel = false
|
||||||
|
},
|
||||||
|
SuperiorRole () { // 点击选择上级角色按钮
|
||||||
|
this.SuperiorRoleModel = true
|
||||||
|
},
|
||||||
|
RolesAdd (type, row) { // 新增/编辑角色按钮
|
||||||
|
this.type = type
|
||||||
|
if (type === 1) {
|
||||||
|
this.addRoleTitle = '新增角色'
|
||||||
|
this.addForm.name = ''
|
||||||
|
this.addForm.remarks = ''
|
||||||
|
this.addForm.parentId = ''
|
||||||
|
this.addForm.parent = ''
|
||||||
|
this.addForm.id = ''
|
||||||
|
} else {
|
||||||
|
this.addRoleTitle = '编辑角色'
|
||||||
|
this.addForm.name = row.name
|
||||||
|
this.addForm.remarks = row.remarks
|
||||||
|
this.addForm.parentId = row.parentId
|
||||||
|
this.addForm.parent = row.parent
|
||||||
|
this.addForm.id = row.id
|
||||||
|
this.nodeList3 = []
|
||||||
|
this.nodeList3.push(this.addForm.parentId)
|
||||||
|
}
|
||||||
|
this.addModel = true
|
||||||
|
},
|
||||||
getTree3 () {
|
getTree3 () {
|
||||||
this.$http.get('sarResource/ts-resource', {}, {}, res=> {
|
this.$http.get('sarResource/ts-resource', {}, {}, res=> {
|
||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
@@ -282,6 +506,12 @@ export default {
|
|||||||
.role-manage {
|
.role-manage {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
/deep/.el-form-item__content {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.filter-tree1 {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
.tree-close{
|
.tree-close{
|
||||||
.tree{
|
.tree{
|
||||||
left: -200px !important;
|
left: -200px !important;
|
||||||
|
|||||||
@@ -174,6 +174,7 @@
|
|||||||
check-strictly
|
check-strictly
|
||||||
@check="drawerCheck"
|
@check="drawerCheck"
|
||||||
default-expand-all
|
default-expand-all
|
||||||
|
:expand-on-click-node="false"
|
||||||
show-checkbox
|
show-checkbox
|
||||||
ref="tree">
|
ref="tree">
|
||||||
</el-tree>
|
</el-tree>
|
||||||
|
|||||||
Reference in New Issue
Block a user