From 7f32e69ea234767a34d3316d42f5d0a44d32e1ae Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 26 Mar 2024 14:28:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=96=AD=E8=A8=80=E7=9B=B8=E5=85=B3=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ms-assertion/comp/ResponseBodyTab.vue | 80 ++++------- .../business/ms-assertion/comp/ScriptTab.vue | 19 ++- .../business/ms-assertion/index.vue | 126 ++++++------------ .../business/ms-case-associate/index.vue | 2 +- .../components/pure/ms-table/base-table.vue | 2 + .../pure/ms-table/columnSelector.vue | 5 +- frontend/src/models/apiTest/common.ts | 1 + .../api-test/components/condition/content.vue | 6 +- .../report/component/step/stepTree.vue | 17 +-- .../api-test/report/component/tiledList.vue | 2 +- .../components/caseTable.vue | 3 +- .../tabContent/tabCase/tabCaseTable.vue | 23 ++-- .../case-management/caseReview/create.vue | 2 +- 13 files changed, 114 insertions(+), 174 deletions(-) diff --git a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue index 162697d0df..306e03d3ae 100644 --- a/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue +++ b/frontend/src/components/business/ms-assertion/comp/ResponseBodyTab.vue @@ -1,14 +1,14 @@ @@ -26,20 +26,26 @@ interface ScriptTabProps { data: any; - disabled?: boolean; + // disabled?: boolean; } const props = defineProps(); const emit = defineEmits<{ (e: 'change', val: ScriptItem): void; // 数据发生变化 + (e: 'update:data'): void; // 数据发生变化 }>(); - function handleChange() { - // eslint-disable-next-line no-use-before-define - emit('change', { ...condition.value }); - } + const condition = useVModel(props, 'data', emit); + + // function handleChange() { + // // eslint-disable-next-line no-use-before-define + // emit('update:data'); + // emit('change', { ...condition.value }); + // } + const currentEnvConfig = ref({}); + async function initEnvironment() { if (store.currentId) { currentEnvConfig.value = await getEnvironment(store.currentId); @@ -47,6 +53,7 @@ } /** 向孙组件提供属性 */ provide('currentEnvConfig', readonly(currentEnvConfig)); + onBeforeMount(() => { initEnvironment(); }); diff --git a/frontend/src/components/business/ms-assertion/index.vue b/frontend/src/components/business/ms-assertion/index.vue index f1431ee73e..5dccadff68 100644 --- a/frontend/src/components/business/ms-assertion/index.vue +++ b/frontend/src/components/business/ms-assertion/index.vue @@ -26,14 +26,8 @@
- - +
+
- -
+
+
- +
@@ -159,7 +159,9 @@ // 当前鼠标所在的key const focusKey = ref(''); // 所有的断言列表参数 - const assertions = defineModel('params', { default: [] }); + const assertions = defineModel('params', { + required: true, + }); const props = defineProps<{ isDefinition?: boolean; // 是否是定义页面 @@ -170,75 +172,16 @@ const emit = defineEmits<{ (e: 'update:assertionConfig', params: ExecuteAssertionConfig): void; + // TODO 类型优化 + (e: 'update:params', params: any[]): void; (e: 'change'): void; }>(); const innerConfig = useVModel(props, 'assertionConfig', emit); - // Item点击的key const activeKey = ref(''); - // 展示的value - const valueKey = computed(() => { - return activeKey.value && assertions.value.find((item) => item.id === activeKey.value)?.assertionType; - }); - const defaultResBodyItem = { - jsonPathAssertion: { - assertions: [], - }, - xpathAssertion: { responseFormat: 'XML', assertions: [] }, - assertionBodyType: '', - regexAssertion: { - assertions: [], - }, - // TODO文档暂时不做 - // documentAssertion: { - // jsonAssertion: [ - // { - // id: rootId, - // paramsName: 'root', - // mustInclude: false, - // typeChecking: false, - // paramType: 'object', - // matchCondition: '', - // matchValue: '', - // }, - // ], - // responseFormat: 'JSON', - // followApi: false, - // }, - }; - // 计算当前页面的存储的状态 - const getCurrentItemState = computed({ - get: () => { - const currentResItem = - assertions.value.find((item: any) => item.id === activeKey.value) || assertions.value[0] || {}; - if (currentResItem && currentResItem?.assertionType === ResponseAssertionType.RESPONSE_BODY) { - const { jsonPathAssertion, xpathAssertion, regexAssertion } = currentResItem; - return { - ...currentResItem, - jsonPathAssertion: jsonPathAssertion || defaultResBodyItem.jsonPathAssertion, - xpathAssertion: xpathAssertion || defaultResBodyItem.xpathAssertion, - assertionBodyType: '', - regexAssertion: regexAssertion || defaultResBodyItem.regexAssertion, - bodyAssertionDataByType: {}, - }; - } - if (currentResItem && currentResItem?.assertionType === ResponseAssertionType.SCRIPT) { - return { - ...currentResItem, - processorType: ResponseAssertionType.SCRIPT, - }; - } - return currentResItem; - }, - set: (val: ExecuteAssertion) => { - const currentIndex = assertions.value.findIndex((item) => item.id === activeKey.value); - const tmpArr = assertions.value; - tmpArr[currentIndex] = cloneDeep(val); - assertions.value = tmpArr; - }, - }); + const getCurrentItemState = ref(assertions.value[0]); const itemMoreActions: ActionsItem[] = [ { @@ -282,6 +225,7 @@ const showBody = computed(() => { return assertions.value.length > 0; }); + // dropdown选择 const handleSelect = (value: string | number | Record | undefined) => { const id = new Date().getTime().toString(); @@ -363,7 +307,9 @@ default: break; } - activeKey.value = id; + getCurrentItemState.value = assertions.value[assertions.value.length - 1]; + activeKey.value = assertions.value[assertions.value.length - 1].id; + emit('change'); }; const handleMoreActionSelect = (event: ActionsItem, item: MsAssertionItem) => { @@ -373,10 +319,10 @@ activeKey.value = currentIndex > 0 ? assertions.value[currentIndex - 1].id : ''; } else { // copy 当前item - const tmpObj = { ...assertions.value[currentIndex], id: new Date().getTime().valueOf().toString() }; - const tmpArr = assertions.value; + const tmpObj = { ...cloneDeep(assertions.value[currentIndex]), id: new Date().getTime().valueOf().toString() }; + const tmpArr = cloneDeep(assertions.value); tmpArr.splice(currentIndex, 0, tmpObj); - assertions.value = tmpArr; + assertions.value = cloneDeep(tmpArr); activeKey.value = tmpObj.id; } }; @@ -422,24 +368,30 @@ diff --git a/frontend/src/views/api-test/report/component/tiledList.vue b/frontend/src/views/api-test/report/component/tiledList.vue index a987e78116..b2a94bd2be 100644 --- a/frontend/src/views/api-test/report/component/tiledList.vue +++ b/frontend/src/views/api-test/report/component/tiledList.vue @@ -1,6 +1,6 @@ @@ -584,6 +584,7 @@ dataIndex: 'tags', showInTable: true, isTag: true, + width: 456, showDrag: true, }, { diff --git a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue index e7bdd9aaa0..b2d0fef117 100644 --- a/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue +++ b/frontend/src/views/case-management/caseManagementFeature/components/tabContent/tabCase/tabCaseTable.vue @@ -207,12 +207,24 @@ const confirmLoading = ref(false); + async function getFetch() { + setLoadListParams({ + keyword: keyword.value, + sourceId: props.caseId, + projectId: currentProjectId.value, + sourceType: currentSelectCase.value, + }); + await loadList(); + featureCaseStore.getCaseCounts(props.caseId); + } + async function saveHandler(params: TableQueryParams) { try { confirmLoading.value = true; await associationPublicCase(params); Message.success(t('caseManagement.featureCase.AssociatedSuccess')); innerVisible.value = false; + getFetch(); } catch (error) { console.log(error); } finally { @@ -255,17 +267,6 @@ currentSelectCase.value = caseTypeOptions.value[0].value; } - async function getFetch() { - setLoadListParams({ - keyword: keyword.value, - sourceId: props.caseId, - projectId: currentProjectId.value, - sourceType: currentSelectCase.value, - }); - await loadList(); - featureCaseStore.getCaseCounts(props.caseId); - } - async function cancelLink(record: any) { try { await cancelAssociatedCase({ diff --git a/frontend/src/views/case-management/caseReview/create.vue b/frontend/src/views/case-management/caseReview/create.vue index 79640a384e..fe0992e565 100644 --- a/frontend/src/views/case-management/caseReview/create.vue +++ b/frontend/src/views/case-management/caseReview/create.vue @@ -189,6 +189,7 @@ v-model:visible="caseAssociateVisible" v-model:project="caseAssociateProject" :reviewers="reviewForm.reviewers" + :associated-ids="selectedAssociateCasesParams.selectIds" @success="writeAssociateCases" /> @@ -424,7 +425,6 @@ loading.value = false; } } - onBeforeMount(() => { initModules(); initReviewers();