feat(接口测试): 定义和场景的表格展示空数据时增加友好提示以及快捷创建数据的交互

--bug=1037367 --user=宋天阳 【接口测试】模块树-默认初始化展示信息优化 https://www.tapd.cn/55049933/s/1482795
This commit is contained in:
Jianguo-Genius 2024-03-28 16:07:51 +08:00 committed by Craftsman
parent 60ba5d8fb4
commit ab5b4b355f
12 changed files with 48 additions and 16 deletions

View File

@ -149,6 +149,19 @@
<a-divider v-permission="['PROJECT_API_DEFINITION:READ+ADD']" direction="vertical" :margin="8"></a-divider>
<MsTableMoreAction :list="tableMoreActionList" @select="handleTableMoreActionSelect($event, record)" />
</template>
<template v-if="hasAnyPermission(['PROJECT_API_DEFINITION:READ+ADD', 'FUNCTIONAL_CASE:READ+IMPORT'])" #empty>
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
{{ t('apiTestManagement.tableNoDataAndPlease') }}
<MsButton class="ml-[8px]" @click="emit('addApiTab')">
{{ t('apiTestManagement.newApi') }}
</MsButton>
{{ t('apiTestManagement.or') }}
<MsButton class="ml-[8px]" @click="emit('import')">
{{ t('caseManagement.featureCase.importExcel') }}
</MsButton>
</div>
</template>
</ms-base-table>
</div>
<a-modal v-model:visible="showBatchModal" title-align="start" class="ms-modal-upload ms-modal-medium" :width="480">
@ -328,6 +341,8 @@
const emit = defineEmits<{
(e: 'openApiTab', record: ApiDefinitionDetail, isExecute?: boolean): void;
(e: 'openCopyApiTab', record: ApiDefinitionDetail): void;
(e: 'addApiTab'): void;
(e: 'import'): void;
}>();
const appStore = useAppStore();
@ -399,12 +414,6 @@
width: 150,
showDrag: true,
},
{
title: 'apiTestManagement.version',
dataIndex: 'versionName',
width: 100,
showDrag: true,
},
{
title: 'apiTestManagement.createTime',
dataIndex: 'createTime',

View File

@ -8,6 +8,8 @@
:protocol="props.protocol"
@open-api-tab="(record, isExecute) => openApiTab(record, false, isExecute)"
@open-copy-api-tab="openApiTab($event, true)"
@add-api-tab="addApiTab"
@import="emit('import')"
/>
</div>
<div v-if="activeApiTab.id !== 'all'" class="flex-1 overflow-hidden">
@ -77,6 +79,7 @@
// import MsButton from '@/components/pure/ms-button/index.vue';
import { TabItem } from '@/components/pure/ms-editable-tab/types';
import type { ActionsItem } from '@/components/pure/ms-table-more-action/types';
import caseTable from '../case/caseTable.vue';
// import MsFormCreate from '@/components/pure/ms-form-create/formCreate.vue';
import apiTable from './apiTable.vue';
@ -122,6 +125,9 @@
protocol: string;
}>();
const emit = defineEmits<{
(e: 'import'): void;
}>();
const refreshModuleTree: (() => Promise<any>) | undefined = inject('refreshModuleTree');
const currentEnvConfig = inject<Ref<EnvConfig>>('currentEnvConfig');

View File

@ -39,6 +39,7 @@
:offspring-ids="props.offspringIds"
:protocol="props.protocol"
:module-tree="props.moduleTree"
@import="emit('import')"
/>
<apiCase
v-show="(activeApiTab.id === 'all' && currentTab === 'case') || activeApiTab.type === 'case'"
@ -87,7 +88,9 @@
protocol: string;
moduleTree: ModuleTreeNode[]; //
}>();
const emit = defineEmits<{
(e: 'import'): void;
}>();
const appStore = useAppStore();
const { t } = useI18n();

View File

