fix(功能用例): 修改ts类型
This commit is contained in:
parent
5ddf98c414
commit
879d929ff3
|
@ -181,19 +181,19 @@
|
|||
const actionType = ref([
|
||||
{
|
||||
value: 'API',
|
||||
name: '接口用例',
|
||||
name: t('caseManagement.featureCase.apiCase'),
|
||||
},
|
||||
{
|
||||
value: 'SCENE',
|
||||
name: '接口用例',
|
||||
name: t('caseManagement.featureCase.sceneCase'),
|
||||
},
|
||||
{
|
||||
value: 'UI',
|
||||
name: 'UI用例',
|
||||
name: t('caseManagement.featureCase.uiCase'),
|
||||
},
|
||||
{
|
||||
value: 'PERFORMANCE',
|
||||
name: '性能用例',
|
||||
name: t('caseManagement.featureCase.propertyCase'),
|
||||
},
|
||||
]);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
props.titleTag
|
||||
}}</a-tag></div
|
||||
>
|
||||
<div class="flex"> <slot name="tbutton"></slot></div>
|
||||
<slot name="tbutton"></slot>
|
||||
</div>
|
||||
</slot>
|
||||
</template>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import { TagData } from '@arco-design/web-vue';
|
||||
|
||||
import { TableQueryParams } from '@/models/common';
|
||||
import { StatusType } from '@/enums/caseEnum';
|
||||
|
||||
import { RawCommands } from '@halo-dev/richtext-editor';
|
||||
|
||||
export interface ModulesTreeType {
|
||||
id: string;
|
||||
name: string;
|
||||
|
@ -28,6 +32,23 @@ export interface customFieldsItem {
|
|||
value: string;
|
||||
}
|
||||
|
||||
export interface OptionsFieldId {
|
||||
fieldId: string;
|
||||
value: string;
|
||||
text: string;
|
||||
internal: boolean; // 是否是内置
|
||||
}
|
||||
|
||||
export interface CustomAttributes {
|
||||
fieldId: string;
|
||||
fieldName: string;
|
||||
required: boolean;
|
||||
apiFieldId: null | undefined | 'string'; // 三方API
|
||||
defaultValue: string;
|
||||
type: string;
|
||||
options: OptionsFieldId[];
|
||||
}
|
||||
|
||||
// 功能用例表
|
||||
export interface CaseManagementTable {
|
||||
id: string;
|
||||
|
@ -39,20 +60,23 @@ export interface CaseManagementTable {
|
|||
reviewStatus: StatusType[keyof StatusType]; // 评审状态:未评审/评审中/通过/不通过/重新提审
|
||||
tags: any; // 标签(JSON)
|
||||
caseEditType: string; // 编辑模式:步骤模式/文本模式
|
||||
prerequisite: string; // 前置条件
|
||||
pos: number; // 自定义排序,间隔5000
|
||||
versionId: string; // 版本ID
|
||||
refId: string; // 指向初始版本ID
|
||||
lastExecuteResult: string; // 最近的执行结果:未执行/通过/失败/阻塞/跳过
|
||||
deleted: true; // 是否在回收站:0-否,1-是
|
||||
publicCase: true; // 是否是公共用例:0-否,1-是
|
||||
latest: true; // 是否为最新版本:0-否,1-是
|
||||
deleted: boolean; // 是否在回收站:0-否,1-是
|
||||
publicCase: boolean; // 是否是公共用例:0-否,1-是
|
||||
latest: boolean; // 是否为最新版本:0-否,1-是
|
||||
createUser: string;
|
||||
updateUser: string;
|
||||
deleteUser: string;
|
||||
createTime: string;
|
||||
updateTime: string;
|
||||
deleteTime: string;
|
||||
customFields: customFieldsItem[]; // 自定义字段集合
|
||||
steps: string;
|
||||
customFields: CustomAttributes[]; // 自定义字段集合
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 选择类型步骤和预期结果列表
|
||||
|
@ -107,22 +131,6 @@ export interface BatchDeleteType {
|
|||
projectId: string;
|
||||
}
|
||||
|
||||
export interface OptionsFieldId {
|
||||
fieldId: string;
|
||||
value: string;
|
||||
text: string;
|
||||
internal: boolean; // 是否是内置
|
||||
}
|
||||
export interface CustomAttributes {
|
||||
fieldId: string;
|
||||
fieldName: string;
|
||||
required: boolean;
|
||||
apiFieldId: null | undefined | 'string'; // 三方API
|
||||
defaultValue: string;
|
||||
type: string;
|
||||
options: OptionsFieldId[];
|
||||
}
|
||||
|
||||
// 批量编辑
|
||||
export interface BatchEditCaseType {
|
||||
selectIds: string[];
|
||||
|
@ -145,7 +153,9 @@ export interface BatchMoveOrCopyType {
|
|||
condition: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface CreateCase {
|
||||
// 创建或者更新
|
||||
export interface CreateOrUpdateCase {
|
||||
id?: string;
|
||||
projectId: string;
|
||||
templateId: string;
|
||||
name: string;
|
||||
|
@ -158,9 +168,48 @@ export interface CreateCase {
|
|||
publicCase: boolean; // 是否公共用例
|
||||
moduleId: string;
|
||||
versionId: string;
|
||||
tags: string[];
|
||||
customFields: Record<string, any>; // 自定义字段集合
|
||||
relateFileMetaIds?: string[]; // 关联文件ID集合
|
||||
deleteFileMetaIds?: string[]; // 删除本地上传的文件id
|
||||
unLinkFilesIds?: string[]; // 取消关联的文件id
|
||||
[key: string]: any;
|
||||
}
|
||||
export interface AttachFileInfo {
|
||||
id: string;
|
||||
fileId: string;
|
||||
fileName: string;
|
||||
size: number;
|
||||
local: boolean;
|
||||
createUser: string;
|
||||
createTime: number;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 详情
|
||||
export interface DetailCase {
|
||||
id: string;
|
||||
num?: number;
|
||||
moduleId: string;
|
||||
moduleName?: string;
|
||||
projectId: string;
|
||||
templateId?: string;
|
||||
name: string;
|
||||
reviewStatus?: string;
|
||||
tags: any;
|
||||
customFields: CustomAttributes[] | Record<string, any>; // 自定义字段集合
|
||||
relateFileMetaIds: string[]; // 关联文件ID集合
|
||||
caseEditType: string;
|
||||
versionId?: string;
|
||||
publicCase: boolean;
|
||||
latest?: boolean;
|
||||
createUser?: string;
|
||||
steps: string;
|
||||
textDescription: string;
|
||||
expectedResult: string;
|
||||
prerequisite: string;
|
||||
description: string;
|
||||
customFields: CustomAttributes[];
|
||||
attachments?: AttachFileInfo[];
|
||||
followFlag?: boolean;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@
|
|||
|
||||
function loadedCase(detail: CaseManagementTable) {
|
||||
detailInfo.value = { ...detail };
|
||||
customFields.value = detailInfo.value.customFields as CustomAttributes[];
|
||||
customFields.value = detailInfo.value.customFields;
|
||||
}
|
||||
|
||||
const moduleName = computed(() => {
|
||||
|
|
|
@ -195,8 +195,9 @@
|
|||
|
||||
import type {
|
||||
CaseManagementTable,
|
||||
CreateCase,
|
||||
CreateOrUpdateCase,
|
||||
CustomAttributes,
|
||||
DetailCase,
|
||||
TabItemType,
|
||||
} from '@/models/caseManagement/featureCase';
|
||||
import { FormCreateKeyEnum } from '@/enums/formCreateEnum';
|
||||
|
@ -251,7 +252,8 @@
|
|||
break;
|
||||
}
|
||||
}
|
||||
const initDetail: CreateCase = {
|
||||
const initDetail: DetailCase = {
|
||||
id: '',
|
||||
projectId: '',
|
||||
templateId: '',
|
||||
name: '',
|
||||
|
@ -269,12 +271,12 @@
|
|||
relateFileMetaIds: [], // 关联文件ID集合
|
||||
};
|
||||
|
||||
const detailInfo = ref<CreateCase>({ ...initDetail });
|
||||
const detailInfo = ref<DetailCase>({ ...initDetail });
|
||||
const customFields = ref<CustomAttributes[]>([]);
|
||||
const caseLevels = ref(0);
|
||||
function loadedCase(detail: CreateCase) {
|
||||
function loadedCase(detail: DetailCase) {
|
||||
detailInfo.value = { ...detail };
|
||||
customFields.value = detailInfo.value.customFields as CustomAttributes[];
|
||||
customFields.value = detailInfo.value.customFields;
|
||||
const caseLevelsValue = customFields.value.find((item) => item.fieldName === '用例等级')?.defaultValue;
|
||||
if (caseLevelsValue) {
|
||||
caseLevels.value = JSON.parse(caseLevelsValue).replaceAll('P', '') * 1;
|
||||
|
@ -313,13 +315,15 @@
|
|||
async function followHandler() {
|
||||
followLoading.value = true;
|
||||
try {
|
||||
await followerCaseRequest({ userId: userId.value as string, functionalCaseId: detailInfo.value.id });
|
||||
updateSuccess();
|
||||
Message.success(
|
||||
detailInfo.value.followFlag
|
||||
? t('caseManagement.featureCase.cancelFollowSuccess')
|
||||
: t('caseManagement.featureCase.followSuccess')
|
||||
);
|
||||
if (detailInfo.value.id) {
|
||||
await followerCaseRequest({ userId: userId.value as string, functionalCaseId: detailInfo.value.id });
|
||||
updateSuccess();
|
||||
Message.success(
|
||||
detailInfo.value.followFlag
|
||||
? t('caseManagement.featureCase.cancelFollowSuccess')
|
||||
: t('caseManagement.featureCase.followSuccess')
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
} finally {
|
||||
|
|
|
@ -237,7 +237,13 @@
|
|||
import useFormCreateStore from '@/store/modules/form-create/form-create';
|
||||
import { getGenerateId } from '@/utils';
|
||||
|
||||
import type { AssociatedList, CreateCase, StepList } from '@/models/caseManagement/featureCase';
|
||||
import type {
|
||||
AssociatedList,
|
||||
AttachFileInfo,
|
||||
CreateOrUpdateCase,
|
||||
DetailCase,
|
||||
StepList,
|
||||
} from '@/models/caseManagement/featureCase';
|
||||
import type { CustomField, DefinedFieldItem } from '@/models/setting/template';
|
||||
import { FormCreateKeyEnum } from '@/enums/formCreateEnum';
|
||||
|
||||
|
@ -280,7 +286,8 @@
|
|||
const modelId = computed(() => featureCaseStore.moduleId[0]);
|
||||
const caseTree = computed(() => featureCaseStore.caseTree);
|
||||
|
||||
const initForm: CreateCase = {
|
||||
const initForm: DetailCase = {
|
||||
id: '',
|
||||
projectId: currentProjectId.value,
|
||||
templateId: '',
|
||||
name: '',
|
||||
|
@ -298,7 +305,7 @@
|
|||
relateFileMetaIds: [],
|
||||
};
|
||||
|
||||
const form = ref<CreateCase>({ ...initForm });
|
||||
const form = ref<DetailCase | CreateOrUpdateCase>({ ...initForm });
|
||||
|
||||
watch(
|
||||
() => stepData.value,
|
||||
|
@ -381,7 +388,7 @@
|
|||
}
|
||||
|
||||
const isEditOrCopy = computed(() => !!route.query.id);
|
||||
const attachmentsList = ref([]);
|
||||
const attachmentsList = ref<AttachFileInfo[]>([]);
|
||||
|
||||
// 后台传过来的local文件的item列表
|
||||
const oldLocalFileList = computed(() => {
|
||||
|
@ -433,12 +440,12 @@
|
|||
});
|
||||
|
||||
// 处理详情字段
|
||||
function getDetailData(detailResult: CreateCase) {
|
||||
function getDetailData(detailResult: DetailCase) {
|
||||
const { customFields, attachments, steps, tags } = detailResult;
|
||||
form.value = {
|
||||
...detailResult,
|
||||
name: route.params.mode === 'copy' ? `${detailResult.name}_copy` : detailResult.name,
|
||||
tags: JSON.parse(tags as string),
|
||||
tags: JSON.parse(tags),
|
||||
};
|
||||
// 处理自定义字段
|
||||
selectData.value = getCustomDetailFields(
|
||||
|
@ -454,19 +461,21 @@
|
|||
};
|
||||
});
|
||||
}
|
||||
attachmentsList.value = attachments;
|
||||
if (attachments) {
|
||||
attachmentsList.value = attachments;
|
||||
|
||||
// 处理文件列表
|
||||
fileList.value = attachments
|
||||
.map((fileInfo: any) => {
|
||||
return {
|
||||
...fileInfo,
|
||||
name: fileInfo.fileName,
|
||||
};
|
||||
})
|
||||
.map((fileInfo: any) => {
|
||||
return convertToFile(fileInfo);
|
||||
});
|
||||
// 处理文件列表
|
||||
fileList.value = attachments
|
||||
.map((fileInfo: any) => {
|
||||
return {
|
||||
...fileInfo,
|
||||
name: fileInfo.fileName,
|
||||
};
|
||||
})
|
||||
.map((fileInfo: any) => {
|
||||
return convertToFile(fileInfo);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 处理详情
|
||||
|
@ -474,7 +483,7 @@
|
|||
try {
|
||||
isLoading.value = true;
|
||||
await getAllCaseFields();
|
||||
const detailResult = await getCaseDetail(route.query.id as string);
|
||||
const detailResult: DetailCase = await getCaseDetail(route.query.id as string);
|
||||
getDetailData(detailResult);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
@ -605,7 +614,7 @@
|
|||
formRuleList.value?.forEach((item) => {
|
||||
customFieldsMaps[item.field as string] = item.value;
|
||||
});
|
||||
form.value.customFields = customFieldsMaps as Record<string, any>;
|
||||
form.value.customFields = customFieldsMaps;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
allow-clear
|
||||
class="mb-[16px]"
|
||||
></a-input>
|
||||
<a-spin class="min-h-[300px] w-full" :loading="loading">
|
||||
<a-spin class="min-h-[400px] w-full" :loading="loading">
|
||||
<MsTree
|
||||
v-model:focus-node-key="focusNodeKey"
|
||||
:selected-keys="props.selectedKeys"
|
||||
|
@ -59,7 +59,6 @@
|
|||
const props = defineProps<{
|
||||
isExpandAll: boolean;
|
||||
selectedKeys?: Array<string | number>; // 选中的节点 key
|
||||
isModal?: boolean; // 是否是弹窗模式
|
||||
modulesCount?: Record<string, number>; // 模块数量统计对象
|
||||
showType?: string; // 显示类型
|
||||
getTreeRequest: (params: any) => Promise<ModuleTreeNode[]>; // 获取模块树接口
|
||||
|
@ -76,7 +75,7 @@
|
|||
|
||||
const virtualListProps = computed(() => {
|
||||
return {
|
||||
height: 'calc(100vh - 350px)',
|
||||
height: 'calc(100vh - 296px)',
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
@ -127,10 +127,6 @@
|
|||
onMounted(() => {
|
||||
resetSelector();
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
resetSelector();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
@ -199,7 +199,7 @@
|
|||
import { downloadByteFile, getGenerateId } from '@/utils';
|
||||
import { scrollIntoView } from '@/utils/dom';
|
||||
|
||||
import type { AssociatedList, CreateCase, StepList } from '@/models/caseManagement/featureCase';
|
||||
import type { AssociatedList, CreateOrUpdateCase, DetailCase, StepList } from '@/models/caseManagement/featureCase';
|
||||
import { FormCreateKeyEnum } from '@/enums/formCreateEnum';
|
||||
|
||||
import { convertToFile } from '../utils';
|
||||
|
@ -216,7 +216,7 @@
|
|||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
form: CreateCase;
|
||||
form: DetailCase;
|
||||
allowEdit?: boolean; // 是否允许编辑
|
||||
}>(),
|
||||
{
|
||||
|
|
|
@ -199,4 +199,8 @@ export default {
|
|||
'caseManagement.featureCase.reviewComment': 'Review Comments',
|
||||
'caseManagement.featureCase.executiveReview': 'Executive review',
|
||||
'caseManagement.featureCase.linkCase': 'Associated case',
|
||||
'caseManagement.featureCase.apiCase': 'API Case',
|
||||
'caseManagement.featureCase.sceneCase': 'Scene Case',
|
||||
'caseManagement.featureCase.uiCase': 'UI Case',
|
||||
'caseManagement.featureCase.propertyCase': 'Property Case',
|
||||
};
|
||||
|
|
|
@ -197,4 +197,8 @@ export default {
|
|||
'caseManagement.featureCase.reviewComment': '评审评论',
|
||||
'caseManagement.featureCase.executiveReview': '执行评论',
|
||||
'caseManagement.featureCase.linkCase': '关联用例',
|
||||
'caseManagement.featureCase.apiCase': '接口用例',
|
||||
'caseManagement.featureCase.sceneCase': '场景用例',
|
||||
'caseManagement.featureCase.uiCase': 'UI用例',
|
||||
'caseManagement.featureCase.propertyCase': '性能用例',
|
||||
};
|
||||
|
|
|
@ -280,7 +280,7 @@
|
|||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import type { CreateCase } from '@/models/caseManagement/featureCase';
|
||||
import type { DetailCase } from '@/models/caseManagement/featureCase';
|
||||
|
||||
const route = useRoute();
|
||||
const { t } = useI18n();
|
||||
|
@ -324,7 +324,8 @@
|
|||
{ label: resultMap[3].label, value: 'reReview' },
|
||||
]);
|
||||
|
||||
const initDetail: CreateCase = {
|
||||
const initDetail: DetailCase = {
|
||||
id: '',
|
||||
projectId: '',
|
||||
templateId: '',
|
||||
name: '',
|
||||
|
@ -341,7 +342,7 @@
|
|||
customFields: [], // 自定义字段集合
|
||||
relateFileMetaIds: [], // 关联文件ID集合
|
||||
};
|
||||
const detailForm = ref<CreateCase>({ ...initDetail });
|
||||
const detailForm = ref<DetailCase>({ ...initDetail });
|
||||
|
||||
const caseList = ref([
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue