From 447315ae4957e05fe19a5a93a5f5afa214652a8f Mon Sep 17 00:00:00 2001 From: xiaoning <1097449274@qq.com> Date: Fri, 23 Feb 2024 16:07:52 +0800 Subject: [PATCH] xn --- src/api/sy/yhgl.js | 6 ++ src/views/xtgl/jsgl.vue | 167 ++++++++++++++-------------------------- 2 files changed, 64 insertions(+), 109 deletions(-) diff --git a/src/api/sy/yhgl.js b/src/api/sy/yhgl.js index 34c7961..7d9041c 100644 --- a/src/api/sy/yhgl.js +++ b/src/api/sy/yhgl.js @@ -111,6 +111,12 @@ export function getMenuList(data) { method: 'post', data }) +}export function getMenuForRole(data) { + return request({ + url: '/api/sy/getMenuForRole', + method: 'post', + data + }) } export function getUserListByMenu(data) { diff --git a/src/views/xtgl/jsgl.vue b/src/views/xtgl/jsgl.vue index d3098b6..aa4843d 100644 --- a/src/views/xtgl/jsgl.vue +++ b/src/views/xtgl/jsgl.vue @@ -40,7 +40,7 @@ 代码: - + 名称: @@ -163,28 +163,28 @@
- - - - - - - - - - - - - - - - - - - - - - + + + + + + + + { this.fzqxTableData = response.data this.isFzqxTableLoading = false - getMenuList({}).then(response => { + getMenuForRole({}).then(response => { this.gnqxTreeData = this.parseTreeData(response.data) this.gnqxTableData = response.data this.isGnqxTableLoading = false @@ -365,77 +365,6 @@ export default { } return '' }, - // parseTreeData(menu) { - // const treeData = [{ 'label': '全部功能', 'id': '@', children: [], disabled: true }] - // - // const myMap = new Map(); - // for (let i = 0; i< menu.length - 1; i++) { - // if (menu[i].ylzd1) { - // menu[i].children = [] - // myMap.set(menu[i].ylzd1,menu[i]) - // } - // } - // for (let i = 0; i< menu.length - 1; i++) { - // if (myMap.has(menu[i].ylzd1)) { - // myMap.get(menu[i].ylzd1).children.push(menu[i]) - // } - // } - // // let id = 0; - // // myMap.forEach((value, key) => { - // // console.log('info1',key) - // // console.log('info2',value) - // // id = id+1; - // // treeData[0].children.push({ 'label': key, 'id': id, 'children': value.children }) - // // }); - // console.log("info",myMap.get(menu[1].ylzd1)) - // // const treeData= [{ 'label': '全部功能', 'id': '@', children: [], disabled: true }] - // treeData[0].children.push({ 'label': '计划排产', 'id': 1, 'children': []}) - // treeData[0].children.push({ 'label': '计划排产', 'id': 2, 'children': []}) - // treeData[0].children.push({ 'label': '计划排产', 'id': 3, 'children': []}) - // // console.log('info',myMap) - // // console.log('infotree',treeData) - // // const info = menu.reduce((map, node) => { - // // node.label = node.ylzd1 - // // node.children = [] - // // return map[node.ylzd1] = node, node.children = [], map - // // const myMap = new Map([ - // // [node.ylzd1, node] - // // ]); - // // return map[node.ylzd1,node], map - // // }, {}) - // // console.log('info',info) - // // for (let i = 0; i< menu.length - 1; i++) { - // // if (info[menu[i].ylzd1]) { - // // info[menu[i].ylzd1].children.push(menu[i]) - // // } - // // } - // // for(let item of info){ - // // console.log('info',item) - // // } - // - // // console.log('info',info) - // - // // const result = menu.filter(node => { - // // if (info[node.ylzd1]) { - // // info[node.ylzd1].children.push(node) - // // } - // // return !node.ylzd1 - // // }) - // // const system_menu = {} - // // for (let i = 0; i < result.length; i++) { - // // - // // if (!system_menu[result[i].system_code]) { - // // system_menu[result[i].system_code] = [] - // // } - // // system_menu[result[i].system_code].push(result[i]) - // // } - // // for (let i = 0; i < this.zxtbmList.length; i++) { - // // - // // const key = this.zxtbmList[i].zxtbm - // // treeData[0].children.push({ 'label': this.getSystemName(key), 'id': key, 'children': system_menu[key] }) - // // } - // return treeData - // }, parseTreeData(menu) { const treeData = [{ 'label': '全部功能', 'id': '@', children: [], disabled: true }] @@ -449,7 +378,6 @@ export default { } return !node.parent_id }) - const system_menu = {} for (let i = 0; i < result.length; i++) { if (!system_menu[result[i].system_code]) { @@ -457,12 +385,12 @@ export default { } system_menu[result[i].system_code].push(result[i]) } - console.log('info',info) - console.log('result',result) - for (let i = 0; i < this.zxtbmList.length; i++) { - const key = this.zxtbmList[i].zxtdm - treeData[0].children.push({ 'label': this.getSystemName(key), 'id': key, 'children': system_menu[key] }) - } + // for (let i = 0; i < this.zxtbmList.length; i++) { + // const key = this.zxtbmList[i].zxtdm + // console.log(system_menu[key]) + // treeData[0].children.push({ 'label': this.getSystemName(key), 'id': key, 'children': system_menu[key] }) + // } + treeData[0].children.push({ 'label': this.getSystemName('PS'), 'id': 'PS', 'children': system_menu['PS'] }) console.log('treeData',treeData) return treeData }, @@ -547,6 +475,7 @@ export default { }, handleWorkGroupAdd() { this.dialogTitle = '添加工作组' this.dialogTableVisible = true + this.inputDisabled=false; this.updateData = {} }, handleWorkGroupAddComplated() { @@ -563,6 +492,7 @@ export default { } this.dialogTitle = '修改工作组' this.dialogTableVisible = true + this.inputDisabled=true this.updateData = JSON.parse(JSON.stringify(this.selectWorkGroup)) }, handleWorkGroupUpdateComplated() { updateRole(this.updateData).then(response => { @@ -592,7 +522,7 @@ export default { this.$message({ message: '请选择一个工作组!', type: 'warning' }) return } - const data = { 'role_code': this.selectWorkGroup.role_code, 'user_code': row.user_code } + const data = { 'role_code': this.selectWorkGroup.role_code, 'yhdm': row.yhdm, 'yhms': row.yhms } if (row.checked) { addRoleForUser([data]).then(response => { this.$message({ message: '添加用户到工作组成功!', type: 'success' }) @@ -603,7 +533,10 @@ export default { }) } }, handleFzqxSelect(row) { - const data = { 'institution_code': row.institution_code, 'role_code': this.selectWorkGroup.role_code } + const data = { 'role_code': this.selectWorkGroup.role_code, + 'FZDM': row.institution_code.substring(0,2) , + 'ZXTDM':row.institution_code.substring(2), + } if (row.checked) { addRoleForInstitution([data]).then(response => { this.$message({ message: '添加分组权限到工作组成功!', type: 'success' }) @@ -614,7 +547,7 @@ export default { }) } }, handleZxtSelect(row) { - const data = { 'role_code': this.selectWorkGroup.role_code, 'system_code': row.system_code } + const data = { 'role_code': this.selectWorkGroup.role_code, 'system_code': row.zxtdm } if (row.checked) { addRoleForSystem([data]).then(response => { this.$message({ message: '添加子系统权限到工作组成功!', type: 'success' }) @@ -625,7 +558,15 @@ export default { }) } }, handleGnqxSelect(row) { - const data = { 'role_code': this.selectWorkGroup.role_code, 'menu_id': row.id } + let gnlb='' + if (row.gnlb){ + gnlb=row.gnlb + } + const data = { 'role_code': this.selectWorkGroup.role_code, + 'system_code': row.system_code, + 'menu_name': row.menu_name, + 'gnlb': gnlb, + } if (row.checked) { addRoleForMenu([data]).then(response => { this.$refs.tree.setChecked(row.id, true, false) @@ -661,7 +602,15 @@ export default { this.gnqxTableData[j]['checked'] = true } } - const data = { 'role_code': this.selectWorkGroup.role_code, 'menu_id': this.gnqxTableData[j]['id'] } + let gnlb='' + if (this.gnqxTableData[j]['gnlb']){ + gnlb=this.gnqxTableData[j]['gnlb'] + } + const data = { 'role_code': this.selectWorkGroup.role_code, + 'system_code': this.gnqxTableData[j]['system_code'], + 'menu_name': this.gnqxTableData[j]['menu_name'], + 'gnlb': gnlb + } if (source && !this.gnqxTableData[j]['checked']) { deleteFunction.push(data) }