From 3e42e33914750122687a9d391990177bfc6e8139 Mon Sep 17 00:00:00 2001 From: zhutianqi Date: Mon, 28 Jun 2021 20:12:12 +0800 Subject: [PATCH 1/3] commit --- src/components/navMenu/index.vue | 8 +- .../config/pages/mechanismManage/index.vue | 1 - src/pages/config/pages/menuManage/index.vue | 533 ++---- src/pages/config/pages/postManage/index.vue | 54 +- src/pages/config/pages/roleManage/index.vue | 1611 +++-------------- 5 files changed, 368 insertions(+), 1839 deletions(-) diff --git a/src/components/navMenu/index.vue b/src/components/navMenu/index.vue index bc43095be..f078cfe8f 100644 --- a/src/components/navMenu/index.vue +++ b/src/components/navMenu/index.vue @@ -299,10 +299,10 @@ export default { // path: '/convertDocView', // menuId: '3F52K25546' // }, - // // { - // // title: '菜单管理', - // // path: '/menuManage' - // // }, + { + title: '菜单管理', + path: '/menuManage' + }, // // { // // title: '保密管理', // // path: '/convertDocView' diff --git a/src/pages/config/pages/mechanismManage/index.vue b/src/pages/config/pages/mechanismManage/index.vue index ed2956fe3..b5e1f5053 100644 --- a/src/pages/config/pages/mechanismManage/index.vue +++ b/src/pages/config/pages/mechanismManage/index.vue @@ -188,7 +188,6 @@ export default { computed: {}, watch: { filterText(val) { - console.log(val); this.$refs.tree.filter(val); } }, diff --git a/src/pages/config/pages/menuManage/index.vue b/src/pages/config/pages/menuManage/index.vue index 50cb3a232..55b79fe33 100644 --- a/src/pages/config/pages/menuManage/index.vue +++ b/src/pages/config/pages/menuManage/index.vue @@ -2,89 +2,67 @@ @@ -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 { diff --git a/src/pages/config/pages/roleManage/index.vue b/src/pages/config/pages/roleManage/index.vue index add59698b..d7fecfe7c 100644 --- a/src/pages/config/pages/roleManage/index.vue +++ b/src/pages/config/pages/roleManage/index.vue @@ -1,1322 +1,187 @@ @@ -1324,108 +189,72 @@ export default { From 708cdd904f1eca7244e13ebccb9ecf3ff50e258c Mon Sep 17 00:00:00 2001 From: zhutianqi Date: Tue, 29 Jun 2021 15:19:46 +0800 Subject: [PATCH 2/3] commit --- src/pages/config/pages/menuManage/index.vue | 3 ++ src/pages/config/pages/postManage/index.vue | 19 +++++++- src/pages/config/pages/roleManage/index.vue | 51 ++++++++++++++++----- 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/pages/config/pages/menuManage/index.vue b/src/pages/config/pages/menuManage/index.vue index 55b79fe33..226cf8883 100644 --- a/src/pages/config/pages/menuManage/index.vue +++ b/src/pages/config/pages/menuManage/index.vue @@ -101,10 +101,13 @@ export default { this.getTree() this.modalshowflag = false this.$message.success('成功') + } else { + this.$message.warning(res.message) } }) }, Add () { + this.NewForm.menuName = '' this.modalshowflag = true }, closeDialog () { diff --git a/src/pages/config/pages/postManage/index.vue b/src/pages/config/pages/postManage/index.vue index 064f1bcc6..fa0f14c26 100644 --- a/src/pages/config/pages/postManage/index.vue +++ b/src/pages/config/pages/postManage/index.vue @@ -34,7 +34,7 @@ width="170px"> @@ -122,6 +129,22 @@ export default { } }, methods: { + closeDialog () { + this.nodeList = [] + this.modalshowflag = false + }, + confirmDialog () { + this.$http.postData('sarRole/role/menu', { + menuIds: this.$refs.tree2.getCheckedKeys().concat(this.$refs.tree2.getHalfCheckedKeys()), + roleId: this.id + }, {}, res=> { + console.log(res); + if (res.ok) { + this.$message.success('设置权限成功') + this.modalshowflag = false + } + }) + }, getTree2 () { this.$http.get('lawss/sarMenu', {}, {}, res=> { if (res.ok) { @@ -243,6 +266,12 @@ export default { } } } + .myDialog { + /deep/.el-tree { + height: 300px; + overflow: auto; + } + } /deep/.el-select__tags { overflow-x: hidden; } From 2c657ac274800dc17e29a1844fbe2123dacf5f2c Mon Sep 17 00:00:00 2001 From: zhutianqi Date: Tue, 29 Jun 2021 17:14:26 +0800 Subject: [PATCH 3/3] commit --- .../config/pages/mechanismManage/index.vue | 90 +++++++++++++++- src/pages/config/pages/postManage/index.vue | 101 ++++++++++++++---- 2 files changed, 171 insertions(+), 20 deletions(-) diff --git a/src/pages/config/pages/mechanismManage/index.vue b/src/pages/config/pages/mechanismManage/index.vue index b5e1f5053..4c35ec569 100644 --- a/src/pages/config/pages/mechanismManage/index.vue +++ b/src/pages/config/pages/mechanismManage/index.vue @@ -9,7 +9,6 @@ v-model="filterText"> 启用 禁用 + 配置岗位 @@ -94,6 +94,36 @@ 导入中... + + + + + @@ -102,6 +132,14 @@ export default { name: 'MechanismManage', data () { return { + userId: '', + postList: [], + props: { + children: 'children', + label: 'name' + }, + nodeList: [], + modalPost: false, filterText: '', // 树结构检索条件 defaultProps: { children: 'children', @@ -119,6 +157,21 @@ export default { } }, methods: { + resetFormPost () { + this.modalPost= false + }, + PostSubmit () { + this.$http.postData('sarUser/user/position', { + positionIds: this.$refs.tree2.getCheckedKeys(), + userId: this.userId + }, {}, res => { + if (res.ok) { + this.$message.success('配置岗位成功') + this.modalPost = false + this.getData() + } + }) + }, handleCommand (command) { switch (command[1]) { case '启用': @@ -127,8 +180,27 @@ export default { case '禁用': this.disableFlagEdit(command[0], 1) break + case '配置岗位': + this.postsConfigure(command[0]) + break } }, + getTree2 () { + this.$http.get('sarPosition/position', {}, { + _this: this, + }, res=> { + this.postList = res.data + }) + }, + postsConfigure (row) { + var arr = [] + this.userId = row.userId + row.positions.forEach((item) => { + arr.push(item.id) + }) + this.nodeList = arr + this.modalPost= true + }, disableFlagEdit (row, type) { let json = {} json.userId = row.userId @@ -173,6 +245,16 @@ export default { _this: this, loading: 'Loading' }, res => { + res.data.forEach((item) => { + var NameList = '' + item.positions.forEach((items) => { + if (NameList.length > 0) { + NameList += ',' + } + NameList += items.name + }) + item.NameList = NameList + }) this.data = res.data }) }, @@ -194,6 +276,7 @@ export default { mounted () { // 获取组织结构树 this.getTree() + this.getTree2() } } @@ -263,6 +346,9 @@ export default { /deep/.width-all{ width: 100%; } +.filter-tree { + height: calc(~'100% - 50px') +} .laws-tree{ /deep/.clearable { top: 20px; diff --git a/src/pages/config/pages/postManage/index.vue b/src/pages/config/pages/postManage/index.vue index fa0f14c26..ec98b27eb 100644 --- a/src/pages/config/pages/postManage/index.vue +++ b/src/pages/config/pages/postManage/index.vue @@ -47,11 +47,26 @@ label="操作时间" width="170px"> + + + 加载中... { + if (res.ok) { + this.$message.success('删除成功') + this.getData() + } + }) + }, + editData (row) { + this.type = 2 + this.editId = row.id + this.sarStandardsInfoEO.name = row.name + this.dialogTitle = '修改岗位信息' + this.modalshowflag = true + }, RoleSubmit () { // 配置角色提交 this.submitLoading = true this.$http.postData('sarPosition/position/role', { @@ -164,9 +209,9 @@ this.selectList = val }, addRole () { // 点击配置角色按钮 - this.nodeList = this.selectList[0].idList if (this.selectList.length === 1) { this.modalRole = true + this.nodeList = this.selectList[0].idList } else if (this.selectList.length === 0) { this.$message.warning('请选择要配置角色的岗位') } else { @@ -195,6 +240,8 @@ }) }, addModal () { // 点击新增按钮 + this.type = 1 + this.dialogTitle = '新增岗位' this.modalshowflag = true }, resetForm () { // 新增岗位关闭事件 @@ -204,22 +251,40 @@ submit () { // 新增角色确认 this.$refs['sarStandardsInfoForm'].validate((valid) => { if (valid) { - this.$http.post('sarPosition/position', { - createById: this.$store.getters.userInfo.userId, - operator: this.$store.getters.userInfo.account, - name: this.sarStandardsInfoEO.name - }, { - _this: this, - loading: 'Loading' - }, res=> { - if (res.ok) { - this.$message.success('新增成功') - this.modalshowflag = false - this.getData() - } else { - this.$message.warning(res.message) - } - }) + if (this.type === 1) { + this.$http.post('sarPosition/position', { + createById: this.$store.getters.userInfo.userId, + operator: this.$store.getters.userInfo.account, + name: this.sarStandardsInfoEO.name + }, { + _this: this, + loading: 'Loading' + }, res=> { + if (res.ok) { + this.$message.success('新增成功') + this.modalshowflag = false + this.getData() + } else { + this.$message.warning(res.message) + } + }) + } else { + this.$http.put('sarPosition/position', { + id: this.editId, + name: this.sarStandardsInfoEO.name + }, { + _this: this, + loading: 'Loading' + }, res=> { + if (res.ok) { + this.$message.success('修改成功') + this.modalshowflag = false + this.getData() + } else { + this.$message.warning(res.message) + } + }) + } } else { return false; }