From 87f2d3dad3e5b92549bebc71ec8fd2b98492e9d9 Mon Sep 17 00:00:00 2001
From: anhc <3442943606@qq.com>
Date: Fri, 8 Jul 2022 18:09:17 +0800
Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E7=AE=A1=E7=90=86=E4=B8=AD?=
=?UTF-8?q?=E5=BF=83=E6=96=B0=E5=BB=BA=E8=A7=92=E8=89=B2=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=86=85=E5=AE=B9=E9=98=B6=E6=AE=B5=E6=8F=90?=
=?UTF-8?q?=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/views/role/RoleUpdate.vue | 196 +++++++++++++++++-
1 file changed, 194 insertions(+), 2 deletions(-)
diff --git a/com.actionsoft.apps.coe.pal.cooperation/src/views/role/RoleUpdate.vue b/com.actionsoft.apps.coe.pal.cooperation/src/views/role/RoleUpdate.vue
index 5acfb4d..958a541 100644
--- a/com.actionsoft.apps.coe.pal.cooperation/src/views/role/RoleUpdate.vue
+++ b/com.actionsoft.apps.coe.pal.cooperation/src/views/role/RoleUpdate.vue
@@ -35,7 +35,38 @@
全部
-
+
+
+
全部
+
+
+
+
+ {{node.label}}
+
+
+ {{dataAction.value}}
+
+
+
+
+
+
@@ -137,7 +168,18 @@
roleName: [
{required: true,message: '必填',trigger: 'blur'}
]
- }
+ },
+ isOlderVersion:true,
+ treeProps: {
+ label: 'name',
+ isLeaf: 'leaf'
+ },
+ treeChecked: [],
+ multiple:true,
+ categorys:'',
+ pid: '',
+ dataActionPerm: {},
+ dataActionPermOpts:[],
}
},
mounted() {
@@ -167,6 +209,7 @@
if (ro.result == 'ok') {
const data = ro.data;
that.wsId = data.wsId;
+ that.isOlderVersion = data.isOlderVersion;
that.roleForm.roleName = data.roleName;
that.roleForm.roleDesc = data.roleDesc;
that.roleForm.roleType = data.roleType;
@@ -175,6 +218,9 @@
that.roleForm.isAllDataPerm = data.isAllDataPerm;
that.roleForm.isAllAppPerm = data.isAllAppPerm;
that.roleForm.dataPerm = data.dataPerm;
+ that.dataActionPermOpts = data.dataActionPermOpts;
+ that.dataActionPerm = data.dataActionPerm;
+ // that.treeChecked = data.dataPerm;
that.roleForm.appPerm = data.appPerm;
that.roleForm.actionPerm = data.actionPerm;
that.roleForm.dataPermText = data.dataPermText;
@@ -275,6 +321,17 @@
appPerm: that.roleForm.appPerm,
actionPerm: that.roleForm.actionPerm
};
+ if (!that.isOlderVersion){
+ let dataPermArr = [];
+ Object.keys(that.dataActionPerm).forEach((key) => {
+ let obj = {
+ id:key,
+ actionPerm: that.dataActionPerm[key].join(",")
+ }
+ dataPermArr.push(obj);
+ })
+ data.dataPerm = dataPermArr;
+ }
// 保存
that.loading = true;
that.buttonDisabled = true;
@@ -285,6 +342,9 @@
data: JSON.stringify(data)
}
};
+
+ // console.log("submit:",data)
+ // console.log("data:",that.roleForm.dataPerm)
awsuiAxios.post(params).then(function (ro) {
that.loading = false;
if (ro.result == 'ok') {
@@ -318,6 +378,138 @@
initRoleSidebar() {
this.drawerBodyHeight = (document.documentElement.clientHeight) - 53 - 1 - 32 - parseInt(this.footerHeight) + 'px';
},
+ openNode(obj, node, tree) {// 打开一只模型文件
+
+ },
+ expandNode(obj, node, tree) {// 展开节点
+
+ },
+ closeNode(obj, node, tree) {// 关闭时清空,下次展开重新请求动态加载
+ node.childNodes = [];
+ node.loaded = false;
+ },
+ checkedNode(data, checked, subChecked) {// 节点选中事件
+ // 获取所有子节点
+ const that = this;
+ const params = {
+ url:'jd',
+ data:{
+ cmd: 'com.actionsoft.apps.coe.pal.cooperation_repository_all_childern_data_query',
+ wsId: that.wsId,
+ teamId: that.teamId,
+ pid: data.id
+ }
+ };
+ awsuiAxios.post(params).then(function (ro) {
+ // debugger;
+ const childVerIds = ro.data;
+ const currVerId = data.versionId;
+ if (checked) {// 选中
+ const checkedVerIds = that.roleForm.dataPerm;
+
+ if (checkedVerIds.indexOf(currVerId) == -1) {
+ checkedVerIds.push(currVerId);
+ Object.assign(that.dataActionPerm,{[currVerId]:[]})
+ }
+ for (let i = 0; i < childVerIds.length; i++) {
+ if (checkedVerIds.indexOf(childVerIds[i]) == -1) {
+ checkedVerIds.push(childVerIds[i]);
+ Object.assign(that.dataActionPerm,{[childVerIds[i]]:[]})
+ }
+ }
+ that.$refs.tree.setCheckedKeys(checkedVerIds);
+
+ } else {// 取消选中
+ const checkedVerIds = that.roleForm.dataPerm;
+ const checkedActions = that.dataActionPerm;
+ const tempArr = [];
+ const tempActions = {};
+ for (let i = 0; i < checkedVerIds.length; i++) {
+ if (checkedVerIds[i] != currVerId && childVerIds.indexOf(checkedVerIds[i]) == -1) {
+ tempArr.push(checkedVerIds[i]);
+ }
+ }
+ Object.keys(checkedActions).forEach((key) => {
+ if (key != currVerId && childVerIds.indexOf(key) == -1) {
+ Object.assign(tempActions,{[key]:checkedActions[key]})
+ }
+ })
+
+ that.roleForm.dataPerm = tempArr;
+ that.dataActionPerm = tempActions;
+ that.$refs.tree.setCheckedKeys([]);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ data.dataActionPerm = []
+ },
+ loadNode(node, resolve) {
+ const that = this;
+ that.loading = true;
+ const data = {
+ url:'jd',
+ data:{
+ cmd: 'com.actionsoft.apps.coe.pal.cooperation_repository_tree_component_subjson',
+ wsId: that.wsId,
+ teamId: that.teamId,
+ categorys: that.categorys,
+ pid: ''
+ }
+ };
+ if (node.level === 0) {
+ // 获取根目录
+ data.data.pid = that.pid;
+ } else {
+ // 获取其他目录
+ data.data.pid = node.data.id;
+ }
+ // 查询数据
+ awsuiAxios.post(data).then(function (ro) {
+ let data = ro.data;
+ for (let i = 0; i < data.length; i++) {
+ let item = data[i];
+ // console.log("@@",that.dataActionPerm)
+ // console.log("@@",item.versionId)
+ // console.log("@@",that.dataActionPerm[item.versionId])
+ if (that.dataActionPerm[item.versionId] != undefined){
+ // console.log("join")
+ Object.assign(item,{dataActionPerm:that.dataActionPerm[item.versionId]})
+ }else {
+ Object.assign(item,{dataActionPerm:[]})
+ }
+ }
+ // console.log("data",data)
+ resolve(data);
+ that.loading = false;
+ if (node.level == 0 && ro.data.length > 0) {
+ const tree = that.$refs.tree;
+ tree.getNode(ro.data[0].id).expand();
+ setTimeout(function(){
+ const childNode = tree.getNode(ro.data[0].id).childNodes[0];
+ if (childNode != null) {
+ childNode.expand();
+ }
+ }, 500);
+ }
+ }).catch(error=>{
+ console.log(error);
+ })
+ },
+ handleCheckedActionChange(node){
+ // console.log("changeChecked",node);
+ const that = this;
+ setTimeout(()=>{
+ if (that.dataActionPerm[node.data.versionId] != undefined){
+ that.dataActionPerm[node.data.versionId] = node.data.dataActionPerm;
+ }
+ },100)
+
+ },
+ test(node){
+ console.log("test",node);
+
+ }
},
watch: {