feat: 用户组权限问题调整&应用管理交互调整

This commit is contained in:
RubyLiu 2024-01-29 17:02:39 +08:00 committed by 刘瑞斌
parent 5551cbde21
commit 0d85df85c7
6 changed files with 79 additions and 64 deletions

View File

@ -20,7 +20,7 @@
v-if="tableData && tableData?.length > 0" v-if="tableData && tableData?.length > 0"
:model-value="allChecked" :model-value="allChecked"
:indeterminate="allIndeterminate" :indeterminate="allIndeterminate"
:disabled="currentInternal" :disabled="currentInternal || props.disabled"
class="mr-[7px]" class="mr-[7px]"
@change="handleAllAuthChangeByCheckbox" @change="handleAllAuthChangeByCheckbox"
></a-checkbox> ></a-checkbox>
@ -35,7 +35,7 @@
<a-checkbox <a-checkbox
v-for="item in record.permissions" v-for="item in record.permissions"
:key="item.id" :key="item.id"
:disabled="item.license || currentInternal" :disabled="item.license || currentInternal || props.disabled"
:value="item.id" :value="item.id"
>{{ t(item.name) }}</a-checkbox >{{ t(item.name) }}</a-checkbox
> >
@ -44,7 +44,7 @@
class="mr-[7px]" class="mr-[7px]"
:model-value="record.enable" :model-value="record.enable"
:indeterminate="record.indeterminate" :indeterminate="record.indeterminate"
:disabled="currentInternal" :disabled="currentInternal || props.disabled"
@change="(value) => handleRowAuthChange(value, rowIndex)" @change="(value) => handleRowAuthChange(value, rowIndex)"
/> />
</div> </div>
@ -106,6 +106,7 @@
savePermission?: string[]; savePermission?: string[];
width?: string; width?: string;
showBottom?: boolean; showBottom?: boolean;
disabled?: boolean;
scroll?: { scroll?: {
x?: number | string; x?: number | string;
y?: number | string; y?: number | string;
@ -115,6 +116,7 @@
}>(), }>(),
{ {
showBottom: true, showBottom: true,
disabled: false,
scroll() { scroll() {
return { return {
x: '800px', x: '800px',

View File

@ -402,7 +402,7 @@
title: 'caseManagement.caseReview.tag', title: 'caseManagement.caseReview.tag',
dataIndex: 'tags', dataIndex: 'tags',
isTag: true, isTag: true,
width: 150, width: 300,
}, },
{ {
title: 'caseManagement.caseReview.desc', title: 'caseManagement.caseReview.desc',

View File

@ -11,7 +11,9 @@
ref="tableRef" ref="tableRef"
class="mt-[16px]" class="mt-[16px]"
v-bind="propsRes" v-bind="propsRes"
row-class="cursor-pointer"
:expanded-keys="expandedKeys" :expanded-keys="expandedKeys"
@row-click="handleRowClick"
@expand="expandChange" @expand="expandChange"
v-on="propsEvent" v-on="propsEvent"
> >
@ -231,31 +233,31 @@
</div> </div>
</template> </template>
<template #operation="{ record }"> <template #operation="{ record }">
<!-- 用例 同步缺陷状态 --> <!-- 缺陷 同步缺陷状态 -->
<a-tooltip <div v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']">
v-if="record.type === 'BUG_SYNC' && !allValueMap['BUG_SYNC_SYNC_ENABLE']" <a-tooltip v-if="record.type === 'BUG_SYNC' && !allValueMap['BUG_SYNC_SYNC_ENABLE']" position="tr">
v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']" <template #content>
position="tr" <span>
> {{ t('project.menu.notConfig') }}
<template #content> <span class="cursor-pointer text-[rgb(var(--primary-4))]" @click="showDefectDrawer">{{
<span> t(`project.menu.${record.type}`)
{{ t('project.menu.notConfig') }} }}</span>
<span class="cursor-pointer text-[rgb(var(--primary-4))]" @click="showDefectDrawer">{{ {{ t('project.menu.configure') }}
t(`project.menu.${record.type}`) </span>
}}</span> </template>
{{ t('project.menu.configure') }}
</span> <a-switch
</template> checked-value="true"
<a-switch unchecked-value="false"
checked-value="true" :disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])"
unchecked-value="false" :value="allValueMap['BUG_SYNC_SYNC_ENABLE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])" size="small"
:value="allValueMap['BUG_SYNC_SYNC_ENABLE']" type="line"
size="small" @change="(v: boolean | string| number) => handleMenuStatusChange('BUG_SYNC_SYNC_ENABLE',v as boolean, MenuEnum.bugManagement)"
type="line" />
@change="(v: boolean | string| number) => handleMenuStatusChange('BUG_SYNC_SYNC_ENABLE',v as boolean, MenuEnum.bugManagement)" </a-tooltip>
/> </div>
</a-tooltip>
<a-switch <a-switch
v-if="record.type === 'BUG_SYNC' && allValueMap['BUG_SYNC_SYNC_ENABLE']" v-if="record.type === 'BUG_SYNC' && allValueMap['BUG_SYNC_SYNC_ENABLE']"
checked-value="true" checked-value="true"
@ -266,30 +268,28 @@
@change="(v: boolean | string| number) => handleMenuStatusChange('BUG_SYNC_SYNC_ENABLE',v as boolean, MenuEnum.bugManagement)" @change="(v: boolean | string| number) => handleMenuStatusChange('BUG_SYNC_SYNC_ENABLE',v as boolean, MenuEnum.bugManagement)"
/> />
<!-- 功能测试 同步缺陷 --> <!-- 功能测试 同步缺陷 -->
<a-tooltip <div v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']">
v-if="record.type === 'CASE_RELATED' && !allValueMap['CASE_RELATED_CASE_ENABLE']" <a-tooltip v-if="record.type === 'CASE_RELATED' && !allValueMap['CASE_RELATED_CASE_ENABLE']" position="tr">
v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']" <template #content>
position="tr" <span>
> {{ t('project.menu.notConfig') }}
<template #content> <span class="cursor-pointer text-[rgb(var(--primary-4))]" @click="showDefectDrawer">{{
<span> t(`project.menu.${record.type}`)
{{ t('project.menu.notConfig') }} }}</span>
<span class="cursor-pointer text-[rgb(var(--primary-4))]" @click="showDefectDrawer">{{ {{ t('project.menu.configure') }}
t(`project.menu.${record.type}`) </span>
}}</span> </template>
{{ t('project.menu.configure') }} <a-switch
</span> checked-value="true"
</template> unchecked-value="false"
<a-switch :disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])"
checked-value="true" :value="allValueMap['CASE_RELATED_CASE_ENABLE']"
unchecked-value="false" size="small"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])" type="line"
:value="allValueMap['CASE_RELATED_CASE_ENABLE']" @change="(v: boolean | string| number) => handleMenuStatusChange('CASE_RELATED_CASE_ENABLE',v as boolean, MenuEnum.caseManagement)"
size="small" />
type="line" </a-tooltip>
@change="(v: boolean | string| number) => handleMenuStatusChange('CASE_RELATED_CASE_ENABLE',v as boolean, MenuEnum.caseManagement)" </div>
/>
</a-tooltip>
<a-switch <a-switch
v-if="record.type === 'CASE_RELATED' && allValueMap['CASE_RELATED_CASE_ENABLE']" v-if="record.type === 'CASE_RELATED' && allValueMap['CASE_RELATED_CASE_ENABLE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])" :disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])"
@ -417,14 +417,14 @@
// //
const defaultValueMap = { const defaultValueMap = {
TEST_PLAN_CLEAN_REPORT: '30D', TEST_PLAN_CLEAN_REPORT: '3M',
TEST_PLAN_SHARE_REPORT: '30D', TEST_PLAN_SHARE_REPORT: '1D',
API_CLEAN_REPORT: '30D', API_CLEAN_REPORT: '3M',
API_SHARE_REPORT: '30D', API_SHARE_REPORT: '1D',
UI_CLEAN_REPORT: '30D', UI_CLEAN_REPORT: '3M',
UI_SHARE_REPORT: '30D', UI_SHARE_REPORT: '1D',
PERFORMANCE_TEST_CLEAN_REPORT: '30D', PERFORMANCE_TEST_CLEAN_REPORT: '3M',
PERFORMANCE_TEST_SHARE_REPORT: '30D', PERFORMANCE_TEST_SHARE_REPORT: '1D',
WORKSTATION_SYNC_RULE: true, WORKSTATION_SYNC_RULE: true,
CASE_RELATED: true, CASE_RELATED: true,
CASE_RE_REVIEW: true, CASE_RE_REVIEW: true,
@ -798,6 +798,13 @@
} }
}; };
//
const handleRowClick = (record: TableData, ev: Event) => {
if (record.module) {
expandChange(record);
}
};
onMounted(() => { onMounted(() => {
setLoadListParams({ projectId: currentProjectId.value }); setLoadListParams({ projectId: currentProjectId.value });
fetchData(); fetchData();

View File

@ -28,13 +28,13 @@
</template> </template>
<template #operation="{ record }"> <template #operation="{ record }">
<div class="flex flex-row flex-nowrap"> <div class="flex flex-row flex-nowrap">
<span v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" class="flex flex-row"> <span v-permission="['PROJECT_GROUP:READ+UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="showAuthDrawer(record)">{{ t('project.userGroup.viewAuth') }}</MsButton> <MsButton class="!mr-0" @click="showAuthDrawer(record)">{{ t('project.userGroup.viewAuth') }}</MsButton>
<a-divider v-if="!record.internal" direction="vertical" /> <a-divider v-if="!record.internal" direction="vertical" />
</span> </span>
<MsButton <MsButton
v-if="!record.internal" v-if="!record.internal"
v-permission="['SYSTEM_ORGANIZATIN_PROJECT:READ+UPDATE']" v-permission="['PROJECT_GROUP:READ+UPDATE']"
class="!mr-0" class="!mr-0"
status="danger" status="danger"
@click="handleDelete(record)" @click="handleDelete(record)"
@ -57,6 +57,7 @@
:show-bottom="false" :show-bottom="false"
:scroll="{ x: 800, y: 'calc(100vh - 150px)' }" :scroll="{ x: 800, y: 'calc(100vh - 150px)' }"
:current="currentItem" :current="currentItem"
:disabled="!hasAnyPermission(['PROJECT_GROUP:READ+UPDATE'])"
/> />
<template #footer> <template #footer>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
@ -134,6 +135,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import useModal from '@/hooks/useModal'; import useModal from '@/hooks/useModal';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import { hasAnyPermission } from '@/utils/permission';
import { CurrentUserGroupItem, UserGroupItem } from '@/models/setting/usergroup'; import { CurrentUserGroupItem, UserGroupItem } from '@/models/setting/usergroup';
import { AuthScopeEnum } from '@/enums/commonEnum'; import { AuthScopeEnum } from '@/enums/commonEnum';

View File

@ -45,6 +45,7 @@
:current="currentUserGroupItem" :current="currentUserGroupItem"
:width="bottomWidth" :width="bottomWidth"
:save-permission="['ORGANIZATION_GROUP:READ+UPDATE']" :save-permission="['ORGANIZATION_GROUP:READ+UPDATE']"
:disabled="!hasAnyPermission(['ORGANIZATION_GROUP:READ+UPDATE'])"
/> />
</div> </div>
</div> </div>
@ -67,6 +68,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import { addPixelValues } from '@/utils/css'; import { addPixelValues } from '@/utils/css';
import { hasAnyPermission } from '@/utils/permission';
import { CurrentUserGroupItem } from '@/models/setting/usergroup'; import { CurrentUserGroupItem } from '@/models/setting/usergroup';
import { AuthScopeEnum } from '@/enums/commonEnum'; import { AuthScopeEnum } from '@/enums/commonEnum';

View File

@ -44,7 +44,8 @@
v-if="currentTable === 'auth' && couldShowAuth" v-if="currentTable === 'auth' && couldShowAuth"
:current="currentUserGroupItem" :current="currentUserGroupItem"
:width="bottomWidth" :width="bottomWidth"
:save-permission="['PROJECT_GROUP:READ+UPDATE']" :save-permission="['SYSTEM_USER_ROLE:READ+UPDATE']"
:disabled="!hasAnyPermission(['SYSTEM_USER_ROLE:READ+UPDATE'])"
/> />
</div> </div>
</div> </div>
@ -67,6 +68,7 @@
import { useI18n } from '@/hooks/useI18n'; import { useI18n } from '@/hooks/useI18n';
import { useAppStore } from '@/store'; import { useAppStore } from '@/store';
import { addPixelValues } from '@/utils/css'; import { addPixelValues } from '@/utils/css';
import { hasAnyPermission } from '@/utils/permission';
import { CurrentUserGroupItem } from '@/models/setting/usergroup'; import { CurrentUserGroupItem } from '@/models/setting/usergroup';
import { AuthScopeEnum } from '@/enums/commonEnum'; import { AuthScopeEnum } from '@/enums/commonEnum';