refactor(项目设置): mock环境禁止修改

This commit is contained in:
fit2-zhao 2024-03-07 18:12:43 +08:00 committed by Craftsman
parent 843a4c9186
commit ac0e994a41
4 changed files with 24 additions and 18 deletions

View File

@ -1,6 +1,7 @@
import { ExecuteConditionProcessor } from '../apiTest/common'; import { ExecuteConditionProcessor } from '../apiTest/common';
export interface EnvListItem { export interface EnvListItem {
mock?: boolean;
name: string; name: string;
id: string; id: string;
} }

View File

@ -42,7 +42,7 @@
<a-divider <a-divider
:margin="0" :margin="0"
:class="{ :class="{
'!mb-[16px]': activeKey === 'pre' || activeKey === 'post' ? false : true, '!mb-[16px]': !(activeKey === 'pre' || activeKey === 'post'),
}" }"
/> />
<div class="content"> <div class="content">

View File

@ -6,7 +6,9 @@
}}</span> }}</span>
</div> </div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<a-button type="outline" @click="handleAddHttp">{{ t('project.environmental.addHttp') }}</a-button> <a-button :disabled="store.currentEnvDetailInfo.mock" type="outline" @click="handleAddHttp">{{
t('project.environmental.addHttp')
}}</a-button>
<div class="flex flex-row gap-[8px]"> <div class="flex flex-row gap-[8px]">
<a-input-number v-model:model-value="form.requestTimeout" class="w-[180px]"> <a-input-number v-model:model-value="form.requestTimeout" class="w-[180px]">
<template #prefix> <template #prefix>
@ -39,7 +41,7 @@
</a-tooltip> </a-tooltip>
</template> </template>
<template #operation="{ record }"> <template #operation="{ record }">
<div class="flex flex-row flex-nowrap items-center"> <div v-show="!store.currentEnvDetailInfo.mock" class="flex flex-row flex-nowrap items-center">
<MsButton class="!mr-0" @click="handleCopy(record)">{{ t('common.copy') }}</MsButton> <MsButton class="!mr-0" @click="handleCopy(record)">{{ t('common.copy') }}</MsButton>
<a-divider class="h-[16px]" direction="vertical" /> <a-divider class="h-[16px]" direction="vertical" />
<MsButton class="!mr-0" @click="handleEdit(record)">{{ t('common.edit') }}</MsButton> <MsButton class="!mr-0" @click="handleEdit(record)">{{ t('common.edit') }}</MsButton>

View File

@ -92,7 +92,7 @@
/> />
</MsButton> </MsButton>
<MsMoreAction <MsMoreAction
:list="envMoreAction" :list="envMoreAction(element.mock || false)"
@select=" @select="
(value) => handleMoreAction(value, element.id, EnvAuthTypeEnum.ENVIRONMENT_PARAM) (value) => handleMoreAction(value, element.id, EnvAuthTypeEnum.ENVIRONMENT_PARAM)
" "
@ -273,7 +273,8 @@
}); });
// MoreAction // MoreAction
const envMoreAction: ActionsItem[] = [ const envMoreAction = (isMock: boolean | undefined) => {
return [
{ {
label: t('common.export'), label: t('common.export'),
eventTag: 'export', eventTag: 'export',
@ -285,8 +286,10 @@
label: t('common.delete'), label: t('common.delete'),
danger: true, danger: true,
eventTag: 'delete', eventTag: 'delete',
disabled: isMock,
}, },
]; ];
};
// / MoreAction // / MoreAction
const allMoreAction: ActionsItem[] = [ const allMoreAction: ActionsItem[] = [