feat(系统设置): 用户组权限&组织项目权限补充
This commit is contained in:
parent
685e7891c0
commit
4de46b9122
|
@ -390,18 +390,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化数据
|
// 初始化数据
|
||||||
const initData = async (id: string, internal: boolean) => {
|
const initData = async (id: string) => {
|
||||||
try {
|
try {
|
||||||
let res: UserGroupAuthSetting[] = [];
|
let res: UserGroupAuthSetting[] = [];
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
if (systemType === AuthScopeEnum.SYSTEM) {
|
if (systemType === AuthScopeEnum.SYSTEM) {
|
||||||
res = await getGlobalUSetting(id);
|
res = await getGlobalUSetting(id);
|
||||||
} else if (systemType === AuthScopeEnum.ORGANIZATION) {
|
} else if (systemType === AuthScopeEnum.ORGANIZATION) {
|
||||||
if (internal) {
|
|
||||||
res = await getGlobalUSetting(id);
|
|
||||||
} else {
|
|
||||||
res = await getOrgUSetting(id);
|
res = await getOrgUSetting(id);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
res = await getAuthByUserGroup(id);
|
res = await getAuthByUserGroup(id);
|
||||||
}
|
}
|
||||||
|
@ -449,7 +445,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Message.success(t('common.saveSuccess'));
|
Message.success(t('common.saveSuccess'));
|
||||||
initData(props.current.id, props.current.internal);
|
initData(props.current.id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -459,13 +455,13 @@
|
||||||
// 恢复默认值
|
// 恢复默认值
|
||||||
const handleReset = () => {
|
const handleReset = () => {
|
||||||
if (props.current.id) {
|
if (props.current.id) {
|
||||||
initData(props.current.id, props.current.internal);
|
initData(props.current.id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.current.id) {
|
if (props.current.id) {
|
||||||
initData(props.current.id, props.current.internal);
|
initData(props.current.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
</div>
|
</div>
|
||||||
</MsMoreAction>
|
</MsMoreAction>
|
||||||
<MsMoreAction
|
<MsMoreAction
|
||||||
|
v-permission="['ORGANIZATION_USER_ROLE:READ+UPDATE']"
|
||||||
:list="orgMoreAction"
|
:list="orgMoreAction"
|
||||||
@select="(value) => handleMoreAction(value, element.id, AuthScopeEnum.ORGANIZATION)"
|
@select="(value) => handleMoreAction(value, element.id, AuthScopeEnum.ORGANIZATION)"
|
||||||
>
|
>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<template v-if="hasAnyPermission(props.updatePermission || [])" #quickCreate>
|
<template v-if="hasAnyPermission(props.updatePermission || [])" #quickCreate>
|
||||||
<MsConfirmUserSelector :ok-loading="okLoading" v-bind="userSelectorProps" @confirm="handleAddMember" />
|
<MsConfirmUserSelector :ok-loading="okLoading" v-bind="userSelectorProps" @confirm="handleAddMember" />
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ record }">
|
<template v-if="hasAnyPermission(props.updatePermission || [])" #action="{ record }">
|
||||||
<MsRemoveButton
|
<MsRemoveButton
|
||||||
:title="t('system.userGroup.removeName', { name: record.name })"
|
:title="t('system.userGroup.removeName', { name: record.name })"
|
||||||
:sub-title-tip="t('system.userGroup.removeTip')"
|
:sub-title-tip="t('system.userGroup.removeTip')"
|
||||||
|
|
|
@ -25,9 +25,13 @@
|
||||||
<MsUserAdminDiv :is-admin="record.orgCreateUserIsAdmin" :name="record.createUser" />
|
<MsUserAdminDiv :is-admin="record.orgCreateUserIsAdmin" :name="record.createUser" />
|
||||||
</template>
|
</template>
|
||||||
<template #memberCount="{ record }">
|
<template #memberCount="{ record }">
|
||||||
<span class="cursor-pointer text-[rgb(var(--primary-5))]" @click="showUserDrawer(record)">{{
|
<span
|
||||||
record.memberCount
|
v-if="hasAnyPermission(['ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||||
}}</span>
|
class="cursor-pointer text-[rgb(var(--primary-5))]"
|
||||||
|
@click="showUserDrawer(record)"
|
||||||
|
>{{ record.memberCount }}</span
|
||||||
|
>
|
||||||
|
<span v-else>{{ record.memberCount }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<template v-if="record.deleted">
|
<template v-if="record.deleted">
|
||||||
|
@ -103,6 +107,7 @@
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import useModal from '@/hooks/useModal';
|
import useModal from '@/hooks/useModal';
|
||||||
import { useAppStore, useTableStore } from '@/store';
|
import { useAppStore, useTableStore } from '@/store';
|
||||||
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import { UserItem } from '@/models/setting/log';
|
import { UserItem } from '@/models/setting/log';
|
||||||
import { CreateOrUpdateSystemProjectParams, OrgProjectTableItem } from '@/models/setting/system/orgAndProject';
|
import { CreateOrUpdateSystemProjectParams, OrgProjectTableItem } from '@/models/setting/system/orgAndProject';
|
||||||
|
@ -117,6 +122,13 @@
|
||||||
const { openDeleteModal, openModal } = useModal();
|
const { openDeleteModal, openModal } = useModal();
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
const currentOrgId = computed(() => appStore.currentOrgId);
|
const currentOrgId = computed(() => appStore.currentOrgId);
|
||||||
|
const hasOperationPermission = computed(() =>
|
||||||
|
hasAnyPermission([
|
||||||
|
'ORGANIZATION_PROJECT:READ+RECOVER',
|
||||||
|
'ORGANIZATION_PROJECT:READ+UPDATE',
|
||||||
|
'ORGANIZATION_PROJECT:READ+DELETE',
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
|
|
||||||
|
@ -126,39 +138,13 @@
|
||||||
dataIndex: 'num',
|
dataIndex: 'num',
|
||||||
width: 100,
|
width: 100,
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
filterConfig: {
|
|
||||||
multiple: false,
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: t('common.all'),
|
|
||||||
value: 'all',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('common.only'),
|
|
||||||
value: 'only',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.name',
|
title: 'system.organization.name',
|
||||||
revokeDeletedSlot: 'revokeDelete',
|
revokeDeletedSlot: 'revokeDelete',
|
||||||
editType: ColumnEditTypeEnum.INPUT,
|
editType: hasAnyPermission(['ORGANIZATION_PROJECT:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined,
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
showTooltip: true,
|
showTooltip: true,
|
||||||
filterConfig: {
|
|
||||||
multiple: false,
|
|
||||||
options: [
|
|
||||||
{
|
|
||||||
label: t('common.all'),
|
|
||||||
value: 'all',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('common.only'),
|
|
||||||
value: 'only',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.member',
|
title: 'system.organization.member',
|
||||||
|
@ -201,11 +187,11 @@
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.operation',
|
title: hasOperationPermission.value ? 'system.organization.operation' : '',
|
||||||
slotName: 'operation',
|
slotName: 'operation',
|
||||||
dataIndex: 'operation',
|
dataIndex: 'operation',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 230,
|
width: hasOperationPermission.value ? 230 : 50,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,22 @@
|
||||||
<MsUserAdminDiv :is-admin="record.projectCreateUserIsAdmin" :name="record.createUser" />
|
<MsUserAdminDiv :is-admin="record.projectCreateUserIsAdmin" :name="record.createUser" />
|
||||||
</template>
|
</template>
|
||||||
<template #memberCount="{ record }">
|
<template #memberCount="{ record }">
|
||||||
<span class="primary-color" @click="showUserDrawer(record)">{{ record.memberCount }}</span>
|
<span
|
||||||
|
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||||
|
class="primary-color"
|
||||||
|
@click="showUserDrawer(record)"
|
||||||
|
>{{ record.memberCount }}</span
|
||||||
|
>
|
||||||
|
<span v-else>{{ record.memberCount }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #projectCount="{ record }">
|
<template #projectCount="{ record }">
|
||||||
<span class="primary-color" @click="showProjectDrawer(record)">{{ record.projectCount }}</span>
|
<span
|
||||||
|
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||||
|
class="primary-color"
|
||||||
|
@click="showProjectDrawer(record)"
|
||||||
|
>{{ record.projectCount }}</span
|
||||||
|
>
|
||||||
|
<span v-else>{{ record.projectCount }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<template v-if="record.deleted">
|
<template v-if="record.deleted">
|
||||||
|
@ -43,12 +55,14 @@
|
||||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showOrganizationModal(record)">{{
|
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showOrganizationModal(record)">{{
|
||||||
t('common.edit')
|
t('common.edit')
|
||||||
}}</MsButton>
|
}}</MsButton>
|
||||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ']" @click="showAddUserModal(record)">{{
|
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" @click="showAddUserModal(record)">{{
|
||||||
t('system.organization.addMember')
|
t('system.organization.addMember')
|
||||||
}}</MsButton>
|
}}</MsButton>
|
||||||
<MsButton v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ']" @click="handleEnableOrDisableOrg(record, false)">{{
|
<MsButton
|
||||||
t('common.end')
|
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']"
|
||||||
}}</MsButton>
|
@click="handleEnableOrDisableOrg(record, false)"
|
||||||
|
>{{ t('common.end') }}</MsButton
|
||||||
|
>
|
||||||
<MsTableMoreAction
|
<MsTableMoreAction
|
||||||
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']"
|
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+DELETE']"
|
||||||
:list="tableActions"
|
:list="tableActions"
|
||||||
|
@ -118,6 +132,13 @@
|
||||||
const currentOrganizationId = ref('');
|
const currentOrganizationId = ref('');
|
||||||
const currentUpdateOrganization = ref<CreateOrUpdateSystemOrgParams>();
|
const currentUpdateOrganization = ref<CreateOrUpdateSystemOrgParams>();
|
||||||
const { openDeleteModal, openModal } = useModal();
|
const { openDeleteModal, openModal } = useModal();
|
||||||
|
const hasOperationPermission = computed(() =>
|
||||||
|
hasAnyPermission([
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+RECOVER',
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE',
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+DELETE',
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
const organizationColumns: MsTableColumn = [
|
const organizationColumns: MsTableColumn = [
|
||||||
{
|
{
|
||||||
|
@ -164,11 +185,11 @@
|
||||||
width: 180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.operation',
|
title: hasOperationPermission.value ? 'system.organization.operation' : '',
|
||||||
slotName: 'operation',
|
slotName: 'operation',
|
||||||
dataIndex: 'operation',
|
dataIndex: 'operation',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 230,
|
width: hasOperationPermission.value ? 230 : 50,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,13 @@
|
||||||
<MsUserAdminDiv :is-admin="record.projectCreateUserIsAdmin" :name="record.createUser" />
|
<MsUserAdminDiv :is-admin="record.projectCreateUserIsAdmin" :name="record.createUser" />
|
||||||
</template>
|
</template>
|
||||||
<template #memberCount="{ record }">
|
<template #memberCount="{ record }">
|
||||||
<span class="primary-color" @click="showUserDrawer(record)">{{ record.memberCount }}</span>
|
<span
|
||||||
|
v-if="hasAnyPermission(['SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE'])"
|
||||||
|
class="primary-color"
|
||||||
|
@click="showUserDrawer(record)"
|
||||||
|
>{{ record.memberCount }}</span
|
||||||
|
>
|
||||||
|
<span v-else>{{ record.memberCount }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #operation="{ record }">
|
<template #operation="{ record }">
|
||||||
<template v-if="record.deleted">
|
<template v-if="record.deleted">
|
||||||
|
@ -117,6 +123,13 @@
|
||||||
const currentProjectId = ref('');
|
const currentProjectId = ref('');
|
||||||
const currentUpdateProject = ref<CreateOrUpdateSystemProjectParams>();
|
const currentUpdateProject = ref<CreateOrUpdateSystemProjectParams>();
|
||||||
const { openDeleteModal, openModal } = useModal();
|
const { openDeleteModal, openModal } = useModal();
|
||||||
|
const hasOperationPermission = computed(() =>
|
||||||
|
hasAnyPermission([
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+RECOVER',
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+UPDATE',
|
||||||
|
'SYSTEM_ORGANIZATION_PROJECT:READ+DELETE',
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
const organizationColumns: MsTableColumn = [
|
const organizationColumns: MsTableColumn = [
|
||||||
{
|
{
|
||||||
|
@ -167,10 +180,11 @@
|
||||||
width: 180,
|
width: 180,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'system.organization.operation',
|
title: hasOperationPermission.value ? 'system.organization.operation' : '',
|
||||||
slotName: 'operation',
|
slotName: 'operation',
|
||||||
|
dataIndex: 'operation',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 230,
|
width: hasOperationPermission.value ? 230 : 50,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue