From 5b162fd92ab2383ce44ca2f84dc8ad750430817b Mon Sep 17 00:00:00 2001
From: wangting <675591594@qq.com>
Date: 星期五, 18 十月 2024 16:48:17 +0800
Subject: [PATCH] 修改功能权限和UI授权
---
Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue | 29 ++++++++++++--
Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue | 40 +++++++++----------
2 files changed, 43 insertions(+), 26 deletions(-)
diff --git a/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
index fa92987..4bef6c2 100644
--- a/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
@@ -118,9 +118,20 @@
this.defaultExpandKeys = ['root'];
getSysModelAuthTreeMenuByPID(params).then(res => {
console.log(res);
- this.processChildren(res.data.data); // 澶勭悊姣忎釜鑺傜偣
+ let data= [{
+ attributes: {},
+ checked: false,
+ expanded: true,
+ data: "root",
+ childType: 1,
+ icon: 'el-icon-s-home',
+ id: 'root',
+ name:'鍔熻兘妯″潡',
+ children: res.data.data
+ }];
+ this.processChildren(data[0]); // 澶勭悊姣忎釜鑺傜偣
this.uiTreeOption.defaultExpandedKeys = this.defaultExpandKeys;
- this.uiTreeData = res.data.data;
+ this.uiTreeData = data;
this.treeLoading = false;
}).catch(error => {
this.treeLoading = false;
@@ -130,25 +141,15 @@
processChildren(item) {
if (item.children && item.children.length > 0) {
item.children = item.children.map(child => {
- if (child.level < 2) {
- // 榛樿鏍戣妭鐐瑰睍寮�涓ゅ眰鏁堟灉
+ if (!child.childType) {
+ // 榛樿鏍戣妭鐐瑰睍寮�,鏈�瀛愮骇涓嶅睍寮�
this.defaultExpandKeys.push(child.id)
}
- if (child.level == 1) {
- child.icon = 'el-icon-s-promotion';
- child.label = child.data.label + '锛�' + child.data.name + '锛�'
- } else if (child.level == 2) {
- child.icon = 'el-icon-s-order';
- child.label = child.text
- } else if (child.level == 3) {
- child.icon = 'el-icon-office-building';
- child.label = child.text
- } else if (child.level == 4) {
+ child.icon = 'el-icon-s-promotion';
+ if (child.childType == 1) {
child.icon = 'el-icon-document';
- child.label = child.text
- } else if (child.level == 5) {
+ } else if (child.childType == 2) {
child.icon = 'el-icon-s-tools';
- child.label = child.text
}
this.processChildren(child); // 閫掑綊澶勭悊姣忎釜瀛愯妭鐐�
return child; // 鍙繑鍥炲瓙鑺傜偣鐨� attributes
@@ -158,9 +159,6 @@
saveHandler() {
const selectTreeList = this.$refs.uiTree.getCheckedNodes();
const selectParentList = this.$refs.uiTree.getHalfCheckedNodes();
-
- console.log(selectTreeList);
- console.log(selectParentList);
if (selectTreeList.length == 0) {
this.$message.error("璇烽�夋嫨鍔熻兘妯″潡");
@@ -183,12 +181,12 @@
}
})
const data = [...parentData,...formData];
+ data.shift();
const params = {
roleId: this.nodeRow.oid,
roleData: data
}
saveRoleRight(params).then(res => {
- console.log(res);
if (res.data.code === 200) {
this.$message.success("鎺堟潈鎴愬姛");
}
diff --git a/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue
index d387f92..4214755 100644
--- a/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/authority/ui/uiAuthorization/index.vue
@@ -111,7 +111,6 @@
this.getTypeList();
},
methods: {
-
getTreeList() {
const loading = this.$loading({});
gridRoles().then(res => {
@@ -173,14 +172,12 @@
if (obj.checked === true) {
result.push(obj.oid);
}
-
// 濡傛灉鏈� children锛屽垯缁х画閬嶅巻
if (obj.children && obj.children.length > 0) {
obj.children.forEach(child => {
this.findCheckedOids(child, result);
});
}
-
return result;
},
@@ -188,7 +185,7 @@
processChildren(item) {
if (item.children && item.children.length > 0) {
item.children = item.children.map(child => {
- if (child.level < 2) {
+ if (child.level < 3) {
// 榛樿鏍戣妭鐐瑰睍寮�涓ゅ眰鏁堟灉
this.defaultExpandKeys.push(child.oid)
}
@@ -243,15 +240,37 @@
saveHandler() {
const selectTreeList = this.$refs.uiTree.getCheckedNodes();
+ const selectParentList = this.$refs.uiTree.getHalfCheckedNodes();
if (selectTreeList.length == 0) {
this.$message.error("璇烽�夋嫨鍔熻兘妯″潡");
return;
}
+ const selectTreeData = selectTreeList.map(item => {
+ return {
+ checked: true,
+ expanded: true,
+ data:item.data,
+ level: item.level,
+ oid: item.oid,
+ text: item.text
+ }
+ })
+ const parentData = selectParentList.map(item => {
+ return {
+ checked: false,
+ expanded: true,
+ data:item.data,
+ level: item.level,
+ oid: item.oid,
+ text: item.text
+ }
+ })
+ const data = [...parentData,...selectTreeData];
const formData = {
roleId: this.nodeRow.oid,
type: this.type,
context: this.context,
- selectTreeList: selectTreeList
+ selectTreeList: data
}
authorizedUI(formData).then(res => {
if (res.data.success) {
--
Gitblit v1.9.3