fix: 前后置&断言相关问题修复
This commit is contained in:
parent
ce9811329d
commit
46da3a57b5
|
@ -17,6 +17,7 @@ import {
|
|||
|
||||
import type { CommonList, TableQueryParams } from '@/models/common';
|
||||
import type { RealTaskCenterApiCaseItem, TimingTaskCenterApiCaseItem } from '@/models/projectManagement/taskCenter';
|
||||
import { TaskCenterEnum } from '@/enums/taskCenter';
|
||||
|
||||
// 实时任务
|
||||
export function getRealSysApiCaseList(data: TableQueryParams) {
|
||||
|
@ -43,13 +44,13 @@ export function batchStopRealProjectApi(data: TableQueryParams) {
|
|||
return MSR.post<CommonList<RealTaskCenterApiCaseItem>>({ url: batchStopRealProjectApiUrl, data });
|
||||
}
|
||||
|
||||
export function stopRealSysApi(moduleType: string, id: string) {
|
||||
export function stopRealSysApi(moduleType: keyof typeof TaskCenterEnum, id: string) {
|
||||
return MSR.get({ url: `${stopRealSysApiUrl}/${moduleType}/${id}` });
|
||||
}
|
||||
export function stopRealOrdApi(moduleType: string, id: string) {
|
||||
export function stopRealOrdApi(moduleType: keyof typeof TaskCenterEnum, id: string) {
|
||||
return MSR.get({ url: `${stopRealOrdApiUrl}/${moduleType}/${id}` });
|
||||
}
|
||||
export function stopRealProjectApi(moduleType: string, id: string) {
|
||||
export function stopRealProjectApi(moduleType: keyof typeof TaskCenterEnum, id: string) {
|
||||
return MSR.get({ url: `${stopRealProjectApiUrl}/${moduleType}/${id}` });
|
||||
}
|
||||
|
||||
|
|
|
@ -335,6 +335,7 @@
|
|||
v-model:visible="fastExtractionVisible"
|
||||
:config="activeRecord"
|
||||
:response="props.response"
|
||||
:is-show-more-setting="false"
|
||||
@apply="handleFastExtractionApply"
|
||||
/>
|
||||
</template>
|
||||
|
@ -342,6 +343,7 @@
|
|||
<script setup lang="ts">
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { TableColumnData, TableData } from '@arco-design/web-vue';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
|
||||
import { statusCodeOptions } from '@/components/pure/ms-advance-filter';
|
||||
import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
|
||||
|
@ -641,7 +643,7 @@
|
|||
return {
|
||||
...activeRecord.value,
|
||||
moreSettingPopoverVisible: false,
|
||||
} as any; // TOOD: 这里的后台类型应该是不对的,需要修改
|
||||
} as any;
|
||||
}
|
||||
return e;
|
||||
});
|
||||
|
@ -682,17 +684,17 @@
|
|||
|
||||
fastExtractionVisible.value = false;
|
||||
nextTick(() => {
|
||||
if (activeTab.value === ResponseBodyAssertionType.JSON_PATH) {
|
||||
if (condition.value.assertionBodyType === ResponseBodyAssertionType.JSON_PATH) {
|
||||
extractParamsTableRef.value?.addTableLine(
|
||||
condition.value.jsonPathAssertion.assertions?.findIndex((e) => e.id === activeRecord.value.id) || 0
|
||||
);
|
||||
}
|
||||
if (activeTab.value === ResponseBodyAssertionType.XPATH) {
|
||||
if (condition.value.assertionBodyType === ResponseBodyAssertionType.XPATH) {
|
||||
extractParamsTableRef.value?.addTableLine(
|
||||
condition.value.xpathAssertion.assertions?.findIndex((e) => e.id === activeRecord.value.id) || 0
|
||||
);
|
||||
}
|
||||
if (activeTab.value === ResponseBodyAssertionType.REGEX) {
|
||||
if (condition.value.assertionBodyType === ResponseBodyAssertionType.REGEX) {
|
||||
extractParamsTableRef.value?.addTableLine(
|
||||
condition.value.xpathAssertion.regexAssertion?.findIndex((e) => e.id === activeRecord.value.id) || 0
|
||||
);
|
||||
|
@ -701,8 +703,8 @@
|
|||
emit('change', { ...condition.value });
|
||||
}
|
||||
|
||||
function copyItem(record) {
|
||||
switch (activeTab.value) {
|
||||
function copyItem(record: Record<string, any>) {
|
||||
switch (condition.value.assertionBodyType) {
|
||||
case ResponseBodyAssertionType.JSON_PATH:
|
||||
const jsonIndex = condition.value.jsonPathAssertion.assertions.findIndex((item) => item.id === record.id);
|
||||
if (jsonIndex > -1) {
|
||||
|
@ -710,9 +712,10 @@
|
|||
...record,
|
||||
id: new Date().getTime().toString(),
|
||||
});
|
||||
// emit('change', { ...condition.value });
|
||||
const temArr = cloneDeep(condition.value.jsonPathAssertion.assertions);
|
||||
condition.value.jsonPathAssertion.assertions = temArr;
|
||||
emit('change', { ...condition.value });
|
||||
}
|
||||
|
||||
break;
|
||||
case ResponseBodyAssertionType.XPATH:
|
||||
const xpathIndex = condition.value.xpathAssertion.assertions.findIndex((item) => item.id === record.id);
|
||||
|
@ -721,10 +724,12 @@
|
|||
...record,
|
||||
id: new Date().getTime().toString(),
|
||||
});
|
||||
const temArr = cloneDeep(condition.value.xpathAssertion.assertions);
|
||||
condition.value.xpathAssertion.assertions = temArr;
|
||||
}
|
||||
// emit('change', {
|
||||
// ...condition.value,
|
||||
// });
|
||||
emit('change', {
|
||||
...condition.value,
|
||||
});
|
||||
break;
|
||||
case ResponseBodyAssertionType.DOCUMENT:
|
||||
condition.value.documentAssertion.jsonAssertion.push({
|
||||
|
@ -733,14 +738,16 @@
|
|||
});
|
||||
break;
|
||||
case ResponseBodyAssertionType.REGEX:
|
||||
const regIndex = condition.value.xpathAssertion.assertions.findIndex((item) => item.id === record.id);
|
||||
const regIndex = condition.value.regexAssertion.assertions.findIndex((item) => item.id === record.id);
|
||||
if (regIndex > -1) {
|
||||
condition.value.regexAssertion.assertions.splice(regIndex, 0, {
|
||||
...record,
|
||||
id: new Date().getTime().toString(),
|
||||
});
|
||||
const temArr = cloneDeep(condition.value.regexAssertion.assertions);
|
||||
condition.value.regexAssertion.assertions = temArr;
|
||||
}
|
||||
// emit('change', { ...condition.value});
|
||||
emit('change', { ...condition.value });
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<paramsTable
|
||||
v-model:params="condition.assertions"
|
||||
:selectable="false"
|
||||
:selectable="true"
|
||||
:columns="columns"
|
||||
:scroll="{ minWidth: '700px' }"
|
||||
:default-param-item="defaultParamItem"
|
||||
|
@ -15,13 +15,14 @@
|
|||
<script setup lang="ts">
|
||||
import { useVModel } from '@vueuse/core';
|
||||
|
||||
import { statusCodeOptions } from '@/components/pure/ms-advance-filter/index';
|
||||
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
|
||||
|
||||
import { responseHeaderOption } from '@/config/apiTest';
|
||||
|
||||
import type { ExecuteAssertionItem } from '@/models/apiTest/common';
|
||||
|
||||
import { statusCodeOptions } from './utils';
|
||||
|
||||
interface Param {
|
||||
[key: string]: any;
|
||||
assertions: ExecuteAssertionItem[];
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
import { computed } from 'vue';
|
||||
import { useVModel } from '@vueuse/core';
|
||||
|
||||
import { statusCodeOptions } from '@/components/pure/ms-advance-filter/index';
|
||||
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
|
||||
import { statusCodeOptions } from './utils';
|
||||
|
||||
const { t } = useI18n();
|
||||
interface Param {
|
||||
id: string;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import {
|
||||
CONTAINS,
|
||||
EMPTY,
|
||||
END_WITH,
|
||||
EQUAL,
|
||||
NO_CONTAINS,
|
||||
NOT_EMPTY,
|
||||
NOT_EQUAL,
|
||||
REGEX,
|
||||
START_WITH,
|
||||
} from '@/components/pure/ms-advance-filter/index';
|
||||
|
||||
export const statusCodeOptions = [CONTAINS, NO_CONTAINS, EQUAL, NOT_EQUAL];
|
||||
|
||||
export default {};
|
|
@ -40,7 +40,7 @@
|
|||
>
|
||||
<div class="ms-assertion-body-left-item-row">
|
||||
<span class="ms-assertion-body-left-item-row-num">{{ index + 1 }}</span>
|
||||
<span class="ms-assertion-body-left-item-row-title">{{ item.name }}</span>
|
||||
<span class="one-text-line">{{ item.name }}</span>
|
||||
</div>
|
||||
<div class="ms-assertion-body-left-item-switch">
|
||||
<div v-show="!props.disabled" class="ms-assertion-body-left-item-switch-action">
|
||||
|
@ -49,7 +49,7 @@
|
|||
class="action-btn-move sort-handle cursor-move text-[12px] text-[var(--color-text-4)]"
|
||||
/>
|
||||
<MsTableMoreAction
|
||||
:list="itemMoreActions"
|
||||
:list="getItemMoreActions(item)"
|
||||
trigger="click"
|
||||
@select="handleMoreActionSelect($event, item)"
|
||||
@close="focusKey = ''"
|
||||
|
@ -149,7 +149,7 @@
|
|||
import { ExecuteAssertionConfig } from '@/models/apiTest/common';
|
||||
import { ResponseAssertionType, ResponseBodyAssertionType } from '@/enums/apiEnum';
|
||||
|
||||
import { MsAssertionItem } from './type';
|
||||
import { ExecuteAssertion, MsAssertionItem } from './type';
|
||||
|
||||
defineOptions({
|
||||
name: 'MsAssertion',
|
||||
|
@ -182,7 +182,6 @@
|
|||
const activeKey = ref<string>('');
|
||||
|
||||
const getCurrentItemState = ref(assertions.value[0]);
|
||||
|
||||
const itemMoreActions: ActionsItem[] = [
|
||||
{
|
||||
label: 'common.copy',
|
||||
|
@ -193,6 +192,13 @@
|
|||
eventTag: 'delete',
|
||||
},
|
||||
];
|
||||
function getItemMoreActions(item: any) {
|
||||
if (item.assertionType === ResponseAssertionType.SCRIPT) {
|
||||
return itemMoreActions;
|
||||
}
|
||||
return itemMoreActions.slice(-1);
|
||||
}
|
||||
|
||||
// 源选项
|
||||
const assertOptionSource = [
|
||||
{
|
||||
|
@ -226,6 +232,21 @@
|
|||
return assertions.value.length > 0;
|
||||
});
|
||||
|
||||
function validateAddType(value: string | number | Record<string, any> | undefined) {
|
||||
// 找到对应的类型项
|
||||
const addTypeLength =
|
||||
assertions.value.filter(
|
||||
(item: any) => item.assertionType === value && item.assertionType !== ResponseAssertionType.SCRIPT
|
||||
).length === 1;
|
||||
if (addTypeLength) {
|
||||
// 赋值当前项加深颜色并且不添加
|
||||
getCurrentItemState.value = assertions.value.find((item: any) => item.assertionType === value);
|
||||
activeKey.value = getCurrentItemState.value.id;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// dropdown选择
|
||||
const handleSelect = (value: string | number | Record<string, any> | undefined) => {
|
||||
const id = new Date().getTime().toString();
|
||||
|
@ -236,79 +257,83 @@
|
|||
enable: true,
|
||||
};
|
||||
|
||||
switch (value) {
|
||||
// 请求头
|
||||
case ResponseAssertionType.RESPONSE_HEADER:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
assertions: [],
|
||||
});
|
||||
break;
|
||||
// 状态码
|
||||
case ResponseAssertionType.RESPONSE_CODE:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
condition: 'EQUALS',
|
||||
expectedValue: '200',
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.RESPONSE_BODY:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
assertionBodyType: ResponseBodyAssertionType.JSON_PATH,
|
||||
jsonPathAssertion: {
|
||||
// 校验添加的类型是否已经重复
|
||||
if (validateAddType(value)) {
|
||||
switch (value) {
|
||||
// 请求头
|
||||
case ResponseAssertionType.RESPONSE_HEADER:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
assertions: [],
|
||||
},
|
||||
xpathAssertion: {
|
||||
responseFormat: 'XML',
|
||||
assertions: [],
|
||||
},
|
||||
regexAssertion: {
|
||||
assertions: [],
|
||||
},
|
||||
bodyAssertionDataByType: {},
|
||||
});
|
||||
break;
|
||||
// 响应时间
|
||||
case ResponseAssertionType.RESPONSE_TIME:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
expectedValue: 100,
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.VARIABLE:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
condition: '',
|
||||
expectedValue: '',
|
||||
variableAssertionItems: [],
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.SCRIPT:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
id,
|
||||
processorType: ResponseAssertionType.SCRIPT,
|
||||
name: t('apiTestDebug.preconditionScriptName'),
|
||||
enableCommonScript: false,
|
||||
script: '',
|
||||
scriptId: '',
|
||||
scriptLanguage: LanguageEnum.BEANSHELL_JSR233,
|
||||
commonScriptInfo: {
|
||||
id: '',
|
||||
name: '',
|
||||
});
|
||||
break;
|
||||
// 状态码
|
||||
case ResponseAssertionType.RESPONSE_CODE:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
condition: 'EQUALS',
|
||||
expectedValue: '200',
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.RESPONSE_BODY:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
assertionBodyType: ResponseBodyAssertionType.JSON_PATH,
|
||||
jsonPathAssertion: {
|
||||
assertions: [],
|
||||
},
|
||||
xpathAssertion: {
|
||||
responseFormat: 'XML',
|
||||
assertions: [],
|
||||
},
|
||||
regexAssertion: {
|
||||
assertions: [],
|
||||
},
|
||||
bodyAssertionDataByType: {},
|
||||
});
|
||||
break;
|
||||
// 响应时间
|
||||
case ResponseAssertionType.RESPONSE_TIME:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
expectedValue: 100,
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.VARIABLE:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
condition: '',
|
||||
expectedValue: '',
|
||||
variableAssertionItems: [],
|
||||
});
|
||||
break;
|
||||
case ResponseAssertionType.SCRIPT:
|
||||
assertions.value.push({
|
||||
...tmpObj,
|
||||
id,
|
||||
processorType: ResponseAssertionType.SCRIPT,
|
||||
name: t('apiTestDebug.preconditionScriptName'),
|
||||
enableCommonScript: false,
|
||||
script: '',
|
||||
params: [{}],
|
||||
scriptId: '',
|
||||
scriptLanguage: LanguageEnum.BEANSHELL_JSR233,
|
||||
},
|
||||
});
|
||||
break;
|
||||
commonScriptInfo: {
|
||||
id: '',
|
||||
name: '',
|
||||
script: '',
|
||||
params: [{}],
|
||||
scriptLanguage: LanguageEnum.BEANSHELL_JSR233,
|
||||
},
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
getCurrentItemState.value = assertions.value[assertions.value.length - 1];
|
||||
activeKey.value = assertions.value[assertions.value.length - 1].id;
|
||||
}
|
||||
getCurrentItemState.value = assertions.value[assertions.value.length - 1];
|
||||
activeKey.value = assertions.value[assertions.value.length - 1].id;
|
||||
|
||||
emit('change');
|
||||
};
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="h-full w-[180px] bg-white">
|
||||
<a-menu
|
||||
class="mr-[16px] w-[180px] min-w-[180px] bg-white p-[4px]"
|
||||
:default-selected-keys="defaultModule"
|
||||
:default-selected-keys="[defaultModule]"
|
||||
@menu-item-click="clickModule"
|
||||
>
|
||||
<a-menu-item :key="'all'">
|
||||
|
|
|
@ -3,28 +3,28 @@ export { default as MsAdvanceFilter } from './index.vue';
|
|||
|
||||
// const IN = { label: 'advanceFilter.operator.in', value: 'in' };
|
||||
// const NOT_IN = { label: 'advanceFilter.operator.not_in', value: 'not_in' };
|
||||
const LIKE = { label: 'advanceFilter.operator.like', value: 'like' };
|
||||
const NOT_LIKE = { label: 'advanceFilter.operator.not_like', value: 'not_like' };
|
||||
const GT = { label: 'advanceFilter.operator.gt', value: 'GT' };
|
||||
const GE = { label: 'advanceFilter.operator.ge', value: 'GT_OR_EQUALS' };
|
||||
const LT = { label: 'advanceFilter.operator.lt', value: 'LT' };
|
||||
const LE = { label: 'advanceFilter.operator.le', value: 'LT_OR_EQUALS' };
|
||||
const EQUAL = { label: 'advanceFilter.operator.equal', value: 'EQUALS' };
|
||||
const NOT_EQUAL = { label: 'advanceFilter.operator.notEqual', value: 'NOT_EQUALS' };
|
||||
const BETWEEN = { label: 'advanceFilter.operator.between', value: 'between' };
|
||||
const NO_CHECK = { label: 'advanceFilter.operator.no_check', value: 'UNCHECK' };
|
||||
const CONTAINS = { label: 'advanceFilter.operator.contains', value: 'CONTAINS' };
|
||||
const NO_CONTAINS = { label: 'advanceFilter.operator.not_contains', value: 'NOT_CONTAINS' };
|
||||
const START_WITH = { label: 'advanceFilter.operator.start_with', value: 'START_WITH' };
|
||||
const END_WITH = { label: 'advanceFilter.operator.end_with', value: 'END_WITH' };
|
||||
const EMPTY = { label: 'advanceFilter.operator.empty', value: 'EMPTY' };
|
||||
const NOT_EMPTY = { label: 'advanceFilter.operator.not_empty', value: 'NOT_EMPTY' };
|
||||
const REGEX = { label: 'advanceFilter.operator.regexp', value: 'REGEX' };
|
||||
const LENGTH_EQUAL = { label: 'advanceFilter.operator.length.equal', value: 'LENGTH_EQUALS' };
|
||||
const LENGTH_GT = { label: 'advanceFilter.operator.length.gt', value: 'LENGTH_GT' };
|
||||
const LENGTH_GE = { label: 'advanceFilter.operator.length.ge', value: 'LENGTH_GT_OR_EQUALS' };
|
||||
const LENGTH_LT = { label: 'advanceFilter.operator.length.lt', value: 'LENGTH_LT' };
|
||||
const LENGTH_LE = { label: 'advanceFilter.operator.length.le', value: 'LENGTH_LT_OR_EQUALS' };
|
||||
export const LIKE = { label: 'advanceFilter.operator.like', value: 'like' };
|
||||
export const NOT_LIKE = { label: 'advanceFilter.operator.not_like', value: 'not_like' };
|
||||
export const GT = { label: 'advanceFilter.operator.gt', value: 'GT' };
|
||||
export const GE = { label: 'advanceFilter.operator.ge', value: 'GT_OR_EQUALS' };
|
||||
export const LT = { label: 'advanceFilter.operator.lt', value: 'LT' };
|
||||
export const LE = { label: 'advanceFilter.operator.le', value: 'LT_OR_EQUALS' };
|
||||
export const EQUAL = { label: 'advanceFilter.operator.equal', value: 'EQUALS' };
|
||||
export const NOT_EQUAL = { label: 'advanceFilter.operator.notEqual', value: 'NOT_EQUALS' };
|
||||
export const BETWEEN = { label: 'advanceFilter.operator.between', value: 'between' };
|
||||
export const NO_CHECK = { label: 'advanceFilter.operator.no_check', value: 'UNCHECK' };
|
||||
export const CONTAINS = { label: 'advanceFilter.operator.contains', value: 'CONTAINS' };
|
||||
export const NO_CONTAINS = { label: 'advanceFilter.operator.not_contains', value: 'NOT_CONTAINS' };
|
||||
export const START_WITH = { label: 'advanceFilter.operator.start_with', value: 'START_WITH' };
|
||||
export const END_WITH = { label: 'advanceFilter.operator.end_with', value: 'END_WITH' };
|
||||
export const EMPTY = { label: 'advanceFilter.operator.empty', value: 'EMPTY' };
|
||||
export const NOT_EMPTY = { label: 'advanceFilter.operator.not_empty', value: 'NOT_EMPTY' };
|
||||
export const REGEX = { label: 'advanceFilter.operator.regexp', value: 'REGEX' };
|
||||
export const LENGTH_EQUAL = { label: 'advanceFilter.operator.length.equal', value: 'LENGTH_EQUALS' };
|
||||
export const LENGTH_GT = { label: 'advanceFilter.operator.length.gt', value: 'LENGTH_GT' };
|
||||
export const LENGTH_GE = { label: 'advanceFilter.operator.length.ge', value: 'LENGTH_GT_OR_EQUALS' };
|
||||
export const LENGTH_LT = { label: 'advanceFilter.operator.length.lt', value: 'LENGTH_LT' };
|
||||
export const LENGTH_LE = { label: 'advanceFilter.operator.length.le', value: 'LENGTH_LT_OR_EQUALS' };
|
||||
export const OPERATOR_MAP = {
|
||||
string: [LIKE, NOT_LIKE, EQUAL, NOT_EQUAL],
|
||||
number: [GT, GE, LT, LE, EQUAL, NOT_EQUAL, BETWEEN],
|
||||
|
|
|
@ -60,6 +60,8 @@ export enum TableKeyEnum {
|
|||
PROJECT_MANAGEMENT_ENV_ALL_PARAM_HEADER = 'projectManagementEnvAllParamHeader',
|
||||
PROJECT_MANAGEMENT_ENV_ALL_PARAM_VARIABLE = 'projectManagementEnvAllParamVariable',
|
||||
TEST_PLAN_ALL_TABLE = 'testPlanAllTable',
|
||||
TASK_API_CASE = 'taskCenterApiCase',
|
||||
TASK_SCHEDULE_TASK = 'taskCenterSchedule',
|
||||
}
|
||||
|
||||
// 具有特殊功能的列
|
||||
|
|
|
@ -197,6 +197,11 @@
|
|||
});
|
||||
break;
|
||||
case RequestConditionProcessor.EXTRACT:
|
||||
const isEXTRACT = data.value.find((item) => item.processorType === RequestConditionProcessor.EXTRACT);
|
||||
if (isEXTRACT) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.value.push({
|
||||
id,
|
||||
processorType: RequestConditionProcessor.EXTRACT,
|
||||
|
|
|
@ -110,6 +110,10 @@
|
|||
return false;
|
||||
});
|
||||
|
||||
const hasEXTRACT = computed(() => {
|
||||
return data.value.filter((item: any) => item.processorType === RequestConditionProcessor.EXTRACT).length > 0;
|
||||
});
|
||||
|
||||
const itemMoreActions: ActionsItem[] = [
|
||||
{
|
||||
label: 'common.copy',
|
||||
|
@ -123,20 +127,15 @@
|
|||
];
|
||||
|
||||
let moreActions: ActionsItem[] = [...itemMoreActions];
|
||||
watch(
|
||||
() => hasPreAndPost.value,
|
||||
(val) => {
|
||||
if (val) {
|
||||
moreActions = itemMoreActions.slice(-1);
|
||||
} else {
|
||||
moreActions = itemMoreActions;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watchEffect(() => {
|
||||
activeItem.value = data.value.find((item) => item.id === props.activeId) || data.value[0] || {};
|
||||
emit('activeChange', activeItem.value);
|
||||
if (hasPreAndPost.value || hasEXTRACT.value) {
|
||||
moreActions = itemMoreActions.slice(-1);
|
||||
} else {
|
||||
moreActions = itemMoreActions;
|
||||
}
|
||||
});
|
||||
|
||||
function handleItemClick(item: ExecuteConditionProcessor) {
|
||||
|
|
|
@ -118,7 +118,13 @@
|
|||
<pre v-for="(e, i) of matchResult" :key="i">{{ e }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<a-collapse v-model:active-key="moreSettingActive" :bordered="false" :show-expand-icon="false" class="mt-[16px]">
|
||||
<a-collapse
|
||||
v-if="props.isShowMoreSetting"
|
||||
v-model:active-key="moreSettingActive"
|
||||
:bordered="false"
|
||||
:show-expand-icon="false"
|
||||
class="mt-[16px]"
|
||||
>
|
||||
<a-collapse-item :key="1">
|
||||
<template #header>
|
||||
<MsButton
|
||||
|
@ -157,11 +163,17 @@
|
|||
import type { JSONPathExtract, RegexExtract, XPathExtract } from '@/models/apiTest/common';
|
||||
import { RequestExtractExpressionEnum, RequestExtractExpressionRuleType } from '@/enums/apiEnum';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
config: (RegexExtract | JSONPathExtract | XPathExtract) & Record<string, any>;
|
||||
response?: string; // 响应内容
|
||||
}>();
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
visible: boolean;
|
||||
config: (RegexExtract | JSONPathExtract | XPathExtract) & Record<string, any>;
|
||||
response?: string; // 响应内容
|
||||
isShowMoreSetting?: boolean; // 是否展示更多设置
|
||||
}>(),
|
||||
{
|
||||
isShowMoreSetting: true,
|
||||
}
|
||||
);
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', value: boolean): void;
|
||||
(e: 'apply', config: (RegexExtract | JSONPathExtract | XPathExtract) & Record<string, any>): void;
|
||||
|
@ -235,7 +247,7 @@
|
|||
if (matchesIterator) {
|
||||
const matches = Array.from(matchesIterator);
|
||||
try {
|
||||
if (expressionForm.value.expressionMatchingRule === RequestExtractExpressionRuleType.EXPRESSION) {
|
||||
if (expressionForm.value.expressionMatchingRule === 'EXPRESSION') {
|
||||
// 匹配表达式,取第一个匹配结果,是完整匹配结果
|
||||
matchResult.value = matches.map((e) => e[0]) || [];
|
||||
} else {
|
||||
|
|
|
@ -331,12 +331,13 @@
|
|||
</a-select>
|
||||
</template>
|
||||
<!-- 匹配条件 -->
|
||||
<template #condition="{ record, columnConfig }">
|
||||
<template #condition="{ record, columnConfig, rowIndex }">
|
||||
<a-select
|
||||
v-model="record.condition"
|
||||
:disabled="props.disabledExceptParam"
|
||||
size="mini"
|
||||
class="ms-form-table-input"
|
||||
@change="() => addTableLine(rowIndex)"
|
||||
>
|
||||
<a-option v-for="item in columnConfig.options" :key="item.value" :value="item.value">{{
|
||||
t(item.label)
|
||||
|
@ -367,6 +368,7 @@
|
|||
:disabled="props.disabledExceptParam"
|
||||
size="mini"
|
||||
class="ms-form-table-input"
|
||||
@change="() => addTableLine(rowIndex)"
|
||||
/>
|
||||
</template>
|
||||
<!-- 项目选择 -->
|
||||
|
@ -549,6 +551,7 @@
|
|||
import { groupCategoryEnvList, groupProjectEnv } from '@/api/modules/project-management/envManagement';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
import { isArray, isEmptyObject, isNumber, isObject, isRegExp, isString, isUndefined } from '@/utils/is';
|
||||
|
||||
import { ModuleTreeNode, TransferFileParams } from '@/models/common';
|
||||
import { HttpForm, ProjectOptionItem } from '@/models/projectManagement/environmental';
|
||||
|
@ -767,6 +770,32 @@
|
|||
initProjectOptions();
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 当表格输入框变化时,表格的每一个值存在的情况下才添加行
|
||||
* @param 注意: 目前只做了数组&布尔&字符串类型的校验
|
||||
* @param dataItem 当前编辑项
|
||||
* @param
|
||||
*/
|
||||
function validateAddLine(dataItem: Record<string, any>) {
|
||||
return Object.keys(dataItem).every((key: any) => {
|
||||
if (typeof dataItem[key] === 'boolean') {
|
||||
return true;
|
||||
}
|
||||
if (dataItem[key] && typeof dataItem[key] !== 'boolean') {
|
||||
if (isArray(dataItem[key])) {
|
||||
return dataItem[key].length > 0;
|
||||
}
|
||||
if (isObject(dataItem[key]) && isEmptyObject(dataItem[key])) {
|
||||
return true;
|
||||
}
|
||||
if (isString(dataItem[key])) {
|
||||
return dataItem[key].trim().length > 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/** 环境管理-环境组 end */
|
||||
|
||||
|
@ -781,11 +810,11 @@
|
|||
emitChange('addTableLine addLineDisabled', isInit);
|
||||
return;
|
||||
}
|
||||
// 判断每一个值是否存在才会加行
|
||||
if (
|
||||
rowIndex === paramsData.value.length - 1 &&
|
||||
(paramsData.value[rowIndex].key || paramsData.value[rowIndex].projectId)
|
||||
(rowIndex === paramsData.value.length - 1 && validateAddLine(paramsData.value[rowIndex])) ||
|
||||
paramsData.value[rowIndex].projectId
|
||||
) {
|
||||
// 最后一行的更改才会触发添加新一行
|
||||
const id = new Date().getTime().toString();
|
||||
paramsData.value.push({
|
||||
id,
|
||||
|
|
|
@ -181,15 +181,9 @@
|
|||
*/
|
||||
async function loadLoop() {
|
||||
if (activeStepDetail.value?.content) {
|
||||
const { content } = activeStepDetail.value;
|
||||
activeStepDetailCopy.value = {
|
||||
...activeStepDetail.value,
|
||||
content: {
|
||||
...content,
|
||||
responseResult: {
|
||||
...subRequestResults.value[current.value - 1],
|
||||
},
|
||||
},
|
||||
content: cloneDeep(subRequestResults.value[current.value - 1]),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@
|
|||
case ResponseComposition.EXTRACT:
|
||||
return showExtract.value;
|
||||
case ResponseComposition.ASSERTION:
|
||||
return props.requestResult?.responseResult.assertions.length;
|
||||
return (props.requestResult?.responseResult.assertions || []).length;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@
|
|||
showSetting: true,
|
||||
selectable: true,
|
||||
heightUsed: 330,
|
||||
showSelectorAll: false,
|
||||
showSelectorAll: true,
|
||||
},
|
||||
(item) => ({
|
||||
...item,
|
||||
|
@ -402,15 +402,14 @@
|
|||
const showCaseDetailDrawer = ref<boolean>(false);
|
||||
const activeCaseReportType = ref('');
|
||||
function showReportDetail(id: string, rowIndex: number, integrated: boolean) {
|
||||
activeDetailId.value = id;
|
||||
activeReportIndex.value = rowIndex;
|
||||
if (props.moduleType === ReportEnum.API_SCENARIO_REPORT) {
|
||||
showDetailDrawer.value = true;
|
||||
} else {
|
||||
showCaseDetailDrawer.value = true;
|
||||
activeCaseReportType.value = integrated ? 'INTEGRATED' : 'INDEPENDENT';
|
||||
}
|
||||
|
||||
activeDetailId.value = id;
|
||||
activeReportIndex.value = rowIndex;
|
||||
}
|
||||
|
||||
watch(
|
||||
|
|
|
@ -8,15 +8,28 @@
|
|||
</a-radio>
|
||||
</a-radio-group>
|
||||
</div>
|
||||
<MsCascader
|
||||
v-model:model-value="innerKeyword"
|
||||
mode="native"
|
||||
option-size="small"
|
||||
:multiple="false"
|
||||
class="w-[240px]"
|
||||
:options="cascaderOptions || []"
|
||||
:placeholder="t('report.detail.api.filterPlaceholder')"
|
||||
/>
|
||||
<div class="w-[240px]">
|
||||
<MsCascader
|
||||
v-model:model-value="innerKeyword"
|
||||
mode="native"
|
||||
option-size="small"
|
||||
class="w-full"
|
||||
:multiple="false"
|
||||
:options="cascaderOptions || []"
|
||||
:virtual-list-props="{ height: 200 }"
|
||||
:placeholder="t('report.detail.api.filterPlaceholder')"
|
||||
>
|
||||
<template #option="{ data }">
|
||||
<div title="">
|
||||
<a-tooltip :content="t(data.label)">
|
||||
<div class="one-line-text w-[100%]" title="">
|
||||
{{ t(data.label) }}
|
||||
</div>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</template>
|
||||
</MsCascader>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -90,4 +103,4 @@
|
|||
]);
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
<style scoped lang="less"></style>
|
||||
|
|
|
@ -113,14 +113,18 @@
|
|||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useModal from '@/hooks/useModal';
|
||||
import useOpenNewPage from '@/hooks/useOpenNewPage';
|
||||
import { useTableStore } from '@/store';
|
||||
import { characterLimit } from '@/utils';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import { BatchApiParams } from '@/models/common';
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { ExecutionMethodsLabel, TaskCenterEnum } from '@/enums/taskCenter';
|
||||
|
||||
import { TaskStatus } from './utils';
|
||||
|
||||
const tableStore = useTableStore();
|
||||
|
||||
const { openModal } = useModal();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
@ -239,11 +243,11 @@
|
|||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||
loadRealMap.value[props.group].list,
|
||||
{
|
||||
columns,
|
||||
tableKey: TableKeyEnum.TASK_API_CASE,
|
||||
scroll: {
|
||||
x: '100%',
|
||||
},
|
||||
showSetting: false,
|
||||
showSetting: true,
|
||||
selectable: true,
|
||||
heightUsed: 330,
|
||||
showSelectAll: true,
|
||||
|
@ -293,7 +297,6 @@
|
|||
await loadRealMap.value[props.group].batchStop({
|
||||
selectIds: selectAll ? [] : selectIds,
|
||||
selectAll,
|
||||
moduleType: props.moduleType,
|
||||
});
|
||||
resetSelector();
|
||||
Message.success(t('project.taskCenter.stopSuccess'));
|
||||
|
@ -386,6 +389,9 @@
|
|||
}
|
||||
}
|
||||
);
|
||||
onMounted(async () => {
|
||||
await tableStore.initColumn(TableKeyEnum.TASK_API_CASE, columns, 'drawer', true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
@ -55,9 +55,13 @@
|
|||
getScheduleSysApiCaseList,
|
||||
} from '@/api/modules/project-management/taskCenter';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import { useTableStore } from '@/store';
|
||||
|
||||
import { TableKeyEnum } from '@/enums/tableEnum';
|
||||
import { TaskCenterEnum } from '@/enums/taskCenter';
|
||||
|
||||
const tableStore = useTableStore();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
|
@ -128,6 +132,7 @@
|
|||
dataIndex: 'operation',
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
showDrag: false,
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -140,11 +145,11 @@
|
|||
const { propsRes, propsEvent, loadList, setLoadListParams, resetSelector } = useTable(
|
||||
loadRealMap.value[props.group],
|
||||
{
|
||||
columns,
|
||||
tableKey: TableKeyEnum.TASK_SCHEDULE_TASK,
|
||||
scroll: {
|
||||
x: '100%',
|
||||
},
|
||||
showSetting: false,
|
||||
showSetting: true,
|
||||
selectable: true,
|
||||
heightUsed: 300,
|
||||
enableDrag: false,
|
||||
|
@ -205,6 +210,9 @@
|
|||
}
|
||||
}
|
||||
);
|
||||
onMounted(async () => {
|
||||
await tableStore.initColumn(TableKeyEnum.TASK_SCHEDULE_TASK, columns, 'drawer', true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
Loading…
Reference in New Issue