fix: 用户组权限勾选逻辑修改

This commit is contained in:
RubyLiu 2024-01-31 20:26:27 +08:00 committed by 刘瑞斌
parent a7bc73fc4a
commit c01ba09c11
10 changed files with 49 additions and 18 deletions

View File

@ -73,6 +73,11 @@
const checkIsLogin = async () => { const checkIsLogin = async () => {
const isLogin = await userStore.isLogin(); const isLogin = await userStore.isLogin();
const isLoginPage = route.name === 'login'; const isLoginPage = route.name === 'login';
if (isLoginPage && isLogin) {
//
const currentRouteName = getFirstRouteNameByPermission(router.getRoutes());
router.push({ name: currentRouteName });
}
if (isLogin && appStore.currentProjectId && appStore.currentProjectId !== 'no_such_project') { if (isLogin && appStore.currentProjectId && appStore.currentProjectId !== 'no_such_project') {
// //
try { try {
@ -89,11 +94,6 @@
console.log(err); console.log(err);
} }
} }
if (isLoginPage && isLogin) {
//
const currentRouteName = getFirstRouteNameByPermission(router.getRoutes());
router.push({ name: currentRouteName });
}
}; };
// //
const getPublicKey = async () => { const getPublicKey = async () => {

View File

@ -361,8 +361,15 @@
} }
} else { } else {
// //
const preStr = currentValue.split(':')[0];
const postStr = currentValue.split(':')[1];
if (postStr === 'READ') {
//
record.perChecked = record.perChecked.filter((item) => !item.includes(preStr));
} else {
record.perChecked.splice(record.perChecked.indexOf(currentValue), 1); record.perChecked.splice(record.perChecked.indexOf(currentValue), 1);
} }
}
}; };
// change // change
@ -483,5 +490,11 @@
:deep(.arco-table-th-title) { :deep(.arco-table-th-title) {
width: 100%; width: 100%;
} }
:deep(.arco-checkbox-indeterminate) {
.arco-checkbox-icon {
border-color: rgb(var(--primary-5));
background: rgb(var(--primary-1));
}
}
} }
</style> </style>

View File

@ -314,7 +314,7 @@ const Setting: AppRouteRecordRaw = {
component: () => import('@/views/setting/organization/log/index.vue'), component: () => import('@/views/setting/organization/log/index.vue'),
meta: { meta: {
locale: 'menu.settings.organization.log', locale: 'menu.settings.organization.log',
roles: ['*'], roles: ['ORGANIZATION_LOG:READ'],
isTopMenu: true, isTopMenu: true,
}, },
}, },

View File