@ -193,12 +193,6 @@
width: 150,
showDrag: true,
},
{
title: 'apiTestManagement.version',
dataIndex: 'versionName',
width: 100,
showDrag: true,
},
{
title: 'apiTestManagement.deleteTime',
dataIndex: 'deleteTime',

View File

@ -53,6 +53,7 @@
:active-module="activeModule"
:offspring-ids="offspringIds"
:protocol="protocol"
@import="importDrawerVisible = true"
/>
</div>
</template>

View File

@ -1,5 +1,5 @@
export default {
'apiTestManagement.newApi': 'Create api',
'apiTestManagement.newApi': 'Create request',
'apiTestManagement.importApi': 'Import api',
'apiTestManagement.fileImport': 'Import file',
'apiTestManagement.timeImport': 'Scheduled import',
@ -159,6 +159,8 @@ export default {
'apiTestManagement.belongOrg': 'Organization',
'apiTestManagement.belongProject': 'Project',
'apiTestManagement.quoteSearchPlaceholder': 'Enter ID or name to search',
'apiTestManagement.tableNoDataAndPlease': 'No data yet, please',
'apiTestManagement.or': 'or',
'case.execute.selectEnv': 'Environmental choice',
'case.execute.defaultEnv': 'Default environment',
'case.execute.newEnv': 'New environment',

View File

@ -1,5 +1,5 @@
export default {
'apiTestManagement.newApi': '新建接口',
'apiTestManagement.newApi': '新建请求',
'apiTestManagement.importApi': '导入接口',
'apiTestManagement.fileImport': '文件导入',
'apiTestManagement.timeImport': '定时导入',
@ -153,6 +153,8 @@ export default {
'apiTestManagement.quoteSearchPlaceholder': '输入 ID 或名称搜索',
'apiTestManagement.click': '点击',
'apiTestManagement.getResponse': '获取响应内容',
'apiTestManagement.tableNoDataAndPlease': '暂无数据,请',
'apiTestManagement.or': '或',
'case.execute.selectEnv': '环境选择',
'case.execute.defaultEnv': '默认环境',
'case.execute.newEnv': '新环境',

View File

@ -1,6 +1,6 @@
<template>
<MsCard :min-width="1180" simple no-content-padding>
<MsSplitBox :size="0.25" :max="0.5">
<MsSplitBox :size="300" :max="0.5">
<template #first>
<div class="p-[24px]">
<moduleTree

View File

@ -147,6 +147,14 @@
<a-divider v-permission="['PROJECT_API_SCENARIO:READ+ADD']" direction="vertical" :margin="8"></a-divider>
<MsTableMoreAction :list="tableMoreActionList" @select="handleTableMoreActionSelect($event, record)" />
</template>
<template v-if="hasAnyPermission(['PROJECT_API_SCENARIO:READ+ADD'])" #empty>
<div class="flex w-full items-center justify-center p-[8px] text-[var(--color-text-4)]">
{{ t('api_scenario.table.tableNoDataAndPlease') }}
<MsButton class="float-right ml-[8px]" @click="emit('createScenario')">
{{ t('apiScenario.createScenario') }}
</MsButton>
</div>
</template>
</ms-base-table>
</div>
@ -340,6 +348,7 @@
import useModal from '@/hooks/useModal';
import useTableStore from '@/hooks/useTableStore';
import useAppStore from '@/store/modules/app';
import { hasAnyPermission } from '@/utils/permission';
import { ApiScenarioTableItem, ApiScenarioUpdateDTO } from '@/models/apiTest/scenario';
import { ApiScenarioStatus } from '@/enums/apiEnum';
@ -355,6 +364,7 @@
const emit = defineEmits<{
(e: 'openScenario', record: ApiScenarioTableItem, action?: 'copy' | 'execute'): void;
(e: 'refreshModuleTree', params: any): void;
(e: 'createScenario'): void;
}>();
const lastReportStatusFilterVisible = ref(false);

View File

@ -61,6 +61,7 @@
:offspring-ids="offspringIds"
@refresh-module-tree="refreshTree"
@open-scenario="openScenarioTab"
@create-scenario="() => newTab()"
/>
</template>
</MsSplitBox>

View File

@ -45,6 +45,8 @@ export default {
'apiScenario.table.columns.createTime': 'Create time',
'apiScenario.table.columns.updateUser': 'Update user',
'apiScenario.table.columns.updateTime': 'Update time',
'api_scenario.table.tableNoDataAndPlease': 'No data yet, please',
'api_scenario.table.or': 'or',
'apiScenario.execute': 'Execute',
// 批量操作文案
'api_scenario.batch_operation.success': 'Success {opt} to {name}',

View File

@ -57,6 +57,8 @@ export default {
'api_scenario.table.status.underway': '进行中',
'api_scenario.table.status.completed': '已完成',
'api_scenario.table.status.deprecate': '已废弃',
'api_scenario.table.tableNoDataAndPlease': '暂无数据,请',
'api_scenario.table.or': '或',
'apiScenario.execute': '执行',
// 批量操作文案
'api_scenario.batch_operation.success': '成功{opt}至 {name}',