新版小组权限添加成员内容调整

This commit is contained in:
anhc 2022-07-07 17:11:04 +08:00
parent 026c89b430
commit feb9c54e2f

View File

@ -12,12 +12,38 @@
:before-close="handleClose">
<!--awsui-dialog标签中的内容都可以自行去控制-->
<div class="text-general-color">
<awsui-form ref="form" :model="form" label-position="top">
<awsui-form ref="form" :model="form" label-position="top" style="padding:0 5px">
<div class="awsui-form-item">
<label class="awsui-form-item__label">成员</label>
<div class="awsui-form-item__content">
<div v-if="isOlderVersion" class="awsui-form-item__content">
<awsui-select filterable v-model="form.userArr" :options="form.userOpts" multiple size="large" key="user"></awsui-select>
</div>
<div v-else>
<div v-loading="userLoading" element-loading-text="拼命加载中">
<div style="height: 200px;overflow: auto;border: 1px solid #f2f2f2;">
<div class="tree">
<el-tree
ref="tree"
:props="treeProps"
:show-checkbox="multiple"
:expand-on-click-node=false
:check-strictly=true
:highlight-current=true
@node-click="openNode"
@node-expand="expandNode"
@node-collapse="closeNode"
node-key="id"
lazy
:load="loadNode">
<span slot-scope="{node, data}">
<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>
</el-tree>
</div>
</div>
</div>
</div>
</div>
<div class="awsui-form-item">
<label class="awsui-form-item__label">角色</label>
@ -79,7 +105,18 @@
roleUpdate: {
visible: false,
roleId: '',
}
},
isOlderVersion: true,
userLoading: false,
treeProps: {
label: 'name',
isLeaf: 'leaf'
},
multiple:true,
addressType: 'user',
highSecurityFilter: 'sysAdmin,auditor' ,// sysAdmin,auditor簿
pid: '',
}
},
methods: {
@ -99,6 +136,7 @@
const data = ro.data;
that.form.roleOpts = data.roleOpts;
that.form.userOpts = data.userOpts;
that.isOlderVersion = data.isOlderVersion;
} else {
that.$message.error(ro.msg);
}
@ -115,6 +153,9 @@
that.form.roleId = '';
that.form.roleOpts = [];
that.buttonDisabled = false;
if (!that.isOlderVersion){
this.$refs.tree.setCheckedNodes([]);
}
},
handleClose(done) {
this.closeDlalog('cancel');
@ -129,6 +170,12 @@
closeDlalog(type) {// /
const that = this;
if (type == 'save') {
if (!that.isOlderVersion){
let nodes = this.$refs.tree.getCheckedNodes();
nodes.forEach((item)=>{
that.form.userArr.push(item.id);
})
}
if (that.form.userArr.length == 0) {
that.$message.error('请选择[成员]');
return;
@ -168,8 +215,11 @@
message: ro.msg,
type: 'warning'
});
that.$emit('cancel');
that.dialogVisible = false;
//
that.clearAllData();
}
}).catch(error=>{
console.log(error);
that.loading = false;
@ -191,7 +241,78 @@
if (result == 'ok') {
this.initData();
}
}
},
openNode(obj, node, tree) {//
},
expandNode(obj, node, tree) {//
},
closeNode(obj, node, tree) {//
node.childNodes = [];
node.loaded = false;
},
loadNode(node, resolve) {// ``
const that = this;
that.userLoading = true;
const data = {
url:'jd',
data:{
cmd: 'com.actionsoft.apps.coe.pal_bpm_org_address_component_subjson',
addressType: that.addressType,
pid: '',
highSecurityFilter: that.highSecurityFilter
}
};
if (node.level === 0) {
//
data.data.pid = that.pid;
data.data.parentType = '';
} else {
//
data.data.pid = node.data.id;
data.data.parentType = node.data.type;
}
//
awsuiAxios.post(data).then(function (ro) {
//
if (that.multiple) {//
const isDept = that.addressType.indexOf('department') > -1;
const isUser = that.addressType.indexOf('user') > -1;
const isRole = that.addressType.indexOf('role') > -1;
const isPosition = that.addressType.indexOf('position') > -1;
for (let i = 0; i < ro.data.length; i++) {
const curr = ro.data[i];
if (curr.type == 'company' || curr.type == 'roleRoot' || curr.type == 'roleGroup' || curr.type == 'positionRoot' || curr.type == 'positionGroup') {
curr.disabled = true;
} else {
if (isDept && curr.type == 'department') curr.disabled = false;
if (!isDept && curr.type == 'department') curr.disabled = true;
if (isUser && curr.type == 'user') curr.disabled = false;
if (!isUser && curr.type == 'user') curr.disabled = true;
if (isRole && curr.type == 'role') curr.disabled = false;
if (!isRole && curr.type == 'role') curr.disabled = true;
if (isPosition && curr.type == 'position') curr.disabled = false;
if (!isPosition && curr.type == 'position') curr.disabled = true;
}
}
}
resolve(ro.data);
that.userLoading = 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);
})
},
},
watch: {
visible(val) {