fix(项目管理): 修复应用设置前端权限错误的缺陷

--bug=1037233 --user=王孝刚 【项目管理】项目与权限-应用设置,项目管理员无法编辑应用设置页面信息
https://www.tapd.cn/55049933/s/1476386
This commit is contained in:
wxg0103 2024-03-15 17:42:31 +08:00 committed by Craftsman
parent 7fe9d34b3a
commit 529ba4368c
4 changed files with 42 additions and 43 deletions

View File

@ -10,7 +10,7 @@
:width="680"
:ok-loading="okLoading"
:ok-disabled="okDisabled"
:ok-permission="['PROJECT_APPLICATION_CASE:READ+UPDATE']"
:ok-permission="['PROJECT_APPLICATION_CASE:UPDATE']"
@cancel="handleCancel(false)"
@confirm="handleConfirm"
>

View File

@ -27,7 +27,7 @@
<template #operation="{ record }">
<template v-if="!record.enable">
<div class="flex flex-row">
<span v-permission="['PROJECT_APPLICATION_API:READ+UPDATE']" class="flex flex-row">
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id)">{{
t('common.enable')
}}</MsButton>
@ -44,11 +44,11 @@
</div>
</template>
<template v-else>
<span v-permission="['PROJECT_APPLICATION_API:READ+UPDATE']" class="flex flex-row">
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="showAddRule(record)">{{ t('common.edit') }}</MsButton>
<a-divider direction="vertical" />
</span>
<span v-permission="['PROJECT_APPLICATION_API:READ+UPDATE']" class="flex flex-row">
<span v-permission="['PROJECT_APPLICATION_API:UPDATE']" class="flex flex-row">
<MsButton class="!mr-0" @click="handleEnableOrDisableProject(record.id, false)">{{
t('common.disable')
}}</MsButton>
@ -152,18 +152,18 @@
{
label: 'common.enable',
eventTag: 'batchEnable',
permission: ['PROJECT_APPLICATION_API:READ+UPDATE'],
permission: ['PROJECT_APPLICATION_API:UPDATE'],
},
{
label: 'common.disable',
eventTag: 'batchDisable',
permission: ['PROJECT_APPLICATION_API:READ+UPDATE'],
permission: ['PROJECT_APPLICATION_API:UPDATE'],
},
{
label: 'common.delete',
eventTag: 'batchDelete',
danger: true,
permission: ['PROJECT_APPLICATION_API:READ+UPDATE'],
permission: ['PROJECT_APPLICATION_API:UPDATE'],
},
],
};
@ -471,7 +471,6 @@
}
}
onMounted(() => {
setLoadListParams({ projectId: currentProjectId.value });
fetchData();

View File

@ -10,7 +10,7 @@
:width="680"
:ok-loading="okLoading"
:ok-disabled="okDisabled"
:ok-permission="['PROJECT_APPLICATION_CASE:READ+UPDATE']"
:ok-permission="['PROJECT_APPLICATION_CASE:UPDATE']"
@cancel="handleCancel(false)"
@confirm="handleConfirm"
>

View File

@ -38,7 +38,7 @@
<!-- 测试计划 报告保留时间范围 -->
<MsTimeSelectorVue
v-model="allValueMap['TEST_PLAN_CLEAN_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('TEST_PLAN_CLEAN_REPORT',v,MenuEnum.testPlan)"
/>
</div>
@ -46,7 +46,7 @@
<!-- 测试计划 报告链接有效期 -->
<MsTimeSelectorVue
v-model="allValueMap['TEST_PLAN_SHARE_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('TEST_PLAN_SHARE_REPORT',v,MenuEnum.testPlan)"
/>
</div>
@ -54,7 +54,7 @@
<!-- 同步缺陷 -->
<span>{{ t('project.menu.row2') }}</span>
<div
v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']"
v-permission="['PROJECT_APPLICATION_BUG:UPDATE']"
class="ml-[8px] cursor-pointer text-[rgb(var(--primary-7))]"
@click="showDefectDrawer"
>{{ t('project.menu.BUG_SYNC') }}</div
@ -68,7 +68,7 @@
<!-- 用例 关联需求 -->
<div>{{ t('project.menu.row4') }}</div>
<div
v-permission="['PROJECT_APPLICATION_CASE:READ+UPDATE']"
v-permission="['PROJECT_APPLICATION_CASE:UPDATE']"
class="ml-[8px] cursor-pointer text-[rgb(var(--primary-7))]"
@click="showRelatedCaseDrawer"
>{{ t('project.menu.CASE_RELATED') }}</div
@ -85,7 +85,7 @@
<div v-if="record.type === 'API_CLEAN_REPORT'">
<MsTimeSelectorVue
v-model="allValueMap['API_CLEAN_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('API_CLEAN_REPORT',v,MenuEnum.apiTest)"
/>
</div>
@ -93,7 +93,7 @@
<!--接口测试 报告链接有效期 -->
<MsTimeSelectorVue
v-model="allValueMap['API_SHARE_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('API_SHARE_REPORT',v,MenuEnum.apiTest)"
/>
</div>
@ -104,7 +104,7 @@
:field-names="{ label: 'name', value: 'id' }"
:options="apiPoolOption"
class="w-[120px]"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
@change="(v: SelectValue) => handleMenuStatusChange('API_RESOURCE_POOL_ID',v as string,MenuEnum.apiTest)"
/>
<a-tooltip
@ -129,7 +129,7 @@
v-model="allValueMap['API_SCRIPT_REVIEWER_ID']"
:field-names="{ label: 'name', value: 'id' }"
:options="apiAuditorOption"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
class="w-[120px]"
@change="(v: SelectValue) => handleMenuStatusChange('API_SCRIPT_REVIEWER_ID',v as string,MenuEnum.apiTest)"
/>
@ -157,7 +157,7 @@
</a-input-number>
</div>
<div
v-permission="['PROJECT_APPLICATION_API:READ+UPDATE']"
v-permission="['PROJECT_APPLICATION_API:UPDATE']"
class="ml-[8px] cursor-pointer text-[rgb(var(--primary-7))]"
@click="pushFar"
>{{ t('project.menu.API_ERROR_REPORT_RULE') }}</div
@ -176,7 +176,7 @@
<!--UI 报告保留时间范围 -->
<MsTimeSelectorVue
v-model="allValueMap['UI_CLEAN_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('UI_CLEAN_REPORT',v,MenuEnum.uiTest)"
/>
</div>
@ -184,7 +184,7 @@
<!--UI 报告链接有效期 -->
<MsTimeSelectorVue
v-model="allValueMap['UI_SHARE_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('UI_SHARE_REPORT',v,MenuEnum.uiTest)"
/>
</div>
@ -195,7 +195,7 @@
:field-names="{ label: 'name', value: 'id' }"
:options="uiPoolOption"
class="w-[120px]"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_UI:UPDATE'])"
@change="(v: SelectValue) => handleMenuStatusChange('UI_RESOURCE_POOL_ID',v as string,MenuEnum.uiTest)"
/>
<a-tooltip
@ -218,7 +218,7 @@
<!--性能测试 报告保留时间范围 -->
<MsTimeSelectorVue
v-model="allValueMap['PERFORMANCE_TEST_CLEAN_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('PERFORMANCE_TEST_CLEAN_REPORT',v,MenuEnum.loadTest)"
/>
</div>
@ -226,7 +226,7 @@
<!--性能测试 报告链接有效期 -->
<MsTimeSelectorVue
v-model="allValueMap['PERFORMANCE_TEST_SHARE_REPORT']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:UPDATE'])"
@change="(v: string) => handleMenuStatusChange('PERFORMANCE_TEST_SHARE_REPORT',v,MenuEnum.loadTest)"
/>
</div>
@ -237,7 +237,7 @@
:field-names="{ label: 'name', value: 'id' }"
:options="performanceAuditorOption"
class="w-[120px]"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:UPDATE'])"
@change="(v: SelectValue) => handleMenuStatusChange('PERFORMANCE_TEST_SCRIPT_REVIEWER_ID',v as string,MenuEnum.loadTest)"
/>
<a-tooltip :content="t('project.menu.PERFORMANCE_TEST_SCRIPT_REVIEWER_TIP')" position="right">
@ -252,7 +252,7 @@
</template>
<template #operation="{ record }">
<!-- 缺陷 同步缺陷状态 -->
<div v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']">
<div v-permission="['PROJECT_APPLICATION_BUG:UPDATE']">
<a-tooltip v-if="record.type === 'BUG_SYNC' && !allValueMap['BUG_SYNC_SYNC_ENABLE']" position="tr">
<template #content>
<span>
@ -268,7 +268,7 @@
v-model="allValueMap['BUG_SYNC_SYNC_ENABLE']"
checked-value="true"
unchecked-value="false"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:UPDATE'])"
:value="allValueMap['BUG_SYNC_SYNC_ENABLE']"
size="small"
type="line"
@ -282,13 +282,13 @@
v-model="allValueMap['BUG_SYNC_SYNC_ENABLE']"
checked-value="true"
unchecked-value="false"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:UPDATE'])"
size="small"
type="line"
@change="(v: boolean | string| number) => handleMenuStatusChange('BUG_SYNC_SYNC_ENABLE',v as boolean, MenuEnum.bugManagement)"
/>
<!-- 功能测试 同步缺陷 -->
<div v-permission="['PROJECT_APPLICATION_BUG:READ+UPDATE']">
<div v-permission="['PROJECT_APPLICATION_BUG:UPDATE']">
<a-tooltip v-if="record.type === 'CASE_RELATED' && !allValueMap['CASE_RELATED_CASE_ENABLE']" position="tr">
<template #content>
<span>
@ -302,7 +302,7 @@
<a-switch
checked-value="true"
unchecked-value="false"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:UPDATE'])"
:value="allValueMap['CASE_RELATED_CASE_ENABLE']"
size="small"
type="line"
@ -313,7 +313,7 @@
<a-switch
v-if="record.type === 'CASE_RELATED' && allValueMap['CASE_RELATED_CASE_ENABLE']"
v-model="allValueMap['CASE_RELATED_CASE_ENABLE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_BUG:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -325,7 +325,7 @@
<a-switch
v-if="record.type === 'WORKSTATION_SYNC_RULE'"
v-model="allValueMap['WORKSTATION_SYNC_RULE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -336,7 +336,7 @@
<a-switch
v-if="record.type === 'CASE_PUBLIC'"
v-model="allValueMap['CASE_PUBLIC']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -347,7 +347,7 @@
<a-switch
v-if="record.type === 'CASE_RE_REVIEW'"
v-model="allValueMap['CASE_RE_REVIEW']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_CASE:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -358,7 +358,7 @@
<a-switch
v-if="record.type === 'API_URL_REPEATABLE'"
v-model="allValueMap['API_URL_REPEATABLE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -369,7 +369,7 @@
<a-switch
v-if="record.type === 'API_SYNC_CASE'"
v-model="allValueMap['API_SYNC_CASE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -380,7 +380,7 @@
<a-switch
v-if="record.type === 'PERFORMANCE_TEST_SCRIPT_REVIEWER'"
v-model="allValueMap['PERFORMANCE_TEST_SCRIPT_REVIEWER_ENABLE']"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:READ+UPDATE'])"
:disabled="!hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:UPDATE'])"
checked-value="true"
unchecked-value="false"
size="small"
@ -730,37 +730,37 @@
let hasAuth = false;
switch (suffix) {
case MenuEnum.workstation:
if (hasAnyPermission(['PROJECT_APPLICATION_WORKSTATION:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_WORKSTATION:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.apiTest:
if (hasAnyPermission(['PROJECT_APPLICATION_API:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_API:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.bugManagement:
if (hasAnyPermission(['PROJECT_APPLICATION_BUG:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_BUG:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.caseManagement:
if (hasAnyPermission(['PROJECT_APPLICATION_CASE:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_CASE:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.loadTest:
if (hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_PERFORMANCE_TEST:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.testPlan:
if (hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_TEST_PLAN:UPDATE'])) {
hasAuth = true;
}
break;
case MenuEnum.uiTest:
if (hasAnyPermission(['PROJECT_APPLICATION_UI:READ+UPDATE'])) {
if (hasAnyPermission(['PROJECT_APPLICATION_UI:UPDATE'])) {
hasAuth = true;
}
break;