feat(测试用例): xmind导入
This commit is contained in:
parent
158409ac5a
commit
3c08ffeb9c
|
@ -29,9 +29,11 @@ import {
|
|||
DetailCaseUrl,
|
||||
DownloadExcelTemplateUrl,
|
||||
DownloadFileUrl,
|
||||
DownloadXMindTemplateUrl,
|
||||
dragSortUrl,
|
||||
EditorUploadFileUrl,
|
||||
exportExcelCheckUrl,
|
||||
exportXMindCheckUrl,
|
||||
FollowerCaseUrl,
|
||||
GetAssociatedCaseIdsUrl,
|
||||
GetAssociatedDebuggerUrl,
|
||||
|
@ -64,6 +66,7 @@ import {
|
|||
getTransferTreeUrl,
|
||||
GetTrashCaseModuleTreeUrl,
|
||||
importExcelCaseUrl,
|
||||
importXMindCaseUrl,
|
||||
MoveCaseModuleTreeUrl,
|
||||
PreviewEditorImageUrl,
|
||||
PreviewFileUrl,
|
||||
|
@ -404,23 +407,27 @@ export function getAssociatedCaseIds(caseId: string) {
|
|||
return MSR.get<string[]>({ url: `${GetAssociatedCaseIdsUrl}/${caseId}` });
|
||||
}
|
||||
|
||||
// 下载导入excel模板
|
||||
// 下载导入excel或xmind模板
|
||||
export function downloadTemplate(projectId: string, type: 'Excel' | 'Xmind') {
|
||||
if (type === 'Excel') {
|
||||
return MSR.get(
|
||||
{ url: `${DownloadExcelTemplateUrl}/${projectId}`, responseType: 'blob' },
|
||||
{ isTransformResponse: false }
|
||||
);
|
||||
}
|
||||
return MSR.get(
|
||||
{ url: `${DownloadExcelTemplateUrl}/${projectId}`, responseType: 'blob' },
|
||||
{
|
||||
url: `${type === 'Excel' ? DownloadExcelTemplateUrl : DownloadXMindTemplateUrl}/${projectId}`,
|
||||
responseType: 'blob',
|
||||
},
|
||||
{ isTransformResponse: false }
|
||||
);
|
||||
}
|
||||
|
||||
// 导入excel文件检查
|
||||
export function importExcelChecked(data: { request: ImportExcelType; fileList: File[] }) {
|
||||
return MSR.uploadFile({ url: exportExcelCheckUrl }, { request: data.request, fileList: data.fileList }, '');
|
||||
// 导入excel或xmind文件检查
|
||||
export function importExcelOrXMindChecked(
|
||||
data: { request: ImportExcelType; fileList: File[] },
|
||||
type: 'Excel' | 'Xmind'
|
||||
) {
|
||||
return MSR.uploadFile(
|
||||
{ url: type === 'Excel' ? exportExcelCheckUrl : exportXMindCheckUrl },
|
||||
{ request: data.request, fileList: data.fileList },
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
// 富文本编辑器上传图片文件
|
||||
|
@ -432,8 +439,12 @@ export function editorPreviewImages(data: PreviewImages) {
|
|||
return MSR.post({ url: PreviewEditorImageUrl, data });
|
||||
}
|
||||
// 导入excel
|
||||
export function importExcelCase(data: { request: ImportExcelType; fileList: File[] }) {
|
||||
return MSR.uploadFile({ url: importExcelCaseUrl }, { request: data.request, fileList: data.fileList }, '');
|
||||
export function importExcelOrXMindCase(data: { request: ImportExcelType; fileList: File[] }, type: 'Excel' | 'Xmind') {
|
||||
return MSR.uploadFile(
|
||||
{ url: type === 'Excel' ? importExcelCaseUrl : importXMindCaseUrl },
|
||||
{ request: data.request, fileList: data.fileList },
|
||||
''
|
||||
);
|
||||
}
|
||||
|
||||
// 拖拽排序
|
||||
|
|
|
@ -138,14 +138,20 @@ export const GetAssociatedCaseIdsUrl = '/functional/case/relationship/get-ids';
|
|||
// 导入功能
|
||||
// 功能用例导入excel下载模板
|
||||
export const DownloadExcelTemplateUrl = '/functional/case/download/excel/template';
|
||||
// 功能用例导入xmind下载模板
|
||||
export const DownloadXMindTemplateUrl = '/functional/case/download/xmind/template';
|
||||
// 富文本所需资源上传
|
||||
export const EditorUploadFileUrl = '/attachment/upload/temp/file';
|
||||
// 富文本资源详情预览压缩图
|
||||
export const PreviewEditorImageUrl = '/attachment/download/file';
|
||||
// 导入excel文件检查
|
||||
export const exportExcelCheckUrl = '/functional/case/pre-check/excel';
|
||||
// 导入xmind文件检查
|
||||
export const exportXMindCheckUrl = '/functional/case/pre-check/xmind';
|
||||
// 导入excel文件
|
||||
export const importExcelCaseUrl = '/functional/case/import/excel';
|
||||
// 导入xmind文件
|
||||
export const importXMindCaseUrl = '/functional/case/import/xmind';
|
||||
// 用例拖拽排序
|
||||
export const dragSortUrl = '/functional/case/edit/pos';
|
||||
// 获取变更历史
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
}}
|
||||
</template>
|
||||
<div>
|
||||
<a-alert class="mb-4"
|
||||
><div class="flex items-center">
|
||||
<a-alert class="mb-4">
|
||||
<div class="flex items-center">
|
||||
{{ t('caseManagement.featureCase.beforeUploadTip', { type: props.validateType }) }}
|
||||
<MsIcon
|
||||
:type="props.validateType === 'Excel' ? 'icon-icon_file-excel_colorful1' : 'icon-icon_file-xmind_colorful1'"
|
||||
class="mx-1 cursor-pointer text-[rgb(var(--primary-6))]"
|
||||
></MsIcon>
|
||||
<MsButton @click="downloadExcelTemplate">{{
|
||||
t('caseManagement.featureCase.downloadTemplate', { type: props.validateType })
|
||||
}}</MsButton>
|
||||
<MsButton @click="downloadExcelTemplate">
|
||||
{{ t('caseManagement.featureCase.downloadTemplate', { type: props.validateType }) }}
|
||||
</MsButton>
|
||||
</div>
|
||||
</a-alert>
|
||||
<MsUpload
|
||||
|
@ -78,8 +78,13 @@
|
|||
:loading="props.confirmLoading"
|
||||
:disabled="fileList.length < 1"
|
||||
@click="saveConfirm"
|
||||
>{{ t('caseManagement.featureCase.checkImportFile') }}</a-button
|
||||
>
|
||||
{{
|
||||
props.validateType === 'Excel'
|
||||
? t('caseManagement.featureCase.checkImportFile')
|
||||
: t('caseManagement.featureCase.checkTemplate')
|
||||
}}
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -138,7 +143,7 @@
|
|||
async function downloadExcelTemplate() {
|
||||
try {
|
||||
const res = await downloadTemplate(currentProjectId.value, props.validateType);
|
||||
downloadByteFile(res, 'excel_case.xlsx');
|
||||
downloadByteFile(res, props.validateType === 'Excel' ? 'excel_case.xlsx' : 'xmind_case.xmind');
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,11 @@
|
|||
/></div>
|
||||
|
||||
<div class="flex w-[92%] flex-col">
|
||||
<span class="text-[var(--color-text-1)]">{{ t('caseManagement.featureCase.verifyingTemplate') }}</span>
|
||||
<span class="text-[var(--color-text-1)]">{{
|
||||
props.validateType === 'Excel'
|
||||
? t('caseManagement.featureCase.verifyingFile')
|
||||
: t('caseManagement.featureCase.verifyingTemplate')
|
||||
}}</span>
|
||||
<a-progress :percent="props.percent" size="large" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
}}<span class="mx-1 text-[rgb(var(--success-6))]"> {{ validateResultInfo.successCount }}</span
|
||||
>{{ t('caseManagement.featureCase.caseCount') }}</span
|
||||
>
|
||||
<span
|
||||
>{{ t('caseManagement.featureCase.failCheck')
|
||||
}}<span class="mx-1 font-medium text-[rgb(var(--danger-6))]">{{ validateResultInfo.failCount }}</span
|
||||
>{{ t('caseManagement.featureCase.caseCount') }}</span
|
||||
>
|
||||
<span v-if="props.validateType === 'Excel'">
|
||||
{{ t('caseManagement.featureCase.failCheck') }}
|
||||
<span class="mx-1 font-medium text-[rgb(var(--danger-6))]">{{ validateResultInfo.failCount }}</span>
|
||||
{{ t('caseManagement.featureCase.caseCount') }}
|
||||
</span>
|
||||
<span v-else>
|
||||
{{ t('caseManagement.featureCase.partialCaseVerificationFailed') }}
|
||||
</span>
|
||||
<a-popover
|
||||
position="bottom"
|
||||
:content-style="{
|
||||
|
|
|
@ -29,18 +29,15 @@
|
|||
>
|
||||
{{ t('caseManagement.featureCase.importExcel') }}
|
||||
</a-doption>
|
||||
<a-doption
|
||||
v-permission="['FUNCTIONAL_CASE:READ+IMPORT']"
|
||||
value="Xmind"
|
||||
@click="handleSelect('import', 'Xmind')"
|
||||
>
|
||||
{{ t('caseManagement.featureCase.importXmind') }}
|
||||
</a-doption>
|
||||
</template>
|
||||
</a-dropdown-button>
|
||||
<a-button
|
||||
v-else-if="
|
||||
!hasAnyPermission(['FUNCTIONAL_CASE:READ+ADD']) && hasAnyPermission(['FUNCTIONAL_CASE:READ+IMPORT'])
|
||||
"
|
||||
class="ml-2"
|
||||
type="primary"
|
||||
@click="handleSelect('import', 'Excel')"
|
||||
>
|
||||
{{ t('caseManagement.featureCase.importExcel') }}
|
||||
</a-button>
|
||||
<a-button
|
||||
v-else
|
||||
v-permission="['FUNCTIONAL_CASE:READ+ADD']"
|
||||
|
@ -176,7 +173,11 @@
|
|||
import ValidateModal from './components/export/validateModal.vue';
|
||||
import ValidateResult from './components/export/validateResult.vue';
|
||||
|
||||
import { createCaseModuleTree, importExcelCase, importExcelChecked } from '@/api/modules/case-management/featureCase';
|
||||
import {
|
||||
createCaseModuleTree,
|
||||
importExcelOrXMindCase,
|
||||
importExcelOrXMindChecked,
|
||||
} from '@/api/modules/case-management/featureCase';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import useFeatureCaseStore from '@/store/modules/case/featureCase';
|
||||
|
@ -376,11 +377,12 @@
|
|||
versionId: '',
|
||||
cover,
|
||||
};
|
||||
if (validateType.value === 'Excel') {
|
||||
const result = await importExcelChecked({ request: params, fileList: files.map((item: any) => item.file) });
|
||||
const result = await importExcelOrXMindChecked(
|
||||
{ request: params, fileList: files.map((item: any) => item.file) },
|
||||
validateType.value
|
||||
);
|
||||
finish();
|
||||
validateInfo.value = result.data;
|
||||
}
|
||||
} catch (error) {
|
||||
validateModal.value = false;
|
||||
console.log(error);
|
||||
|
@ -413,7 +415,10 @@
|
|||
cover: isCover.value,
|
||||
count: validateInfo.value.successCount,
|
||||
};
|
||||
await importExcelCase({ request: params, fileList: fileList.value.map((item: any) => item.file) });
|
||||
await importExcelOrXMindCase(
|
||||
{ request: params, fileList: fileList.value.map((item: any) => item.file) },
|
||||
validateType.value
|
||||
);
|
||||
Message.success(t('caseManagement.featureCase.importSuccess'));
|
||||
validateResultModal.value = false;
|
||||
showExcelModal.value = false;
|
||||
|
|
|
@ -219,7 +219,7 @@ export default {
|
|||
'caseManagement.featureCase.dragOrClick': 'Drag or click this area to select a file',
|
||||
'caseManagement.featureCase.onlyEXcelTip':
|
||||
'Only xls and xlsx are supported, and the size of each device cannot exceed 100 MB',
|
||||
'caseManagement.featureCase.onlyXmindTip': 'Only xmind/ type single size up to 100M is supported',
|
||||
'caseManagement.featureCase.onlyXmindTip': 'Only supports xmind, with a single size not exceeding 50M',
|
||||
'caseManagement.featureCase.checkTemplate': 'Check template',
|
||||
'caseManagement.featureCase.checkImportFile': 'Check file',
|
||||
'caseManagement.featureCase.selectedRecoverCase':
|
||||
|
@ -235,7 +235,8 @@ export default {
|
|||
'caseManagement.featureCase.defaultSelectNewVersion': 'The latest version is selected by default',
|
||||
'caseManagement.featureCase.isRecoverOriginCase': 'Whether or not covered',
|
||||
'caseManagement.featureCase.importingUseCase': 'Importing a use case',
|
||||
'caseManagement.featureCase.verifyingTemplate': 'The file is being verified',
|
||||
'caseManagement.featureCase.verifyingTemplate': 'Verifying the correctness of the template',
|
||||
'caseManagement.featureCase.verifyingFile': 'Verifying file correctness',
|
||||
'caseManagement.featureCase.successfulCheck': 'Successful check',
|
||||
'caseManagement.featureCase.failCheck': 'Check failure',
|
||||
'caseManagement.featureCase.caseCount': 'Strip use cases',
|
||||
|
@ -247,6 +248,7 @@ export default {
|
|||
'caseManagement.featureCase.backToUploadPage': 'Back to upload page',
|
||||
'caseManagement.featureCase.ignoreErrorContinueImporting': 'Ignore&continue',
|
||||
'caseManagement.featureCase.partialCheckFailure': 'Partial check failure',
|
||||
'caseManagement.featureCase.partialCaseVerificationFailed': 'Partial case verification failed',
|
||||
'caseManagement.featureCase.CheckFailure': 'Check failure',
|
||||
'caseManagement.featureCase.CheckSuccess': 'Check success',
|
||||
'caseManagement.featureCase.tableNoData': 'No data available',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export default {
|
||||
'caseManagement.featureCase.creatingCase': '创建用例',
|
||||
'caseManagement.featureCase.importCase': '导入用例',
|
||||
'caseManagement.featureCase.importExcel': 'Excel导入',
|
||||
'caseManagement.featureCase.importXmind': 'Xmind导入',
|
||||
'caseManagement.featureCase.importExcel': 'Excel 导入',
|
||||
'caseManagement.featureCase.importXmind': 'Xmind 导入',
|
||||
'caseManagement.featureCase.importSuccess': '导入成功',
|
||||
'caseManagement.featureCase.publicCase': '公共用例库',
|
||||
'caseManagement.featureCase.allCase': '全部用例',
|
||||
|
@ -217,7 +217,7 @@ export default {
|
|||
'caseManagement.featureCase.formXMindExport': '从 Xmind 文件导入用例',
|
||||
'caseManagement.featureCase.dragOrClick': '拖拽或点击此区域选择文件',
|
||||
'caseManagement.featureCase.onlyEXcelTip': '仅支持 xls/xlsx,单个大小不超过 100M',
|
||||
'caseManagement.featureCase.onlyXmindTip': '仅支持 xmind/类型 单个大小不超过 100M',
|
||||
'caseManagement.featureCase.onlyXmindTip': '仅支持 xmind,单个大小不超过 50M',
|
||||
'caseManagement.featureCase.checkTemplate': '校验模板',
|
||||
'caseManagement.featureCase.checkImportFile': '校验文件',
|
||||
'caseManagement.featureCase.selectedRecoverCase': '勾选,ID相同时覆盖原用例',
|
||||
|
@ -231,18 +231,20 @@ export default {
|
|||
'caseManagement.featureCase.defaultSelectNewVersion': '默认选择最新版本',
|
||||
'caseManagement.featureCase.isRecoverOriginCase': '用例 ID 相同时覆盖原用例',
|
||||
'caseManagement.featureCase.importingUseCase': '正在导入用例',
|
||||
'caseManagement.featureCase.verifyingTemplate': '正在校验文件正确性',
|
||||
'caseManagement.featureCase.verifyingTemplate': '正在校验模版正确性',
|
||||
'caseManagement.featureCase.verifyingFile': '正在校验文件正确性',
|
||||
'caseManagement.featureCase.successfulCheck': '成功校验',
|
||||
'caseManagement.featureCase.failCheck': '校验失败',
|
||||
'caseManagement.featureCase.caseCount': '条用例;',
|
||||
'caseManagement.featureCase.viewErrorDetail': '查看错误详情',
|
||||
'caseManagement.featureCase.someCaseImportFailed': '部分用例导入失败',
|
||||
'caseManagement.featureCase.ViewMore': '查看更多',
|
||||
'caseManagement.featureCase.afterFailingToModify': '失败用例在{ type }中修改后重新导入',
|
||||
'caseManagement.featureCase.afterFailingToModify': '失败用例在 { type } 中修改后重新导入',
|
||||
'caseManagement.featureCase.import': '导入',
|
||||
'caseManagement.featureCase.backToUploadPage': '返回上传页',
|
||||
'caseManagement.featureCase.ignoreErrorContinueImporting': '忽略错误继续导入',
|
||||
'caseManagement.featureCase.partialCheckFailure': '部分校验失败',
|
||||
'caseManagement.featureCase.partialCaseVerificationFailed': '部分用例检验失败',
|
||||
'caseManagement.featureCase.CheckFailure': '校验失败',
|
||||
'caseManagement.featureCase.CheckSuccess': '校验成功',
|
||||
'caseManagement.featureCase.tableNoData': '暂无数据',
|
||||
|
|
Loading…
Reference in New Issue