fix(系统设置): 修复系统设置bug
This commit is contained in:
parent
9ce4a23b7b
commit
f9f38e945d
|
@ -189,9 +189,9 @@ export function getUserByProjectByOrg(organizationId: string, projectId: string,
|
|||
}
|
||||
|
||||
// 系统或组织-获取项目下的资源池options
|
||||
export function getPoolOptionsByOrgOrSystem(organizationId?: string) {
|
||||
return MSR.get({
|
||||
export function getPoolOptionsByOrgOrSystem(moduleIds: string[], rganizationId?: string) {
|
||||
return MSR.post({
|
||||
url: orgUrl.getProjectPoolByOrgOrSystemUrl,
|
||||
params: { organizationId },
|
||||
data: { rganizationId, moduleIds },
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import { getPoolOptionsByOrgOrSystem } from '@/api/modules/setting/organizationAndProject';
|
||||
|
||||
const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];
|
||||
const options = ref([]);
|
||||
const fieldNames = { value: 'id', label: 'name' };
|
||||
const props = defineProps<{ organizationId?: string; modelValue: string[] }>();
|
||||
|
@ -22,11 +23,12 @@
|
|||
emit('update:modelValue', v);
|
||||
},
|
||||
});
|
||||
const showPool = computed(() => showPoolModuleIds.some((item) => props.modelValue.includes(item)));
|
||||
|
||||
const loadList = async (id?: string) => {
|
||||
const loadList = async (arr: string[], id?: string) => {
|
||||
try {
|
||||
loading.value = true;
|
||||
options.value = await getPoolOptionsByOrgOrSystem(id);
|
||||
options.value = await getPoolOptionsByOrgOrSystem(arr, id);
|
||||
} catch (error) {
|
||||
options.value = [];
|
||||
// eslint-disable-next-line no-console
|
||||
|
@ -36,6 +38,6 @@
|
|||
}
|
||||
};
|
||||
watchEffect(() => {
|
||||
loadList(props.organizationId);
|
||||
loadList(showPool.value ? props.modelValue : [], props.organizationId);
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
v-if="tableData && tableData?.length > 0"
|
||||
:model-value="allChecked"
|
||||
:indeterminate="allIndeterminate"
|
||||
:disabled="currentInternal || props.disabled"
|
||||
:disabled="systemAdminDisabled"
|
||||
class="mr-[7px]"
|
||||
@change="handleAllAuthChangeByCheckbox"
|
||||
></a-checkbox>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<a-checkbox
|
||||
v-for="item in record.permissions"
|
||||
:key="item.id"
|
||||
:disabled="item.license || currentInternal || props.disabled"
|
||||
:disabled="item.license || systemAdminDisabled"
|
||||
:value="item.id"
|
||||
>{{ t(item.name) }}</a-checkbox
|
||||
>
|
||||
|
@ -44,7 +44,7 @@
|
|||
class="mr-[7px]"
|
||||
:model-value="record.enable"
|
||||
:indeterminate="record.indeterminate"
|
||||
:disabled="currentInternal || props.disabled"
|
||||
:disabled="systemAdminDisabled"
|
||||
@change="(value) => handleRowAuthChange(value, rowIndex)"
|
||||
/>
|
||||
</div>
|
||||
|
@ -79,6 +79,7 @@
|
|||
saveOrgUSetting,
|
||||
} from '@/api/modules/setting/usergroup';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { useUserStore } from '@/store';
|
||||
|
||||
import {
|
||||
type AuthScopeType,
|
||||
|
@ -125,7 +126,7 @@
|
|||
},
|
||||
}
|
||||
);
|
||||
|
||||
const userStore = useUserStore();
|
||||
const systemType = inject<AuthScopeEnum>('systemType');
|
||||
|
||||
const loading = ref(false);
|
||||
|
@ -149,9 +150,22 @@
|
|||
const tableData = ref<AuthTableItem[]>();
|
||||
// 是否可以保存
|
||||
const canSave = ref(false);
|
||||
// 内部用户不可编辑
|
||||
const currentInternal = computed(() => {
|
||||
return props.current.internal;
|
||||
|
||||
// 不可编辑的权限
|
||||
const systemAdminDisabled = computed(() => {
|
||||
const adminArr = ['admin', 'org_admin', 'project_admin'];
|
||||
const memberArr = ['member', 'org_member', 'project_member'];
|
||||
const { id } = props.current;
|
||||
if (adminArr.includes(id)) {
|
||||
// 系统管理员,组织管理员,项目管理员都不可编辑
|
||||
return true;
|
||||
}
|
||||
if (memberArr.includes(id)) {
|
||||
// 系统管理员角色可以编辑 系统成员 组织成员 项目成员
|
||||
return !userStore.isAdmin;
|
||||
}
|
||||
|
||||
return props.disabled;
|
||||
});
|
||||
|
||||
const dataSpanMethod = (data: {
|
||||
|
|
|
@ -292,7 +292,7 @@
|
|||
} from '@/api/modules/setting/usergroup';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import { useAppStore } from '@/store';
|
||||
import { useAppStore, useUserStore } from '@/store';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
|
@ -306,6 +306,7 @@
|
|||
(e: 'addUserSuccess', id: string): void;
|
||||
}>();
|
||||
const appStore = useAppStore();
|
||||
const userStore = useUserStore();
|
||||
const { openModal } = useModal();
|
||||
|
||||
const systemType = inject<AuthScopeEnum>('systemType');
|
||||
|
|
|
@ -56,7 +56,7 @@ export default {
|
|||
'system.organization.updateOrganizationSuccess': 'Update organization success',
|
||||
'system.organization.createProject': 'Create project',
|
||||
'system.organization.subordinateOrg': 'Subordinate organization',
|
||||
'system.project.revokeDeleteTitle': 'Confirm revoke {name} ?',
|
||||
'system.project.revokeDeleteTitle': 'Confirm revoke delete {name} ?',
|
||||
'system.project.enableTitle': 'Start project',
|
||||
'system.project.endTitle': 'Close project',
|
||||
'system.project.enableContent': 'The project after opening is displayed in the organization switching list',
|
||||
|
|
|
@ -51,7 +51,7 @@ export default {
|
|||
'system.organization.updateOrganizationSuccess': '更新组织成功',
|
||||
'system.organization.createProject': '创建项目',
|
||||
'system.organization.subordinateOrg': '所属组织',
|
||||
'system.project.revokeDeleteTitle': '确认恢复 {name} 这个项目吗?',
|
||||
'system.project.revokeDeleteTitle': '确认撤销删除 {name} 这个项目吗?',
|
||||
'system.project.enableTitle': '开启项目',
|
||||
'system.project.endTitle': '关闭项目',
|
||||
'system.project.enableContent': '开启后的项目展示在项目切换列表',
|
||||
|
|
|
@ -347,8 +347,8 @@
|
|||
openModal({
|
||||
type: 'error',
|
||||
cancelText: t('common.cancel'),
|
||||
title: t('system.project.revokeDeleteTitle', { name: record.name }),
|
||||
content: t('system.project.enableContent'),
|
||||
title: t('system.project.revokeDeleteTitle', { name: characterLimit(record.name) }),
|
||||
content: '',
|
||||
okText: t('common.revokeDelete'),
|
||||
onBeforeOk: async () => {
|
||||
try {
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
{
|
||||
title: 'system.project.name',
|
||||
dataIndex: 'name',
|
||||
showTooltip: true,
|
||||
},
|
||||
{
|
||||
title: 'system.organization.status',
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<template #revokeDelete="{ record }">
|
||||
<a-tooltip background-color="#FFFFFF">
|
||||
<template #content>
|
||||
<span>
|
||||
<div class="flex flex-row">
|
||||
<span class="text-[var(--color-text-1)]">{{
|
||||
t('system.organization.revokeDeleteToolTip', { count: record.remainDayCount })
|
||||
}}</span>
|
||||
|
@ -13,7 +13,7 @@
|
|||
@click="handleRevokeDelete(record)"
|
||||
>{{ t('common.revokeDelete') }}</MsButton
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<MsIcon v-if="record.deleted" type="icon-icon_alarm_clock" class="ml-[4px] text-[rgb(var(--danger-6))]" />
|
||||
</a-tooltip>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<template #revokeDelete="{ record }">
|
||||
<a-tooltip background-color="#FFFFFF">
|
||||
<template #content>
|
||||
<span>
|
||||
<div class="flex flex-row">
|
||||
<span class="text-[var(--color-text-1)]">{{
|
||||
t('system.project.revokeDeleteToolTip', { count: record.remainDayCount })
|
||||
}}</span>
|
||||
|
@ -13,7 +13,7 @@
|
|||
@click="handleRevokeDelete(record)"
|
||||
>{{ t('common.revokeDelete') }}</MsButton
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<MsIcon v-if="record.deleted" type="icon-icon_alarm_clock" class="ml-[4px] text-[rgb(var(--danger-6))]" />
|
||||
</a-tooltip>
|
||||
|
@ -332,8 +332,8 @@
|
|||
openModal({
|
||||
type: 'error',
|
||||
cancelText: t('common.cancel'),
|
||||
title: t('system.project.revokeDeleteTitle', { name: record.name }),
|
||||
content: t('system.project.enableContent'),
|
||||
title: t('system.project.revokeDeleteTitle', { name: characterLimit(record.name) }),
|
||||
content: '',
|
||||
okText: t('common.revokeDelete'),
|
||||
onBeforeOk: async () => {
|
||||
try {
|
||||
|
|
|
@ -57,7 +57,6 @@ export default {
|
|||
'system.organization.subordinateOrg': 'Subordinate organization',
|
||||
'system.organization.searchUserPlaceholder': 'Search by name/email/phone number',
|
||||
'system.organization.searchIndexPlaceholder': 'Search by name/id',
|
||||
'system.project.revokeDeleteTitle': 'Confirm revoke {name} ?',
|
||||
'system.project.enableTitle': 'Start project',
|
||||
'system.project.endTitle': 'Close project',
|
||||
'system.project.enableContent': 'The project after opening is displayed in the organization switching list',
|
||||
|
|
|
@ -52,8 +52,7 @@ export default {
|
|||
'system.organization.createProject': '创建项目',
|
||||
'system.organization.subordinateOrg': '所属组织',
|
||||
'system.organization.searchIndexPlaceholder': '通过ID或名称搜索',
|
||||
'system.organization.searchUserPlaceholder': '通过名称/邮箱/手机号搜索',
|
||||
'system.project.revokeDeleteTitle': '确认恢复 {name} 这个项目吗?',
|
||||
'system.organization.searchUserPlaceholder': '通过名称/邮箱/手机搜索',
|
||||
'system.project.enableTitle': '开启项目',
|
||||
'system.project.endTitle': '关闭项目',
|
||||
'system.project.enableContent': '开启后的项目展示在项目切换列表',
|
||||
|
|
Loading…
Reference in New Issue