From 89bd4836d2dd7129947c0c5eea41ab452d3d7443 Mon Sep 17 00:00:00 2001 From: RubyLiu Date: Fri, 22 Dec 2023 18:39:36 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=BC=BA=E9=99=B7=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E7=BC=BA=E9=99=B7=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat(缺陷管理): 解决 ts 报错 --- .../src/api/modules/bug-management/index.ts | 43 ++- frontend/src/api/requrls/bug-management.ts | 4 +- .../pure/ms-form-create/form-create.vue | 1 + .../components/pure/ms-form-create/types.ts | 9 + frontend/src/enums/formCreateEnum.ts | 2 + frontend/src/models/bug-management.ts | 23 +- .../store/modules/form-create/form-create.ts | 8 +- .../components/relateFile/fileTree.vue | 155 +++++++++ .../components/relateFile/linkFileTable.vue | 313 ++++++++++++++++++ .../relateFile/relateFileDrawer.vue | 273 +++++++++++++++ .../components/relateFile/storageList.vue | 169 ++++++++++ frontend/src/views/bug-management/edit.vue | 305 +++++++++++++---- .../organization/project/orgProject.vue | 1 + .../components/systemOrganization.vue | 1 + .../components/systemProject.vue | 1 + 15 files changed, 1225 insertions(+), 83 deletions(-) create mode 100644 frontend/src/views/bug-management/components/relateFile/fileTree.vue create mode 100644 frontend/src/views/bug-management/components/relateFile/linkFileTable.vue create mode 100644 frontend/src/views/bug-management/components/relateFile/relateFileDrawer.vue create mode 100644 frontend/src/views/bug-management/components/relateFile/storageList.vue diff --git a/frontend/src/api/modules/bug-management/index.ts b/frontend/src/api/modules/bug-management/index.ts index 69eefcd595..2715e524cc 100644 --- a/frontend/src/api/modules/bug-management/index.ts +++ b/frontend/src/api/modules/bug-management/index.ts @@ -1,7 +1,8 @@ import MSR from '@/api/http/index'; import * as bugURL from '@/api/requrls/bug-management'; -import { BugExportParams, BugListItem, DefaultTemplate } from '@/models/bug-management'; +import { BugEditFormObject, BugExportParams, BugListItem } from '@/models/bug-management'; +import { AssociatedList } from '@/models/caseManagement/featureCase'; import { CommonList, TableQueryParams, TemplateOption } from '@/models/common'; /** @@ -12,17 +13,35 @@ import { CommonList, TableQueryParams, TemplateOption } from '@/models/common'; export function getBugList(data: TableQueryParams) { return MSR.post>({ url: bugURL.postTableListUrl, data }); } - -export function updateBug(data: TableQueryParams) { - return MSR.post({ url: bugURL.postUpdateBugUrl, data }); +/** + * 更新Bug + * @param data + * @returns + */ +export function updateBug(data: { request: BugEditFormObject; fileList: File[] }) { + return MSR.uploadFile({ url: bugURL.postUpdateBugUrl }, data, '', true); } - +/** + * 批量更新 + * @param data + * @returns + */ export function updateBatchBug(data: TableQueryParams) { return MSR.post({ url: bugURL.postBatchUpdateBugUrl, data }); } - -export function createBug(data: TableQueryParams) { - return MSR.uploadFile({ url: bugURL.postCreateBugUrl }, { request: data.request, fileList: data.fileList }, ''); +/** + * 创建Bug + * @param data + * @returns + */ +export function createBug(data: { request: BugEditFormObject; fileList: File[] }) { + return MSR.uploadFile({ url: bugURL.postCreateBugUrl }, data, '', true); +} +/** + * 获取 bug 详情 + */ +export function getBugDetail(id: string) { + return MSR.get({ url: `${bugURL.getBugDetailUrl}${id}` }); } export function deleteSingleBug(data: TableQueryParams) { @@ -38,14 +57,14 @@ export function getTemplageOption(params: { projectId: string }) { } export function getTemplateById(data: TableQueryParams) { - return MSR.get({ url: bugURL.getTemplateUrl, data }); + return MSR.post({ url: bugURL.getTemplateUrl, data }); } // 获取导出字段配置 export function getExportConfig(projectId: string) { return MSR.get({ url: `${bugURL.getExportConfigUrl}${projectId}` }); } // 获取模版详情 -export function getTemplateDetailInfo(data: DefaultTemplate) { +export function getTemplateDetailInfo(data: { id: string; projectId: string }) { return MSR.post({ url: `${bugURL.getTemplateDetailUrl}`, data }); } @@ -58,3 +77,7 @@ export function syncBugOpenSource(params: { projectId: string }) { export function exportBug(data: BugExportParams) { return MSR.post({ url: bugURL.postExportBugUrl, data }); } +// 获取关联文件列表 +export function getAssociatedFileList(data: TableQueryParams) { + return MSR.post>({ url: bugURL.postAssociatedFileListUrl, data }); +} diff --git a/frontend/src/api/requrls/bug-management.ts b/frontend/src/api/requrls/bug-management.ts index 131a141f8f..5a61d90bb9 100644 --- a/frontend/src/api/requrls/bug-management.ts +++ b/frontend/src/api/requrls/bug-management.ts @@ -4,9 +4,11 @@ export const postBatchUpdateBugUrl = '/bug/batch-update'; export const postCreateBugUrl = '/bug/add'; export const getDeleteBugUrl = '/bug/delete/'; export const postBatchDeleteBugUrl = '/bug/batch-delete'; -export const getTemplateUrl = '/bug/template'; +export const getTemplateUrl = '/bug/template/detail'; export const getTemplageOption = '/bug/template/option'; export const getExportConfigUrl = '/bug/export/columns/'; export const getTemplateDetailUrl = '/bug/template/detail'; export const getSyncBugOpenSourceUrl = '/bug/sync/'; export const postExportBugUrl = '/bug/export'; +export const postAssociatedFileListUrl = '/bug/relate/case/page'; +export const getBugDetailUrl = '/bug/detail/'; diff --git a/frontend/src/components/pure/ms-form-create/form-create.vue b/frontend/src/components/pure/ms-form-create/form-create.vue index 9e624ac0e2..aab6e5210b 100644 --- a/frontend/src/components/pure/ms-form-create/form-create.vue +++ b/frontend/src/components/pure/ms-form-create/form-create.vue @@ -140,6 +140,7 @@ couplingConfig: { ...item.props.couplingConfig, }, + sourceType: item.sourceType || '', }; return formItemRule; }); diff --git a/frontend/src/components/pure/ms-form-create/types.ts b/frontend/src/components/pure/ms-form-create/types.ts index 116843f13a..a3df7b2c26 100644 --- a/frontend/src/components/pure/ms-form-create/types.ts +++ b/frontend/src/components/pure/ms-form-create/types.ts @@ -93,6 +93,15 @@ export interface FormItem { [key: string]: any; } +export type FormValueType = + | string + | number + | boolean + | string[] + | number[] + | Record + | Record[]; + interface FomItemSelect extends FormItemComplexCommonConfig { selectMultiple?: boolean; // 选择器是否多选 selectMultipleLimit?: [number, number]; // 选择器多选时最少和最多可选项数,如:[1, 3],表示最少选1项,最多选3项;[0, 3]表示最多选3项,可不选;[1, 0]表示最少选1项,不限制最大可选数 diff --git a/frontend/src/enums/formCreateEnum.ts b/frontend/src/enums/formCreateEnum.ts index c175d0e838..4eaeaff165 100644 --- a/frontend/src/enums/formCreateEnum.ts +++ b/frontend/src/enums/formCreateEnum.ts @@ -11,6 +11,8 @@ export enum FormCreateKeyEnum { CASE_CUSTOM_ATTRS = 'caseCustomAttributes', // 用例tab详情字段 CASE_CUSTOM_ATTRS_DETAIL = 'caseCustomAttributesDetail', + // bug 详情 + BUG_DETAIL = 'bugDetail', } export default {}; diff --git a/frontend/src/models/bug-management.ts b/frontend/src/models/bug-management.ts index b3ad7d82bc..1647bf944e 100644 --- a/frontend/src/models/bug-management.ts +++ b/frontend/src/models/bug-management.ts @@ -1,3 +1,5 @@ +import { FormItemType } from '@/components/pure/ms-form-create/types'; + import { BatchApiParams } from './common'; export interface BugListItem { @@ -25,12 +27,21 @@ export interface BugExportColumn { export interface BugExportParams extends BatchApiParams { bugExportColumns: BugExportColumn[]; // 导出字段 } - -// 获取默认模版缺陷 -export interface DefaultTemplate { +export interface BugEditCustomField { + type: FormItemType; // 表单项类型 + fieldId: string; + fieldName: string; + value: string; + platformOptionJson?: string; // 选项的 Json + required: boolean; +} +export interface BugEditFormObject { + [key: string]: any; +} +export interface BugEditCustomFieldItem { id: string; - projectId: string; - fromStatusId?: string; - platformBugKey?: string; + name: string; + type: string; + value: string; } export default {}; diff --git a/frontend/src/store/modules/form-create/form-create.ts b/frontend/src/store/modules/form-create/form-create.ts index 63e662c352..42732eac07 100644 --- a/frontend/src/store/modules/form-create/form-create.ts +++ b/frontend/src/store/modules/form-create/form-create.ts @@ -35,7 +35,12 @@ const useFormCreateStore = defineStore('form-create', { (formItemType: any) => item.type?.toUpperCase() === formItemType ); if (currentTypeForm) { - fieldType = FieldTypeFormRules[currentTypeForm].type; + if (currentTypeForm === 'INPUT' && item.subDesc) { + // 如果是input类型并且有subDesc说明是JiraKey 类型 + fieldType = 'JiraKey'; + } else { + fieldType = FieldTypeFormRules[currentTypeForm].type; + } const options = item?.options; const currentOptions = options?.map((optionsItem) => { return { @@ -55,6 +60,7 @@ const useFormCreateStore = defineStore('form-create', { options: !item.optionMethod ? currentOptions : [], link: item.couplingConfig?.cascade, rule: item.validate || [], + sourceType: item.type, // 原始表单类型 // 梳理表单所需要属性 props: { ...FieldTypeFormRules[currentTypeForm].props, diff --git a/frontend/src/views/bug-management/components/relateFile/fileTree.vue b/frontend/src/views/bug-management/components/relateFile/fileTree.vue new file mode 100644 index 0000000000..2205cc985a --- /dev/null +++ b/frontend/src/views/bug-management/components/relateFile/fileTree.vue @@ -0,0 +1,155 @@ + + + + + diff --git a/frontend/src/views/bug-management/components/relateFile/linkFileTable.vue b/frontend/src/views/bug-management/components/relateFile/linkFileTable.vue new file mode 100644 index 0000000000..bc1a65ac79 --- /dev/null +++ b/frontend/src/views/bug-management/components/relateFile/linkFileTable.vue @@ -0,0 +1,313 @@ + + + + + diff --git a/frontend/src/views/bug-management/components/relateFile/relateFileDrawer.vue b/frontend/src/views/bug-management/components/relateFile/relateFileDrawer.vue new file mode 100644 index 0000000000..3ed91b1895 --- /dev/null +++ b/frontend/src/views/bug-management/components/relateFile/relateFileDrawer.vue @@ -0,0 +1,273 @@ + + + + + diff --git a/frontend/src/views/bug-management/components/relateFile/storageList.vue b/frontend/src/views/bug-management/components/relateFile/storageList.vue new file mode 100644 index 0000000000..08f23dfaee --- /dev/null +++ b/frontend/src/views/bug-management/components/relateFile/storageList.vue @@ -0,0 +1,169 @@ + + + + + diff --git a/frontend/src/views/bug-management/edit.vue b/frontend/src/views/bug-management/edit.vue index c59c9db2ab..99156f9334 100644 --- a/frontend/src/views/bug-management/edit.vue +++ b/frontend/src/views/bug-management/edit.vue @@ -1,53 +1,71 @@ diff --git a/frontend/src/views/setting/organization/project/orgProject.vue b/frontend/src/views/setting/organization/project/orgProject.vue index 763ffd0c86..ac206f54c2 100644 --- a/frontend/src/views/setting/organization/project/orgProject.vue +++ b/frontend/src/views/setting/organization/project/orgProject.vue @@ -181,6 +181,7 @@ noDisable: false, size: 'default', showSetting: true, + heightUsed: 286, }, undefined, (record) => handleNameChange(record) diff --git a/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue b/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue index fb7c26533f..9e3ca48a2e 100644 --- a/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue +++ b/frontend/src/views/setting/system/organizationAndProject/components/systemOrganization.vue @@ -166,6 +166,7 @@ noDisable: false, size: 'default', showSetting: true, + heightUsed: 286, }, undefined, handleNameChange diff --git a/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue b/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue index 28c4b7cce3..2ba62e8404 100644 --- a/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue +++ b/frontend/src/views/setting/system/organizationAndProject/components/systemProject.vue @@ -161,6 +161,7 @@ { tableKey: TableKeyEnum.SYSTEM_PROJECT, scroll: { x: '1600px' }, + heightUsed: 286, selectable: false, noDisable: false, size: 'default',