@ -56,7 +56,7 @@
</template> </template>
</a-checkbox-group> </a-checkbox-group>
</a-form-item> </a-form-item>
<a-form-item field="resourcePool" :label="t('system.project.resourcePool')"> <a-form-item v-if="showPool" field="resourcePool" :label="t('system.project.resourcePool')">
<MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="currentOrgId" /> <MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="currentOrgId" />
</a-form-item> </a-form-item>
<a-form-item field="description" :label="t('system.organization.description')"> <a-form-item field="description" :label="t('system.organization.description')">
@ -137,6 +137,10 @@
(e: 'cancel', shouldSearch: boolean): void; (e: 'cancel', shouldSearch: boolean): void;
}>(); }>();
const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'];
const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];
const form = reactive<CreateOrUpdateSystemProjectParams>({ const form = reactive<CreateOrUpdateSystemProjectParams>({
name: '', name: '',
userIds: [], userIds: [],
@ -144,10 +148,11 @@
description: '', description: '',
resourcePoolIds: [], resourcePoolIds: [],
enable: true, enable: true,
moduleIds: ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'], moduleIds: allModuleIds,
}); });
const currentVisible = ref(props.visible); const currentVisible = ref(props.visible);
const showPool = computed(() => showPoolModuleIds.some((item) => form.moduleIds?.includes(item)));
const isXpack = computed(() => { const isXpack = computed(() => {
return licenseStore.hasLicense(); return licenseStore.hasLicense();
@ -163,7 +168,7 @@
form.organizationId = currentOrgId.value; form.organizationId = currentOrgId.value;
form.description = ''; form.description = '';
form.enable = true; form.enable = true;
form.moduleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest']; form.moduleIds = allModuleIds;
form.resourcePoolIds = []; form.resourcePoolIds = [];
}; };
const handleCancel = (shouldSearch: boolean) => { const handleCancel = (shouldSearch: boolean) => {

View File

@ -16,7 +16,7 @@
<a-input-search <a-input-search
v-model:model-value="keyword" v-model:model-value="keyword"
allow-clear allow-clear
:placeholder="t('system.user.searchUser')" :placeholder="t('system.organization.searchUserPlaceholder')"
class="w-[230px]" class="w-[230px]"
@search="searchUser" @search="searchUser"
@press-enter="searchUser" @press-enter="searchUser"

View File

@ -20,8 +20,12 @@
<template #revokeDelete="{ record }"> <template #revokeDelete="{ record }">
<a-tooltip background-color="#FFFFFF"> <a-tooltip background-color="#FFFFFF">
<template #content> <template #content>
<span class="text-[var(--color-text-1)]">{{ t('system.project.revokeDeleteToolTip') }}</span> <div class="flex flex-row">
<span class="text-[var(--color-text-1)]">{{
t('system.project.revokeDeleteToolTip', { count: record.remainDayCount })
}}</span>
<MsButton class="ml-[8px]" @click="handleRevokeDelete(record)">{{ t('common.revokeDelete') }}</MsButton> <MsButton class="ml-[8px]" @click="handleRevokeDelete(record)">{{ t('common.revokeDelete') }}</MsButton>
</div>
</template> </template>
<MsIcon v-if="record.deleted" type="icon-icon_alarm_clock" class="ml-[4px] text-[rgb(var(--danger-6))]" /> <MsIcon v-if="record.deleted" type="icon-icon_alarm_clock" class="ml-[4px] text-[rgb(var(--danger-6))]" />
</a-tooltip> </a-tooltip>

View File

@ -59,7 +59,7 @@
</template> </template>
</a-checkbox-group> </a-checkbox-group>
</a-form-item> </a-form-item>
<a-form-item field="resourcePool" :label="t('system.project.resourcePool')"> <a-form-item v-if="showPool" field="resourcePool" :label="t('system.project.resourcePool')">
<MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="form.organizationId" /> <MsSystemPool v-model:modelValue="form.resourcePoolIds" :organization-id="form.organizationId" />
</a-form-item> </a-form-item>
<a-form-item field="description" :label="t('system.organization.description')"> <a-form-item field="description" :label="t('system.organization.description')">
@ -137,17 +137,22 @@
(e: 'cancel', shouldSearch: boolean): void; (e: 'cancel', shouldSearch: boolean): void;
}>(); }>();
const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'];
const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];
const form = reactive<CreateOrUpdateSystemProjectParams>({ const form = reactive<CreateOrUpdateSystemProjectParams>({
name: '', name: '',
userIds: [], userIds: [],
organizationId: '', organizationId: '',
description: '', description: '',
enable: true, enable: true,
moduleIds: ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest'], moduleIds: allModuleIds,
resourcePoolIds: [], resourcePoolIds: [],
}); });
const currentVisible = ref(props.visible); const currentVisible = ref(props.visible);
const showPool = computed(() => showPoolModuleIds.some((item) => form.moduleIds?.includes(item)));
const isXpack = computed(() => { const isXpack = computed(() => {
return licenseStore.hasLicense(); return licenseStore.hasLicense();
@ -159,7 +164,7 @@
form.organizationId = ''; form.organizationId = '';
form.description = ''; form.description = '';
form.enable = true; form.enable = true;
form.moduleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest']; form.moduleIds = allModuleIds;
}; };
const handleCancel = (shouldSearch: boolean) => { const handleCancel = (shouldSearch: boolean) => {
emit('cancel', shouldSearch); emit('cancel', shouldSearch);

View File

@ -181,6 +181,10 @@
title: 'system.organization.createTime', title: 'system.organization.createTime',
dataIndex: 'createTime', dataIndex: 'createTime',
width: 180, width: 180,
sortable: {
sortDirections: ['ascend', 'descend'],
sorter: true,
},
}, },
{ {
title: hasOperationPermission.value ? 'system.organization.operation' : '', title: hasOperationPermission.value ? 'system.organization.operation' : '',

View File

@ -70,7 +70,7 @@ export default {
'system.project.affiliatedOrgPlaceholder': 'Please select affiliated organization', 'system.project.affiliatedOrgPlaceholder': 'Please select affiliated organization',
'system.project.projectAdmin': 'Project administrator', 'system.project.projectAdmin': 'Project administrator',
'system.project.projectAdminPlaceholder': 'The project administrator defaults to the person who created the project', 'system.project.projectAdminPlaceholder': 'The project administrator defaults to the person who created the project',
'system.project.moduleSetting': 'Module setting', 'system.project.moduleSetting': 'Enable module',
'system.project.projectNameRequired': 'Project name cannot be empty', 'system.project.projectNameRequired': 'Project name cannot be empty',
'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list', 'system.project.createTip': 'After the project is enabled, it will be displayed in the project switching list',
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty', 'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',

View File

@ -65,7 +65,7 @@ export default {
'system.project.affiliatedOrgPlaceholder': '请选择所属组织', 'system.project.affiliatedOrgPlaceholder': '请选择所属组织',
'system.project.projectAdmin': '项目管理员', 'system.project.projectAdmin': '项目管理员',
'system.project.projectAdminPlaceholder': '默认选择创建项目人为项目管理员', 'system.project.projectAdminPlaceholder': '默认选择创建项目人为项目管理员',
'system.project.moduleSetting': '模块设置', 'system.project.moduleSetting': '开启模块',
'system.project.projectNameRequired': '项目名称不能为空', 'system.project.projectNameRequired': '项目名称不能为空',
'system.project.createTip': '项目启用后,将展示在项目切换列表', 'system.project.createTip': '项目启用后,将展示在项目切换列表',
'system.project.affiliatedOrgRequired': '所属组织不能为空', 'system.project.affiliatedOrgRequired': '所属组织不能为空',