From 53226e689ef37f5d55d185dce7ac015c89fa4fca Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 27 Feb 2024 13:33:21 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E9=87=8D=E6=9E=84=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF&=E9=A1=B9=E7=9B=AE=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project-management/commonScript.ts | 5 +- .../ms-common-script/insertCommonScript.vue | 55 +- .../ms-common-script/ms-addScriptDrawer.vue | 18 +- .../ms-common-script/scriptDefined.vue | 2 +- .../pure/ms-form-create/form-create.ts | 2 +- .../pure/ms-form-create/formCreate.vue | 3 +- frontend/src/config/pathMap.ts | 22 +- frontend/src/enums/routeEnum.ts | 9 +- frontend/src/models/setting/template.ts | 2 + .../routes/modules/projectManagement.ts | 70 +- frontend/src/router/routes/modules/setting.ts | 71 +- .../components/caseDetail.vue | 6 + .../components/caseDetailDrawer.vue | 19 +- .../components/caseTable.vue | 11 +- .../tabContent/tabChangeHistory.vue | 27 +- .../tabDemand/associatedDemandTable.vue | 2 +- .../project-management/commonScript/index.vue | 7 +- .../commonScript/locale/en-US.ts | 1 + .../commonScript/locale/zh-CN.ts | 1 + .../template/components/detail.vue | 11 + .../template/components/proTemplateDetail.vue | 408 ---------- .../components/templateManagement.vue | 15 +- .../template/components/addTemplate.vue | 713 ++++++++++++++++++ .../template/components/detail.vue | 11 + .../template/components/editFieldDrawer.vue | 86 ++- .../template/components/fieldSetting.ts | 9 +- .../template/components/templateDetail.vue | 368 --------- .../components/templateManagement.vue | 15 +- .../components/templateManagementTable.vue | 296 -------- .../organization/template/locale/en-US.ts | 12 + .../organization/template/locale/zh-CN.ts | 11 + 31 files changed, 1097 insertions(+), 1191 deletions(-) create mode 100644 frontend/src/views/project-management/template/components/detail.vue delete mode 100644 frontend/src/views/project-management/template/components/proTemplateDetail.vue create mode 100644 frontend/src/views/setting/organization/template/components/addTemplate.vue create mode 100644 frontend/src/views/setting/organization/template/components/detail.vue delete mode 100644 frontend/src/views/setting/organization/template/components/templateDetail.vue delete mode 100644 frontend/src/views/setting/organization/template/components/templateManagementTable.vue diff --git a/frontend/src/api/modules/project-management/commonScript.ts b/frontend/src/api/modules/project-management/commonScript.ts index 2947525bad..f7b5960de8 100644 --- a/frontend/src/api/modules/project-management/commonScript.ts +++ b/frontend/src/api/modules/project-management/commonScript.ts @@ -28,7 +28,10 @@ export function getCommonScriptPage(data: TableQueryParams) { } // 添加公共脚本 -export function addCommonScriptReq(data: AddOrUpdateCommonScript) { +export function addOrUpdateCommonScriptReq(data: AddOrUpdateCommonScript) { + if (data.id) { + return MSR.post({ url: UpdateCommonScriptUrl, data }); + } return MSR.post({ url: AddCommonScriptUrl, data }); } // 更新公共脚本 diff --git a/frontend/src/components/business/ms-common-script/insertCommonScript.vue b/frontend/src/components/business/ms-common-script/insertCommonScript.vue index c8f2b460df..caa635fcbc 100644 --- a/frontend/src/components/business/ms-common-script/insertCommonScript.vue +++ b/frontend/src/components/business/ms-common-script/insertCommonScript.vue @@ -58,6 +58,15 @@ + diff --git a/frontend/src/components/business/ms-common-script/scriptDefined.vue b/frontend/src/components/business/ms-common-script/scriptDefined.vue index 613aa8e776..8c03703a77 100644 --- a/frontend/src/components/business/ms-common-script/scriptDefined.vue +++ b/frontend/src/components/business/ms-common-script/scriptDefined.vue @@ -61,7 +61,6 @@ v-model:visible="showInsertDrawer" :script-language="innerLanguagesType" :enable-radio-selected="props.enableRadioSelected" - @add-script="insertCommonScript" @save="saveHandler" /> diff --git a/frontend/src/config/pathMap.ts b/frontend/src/config/pathMap.ts index 2914539d72..dd81dbf0ac 100644 --- a/frontend/src/config/pathMap.ts +++ b/frontend/src/config/pathMap.ts @@ -480,7 +480,7 @@ export const pathMap: PathMapItem[] = [ locale: 'menu.projectManagement.templateManager', route: RouteEnum.PROJECT_MANAGEMENT_TEMPLATE, permission: [], - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], children: [ { key: 'PROJECT_MANAGEMENT_TEMPLATE_FUNCTIONAL', // 模板管理-用例模板 @@ -490,7 +490,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'FUNCTIONAL', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], children: [ { key: 'PROJECT_MANAGEMENT_TEMPLATE_FUNCTIONAL_FIELD', // 模板管理-用例模板-用例模板字段管理 @@ -500,7 +500,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'FUNCTIONAL', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, { key: 'PROJECT_MANAGEMENT_TEMPLATE_FUNCTIONAL_TEMPLATE', // 模板管理-用例模板-用例模板管理 @@ -510,7 +510,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'FUNCTIONAL', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, ], }, @@ -522,7 +522,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'API', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], children: [ { key: 'PROJECT_MANAGEMENT_TEMPLATE_API_FIELD', // 模板管理-接口模板-接口模板字段管理 @@ -532,7 +532,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'API', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, { key: 'PROJECT_MANAGEMENT_TEMPLATE_API_TEMPLATE', // 模板管理-接口模板-接口模板管理 @@ -542,7 +542,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'API', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, ], }, @@ -554,7 +554,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'BUG', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], children: [ { key: 'PROJECT_MANAGEMENT_TEMPLATE_BUG_FIELD', // 模板管理-缺陷模板管理-字段管理 @@ -564,7 +564,7 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'BUG', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, { key: 'PROJECT_MANAGEMENT_TEMPLATE_BUG_TEMPLATE', // 模板管理-缺陷模板-缺陷模板管理 @@ -574,14 +574,14 @@ export const pathMap: PathMapItem[] = [ routeQuery: { type: 'BUG', }, - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, { key: 'PROJECT_MANAGEMENT_TEMPLATE_BUG_WORKFLOW', // 模板管理-缺陷模板-缺陷工作流 locale: 'menu.settings.organization.templateManagementWorkFlow', route: RouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_WORKFLOW, permission: [], - level: MENU_LEVEL[1], + level: MENU_LEVEL[2], }, ], }, diff --git a/frontend/src/enums/routeEnum.ts b/frontend/src/enums/routeEnum.ts index 143bee193d..65b8bc217d 100644 --- a/frontend/src/enums/routeEnum.ts +++ b/frontend/src/enums/routeEnum.ts @@ -2,6 +2,7 @@ export enum ApiTestRouteEnum { API_TEST = 'apiTest', API_TEST_DEBUG = 'apiTestDebug', API_TEST_MANAGEMENT = 'apiTestManagement', + API_TEST_REPORT = 'apiTestReport', } export enum BugManagementRouteEnum { @@ -41,7 +42,9 @@ export enum ProjectManagementRouteEnum { PROJECT_MANAGEMENT_PERMISSION_MENU_MANAGEMENT = 'projectManagementPermissionMenuManagement', PROJECT_MANAGEMENT_TEMPLATE = 'projectManagementTemplate', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT = 'projectManagementTemplateManagement', - PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL = 'projectManagementTemplateManagementDetail', + PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL = 'projectManagementTemplateManagementCaseDetail', + PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL = 'projectManagementTemplateManagementCaseDetail', + PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL = 'projectManagementTemplateManagementBugDetail', PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_WORKFLOW = 'projectManagementTemplateManagementWorkFlow', PROJECT_MANAGEMENT_TEMPLATE_FIELD_SETTING = 'projectManagementTemplateFiledSetting', PROJECT_MANAGEMENT_PERMISSION_VERSION = 'projectManagementPermissionVersion', @@ -84,7 +87,9 @@ export enum SettingRouteEnum { SETTING_ORGANIZATION_TEMPLATE = 'settingOrganizationTemplate', SETTING_ORGANIZATION_TEMPLATE_FILED_SETTING = 'settingOrganizationTemplateFiledSetting', SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT = 'settingOrganizationTemplateManagement', - SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_DETAIL = 'settingOrganizationTemplateManagementDetail', + SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_CASE_DETAIL = 'settingOrganizationTemplateManagementCaseDetail', + SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_API_DETAIL = 'settingOrganizationTemplateManagementApiDetail', + SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_BUG_DETAIL = 'settingOrganizationTemplateManagementBugDetail', SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_WORKFLOW = 'settingOrganizationTemplateWorkFlow', SETTING_ORGANIZATION_SERVICE = 'settingOrganizationService', SETTING_ORGANIZATION_LOG = 'settingOrganizationLog', diff --git a/frontend/src/models/setting/template.ts b/frontend/src/models/setting/template.ts index b1ef628bfe..b4108740da 100644 --- a/frontend/src/models/setting/template.ts +++ b/frontend/src/models/setting/template.ts @@ -116,6 +116,8 @@ export interface ActionTemplateManage { fieldType?: string; systemFields?: Record[]; internal?: boolean; // 是否为系统模板 + platForm?: string; + [key: string]: any; } // 工作流列表字段 diff --git a/frontend/src/router/routes/modules/projectManagement.ts b/frontend/src/router/routes/modules/projectManagement.ts index a37cfa2501..ef0b78e55a 100644 --- a/frontend/src/router/routes/modules/projectManagement.ts +++ b/frontend/src/router/routes/modules/projectManagement.ts @@ -177,11 +177,11 @@ const ProjectManagement: AppRouteRecordRaw = { }, // 项目-模板-创建模板和模板详情 { - path: 'templateDetail/:mode?', - name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL, - component: () => import('@/views/project-management/template/components/proTemplateDetail.vue'), + path: 'templateCaseDetail/:mode?', + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL, + component: () => import('@/views/project-management/template/components/detail.vue'), meta: { - locale: 'menu.settings.organization.templateManagementDetail', + locale: 'system.orgTemplate.createCaseTemplate', roles: ['PROJECT_TEMPLATE:READ+UPDATE', 'PROJECT_TEMPLATE:READ+ADD'], breadcrumbs: [ { @@ -194,9 +194,65 @@ const ProjectManagement: AppRouteRecordRaw = { query: ['type'], }, { - name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL, - locale: 'menu.settings.organization.templateManagementDetail', - editLocale: 'menu.settings.organization.templateManagementEdit', + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL, + locale: 'system.orgTemplate.createCaseTemplate', + editLocale: 'system.orgTemplate.updateCaseTemplate', + editTag: 'id', + query: ['type'], + }, + ], + }, + }, + // 项目-模板-接口模板 + { + path: 'templateApiDetail/:mode?', + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL, + component: () => import('@/views/project-management/template/components/detail.vue'), + meta: { + locale: 'system.orgTemplate.createApiTemplate', + roles: ['PROJECT_TEMPLATE:READ+UPDATE', 'PROJECT_TEMPLATE:READ+ADD'], + breadcrumbs: [ + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE, + locale: 'menu.settings.organization.template', + }, + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT, + locale: 'menu.settings.organization.templateManagementList', + query: ['type'], + }, + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL, + locale: 'system.orgTemplate.createApiTemplate', + editLocale: 'system.orgTemplate.updateApiTemplate', + editTag: 'id', + query: ['type'], + }, + ], + }, + }, + // 项目-模板-缺陷模板 + { + path: 'templateBugDetail/:mode?', + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL, + component: () => import('@/views/project-management/template/components/detail.vue'), + meta: { + locale: 'system.orgTemplate.createDefectTemplate', + roles: ['PROJECT_TEMPLATE:READ+UPDATE', 'PROJECT_TEMPLATE:READ+ADD'], + breadcrumbs: [ + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE, + locale: 'menu.settings.organization.template', + }, + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT, + locale: 'menu.settings.organization.templateManagementList', + query: ['type'], + }, + { + name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_BUG_DETAIL, + locale: 'system.orgTemplate.createDefectTemplate', + editLocale: 'system.orgTemplate.updateDefectTemplate', editTag: 'id', query: ['type'], }, diff --git a/frontend/src/router/routes/modules/setting.ts b/frontend/src/router/routes/modules/setting.ts index 13462ac6aa..4eb8ee33a2 100644 --- a/frontend/src/router/routes/modules/setting.ts +++ b/frontend/src/router/routes/modules/setting.ts @@ -285,13 +285,14 @@ const Setting: AppRouteRecordRaw = { ], }, }, - // 模板列表-模板管理-创建&编辑模板 + // 模板列表-创建&编辑模板 + // 用例模板 { - path: 'templateManagementDetail/:mode?', - name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_DETAIL, - component: () => import('@/views/setting/organization/template/components/templateDetail.vue'), + path: 'templateManagementCaseDetail/:mode?', + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_CASE_DETAIL, + component: () => import('@/views/setting/organization/template/components/detail.vue'), meta: { - locale: 'menu.settings.organization.templateManagementDetail', + locale: 'system.orgTemplate.createCaseTemplate', roles: ['ORGANIZATION_TEMPLATE:READ+UPDATE', 'ORGANIZATION_TEMPLATE:READ+ADD'], breadcrumbs: [ { @@ -305,9 +306,65 @@ const Setting: AppRouteRecordRaw = { }, { name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, - locale: 'menu.settings.organization.templateManagementDetail', + locale: 'system.orgTemplate.createCaseTemplate', editTag: 'id', - editLocale: 'menu.settings.organization.templateManagementEdit', + editLocale: 'system.orgTemplate.updateCaseTemplate', + query: ['type'], + }, + ], + }, + }, + // 接口模板 + { + path: 'templateManagementApiDetail/:mode?', + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_API_DETAIL, + component: () => import('@/views/setting/organization/template/components/detail.vue'), + meta: { + locale: 'system.orgTemplate.createApiTemplate', + roles: ['ORGANIZATION_TEMPLATE:READ+UPDATE', 'ORGANIZATION_TEMPLATE:READ+ADD'], + breadcrumbs: [ + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE, + locale: 'menu.settings.organization.template', + }, + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, + locale: 'menu.settings.organization.templateManagementList', + query: ['type'], + }, + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, + locale: 'system.orgTemplate.createApiTemplate', + editTag: 'id', + editLocale: 'system.orgTemplate.updateApiTemplate', + query: ['type'], + }, + ], + }, + }, + // 缺陷模板 + { + path: 'templateManagementBugDetail/:mode?', + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_BUG_DETAIL, + component: () => import('@/views/setting/organization/template/components/detail.vue'), + meta: { + locale: 'system.orgTemplate.createDefectTemplate', + roles: ['ORGANIZATION_TEMPLATE:READ+UPDATE', 'ORGANIZATION_TEMPLATE:READ+ADD'], + breadcrumbs: [ + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE, + locale: 'menu.settings.organization.template', + }, + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, + locale: 'menu.settings.organization.templateManagementList', + query: ['type'], + }, + { + name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT, + locale: 'system.orgTemplate.createDefectTemplate', + editTag: 'id', + editLocale: 'system.orgTemplate.updateDefectTemplate', query: ['type'], }, ], diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseDetail.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseDetail.vue index f92928f503..3cee6c5205 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseDetail.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseDetail.vue @@ -38,6 +38,7 @@ import { createCaseRequest, updateCaseRequest } from '@/api/modules/case-management/featureCase'; import { useI18n } from '@/hooks/useI18n'; + import useLeaveUnSaveTip from '@/hooks/useLeaveUnSaveTip'; import useVisit from '@/hooks/useVisit'; import { useAppStore } from '@/store'; import useFeatureCaseStore from '@/store/modules/case/featureCase'; @@ -48,10 +49,13 @@ import Message from '@arco-design/web-vue/es/message'; + const { setState } = useLeaveUnSaveTip(); const { t } = useI18n(); const route = useRoute(); const router = useRouter(); + setState(false); + const featureCaseStore = useFeatureCaseStore(); const visitedKey = 'doNotNextTipCreateCase'; @@ -83,6 +87,7 @@ name: CaseManagementRouteEnum.CASE_MANAGEMENT_CASE, query: { organizationId: route.query.organizationId, projectId: route.query.projectId }, }); + setState(true); // 创建用例 } else { // 创建并关联 @@ -119,6 +124,7 @@ }, }); } + setState(true); } } catch (error) { // eslint-disable-next-line no-console diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue index b3701c9d03..d00c656cef 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseDetailDrawer.vue @@ -229,15 +229,6 @@ import { CommentParams } from '@/components/business/ms-comment/types'; import MsDetailDrawer from '@/components/business/ms-detail-drawer/index.vue'; import SettingDrawer from './tabContent/settingDrawer.vue'; - import TabDefect from './tabContent/tabBug/tabDefect.vue'; - import TabCaseTable from './tabContent/tabCase/tabCaseTable.vue'; - import TabCaseReview from './tabContent/tabCaseReview.vue'; - import TabChangeHistory from './tabContent/tabChangeHistory.vue'; - import TabComment from './tabContent/tabComment/tabCommentIndex.vue'; - import TabDemand from './tabContent/tabDemand/demand.vue'; - import TabDependency from './tabContent/tabDependency/tabDependency.vue'; - import TabDetail from './tabContent/tabDetail.vue'; - import TabTestPlan from './tabContent/tabTestPlan.vue'; import { createCommentList, @@ -261,6 +252,16 @@ import { getCaseLevels } from './utils'; import { LabelValue } from '@arco-design/web-vue/es/tree-select/interface'; import debounce from 'lodash-es/debounce'; + // 异步加载组件 + const TabDefect = defineAsyncComponent(() => import('./tabContent/tabBug/tabDefect.vue')); + const TabCaseTable = defineAsyncComponent(() => import('./tabContent/tabCase/tabCaseTable.vue')); + const TabCaseReview = defineAsyncComponent(() => import('./tabContent/tabCaseReview.vue')); + const TabChangeHistory = defineAsyncComponent(() => import('./tabContent/tabChangeHistory.vue')); + const TabComment = defineAsyncComponent(() => import('./tabContent/tabComment/tabCommentIndex.vue')); + const TabDemand = defineAsyncComponent(() => import('./tabContent/tabDemand/demand.vue')); + const TabDependency = defineAsyncComponent(() => import('./tabContent/tabDependency/tabDependency.vue')); + const TabDetail = defineAsyncComponent(() => import('./tabContent/tabDetail.vue')); + const TabTestPlan = defineAsyncComponent(() => import('./tabContent/tabTestPlan.vue')); const router = useRouter(); const detailDrawerRef = ref>(); diff --git a/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue b/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue index 174f1195c8..b90212b1ea 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/caseTable.vue @@ -465,21 +465,18 @@ 'slotName': 'num', 'dataIndex': 'num', 'width': 200, - 'showInTable': true, 'sortable': { sortDirections: ['ascend', 'descend'], sorter: true, }, 'filter-icon-align-left': true, 'showTooltip': true, - 'ellipsis': true, 'showDrag': false, }, { title: 'caseManagement.featureCase.tableColumnName', slotName: 'name', dataIndex: 'name', - showInTable: true, showTooltip: true, width: 300, editType: hasAnyPermission(['FUNCTIONAL_CASE:READ+UPDATE']) ? ColumnEditTypeEnum.INPUT : undefined, @@ -487,7 +484,6 @@ sortDirections: ['ascend', 'descend'], sorter: true, }, - ellipsis: true, showDrag: false, }, { @@ -791,7 +787,7 @@ } } const initDefaultFields = ref([]); - let fullColumns: MsTableColumn = []; // 全量列表 + // let fullColumns: MsTableColumn = []; // 全量列表 const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector, setKeyword, setAdvanceFilter } = useTable( getCaseList, @@ -1183,6 +1179,7 @@ // 处理自定义字段列 let customFieldsColumns: Record[] = []; const tableRef = ref | null>(null); + const fullColumns = ref([]); // 处理自定义字段展示 async function getDefaultFields() { @@ -1204,12 +1201,12 @@ caseLevelFields.value = result.customFields.find((item: any) => item.internal && item.fieldName === '用例等级'); caseFilters.value = caseLevelFields.value.options.map((item: any) => item.value); - fullColumns = [ + fullColumns.value = [ ...columns.slice(0, columns.length - 1), ...customFieldsColumns, ...columns.slice(columns.length - 1, columns.length), ]; - await tableStore.initColumn(TableKeyEnum.CASE_MANAGEMENT_TABLE, fullColumns, 'drawer'); + await tableStore.initColumn(TableKeyEnum.CASE_MANAGEMENT_TABLE, fullColumns.value, 'drawer'); } // 如果是用例等级 diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabChangeHistory.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabChangeHistory.vue index 0e2c15ebf3..c61ad9f311 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabChangeHistory.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabChangeHistory.vue @@ -30,7 +30,6 @@ /> --> {{ t('caseManagement.featureCase.saveAsVersion') }} - + + + + + + diff --git a/frontend/src/views/project-management/template/components/proTemplateDetail.vue b/frontend/src/views/project-management/template/components/proTemplateDetail.vue deleted file mode 100644 index 91e9df6725..0000000000 --- a/frontend/src/views/project-management/template/components/proTemplateDetail.vue +++ /dev/null @@ -1,408 +0,0 @@ - - - - - diff --git a/frontend/src/views/project-management/template/components/templateManagement.vue b/frontend/src/views/project-management/template/components/templateManagement.vue index 77e5f96f59..095340e321 100644 --- a/frontend/src/views/project-management/template/components/templateManagement.vue +++ b/frontend/src/views/project-management/template/components/templateManagement.vue @@ -301,11 +301,11 @@ } } }; - + const routeName = ref(''); // 创建模板 const createTemplate = () => { router.push({ - name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { type: route.query.type, }, @@ -318,7 +318,7 @@ // 编辑模板 const editTemplate = (id: string) => { router.push({ - name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { id, type: route.query.type, @@ -332,7 +332,7 @@ // 复制模板 const copyTemplate = (id: string) => { router.push({ - name: ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { id, type: route.query.type, @@ -413,6 +413,13 @@ onMounted(() => { fetchData(); updateColumns(); + if (route.query.type === 'FUNCTIONAL') { + routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_CASE_DETAIL; + } else if (route.query.type === 'API') { + routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL; + } else { + routeName.value = ProjectManagementRouteEnum.PROJECT_MANAGEMENT_TEMPLATE_MANAGEMENT_API_DETAIL; + } }); diff --git a/frontend/src/views/setting/organization/template/components/addTemplate.vue b/frontend/src/views/setting/organization/template/components/addTemplate.vue new file mode 100644 index 0000000000..a14bbd6de8 --- /dev/null +++ b/frontend/src/views/setting/organization/template/components/addTemplate.vue @@ -0,0 +1,713 @@ + + + + + diff --git a/frontend/src/views/setting/organization/template/components/detail.vue b/frontend/src/views/setting/organization/template/components/detail.vue new file mode 100644 index 0000000000..7888fb9964 --- /dev/null +++ b/frontend/src/views/setting/organization/template/components/detail.vue @@ -0,0 +1,11 @@ + + + + + diff --git a/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue b/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue index e886999f96..b98626309c 100644 --- a/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue +++ b/frontend/src/views/setting/organization/template/components/editFieldDrawer.vue @@ -252,6 +252,7 @@ // 保存 const confirmHandler = async (isContinue = false) => { try { + drawerLoading.value = true; const formCopy = cloneDeep(fieldForm.value); formCopy.scene = route.query.type; @@ -287,13 +288,13 @@ if (id) { params.id = id; } - await addOrUpdate(params); + const res = await addOrUpdate(params); Message.success(isEdit.value ? t('common.updateSuccess') : t('common.newSuccess')); if (!isContinue) { handleDrawerCancel(); } resetForm(); - emit('success', isEdit.value); + emit('success', isEdit.value, res.id); } catch (error) { console.log(error); } finally { @@ -302,30 +303,34 @@ }; const fieldDefaultValues = ref([]); function userFormFiledValidate(cb: () => Promise) { - fieldFormRef.value?.validate((errors: undefined | Record) => { + fieldFormRef.value?.validate(async (errors: undefined | Record) => { if (errors) { return; } - batchFormRef.value?.formValidate(async (list: any) => { - try { - drawerLoading.value = true; - fieldDefaultValues.value = [...list]; - if (showOptionsSelect) { - fieldForm.value.options = (batchFormRef.value?.getFormResult() || []).map((item: any) => { - return { - ...item, - value: fieldForm.value.enableOptionKey ? item.value : getGenerateId(), - }; - }); + if (showOptionsSelect.value) { + batchFormRef.value?.formValidate(async (list: any) => { + try { + drawerLoading.value = true; + fieldDefaultValues.value = [...list]; + if (showOptionsSelect.value) { + fieldForm.value.options = (batchFormRef.value?.getFormResult() || []).map((item: any) => { + return { + ...item, + value: fieldForm.value.enableOptionKey ? item.value : getGenerateId(), + }; + }); + } + await cb(); + } catch (error) { + // eslint-disable-next-line no-console + console.log(error); + } finally { + drawerLoading.value = false; } - await cb(); - } catch (error) { - // eslint-disable-next-line no-console - console.log(error); - } finally { - drawerLoading.value = false; - } - }); + }); + } else { + await cb(); + } }); } @@ -342,21 +347,6 @@ // 字段类型列表选项 const fieldOptions = ref([]); - - // 获取字段选项详情 - const getFieldDetail = async (id: string) => { - try { - const fieldDetail = await detail(id); - fieldDefaultValues.value = fieldDetail.options.map((item: any) => { - return { - ...item, - }; - }); - } catch (error) { - console.log(error); - } - }; - // 处理特殊情况编辑回显 const getSpecialHandler = (itemType: FormItemType): FormItemType => { switch (itemType) { @@ -377,16 +367,30 @@ } }; + // 获取字段选项详情 + const getFieldDetail = async (id: string) => { + try { + const fieldDetail = await detail(id); + fieldForm.value = { + ...fieldDetail, + type: getSpecialHandler(fieldDetail.type), + }; + fieldDefaultValues.value = fieldDetail.options.map((item: any) => { + return { + ...item, + }; + }); + } catch (error) { + console.log(error); + } + }; + // 编辑 const editHandler = (item: AddOrUpdateField) => { showDrawer.value = true; isMultipleSelectMember.value = item.type === 'MULTIPLE_MEMBER'; if (item.id) { getFieldDetail(item.id); - fieldForm.value = { - ...item, - type: getSpecialHandler(item.type), - }; } }; diff --git a/frontend/src/views/setting/organization/template/components/fieldSetting.ts b/frontend/src/views/setting/organization/template/components/fieldSetting.ts index 8d9f825340..c5661ac1d0 100644 --- a/frontend/src/views/setting/organization/template/components/fieldSetting.ts +++ b/frontend/src/views/setting/organization/template/components/fieldSetting.ts @@ -281,11 +281,15 @@ export const getTotalFieldOptionList = (totalData: DefinedFieldItem[]) => { formRules: [ { ...currentFormRules, + title: item.name, + effect: { + required: false, + }, props: { ...currentFormRules.props, options: selectOptions }, }, ], fApi: null, - required: item.internal, + required: false, }; }); }; @@ -305,6 +309,9 @@ export const getCustomDetailFields = (totalData: DefinedFieldItem[], customField return { ...it, value: customFields[currentCustomFieldIndex].defaultValue, + effect: { + required: item.required, + }, }; }); const formItem = item; diff --git a/frontend/src/views/setting/organization/template/components/templateDetail.vue b/frontend/src/views/setting/organization/template/components/templateDetail.vue deleted file mode 100644 index 9a432cf114..0000000000 --- a/frontend/src/views/setting/organization/template/components/templateDetail.vue +++ /dev/null @@ -1,368 +0,0 @@ - - - - - diff --git a/frontend/src/views/setting/organization/template/components/templateManagement.vue b/frontend/src/views/setting/organization/template/components/templateManagement.vue index 2fccd1aec1..7d132ba5e2 100644 --- a/frontend/src/views/setting/organization/template/components/templateManagement.vue +++ b/frontend/src/views/setting/organization/template/components/templateManagement.vue @@ -230,10 +230,12 @@ await loadList(); }; + const routeName = ref(''); + // 创建模板 const createTemplate = () => { router.push({ - name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { type: route.query.type, }, @@ -246,7 +248,7 @@ // 编辑模板 const editTemplate = (id: string) => { router.push({ - name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { id, type: route.query.type, @@ -260,7 +262,7 @@ // 复制模板 const copyTemplate = (id: string) => { router.push({ - name: SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_DETAIL, + name: routeName.value, query: { id, type: route.query.type, @@ -307,6 +309,13 @@ onMounted(() => { fetchData(); updateColumns(); + if (route.query.type === 'FUNCTIONAL') { + routeName.value = SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_CASE_DETAIL; + } else if (route.query.type === 'API') { + routeName.value = SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_API_DETAIL; + } else { + routeName.value = SettingRouteEnum.SETTING_ORGANIZATION_TEMPLATE_MANAGEMENT_BUG_DETAIL; + } }); diff --git a/frontend/src/views/setting/organization/template/components/templateManagementTable.vue b/frontend/src/views/setting/organization/template/components/templateManagementTable.vue deleted file mode 100644 index 5c42c125dc..0000000000 --- a/frontend/src/views/setting/organization/template/components/templateManagementTable.vue +++ /dev/null @@ -1,296 +0,0 @@ - - - - - diff --git a/frontend/src/views/setting/organization/template/locale/en-US.ts b/frontend/src/views/setting/organization/template/locale/en-US.ts index 742c263662..357de5ebfb 100644 --- a/frontend/src/views/setting/organization/template/locale/en-US.ts +++ b/frontend/src/views/setting/organization/template/locale/en-US.ts @@ -189,4 +189,16 @@ export default { 'system.orgTemplate.caseTemplateManagement': 'Use case template management', 'system.orgTemplate.apiTemplateManagement': 'Interface template management', 'system.orgTemplate.bugTemplateManagement': 'Defect template management', + 'system.orgTemplate.templateTypeName': ' {type}name', + 'system.orgTemplate.createCaseTemplate': 'Create a use case template', + 'system.orgTemplate.updateCaseTemplate': 'Update the use case template', + 'system.orgTemplate.createApiTemplate': 'Creating Api Template', + 'system.orgTemplate.updateApiTemplate': 'Update Api Template', + 'system.orgTemplate.createDefectTemplate': 'Create defect templates', + 'system.orgTemplate.updateDefectTemplate': 'Update defect templates', + 'system.orgTemplate.enableApiAlert': + 'After connecting to the third-party platform, you need to fill in the field API for the custom field. When using the template, the API field is not displayed', + 'system.orgTemplate.pleaseEnterAPITip': 'Please enter the field API', + 'system.orgTemplate.apiFieldNotEmpty': 'The field API cannot be empty', + 'system.orgTemplate.selectThirdPlatType': 'Please select the third party platform', }; diff --git a/frontend/src/views/setting/organization/template/locale/zh-CN.ts b/frontend/src/views/setting/organization/template/locale/zh-CN.ts index 81ff99c182..e7598d2c24 100644 --- a/frontend/src/views/setting/organization/template/locale/zh-CN.ts +++ b/frontend/src/views/setting/organization/template/locale/zh-CN.ts @@ -180,4 +180,15 @@ export default { 'system.orgTemplate.caseTemplateManagement': '用例模板管理', 'system.orgTemplate.apiTemplateManagement': '接口模板管理', 'system.orgTemplate.bugTemplateManagement': '缺陷模板管理', + 'system.orgTemplate.templateTypeName': ' {type}名称', + 'system.orgTemplate.createCaseTemplate': '创建用例模板', + 'system.orgTemplate.updateCaseTemplate': '更新用例模板', + 'system.orgTemplate.createApiTemplate': '创建接口模板', + 'system.orgTemplate.updateApiTemplate': '更新接口模板', + 'system.orgTemplate.createDefectTemplate': '创建缺陷模板', + 'system.orgTemplate.updateDefectTemplate': '更新缺陷模板', + 'system.orgTemplate.enableApiAlert': '对接第三方平台后,自定义字段需要填写字段 API,使用模版时,不显示 API 字段', + 'system.orgTemplate.pleaseEnterAPITip': '请输入字段API', + 'system.orgTemplate.apiFieldNotEmpty': '字段 API 不能为空', + 'system.orgTemplate.selectThirdPlatType': '请选择三方平台', };