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 isLogin = await userStore.isLogin();
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') {
//
try {
@ -89,11 +94,6 @@
console.log(err);
}
}
if (isLoginPage && isLogin) {
//
const currentRouteName = getFirstRouteNameByPermission(router.getRoutes());
router.push({ name: currentRouteName });
}
};
//
const getPublicKey = async () => {

View File

@ -361,7 +361,14 @@
}
} else {
//
record.perChecked.splice(record.perChecked.indexOf(currentValue), 1);
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);
}
}
};
@ -483,5 +490,11 @@
:deep(.arco-table-th-title) {
width: 100%;
}
:deep(.arco-checkbox-indeterminate) {
.arco-checkbox-icon {
border-color: rgb(var(--primary-5));
background: rgb(var(--primary-1));
}
}
}
</style>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -70,7 +70,7 @@ export default {
'system.project.affiliatedOrgPlaceholder': 'Please select affiliated organization',
'system.project.projectAdmin': 'Project administrator',
'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.createTip': 'After the project is enabled, it will be displayed in the project switching list',
'system.project.affiliatedOrgRequired': 'Affiliated organization cannot be empty',

View File

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