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';
export interface EnvListItem {
mock?: boolean;
name: string;
id: string;
}

View File

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

View File

@ -6,7 +6,9 @@
}}</span>
</div>
<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]">
<a-input-number v-model:model-value="form.requestTimeout" class="w-[180px]">
<template #prefix>
@ -39,7 +41,7 @@
</a-tooltip>
</template>
<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>
<a-divider class="h-[16px]" direction="vertical" />
<MsButton class="!mr-0" @click="handleEdit(record)">{{ t('common.edit') }}</MsButton>

View File

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