小组管理中心新建角色权限相关内容阶段提交
This commit is contained in:
parent
b14a45e11c
commit
87f2d3dad3
@ -35,7 +35,38 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<awsui-checkbox size="small" v-model="roleForm.isAllDataPerm">全部</awsui-checkbox>
|
<awsui-checkbox size="small" v-model="roleForm.isAllDataPerm">全部</awsui-checkbox>
|
||||||
<div class="awsui-form-item__content">
|
<div class="awsui-form-item__content">
|
||||||
<awsui-input class="role_data_perm_textarea" type="textarea" v-model="roleForm.isAllDataPerm ? '全部' : roleForm.dataPermText" readonly placeholder="请选择" @click.native="openDataPermTreeDlg"></awsui-input>
|
<awsui-input v-if="isOlderVersion" class="role_data_perm_textarea" type="textarea" v-model="roleForm.isAllDataPerm ? '全部' : roleForm.dataPermText" readonly placeholder="请选择" @click.native="openDataPermTreeDlg"></awsui-input>
|
||||||
|
<div v-else style="height: 300px;overflow: auto;border: 1px solid #f2f2f2;">
|
||||||
|
<div v-if="roleForm.isAllDataPerm"> 全部</div>
|
||||||
|
<div v-else class="tree">
|
||||||
|
<el-tree
|
||||||
|
ref="tree"
|
||||||
|
:props="treeProps"
|
||||||
|
:default-checked-keys="roleForm.dataPerm"
|
||||||
|
:expand-on-click-node=false
|
||||||
|
:highlight-current=true
|
||||||
|
empty-text=""
|
||||||
|
@node-click="openNode"
|
||||||
|
@node-expand="expandNode"
|
||||||
|
@node-collapse="closeNode"
|
||||||
|
@check-change="checkedNode"
|
||||||
|
check-strictly
|
||||||
|
:show-checkbox=multiple
|
||||||
|
node-key="id"
|
||||||
|
lazy
|
||||||
|
:load="loadNode">
|
||||||
|
<span slot-scope="{node, data}" style="display: flex;width: 100%">
|
||||||
|
<i class="awsui-iconfont tree-content-icon tree-content-icon-padding" :style="{'color': node.data.icon.color}" v-html="node.data.icon.icon"></i>
|
||||||
|
<span>{{node.label}}</span>
|
||||||
|
<span v-if="node.level > 1" class="action-checkBox" style="flex: 1;text-align: right" @click="handleCheckedActionChange(node)">
|
||||||
|
<el-checkbox-group v-model="node.data.dataActionPerm">
|
||||||
|
<el-checkbox v-for="dataAction in dataActionPermOpts" :label="dataAction.label" :key="dataAction.label" :disabled="!node.checked" >{{dataAction.value}}</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</el-tree>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<awsui-form-item label="操作权限">
|
<awsui-form-item label="操作权限">
|
||||||
@ -137,7 +168,18 @@
|
|||||||
roleName: [
|
roleName: [
|
||||||
{required: true,message: '必填',trigger: 'blur'}
|
{required: true,message: '必填',trigger: 'blur'}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
isOlderVersion:true,
|
||||||
|
treeProps: {
|
||||||
|
label: 'name',
|
||||||
|
isLeaf: 'leaf'
|
||||||
|
},
|
||||||
|
treeChecked: [],
|
||||||
|
multiple:true,
|
||||||
|
categorys:'',
|
||||||
|
pid: '',
|
||||||
|
dataActionPerm: {},
|
||||||
|
dataActionPermOpts:[],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@ -167,6 +209,7 @@
|
|||||||
if (ro.result == 'ok') {
|
if (ro.result == 'ok') {
|
||||||
const data = ro.data;
|
const data = ro.data;
|
||||||
that.wsId = data.wsId;
|
that.wsId = data.wsId;
|
||||||
|
that.isOlderVersion = data.isOlderVersion;
|
||||||
that.roleForm.roleName = data.roleName;
|
that.roleForm.roleName = data.roleName;
|
||||||
that.roleForm.roleDesc = data.roleDesc;
|
that.roleForm.roleDesc = data.roleDesc;
|
||||||
that.roleForm.roleType = data.roleType;
|
that.roleForm.roleType = data.roleType;
|
||||||
@ -175,6 +218,9 @@
|
|||||||
that.roleForm.isAllDataPerm = data.isAllDataPerm;
|
that.roleForm.isAllDataPerm = data.isAllDataPerm;
|
||||||
that.roleForm.isAllAppPerm = data.isAllAppPerm;
|
that.roleForm.isAllAppPerm = data.isAllAppPerm;
|
||||||
that.roleForm.dataPerm = data.dataPerm;
|
that.roleForm.dataPerm = data.dataPerm;
|
||||||
|
that.dataActionPermOpts = data.dataActionPermOpts;
|
||||||
|
that.dataActionPerm = data.dataActionPerm;
|
||||||
|
// that.treeChecked = data.dataPerm;
|
||||||
that.roleForm.appPerm = data.appPerm;
|
that.roleForm.appPerm = data.appPerm;
|
||||||
that.roleForm.actionPerm = data.actionPerm;
|
that.roleForm.actionPerm = data.actionPerm;
|
||||||
that.roleForm.dataPermText = data.dataPermText;
|
that.roleForm.dataPermText = data.dataPermText;
|
||||||
@ -275,6 +321,17 @@
|
|||||||
appPerm: that.roleForm.appPerm,
|
appPerm: that.roleForm.appPerm,
|
||||||
actionPerm: that.roleForm.actionPerm
|
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.loading = true;
|
||||||
that.buttonDisabled = true;
|
that.buttonDisabled = true;
|
||||||
@ -285,6 +342,9 @@
|
|||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// console.log("submit:",data)
|
||||||
|
// console.log("data:",that.roleForm.dataPerm)
|
||||||
awsuiAxios.post(params).then(function (ro) {
|
awsuiAxios.post(params).then(function (ro) {
|
||||||
that.loading = false;
|
that.loading = false;
|
||||||
if (ro.result == 'ok') {
|
if (ro.result == 'ok') {
|
||||||
@ -318,6 +378,138 @@
|
|||||||
initRoleSidebar() {
|
initRoleSidebar() {
|
||||||
this.drawerBodyHeight = (document.documentElement.clientHeight) - 53 - 1 - 32 - parseInt(this.footerHeight) + 'px';
|
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: {
|
watch: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user