This commit is contained in:
zhutianqi
2021-06-28 20:12:12 +08:00
parent 3884f31906
commit 3e42e33914
5 changed files with 368 additions and 1839 deletions
+4 -4
View File
@@ -299,10 +299,10 @@ export default {
// path: '/convertDocView',
// menuId: '3F52K25546'
// },
// // {
// // title: '菜单管理',
// // path: '/menuManage'
// // },
{
title: '菜单管理',
path: '/menuManage'
},
// // {
// // title: '保密管理',
// // path: '/convertDocView'
@@ -188,7 +188,6 @@ export default {
computed: {},
watch: {
filterText(val) {
console.log(val);
this.$refs.tree.filter(val);
}
},
+105 -428
View File
@@ -2,89 +2,67 @@
<template>
<div id="permission-menu-manage">
<div class="permission-menu-manage-left">
<laws-tree
ref="permissionManage"
treeDivId="permissionManage"
:zNodes="zNodes"
autoSelect
deptSelect
showRMenu
@treeClick="(treeId, treeNode) => handleClick(treeId, treeNode)"
@treeAdd="(treeId, treeNode) => handleAdd(treeId, treeNode)"
@treeEdit="(treeId, treeNode) => handleEdit(treeId, treeNode)"
@treeRightClick="(treeId, treeNode) => treeRightClick(treeId, treeNode)"
@treeRemove="(treeId, treeNode) => handleRemove(treeId, treeNode)"
></laws-tree>
<el-tree
class="filter-tree"
:data="treeData"
:props="defaultProps"
default-expand-all
ref="tree"
@node-contextmenu="rightHandleNodeClick"
@node-click="handleNodeClick">
</el-tree>
</div>
<div class="permission-menu-manage-right" v-if="showSarMenuInfoFlag">
<div class="permission-content">
<el-form ref="sarMenuForm" :model="sarMenuEO" :rules="sarMenuRules" class="label-input-form">
<el-row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="ID" prop="id" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.id" :disabled="formdisableflag" class="permission-input"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="名称" prop="name" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.name" class="permission-input"></el-input>
</el-form-item>
</el-col>
</el-row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="父节点ID" prop="pId" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.pId" :disabled="formdisableflag" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="前台页面地址" prop="href" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.href" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="排序号" prop="isShow" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.isShow" maxlength="2" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
<Row>
<el-col :span="6">
<span style="color: #fff">1</span>
</el-col>
<el-col :span="18">
<el-form-item label="后台接口权限" prop="permission" label-width="130px" class="standards-info-item">
<el-input v-model="sarMenuEO.permission" class="permission-input"></el-input>
</el-form-item>
</el-col>
</Row>
</el-form>
</div>
<div class="permission-btn" v-if="submitBtnFlag">
<el-button type="primary" :loading="isSubmit" @click="saveMenuInfo">提交</el-button>
</div>
<el-row>
<el-col :span="12">
<el-button type="primary"
class="common-button-primary add-button"
@click="Add"
size="mini">新增</el-button>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form
ref="sarStandardsInfoForm"
:model="form"
label-width="100px"
class="label-input-form"
>
<el-form-item label="Id" class="search-item">
<el-input v-model="form.id" clearable disabled/>
</el-form-item>
<el-form-item label="名称" class="search-item">
<el-input v-model="form.menuName" clearable disabled/>
</el-form-item>
<el-form-item label="父节点Id" class="search-item">
<el-input v-model="form.parentId" clearable disabled/>
</el-form-item>
</el-form>
</el-col>
</el-row>
</div>
<el-dialog
title="新增"
:visible.sync="modalshowflag"
:wrapperClosable="false"
:before-close="closeDialog"
size="800px">
<el-form
ref="sarStandardsInfoForm"
:model="NewForm"
label-width="100px"
class="label-input-form"
>
<el-form-item label="名称" class="search-item">
<el-input v-model="NewForm.menuName" clearable/>
</el-form-item>
</el-form>
<div slot="footer">
<el-button class="common-button-default" size="mini" icon="el-icon-close" @click="closeDialog">取消</el-button>
<el-button class="common-button-primary" size="mini" icon="el-icon-check" type="primary" @click="confirmDialog">提交</el-button>
</div>
</el-dialog>
</div>
</template>
@@ -96,212 +74,59 @@ export default {
name: 'permission-menu-manage',
data () {
return {
formdisableflag: true,
zNodes: [],
sarMenuEO: {
modalshowflag: false,
showSarMenuInfoFlag: false,
treeData: [],
defaultProps: {
children: 'children',
label: 'menuName'
},
form: {
id: '',
name: '',
pId: '',
href: '',
isShow: '',
permission: '',
menuName: '',
parentId: ''
},
sarMenuRules: {
name: [
{ required: true, message: '不能为空', trigger: 'blur' }
]
// isShow: [
// { type: 'string', required: true, message: '不能为空', trigger: 'blur' }
// ]
},
isSubmit: false,
showSarMenuInfoFlag: false,
submitBtnFlag: false,
saveClickNodeInfo: '',
clickType: '' // 1为新增,2为修改
NewForm: {
menuName: '',
}
}
},
methods: {
getTree () {
return new Promise((resolve, reject) => {
this.$http.get('sys/menu/listAllMenu', {}, {
_this: this
}, res => {
if (res.ok) {
let zNodes = []
for (let i = 0; i < res.data.length; i++) {
let zObj = {}
zObj.id = res.data[i].id
zObj.pId = res.data[i].parentId
zObj.name = res.data[i].name
zObj.href = res.data[i].href
zObj.isShow = res.data[i].isShow
zObj.permission = res.data[i].permission
zObj.remarks = res.data[i].remarks
zNodes[i] = zObj
if (res.data[i].parentIds !== null) {}
}
this.zNodes = zNodes
}
resolve()
}, e => {
reject(e)
})
})
},
/**
* @description: 树节点点击
* @author: chenxiaoxi
* @date: 2018-09-25 16:13:25
*/
handleClick (treeId, treeNode) {
this.submitBtnFlag = false
this.showSarMenuInfoFlag = true
this.sarMenuEO = treeNode
if (treeNode.href == null || treeNode.href === '' || treeNode.href === 'null') {
this.sarMenuEO.href = ''
}
if (treeNode.permission == null || treeNode.permission === '' || treeNode.permission === 'null') {
this.sarMenuEO.permission = ''
}
},
/**
* @description: 树节点添加
* @author: chenxiaoxi
* @date: 2018/12/26 15:39:22
*/
handleAdd (treeId, treeNode) {
this.resetForm()
this.submitBtnFlag = true
this.clickType = '1'
this.showSarMenuInfoFlag = true
this.sarMenuEO.pId = treeNode.id
},
/**
* @description: 树节点删除
* @author: chenxiaoxi
* @date: 2018-09-25 14:05:25
*/
handleRemove (treeId, treeNode) {
if (treeNode.pId == null || treeNode.pId === '') {
this.$Message.error('不能删除根级节点')
} else {
this.$http.get('sys/menu/judgeContentChild', {
id: treeNode.id
}, {
_this: this
}, res => {
if (res.data != null && res.data.length > 0) {
this.$message.error('该节点包含子节点,不能删除')
} else {
this.sureDeleteMenu(treeNode)
}
}, e => {})
}
},
sureDeleteMenu (treeNode) {
this.$confirm('确认删除该条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
if (treeNode.id != null && treeNode.id !== '') {
this.$http.put('sys/menu/deleteMenuById', {
id: treeNode.id
}, {
_this: this
}, res => {
if (res.data != null) {
this.getTree()
this.showSarMenuInfoFlag = false
this.resetForm()
}
}, e => {
})
} else {
this.$message.warning('没有获取到所选节点id')
confirmDialog () {
var form = {}
form.parentId = this.form.id
form.menuName = this.NewForm.menuName
this.$http.postData('lawss/sarMenu/add', form, {}, res=> {
if (res.ok) {
this.getTree()
this.modalshowflag = false
this.$message.success('成功')
}
})
},
/**
* @description: 节点编辑
* @author: chenxiaoxi
* @date: 2018/12/26 15:29:46
*/
handleEdit (treeId, treeNode) {
this.submitBtnFlag = true
this.clickType = '2'
Add () {
this.modalshowflag = true
},
closeDialog () {
this.modalshowflag = false
this.NewForm.menuName = ''
},
rightHandleNodeClick (e, data) {},
handleNodeClick (data) {
this.form.id = data.id
this.form.menuName = data.menuName
this.form.parentId = data.parentId
this.showSarMenuInfoFlag = true
this.saveClickNodeInfo = treeNode
this.sarMenuEO = treeNode
if (treeNode.href == null || treeNode.href === '' || treeNode.href === 'null') {
this.sarMenuEO.href = ''
}
if (treeNode.permission == null || treeNode.permission === '' || treeNode.permission === 'null') {
this.sarMenuEO.permission = ''
}
},
treeRightClick (treeId, treeNode) {
},
resetForm () {
this.sarMenuEO.id = ''
this.sarMenuEO.pId = ''
this.sarMenuEO.name = ''
this.sarMenuEO.href = ''
this.sarMenuEO.isShow = ''
this.sarMenuEO.permission = ''
},
saveMenuInfo () {
if (this.sarMenuEO.isShow != null && this.sarMenuEO.isShow !== '') {
this.isSubmit = true
this.$refs['sarMenuForm'].validate((valid) => {
if (valid) {
this.sarMenuEO.parentId = this.sarMenuEO.pId
let menuEO = JSON.parse(JSON.stringify(this.sarMenuEO))
if (this.clickType === '1') {
this.$http.post('sys/menu/addMenu', menuEO, {
_this: this,
loading: 'isSubmit'
}, res => {
if (res.ok) {
this.isSubmit = false
this.submitBtnFlag = false
this.getTree()
}
}, e => {
this.isSubmit = false
})
} else {
this.$http.put('sys/menu/updateMenu', this.sarMenuEO, {
_this: this,
loading: 'isSubmit'
}, res => {
this.isSubmit = false
this.submitBtnFlag = false
this.getTree()
}, e => {
this.isSubmit = false
})
}
} else {
this.isSubmit = false
this.$message.error('请检查表单是否填写正确!')
}
})
} else {
this.$message.warning('排序号不能为空!')
}
}
},
props: {
sideClose: {
type: Boolean
getTree () {
this.$http.get('lawss/sarMenu', {}, {}, res=> {
if (res.ok) {
this.treeData = res.data
}
})
}
},
props: {},
computed: {},
watch: {},
mounted () {
@@ -312,177 +137,29 @@ export default {
<style lang="less">
//@import '~styles/mixins';
#permission-menu-manage{
#permission-menu-manage {
display: flex;
//.flex();
background: #FFF;
.permission-menu-manage-left{
height: 100%;
.permission-menu-manage-left {
width: 240px;
height: 100%;
border-right: 1px solid #DDD;
position: relative;
overflow-x: auto;
padding: 5px;
.node_name{
display: inline-block;
max-width: 200px;
//.ellipsis();
}
}
.permission-menu-manage-right{
.permission-menu-manage-right {
width: calc(~'100% - 240px');
display: inline-block;
height: 100%;
padding: 10px;
position: relative;
.content{
.content {
height: calc(~'100% - 150px');
background: #CCC;
.hasNoData{
background: #FFF;
width: 100%;
height: 100%;
.no-data-icon{
width: 150px;
}
}
}
.ivu-table-overflowX{
overflow-x: auto;
}
.pagination{
.ivu-divider{
margin-bottom: 0;
}
}
.syncInfo{
padding-bottom: 0.2rem;
//.flex();
flex: 1;
align-items: center;
}
.permission-content{
padding-top: 30px;
.permission-input{
width: 300px;
}
}
.permission-btn{
text-align: center;
}
}
.ivu-tree-children{
.ivu-tree-arrow{
margin-right: 5px;
}
}
.content .btn-group{
margin-bottom: 0.5rem;
}
.permission-menu-manage-right-search{
.ivu-form-item-label{
padding: 0;
}
.ivu-form-item-content{
width: calc(~'100% - 60px');
.ivu-select{
width: 100%;
}
}
.ivu-form-item{
margin: 0;
}
.ivu-btn{
position: relative;
top: 1px;
}
}
.ivu-divider-horizontal{
margin: 8px 0;
}
.ivu-table-body{
overflow-x: auto;
}
.ivu-table-tip{
width: 100%;
height: calc(~'100% - 41px');
table{
display: block;
tbody,tr,td{
display: block;
width: 100% !important;
height: 100%;
}
td{
//.flex();
justify-content: center;
align-items: center;
}
}
}
.hasNoData{
background: #FFF;
.no-data-icon{
width: 85px;
}
}
.ivu-table-fixed,
.ivu-table-fixed-right{
height: 100%;
.ivu-table-fixed-body{
height: calc(~'100% - 41px');
}
}
.ivu-select-item{
max-width: 200px;
//.ellipsis();
}
.demo-drawer-footer{
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
.btn-show{
display: inline-block !important;
}
.btn-hide{
display: none !important;
}
.ivu-tag{
cursor: default;
}
}
.role-setting-form{
.ivu-modal-body{
overflow-y: inherit;
}
}
.demo-drawer-profile{
font-size: 14px;
}
.demo-drawer-profile .ivu-col{
margin-bottom: 12px;
}
.user-info-text{
color: #A59D9D;
}
.mechanism-tree-modal{
.ivu-modal{
width: 350px !important;
.form-content{
width: 300px;
margin: 0 auto;
.ivu-form-item{
//.flex();
.ivu-form-item-content{
flex: 1;
}
}
}
}
}
+39 -15
View File
@@ -88,10 +88,20 @@
v-if="modalRole"
:props="props"
:data="roleList"
show-checkbox
@check="handleCheckChange">
check-strictly
show-checkbox>
</el-tree>
<el-button @click="add"></el-button>
<div id="roleFormButton" class="demo-drawer-footer">
<el-button
size="mini"
class="common-button-primary"
icon="el-icon-check"
type="primary"
@click="RoleSubmit"
:loading="submitLoading"
>确定</el-button>
<el-button size="mini" class="common-button-default" icon="el-icon-close" @click="resetFormRole">取消</el-button>
</div>
</el-drawer>
</div>
</template>
@@ -101,6 +111,7 @@
name: 'PostManage',
data () {
return {
submitLoading: false,
selectList: [],
data: [],
Loading: false,
@@ -122,14 +133,24 @@
}
},
methods: {
add () {
console.log(this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys()));
RoleSubmit () { // 配置角色提交
this.submitLoading = true
this.$http.postData('sarPosition/position/role', {
positionId: this.selectList[0].id,
roleIds: this.$refs.tree.getCheckedKeys().concat(this.$refs.tree.getHalfCheckedKeys())
}, {}, res=> {
if (res.ok) {
this.$message.success('配置成功')
this.modalRole = false
this.getData()
} else {
this.$message.warning(res.message)
}
this.submitLoading = false
})
},
handleCheckChange (checkedNodes, checkedKeys) {
var list = []
for (var a = 0; a < checkedKeys.checkedNodes.length; a++) {
list.push(checkedKeys.checkedNodes[a].id)
}
resetFormRole () { // 配置角色关闭事件
this.modalRole = false
},
getRole () {
this.$http.get('sarRole/role', {}, {}, res=> {
@@ -140,10 +161,12 @@
this.selectList = val
},
addRole () { // 点击配置角色按钮
if (this.selectList.length > 0) {
if (this.selectList.length === 1) {
this.modalRole = true
} else {
} else if (this.selectList.length === 0) {
this.$message.warning('请选择要配置角色的岗位')
} else {
this.$message.warning('请选择一条岗位')
}
},
getData () { // 获取岗位数据
@@ -161,8 +184,6 @@
this.$refs['sarStandardsInfoForm'].resetFields();
this.modalshowflag = false
},
resetFormRole () { // 配置角色关闭事件
},
submit () { // 新增角色确认
this.$refs['sarStandardsInfoForm'].validate((valid) => {
if (valid) {
@@ -179,7 +200,7 @@
this.modalshowflag = false
this.getData()
} else {
this.$message.warning('新增失败')
this.$message.warning(res.message)
}
})
} else {
@@ -204,5 +225,8 @@
.content {
height: calc(~'100% - 53px')
}
.filter-tree {
height: calc(~'100% - 50px')
}
}
</style>
File diff suppressed because it is too large Load Diff