Merge pull request '🏈优化用户拥有角色集合代码' (#149) from KaneLeung/Admin.NET.Pro:main into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/149
This commit is contained in:
commit
9ac68d671d
@ -363,7 +363,7 @@ public class SysUserService : IDynamicApiController, ITransient
|
||||
// 获取当前用户可用的角色
|
||||
var availableRoles = await _sysRoleService.GetList();
|
||||
// 改变用户分配的角色可分配状态
|
||||
grantedRoles.ForEach(u => u.Disabled = !availableRoles.Any(u => u.Id == u.Id));
|
||||
grantedRoles.ForEach(u => u.Disabled = !availableRoles.Any(e => e.Id == u.Id));
|
||||
// 排除已分配的角色
|
||||
availableRoles = availableRoles.ExceptBy(grantedRoles.Select(u => u.Id), u => u.Id).ToList();
|
||||
return new GrantRoleOutput { GrantedRoles = grantedRoles, AvailableRoles = availableRoles };
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
:disabled="item[props.options.disabled]"
|
||||
:validate-event="false"
|
||||
class="transfer-panel__item"
|
||||
@dblclick="dbClickToRight(item)"
|
||||
>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
@ -54,6 +55,7 @@
|
||||
:disabled="item[props.options.disabled]"
|
||||
:validate-event="false"
|
||||
class="transfer-panel__item"
|
||||
@dblclick="dbClickToLeft(item)"
|
||||
>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
@ -156,6 +158,20 @@ watch(
|
||||
}
|
||||
);
|
||||
|
||||
// 双击左边的变右边
|
||||
const dbClickToRight = (item: any) => {
|
||||
if (item[props.options.value] && item[props.options.disabled] === false) {
|
||||
//取交集
|
||||
let adds = props.leftData.filter((e: any) => item[props.options.value] == e[props.options.value]);
|
||||
//取差集
|
||||
let cuts = props.leftData.filter((e: any) => item[props.options.value] != e[props.options.value]);
|
||||
emits('update:leftData', cuts);
|
||||
emits('update:rightData', props.rightData.concat(adds));
|
||||
emits('right');
|
||||
state.leftChecked = state.leftChecked.filter((e: any) => item[props.options.value] != e);
|
||||
}
|
||||
};
|
||||
|
||||
// 左边中选中的变右边
|
||||
const toRight = () => {
|
||||
if (state.leftChecked?.length > 0) {
|
||||
@ -185,6 +201,20 @@ const allToRight = () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 双击右边的变左边
|
||||
const dbClickToLeft = (item: any) => {
|
||||
if (item[props.options.value] && item[props.options.disabled] === false) {
|
||||
//取交集
|
||||
let adds = props.rightData.filter((e: any) => item[props.options.value] == e[props.options.value]);
|
||||
//取差集
|
||||
let cuts = props.rightData.filter((e: any) => item[props.options.value] != e[props.options.value]);
|
||||
emits('update:leftData', props.leftData.concat(adds));
|
||||
emits('update:rightData', cuts);
|
||||
emits('left');
|
||||
state.rightChecked = state.rightChecked.filter((e: any) => item[props.options.value] != e);
|
||||
}
|
||||
};
|
||||
|
||||
// 右边中选中的变左边
|
||||
const toLeft = () => {
|
||||
if (state.rightChecked?.length > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user