diff --git a/frontend/src/api/modules/project-management/menuManagement.ts b/frontend/src/api/modules/project-management/menuManagement.ts index 621819eb9b..1cfc07e8af 100644 --- a/frontend/src/api/modules/project-management/menuManagement.ts +++ b/frontend/src/api/modules/project-management/menuManagement.ts @@ -167,14 +167,16 @@ export function getDeleteFake(data: FakeTableOperationParams) { // JIRA插件key校验 export function validateJIRAKey(data: object, pluginId: string) { - return MSR.post({ url: `${Url.postValidateJiraKeyUrl}${pluginId}`, data }); + return MSR.post({ url: `${Url.postValidateJiraKeyUrl}${pluginId}`, data }); } // 缺陷管理-获取同步信息 export function getBugSyncInfo(projectId: string) { - return MSR.get({ url: `${Url.getBugSyncInfoUrl}${projectId}` }); + return MSR.get({ url: `${Url.getBugSyncInfoUrl}${projectId}` }); } // 用例管理-获取关联需求信息 export function getCaseRelatedInfo(projectId: string) { - return MSR.get({ url: `${Url.getCaseRelatedInfoUrl}${projectId}` }); + return MSR.get<{ demand_platform_config: string; platform_key: string; case_enable: string }>({ + url: `${Url.getCaseRelatedInfoUrl}${projectId}`, + }); } diff --git a/frontend/src/components/pure/ms-form-create/comp/jiraKey.vue b/frontend/src/components/pure/ms-form-create/comp/jiraKey.vue index 3bf72c12d9..2649d43413 100644 --- a/frontend/src/components/pure/ms-form-create/comp/jiraKey.vue +++ b/frontend/src/components/pure/ms-form-create/comp/jiraKey.vue @@ -1,10 +1,9 @@ diff --git a/frontend/src/components/pure/ms-form-create/ms-form-create.vue b/frontend/src/components/pure/ms-form-create/ms-form-create.vue index 49d9fd509d..fcae89bcc7 100644 --- a/frontend/src/components/pure/ms-form-create/ms-form-create.vue +++ b/frontend/src/components/pure/ms-form-create/ms-form-create.vue @@ -19,6 +19,8 @@ import { FormRuleItem } from './types'; import formCreate, { Rule } from '@form-create/arco-design'; + defineOptions({ name: 'MsFormCreate' }); + const { t } = useI18n(); formCreate.component('PassWord', PassWord); diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue index 50e6ccbb49..174cbeb059 100644 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/defectSync.vue @@ -83,7 +83,14 @@ - + {{ t('project.menu.status') }} @@ -111,6 +118,7 @@ import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types'; import { + getBugSyncInfo, getPlatformInfo, getPlatformOptions, postSaveDefectSync, @@ -129,6 +137,8 @@ const props = defineProps<{ visible: boolean; }>(); + + const formCreateValue = ref>({}); const currentVisible = ref(props.visible); const platformOption = ref([]); const frequencyOption = ref([ @@ -171,6 +181,13 @@ try { if (value) { const res = await getPlatformInfo(value as string, MenuEnum.bugManagement); + if (formCreateValue.value) { + res.formItems.forEach((item) => { + if (formCreateValue.value[item.name]) { + item.value = formCreateValue.value[item.name]; + } + }); + } platformRules.value = res.formItems; sessionStorage.setItem('platformKey', value as string); } else { @@ -210,12 +227,30 @@ } }; + // 获取关联需求信息 + const initDetailInfo = async () => { + try { + await initPlatformOption(); + const res = await getBugSyncInfo(currentProjectId.value); + if (res && res.platform_key) { + form.SYNC_ENABLE = res.sync_enable; + form.PLATFORM_KEY = res.platform_key; + formCreateValue.value = JSON.parse(res.bug_platform_config); + // 如果平台key存在调用平台change拉取插件字段 + await handlePlatformChange(res.platform_key); + } + } catch (e) { + // eslint-disable-next-line no-console + console.log(e); + } + }; + watch( () => props.visible, (val) => { currentVisible.value = val; if (val) { - initPlatformOption(); + initDetailInfo(); } else { formRef.value?.resetFields(); platformRules.value = []; diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue index 1900e4e0eb..adc993f240 100644 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/relatedCase.vue @@ -40,7 +40,14 @@ - + {{ t('project.menu.status') }} @@ -68,6 +75,7 @@ import type { FormItem, FormRuleItem } from '@/components/pure/ms-form-create/types'; import { + getCaseRelatedInfo, getPlatformInfo, getPlatformOptions, postSaveRelatedCase, @@ -98,9 +106,11 @@ const form = reactive({ PLATFORM_KEY: '', - SYNC_ENABLE: 'false', // 同步开关 + CASE_ENABLE: 'false', // 同步开关 }); + const formCreateValue = ref>({}); + const okDisabled = computed(() => !form.PLATFORM_KEY); const emit = defineEmits<{ @@ -116,6 +126,13 @@ try { if (value) { const res = await getPlatformInfo(value as string, MenuEnum.caseManagement); + if (formCreateValue.value) { + res.formItems.forEach((item) => { + if (formCreateValue.value[item.name]) { + item.value = formCreateValue.value[item.name]; + } + }); + } platformRules.value = res.formItems; } else { platformRules.value = []; @@ -156,13 +173,30 @@ console.log(error); } }; + // 获取关联需求信息 + const initDetailInfo = async () => { + try { + await initPlatformOption(); + const res = await getCaseRelatedInfo(currentProjectId.value); + if (res && res.platform_key) { + form.CASE_ENABLE = res.case_enable; + form.PLATFORM_KEY = res.platform_key; + formCreateValue.value = JSON.parse(res.demand_platform_config); + // 如果平台key存在调用平台change拉取插件字段 + await handlePlatformChange(res.platform_key); + } + } catch (e) { + // eslint-disable-next-line no-console + console.log(e); + } + }; watch( () => props.visible, (val) => { currentVisible.value = val; if (val) { - initPlatformOption(); + initDetailInfo(); } else { formRef.value?.resetFields(); platformRules.value = []; diff --git a/frontend/src/views/setting/organization/project/components/addProjectModal.vue b/frontend/src/views/setting/organization/project/components/addProjectModal.vue index 413681abad..7f824b3e98 100644 --- a/frontend/src/views/setting/organization/project/components/addProjectModal.vue +++ b/frontend/src/views/setting/organization/project/components/addProjectModal.vue @@ -142,7 +142,7 @@ (e: 'cancel', shouldSearch: boolean): void; }>(); - const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest']; + const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest']; const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest']; diff --git a/frontend/src/views/setting/organization/project/orgProject.vue b/frontend/src/views/setting/organization/project/orgProject.vue index d334ec54ad..1d634d840f 100644 --- a/frontend/src/views/setting/organization/project/orgProject.vue +++ b/frontend/src/views/setting/organization/project/orgProject.vue @@ -9,7 +9,7 @@ }} - + (); - const allModuleIds = ['workstation', 'testPlan', 'bugManagement', 'caseManagement', 'apiTest', 'uiTest', 'loadTest']; + const allModuleIds = ['bugManagement', 'caseManagement', 'apiTest']; const showPoolModuleIds = ['uiTest', 'apiTest', 'loadTest'];