fix: 修改全局组件断言相关问题
This commit is contained in:
parent
c18652c809
commit
7f32e69ea2
|
@ -1,14 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex w-full flex-col">
|
<div class="flex w-full flex-col">
|
||||||
<div>
|
<div>
|
||||||
<a-radio-group v-model:model-value="activeTab" type="button" size="small">
|
<a-radio-group v-model:model-value="condition.assertionBodyType" type="button" size="small">
|
||||||
<a-radio v-for="item of responseRadios" :key="item.value" :value="item.value">
|
<a-radio v-for="item of responseRadios" :key="item.value" :value="item.value">
|
||||||
{{ t(item.label) }}
|
{{ t(item.label) }}
|
||||||
</a-radio>
|
</a-radio>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</div>
|
</div>
|
||||||
<!-- jsonPath开始 -->
|
<!-- jsonPath开始 -->
|
||||||
<div v-if="activeTab === ResponseBodyAssertionType.JSON_PATH" class="mt-[16px]">
|
<div v-if="condition.assertionBodyType === ResponseBodyAssertionType.JSON_PATH" class="mt-[16px]">
|
||||||
<paramsTable
|
<paramsTable
|
||||||
ref="extractParamsTableRef"
|
ref="extractParamsTableRef"
|
||||||
v-model:params="condition.jsonPathAssertion.assertions"
|
v-model:params="condition.jsonPathAssertion.assertions"
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- jsonPath结束 -->
|
<!-- jsonPath结束 -->
|
||||||
<!-- xPath开始 -->
|
<!-- xPath开始 -->
|
||||||
<div v-if="activeTab === ResponseBodyAssertionType.XPATH" class="mt-[16px]">
|
<div v-if="condition.assertionBodyType === ResponseBodyAssertionType.XPATH" class="mt-[16px]">
|
||||||
<div class="text-[var(--color-text-1)]">{{ t('ms.assertion.responseContentType') }}</div>
|
<div class="text-[var(--color-text-1)]">{{ t('ms.assertion.responseContentType') }}</div>
|
||||||
<a-radio-group
|
<a-radio-group
|
||||||
v-model="condition.xpathAssertion.responseFormat"
|
v-model="condition.xpathAssertion.responseFormat"
|
||||||
|
@ -184,7 +184,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- xPath结束 -->
|
<!-- xPath结束 -->
|
||||||
<!-- document开始 -->
|
<!-- document开始 -->
|
||||||
<div v-if="activeTab === ResponseBodyAssertionType.DOCUMENT" class="relative mt-[16px]">
|
<div v-if="condition.assertionBodyType === ResponseBodyAssertionType.DOCUMENT" class="relative mt-[16px]">
|
||||||
<div class="text-[var(--color-text-1)]">
|
<div class="text-[var(--color-text-1)]">
|
||||||
{{ t('ms.assertion.responseContentType') }}
|
{{ t('ms.assertion.responseContentType') }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -248,7 +248,7 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- document结束 -->
|
<!-- document结束 -->
|
||||||
<!-- 正则开始 -->
|
<!-- 正则开始 -->
|
||||||
<div v-if="activeTab === ResponseBodyAssertionType.REGEX" class="mt-[16px]">
|
<div v-if="condition.assertionBodyType === ResponseBodyAssertionType.REGEX" class="mt-[16px]">
|
||||||
<paramsTable
|
<paramsTable
|
||||||
ref="extractParamsTableRef"
|
ref="extractParamsTableRef"
|
||||||
v-model:params="condition.regexAssertion.assertions"
|
v-model:params="condition.regexAssertion.assertions"
|
||||||
|
@ -330,10 +330,6 @@
|
||||||
</paramsTable>
|
</paramsTable>
|
||||||
</div>
|
</div>
|
||||||
<!-- 正则结束 -->
|
<!-- 正则结束 -->
|
||||||
<!-- 这一版断言里边的脚本不需要 -->
|
|
||||||
<!-- <div v-if="activeTab === ResponseBodyAssertionType.SCRIPT" class="mt-[16px]">
|
|
||||||
<conditionContent v-model:data="condition.script" :height-used="600" is-build-in class="mt-[16px]" />
|
|
||||||
</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
<fastExtraction
|
<fastExtraction
|
||||||
v-model:visible="fastExtractionVisible"
|
v-model:visible="fastExtractionVisible"
|
||||||
|
@ -350,12 +346,10 @@
|
||||||
import { statusCodeOptions } from '@/components/pure/ms-advance-filter';
|
import { statusCodeOptions } from '@/components/pure/ms-advance-filter';
|
||||||
import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
|
import { ActionsItem } from '@/components/pure/ms-table-more-action/types';
|
||||||
import { TableOperationColumn } from '../../ms-user-group-comp/authTable.vue';
|
import { TableOperationColumn } from '../../ms-user-group-comp/authTable.vue';
|
||||||
import conditionContent from '@/views/api-test/components/condition/content.vue';
|
|
||||||
import fastExtraction from '@/views/api-test/components/fastExtraction/index.vue';
|
import fastExtraction from '@/views/api-test/components/fastExtraction/index.vue';
|
||||||
import moreSetting from '@/views/api-test/components/fastExtraction/moreSetting.vue';
|
import moreSetting from '@/views/api-test/components/fastExtraction/moreSetting.vue';
|
||||||
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
|
import paramsTable, { type ParamTableColumn } from '@/views/api-test/components/paramTable.vue';
|
||||||
|
|
||||||
import { conditionTypeNameMap } from '@/config/apiTest';
|
|
||||||
import { useI18n } from '@/hooks/useI18n';
|
import { useI18n } from '@/hooks/useI18n';
|
||||||
import {
|
import {
|
||||||
countNodes,
|
countNodes,
|
||||||
|
@ -374,8 +368,6 @@
|
||||||
XPathExtract,
|
XPathExtract,
|
||||||
} from '@/models/apiTest/common';
|
} from '@/models/apiTest/common';
|
||||||
import {
|
import {
|
||||||
RequestConditionProcessor,
|
|
||||||
RequestConditionScriptLanguage,
|
|
||||||
RequestExtractEnvType,
|
RequestExtractEnvType,
|
||||||
RequestExtractExpressionEnum,
|
RequestExtractExpressionEnum,
|
||||||
RequestExtractExpressionRuleType,
|
RequestExtractExpressionRuleType,
|
||||||
|
@ -385,26 +377,31 @@
|
||||||
ResponseBodyXPathAssertionFormat,
|
ResponseBodyXPathAssertionFormat,
|
||||||
} from '@/enums/apiEnum';
|
} from '@/enums/apiEnum';
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
interface Param {
|
interface Param {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
// (e: 'update:data', data: ExecuteConditionProcessor): void;
|
|
||||||
(e: 'copy'): void;
|
|
||||||
(e: 'delete', id: number): void;
|
|
||||||
(e: 'change', param: Param): void;
|
|
||||||
}>();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const rootId = 0; // 1970-01-01 00:00:00 UTC
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
data: Param;
|
data: Param;
|
||||||
response?: string;
|
response?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'update:data', data: ExecuteConditionProcessor): void;
|
||||||
|
(e: 'copy'): void;
|
||||||
|
(e: 'delete', id: number): void;
|
||||||
|
(e: 'change', param: Param): void;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const condition = useVModel(props, 'data', emit);
|
||||||
|
|
||||||
|
const rootId = 0; // 1970-01-01 00:00:00 UTC
|
||||||
|
|
||||||
const activeTab = ref(ResponseBodyAssertionType.JSON_PATH);
|
const activeTab = ref(ResponseBodyAssertionType.JSON_PATH);
|
||||||
const activeResponseFormat = ref('XML');
|
|
||||||
const defaultParamItem = {
|
const defaultParamItem = {
|
||||||
jsonPathAssertion: {
|
jsonPathAssertion: {
|
||||||
assertions: [],
|
assertions: [],
|
||||||
|
@ -414,26 +411,8 @@
|
||||||
regexAssertion: {
|
regexAssertion: {
|
||||||
assertions: [],
|
assertions: [],
|
||||||
},
|
},
|
||||||
// TODO文档暂时不做
|
|
||||||
// documentAssertion: {
|
|
||||||
// jsonAssertion: [
|
|
||||||
// {
|
|
||||||
// id: rootId,
|
|
||||||
// paramsName: 'root',
|
|
||||||
// mustInclude: false,
|
|
||||||
// typeChecking: false,
|
|
||||||
// paramType: 'object',
|
|
||||||
// matchCondition: '',
|
|
||||||
// matchValue: '',
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// responseFormat: 'JSON',
|
|
||||||
// followApi: false,
|
|
||||||
// },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const condition = useVModel(props, 'data', emit);
|
|
||||||
|
|
||||||
const extractParamsTableRef = ref<InstanceType<typeof paramsTable>>();
|
const extractParamsTableRef = ref<InstanceType<typeof paramsTable>>();
|
||||||
const fastExtractionVisible = ref(false);
|
const fastExtractionVisible = ref(false);
|
||||||
const disabledExpressionSuffix = ref(false);
|
const disabledExpressionSuffix = ref(false);
|
||||||
|
@ -521,7 +500,7 @@
|
||||||
case ResponseBodyAssertionType.JSON_PATH:
|
case ResponseBodyAssertionType.JSON_PATH:
|
||||||
condition.value.jsonPathAssertion.assertions = data;
|
condition.value.jsonPathAssertion.assertions = data;
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
emit('change', { ...condition.value, assertionBodyType: activeTab.value });
|
emit('change', { ...condition.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -530,7 +509,6 @@
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
emit('change', {
|
emit('change', {
|
||||||
...condition.value,
|
...condition.value,
|
||||||
assertionBodyType: activeTab.value,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -540,7 +518,7 @@
|
||||||
case ResponseBodyAssertionType.REGEX:
|
case ResponseBodyAssertionType.REGEX:
|
||||||
condition.value.regexAssertion.assertions = data;
|
condition.value.regexAssertion.assertions = data;
|
||||||
if (!isInit) {
|
if (!isInit) {
|
||||||
emit('change', { ...defaultParamItem, ...condition.value, assertionBodyType: activeTab.value });
|
emit('change', { ...defaultParamItem, ...condition.value });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -642,6 +620,7 @@
|
||||||
align: 'right',
|
align: 'right',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const documentDefaultParamItem = {
|
const documentDefaultParamItem = {
|
||||||
id: new Date().getTime(),
|
id: new Date().getTime(),
|
||||||
paramsName: '',
|
paramsName: '',
|
||||||
|
@ -731,7 +710,7 @@
|
||||||
...record,
|
...record,
|
||||||
id: new Date().getTime().toString(),
|
id: new Date().getTime().toString(),
|
||||||
});
|
});
|
||||||
emit('change', { ...condition.value, assertionBodyType: activeTab.value });
|
// emit('change', { ...condition.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -743,11 +722,9 @@
|
||||||
id: new Date().getTime().toString(),
|
id: new Date().getTime().toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
emit('change', {
|
// emit('change', {
|
||||||
...condition.value,
|
// ...condition.value,
|
||||||
assertionBodyType: activeTab.value,
|
// });
|
||||||
responseFormat: activeResponseFormat.value,
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
case ResponseBodyAssertionType.DOCUMENT:
|
case ResponseBodyAssertionType.DOCUMENT:
|
||||||
condition.value.documentAssertion.jsonAssertion.push({
|
condition.value.documentAssertion.jsonAssertion.push({
|
||||||
|
@ -763,7 +740,7 @@
|
||||||
id: new Date().getTime().toString(),
|
id: new Date().getTime().toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
emit('change', { ...condition.value, assertionBodyType: activeTab.value });
|
// emit('change', { ...condition.value});
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -886,6 +863,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleScriptChange = (data: ExecuteConditionProcessor) => {
|
const handleScriptChange = (data: ExecuteConditionProcessor) => {
|
||||||
condition.value.script = data;
|
condition.value.script = data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
height: 'calc(100vh - 490px)',
|
height: 'calc(100vh - 490px)',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<conditionContent v-model:data="condition" :disabled="disabled" is-build-in @change="handleChange" />
|
<conditionContent v-model:data="condition" />
|
||||||
</a-scrollbar>
|
</a-scrollbar>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -26,20 +26,26 @@
|
||||||
|
|
||||||
interface ScriptTabProps {
|
interface ScriptTabProps {
|
||||||
data: any;
|
data: any;
|
||||||
disabled?: boolean;
|
// disabled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<ScriptTabProps>();
|
const props = defineProps<ScriptTabProps>();
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'change', val: ScriptItem): void; // 数据发生变化
|
(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);
|
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({});
|
const currentEnvConfig = ref({});
|
||||||
|
|
||||||
async function initEnvironment() {
|
async function initEnvironment() {
|
||||||
if (store.currentId) {
|
if (store.currentId) {
|
||||||
currentEnvConfig.value = await getEnvironment(store.currentId);
|
currentEnvConfig.value = await getEnvironment(store.currentId);
|
||||||
|
@ -47,6 +53,7 @@
|
||||||
}
|
}
|
||||||
/** 向孙组件提供属性 */
|
/** 向孙组件提供属性 */
|
||||||
provide('currentEnvConfig', readonly(currentEnvConfig));
|
provide('currentEnvConfig', readonly(currentEnvConfig));
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
initEnvironment();
|
initEnvironment();
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,14 +26,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showBody" class="ms-assertion-body w-full">
|
<div v-if="showBody" class="ms-assertion-body w-full">
|
||||||
<a-scrollbar
|
<div class="ms-assertion-body-left h-full w-[20%] min-w-[220px]">
|
||||||
:style="{
|
<VueDraggable v-model="assertions" ghost-class="ghost" handle=".sort-handle">
|
||||||
overflow: 'auto',
|
|
||||||
height: 'calc(100vh - 458px)',
|
|
||||||
width: '100%',
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<VueDraggable v-model="assertions" class="ms-assertion-body-left" ghost-class="ghost" handle=".sort-handle">
|
|
||||||
<div
|
<div
|
||||||
v-for="(item, index) in assertions"
|
v-for="(item, index) in assertions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -75,25 +69,32 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</VueDraggable>
|
</VueDraggable>
|
||||||
</a-scrollbar>
|
</div>
|
||||||
<section class="ms-assertion-body-right h-full">
|
<div
|
||||||
|
class="ms-assertion-body-right h-full"
|
||||||
|
:class="{
|
||||||
|
'p-4': getCurrentItemState.assertionType !== ResponseAssertionType.SCRIPT,
|
||||||
|
'border border-solid border-[var(--color-text-n8)]':
|
||||||
|
getCurrentItemState.assertionType !== ResponseAssertionType.SCRIPT,
|
||||||
|
}"
|
||||||
|
>
|
||||||
<!-- 响应头 -->
|
<!-- 响应头 -->
|
||||||
<ResponseHeaderTab
|
<ResponseHeaderTab
|
||||||
v-if="valueKey === ResponseAssertionType.RESPONSE_HEADER"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.RESPONSE_HEADER"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
/>
|
/>
|
||||||
<!-- 状态码 -->
|
<!-- 状态码 -->
|
||||||
<StatusCodeTab
|
<StatusCodeTab
|
||||||
v-if="valueKey === ResponseAssertionType.RESPONSE_CODE"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.RESPONSE_CODE"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
/>
|
/>
|
||||||
<!-- 响应体 -->
|
<!-- 响应体 -->
|
||||||
<ResponseBodyTab
|
<ResponseBodyTab
|
||||||
v-if="valueKey === ResponseAssertionType.RESPONSE_BODY"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.RESPONSE_BODY"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
:response="props.response"
|
:response="props.response"
|
||||||
|
@ -101,27 +102,26 @@
|
||||||
/>
|
/>
|
||||||
<!-- 响应时间 -->
|
<!-- 响应时间 -->
|
||||||
<ResponseTimeTab
|
<ResponseTimeTab
|
||||||
v-if="valueKey === ResponseAssertionType.RESPONSE_TIME"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.RESPONSE_TIME"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
/>
|
/>
|
||||||
<!-- 变量 -->
|
<!-- 变量 -->
|
||||||
<VariableTab
|
<VariableTab
|
||||||
v-if="valueKey === ResponseAssertionType.VARIABLE"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.VARIABLE"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
:disabled="props.disabled"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
/>
|
/>
|
||||||
<!-- 脚本 -->
|
<!-- 脚本 -->
|
||||||
<ScriptTab
|
<ScriptTab
|
||||||
v-if="valueKey === ResponseAssertionType.SCRIPT"
|
v-if="getCurrentItemState.assertionType === ResponseAssertionType.SCRIPT"
|
||||||
v-model:data="getCurrentItemState"
|
v-model:data="getCurrentItemState"
|
||||||
:disabled="props.disabled"
|
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
/>
|
/>
|
||||||
<!-- </a-scrollbar> -->
|
<!-- </a-scrollbar> -->
|
||||||
</section>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -159,7 +159,9 @@
|
||||||
// 当前鼠标所在的key
|
// 当前鼠标所在的key
|
||||||
const focusKey = ref<string>('');
|
const focusKey = ref<string>('');
|
||||||
// 所有的断言列表参数
|
// 所有的断言列表参数
|
||||||
const assertions = defineModel<any[]>('params', { default: [] });
|
const assertions = defineModel<any[]>('params', {
|
||||||
|
required: true,
|
||||||
|
});
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
isDefinition?: boolean; // 是否是定义页面
|
isDefinition?: boolean; // 是否是定义页面
|
||||||
|
@ -170,75 +172,16 @@
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:assertionConfig', params: ExecuteAssertionConfig): void;
|
(e: 'update:assertionConfig', params: ExecuteAssertionConfig): void;
|
||||||
|
// TODO 类型优化
|
||||||
|
(e: 'update:params', params: any[]): void;
|
||||||
(e: 'change'): void;
|
(e: 'change'): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const innerConfig = useVModel(props, 'assertionConfig', emit);
|
const innerConfig = useVModel(props, 'assertionConfig', emit);
|
||||||
|
|
||||||
// Item点击的key
|
|
||||||
const activeKey = ref<string>('');
|
const activeKey = ref<string>('');
|
||||||
// 展示的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 = ref(assertions.value[0]);
|
||||||
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 itemMoreActions: ActionsItem[] = [
|
const itemMoreActions: ActionsItem[] = [
|
||||||
{
|
{
|
||||||
|
@ -282,6 +225,7 @@
|
||||||
const showBody = computed(() => {
|
const showBody = computed(() => {
|
||||||
return assertions.value.length > 0;
|
return assertions.value.length > 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// dropdown选择
|
// dropdown选择
|
||||||
const handleSelect = (value: string | number | Record<string, any> | undefined) => {
|
const handleSelect = (value: string | number | Record<string, any> | undefined) => {
|
||||||
const id = new Date().getTime().toString();
|
const id = new Date().getTime().toString();
|
||||||
|
@ -363,7 +307,9 @@
|
||||||
default:
|
default:
|
||||||
break;
|
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) => {
|
const handleMoreActionSelect = (event: ActionsItem, item: MsAssertionItem) => {
|
||||||
|
@ -373,10 +319,10 @@
|
||||||
activeKey.value = currentIndex > 0 ? assertions.value[currentIndex - 1].id : '';
|
activeKey.value = currentIndex > 0 ? assertions.value[currentIndex - 1].id : '';
|
||||||
} else {
|
} else {
|
||||||
// copy 当前item
|
// copy 当前item
|
||||||
const tmpObj = { ...assertions.value[currentIndex], id: new Date().getTime().valueOf().toString() };
|
const tmpObj = { ...cloneDeep(assertions.value[currentIndex]), id: new Date().getTime().valueOf().toString() };
|
||||||
const tmpArr = assertions.value;
|
const tmpArr = cloneDeep(assertions.value);
|
||||||
tmpArr.splice(currentIndex, 0, tmpObj);
|
tmpArr.splice(currentIndex, 0, tmpObj);
|
||||||
assertions.value = tmpArr;
|
assertions.value = cloneDeep(tmpArr);
|
||||||
activeKey.value = tmpObj.id;
|
activeKey.value = tmpObj.id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -422,24 +368,30 @@
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
.ms-assertion {
|
.ms-assertion {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: calc(100% - 22px);
|
||||||
&-body {
|
&-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
|
height: calc(100% - 42px);
|
||||||
flex-flow: row nowrap;
|
flex-flow: row nowrap;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
&-left {
|
&-left {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
overflow-y: auto;
|
||||||
padding: 12px;
|
padding: 12px;
|
||||||
width: 216px;
|
width: 216px;
|
||||||
min-width: 216px;
|
min-width: 216px;
|
||||||
|
height: 100%;
|
||||||
background-color: var(--color-text-n9);
|
background-color: var(--color-text-n9);
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
.ms-scroll-bar();
|
||||||
&-item {
|
&-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row nowrap;
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
margin: 4px 0;
|
||||||
|
flex-flow: row nowrap;
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: var(--color-text-fff);
|
background-color: var(--color-text-fff);
|
||||||
|
@ -483,8 +435,6 @@
|
||||||
&-right {
|
&-right {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
padding: 0;
|
|
||||||
border: 1px solid var(--color-text-n8);
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background: var(--color-text-fff);
|
background: var(--color-text-fff);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<div :class="getFolderClass('all')" @click="setActiveFolder('all')">
|
<div :class="getFolderClass('all')" @click="setActiveFolder('all')">
|
||||||
<MsIcon type="icon-icon_folder_filled1" class="folder-icon" />
|
<MsIcon type="icon-icon_folder_filled1" class="folder-icon" />
|
||||||
<div class="folder-name">{{ t('caseManagement.featureCase.allCase') }}</div>
|
<div class="folder-name">{{ t('caseManagement.featureCase.allCase') }}</div>
|
||||||
<div class="folder-count">({{ modulesCount.total || 0 }})</div>
|
<div class="folder-count">({{ modulesCount.total || modulesCount.all || 0 }})</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-auto flex items-center">
|
<div class="ml-auto flex items-center">
|
||||||
<a-tooltip
|
<a-tooltip
|
||||||
|
|
|
@ -3,9 +3,11 @@
|
||||||
<div v-if="$slots.quickCreate" class="ms-base-table-quickCreate">
|
<div v-if="$slots.quickCreate" class="ms-base-table-quickCreate">
|
||||||
<slot name="quickCreate"></slot>
|
<slot name="quickCreate"></slot>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- 表只做自适应不做可拖拽列 -->
|
||||||
<a-table
|
<a-table
|
||||||
v-bind="{ ...$attrs, ...scrollObj }"
|
v-bind="{ ...$attrs, ...scrollObj }"
|
||||||
:row-class="getRowClass"
|
:row-class="getRowClass"
|
||||||
|
:column-resizable="false"
|
||||||
:span-method="spanMethod"
|
:span-method="spanMethod"
|
||||||
:columns="currentColumns"
|
:columns="currentColumns"
|
||||||
:expanded-keys="props.expandedKeys"
|
:expanded-keys="props.expandedKeys"
|
||||||
|
|
|
@ -31,12 +31,13 @@
|
||||||
<span class="mode-button-title">{{ t('msTable.columnSetting.drawer') }}</span>
|
<span class="mode-button-title">{{ t('msTable.columnSetting.drawer') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</a-radio>
|
</a-radio>
|
||||||
<a-radio value="new_window">
|
<!-- TODO 这版本不上新窗口 -->
|
||||||
|
<!-- <a-radio value="new_window">
|
||||||
<div class="mode-button">
|
<div class="mode-button">
|
||||||
<MsIcon :class="{ 'active-color': currentMode === 'new_window' }" type="icon-icon_into-item_outlined" />
|
<MsIcon :class="{ 'active-color': currentMode === 'new_window' }" type="icon-icon_into-item_outlined" />
|
||||||
<span class="mode-button-title">{{ t('msTable.columnSetting.newWindow') }}</span>
|
<span class="mode-button-title">{{ t('msTable.columnSetting.newWindow') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</a-radio>
|
</a-radio> -->
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="props.showPagination">
|
<template v-if="props.showPagination">
|
||||||
|
|
|
@ -249,6 +249,7 @@ export interface ExecuteConditionProcessorCommon {
|
||||||
associateScenarioResult?: boolean; // 是否关联场景结果
|
associateScenarioResult?: boolean; // 是否关联场景结果
|
||||||
ignoreProtocols: string[]; // 忽略协议
|
ignoreProtocols: string[]; // 忽略协议
|
||||||
beforeStepScript: boolean; // 是否是步骤内前置脚本前
|
beforeStepScript: boolean; // 是否是步骤内前置脚本前
|
||||||
|
assertionType?: RequestConditionProcessor;
|
||||||
}
|
}
|
||||||
// 执行请求-前后置条件-脚本处理器
|
// 执行请求-前后置条件-脚本处理器
|
||||||
export type ScriptProcessor = ScriptCommonConfig & ExecuteConditionProcessorCommon;
|
export type ScriptProcessor = ScriptCommonConfig & ExecuteConditionProcessorCommon;
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
v-if="
|
v-if="
|
||||||
condition.processorType === RequestConditionProcessor.SCRIPT ||
|
condition.processorType === RequestConditionProcessor.SCRIPT ||
|
||||||
condition.processorType === RequestConditionProcessor.SCENARIO_SCRIPT ||
|
condition.processorType === RequestConditionProcessor.SCENARIO_SCRIPT ||
|
||||||
condition.processorType === RequestConditionProcessor.REQUEST_SCRIPT
|
condition.processorType === RequestConditionProcessor.REQUEST_SCRIPT ||
|
||||||
|
condition?.assertionType === RequestConditionProcessor.SCRIPT
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<!-- 前后置请求开始 -->
|
<!-- 前后置请求开始 -->
|
||||||
|
@ -645,7 +646,8 @@ if (!result){
|
||||||
() => condition.value.commonScriptInfo,
|
() => condition.value.commonScriptInfo,
|
||||||
(info) => {
|
(info) => {
|
||||||
propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
|
propsRes.value.data = info?.params as any[]; // 查看详情的时候需要赋值一下
|
||||||
}
|
},
|
||||||
|
{ deep: true, immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const showQuoteDrawer = ref(false);
|
const showQuoteDrawer = ref(false);
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="flex h-full flex-col gap-[16px]">
|
<div class="flex h-full flex-col gap-[16px]">
|
||||||
<a-spin class="max-h-[calc(100vh - 454px)] w-full" :loading="loading">
|
<a-spin class="w-full" :loading="loading">
|
||||||
|
<!-- 不做虚拟滚动 :virtual-list-props="{
|
||||||
|
height: `calc(100vh - 454px)`,
|
||||||
|
threshold: 20,
|
||||||
|
fixedSize: true,
|
||||||
|
buffer: 15,
|
||||||
|
}" -->
|
||||||
<MsTree
|
<MsTree
|
||||||
ref="treeRef"
|
ref="treeRef"
|
||||||
v-model:selected-keys="selectedKeys"
|
v-model:selected-keys="selectedKeys"
|
||||||
|
@ -8,12 +14,6 @@
|
||||||
v-model:data="steps"
|
v-model:data="steps"
|
||||||
:expand-all="props.expandAll"
|
:expand-all="props.expandAll"
|
||||||
:field-names="{ title: 'name', key: 'stepId', children: 'children' }"
|
:field-names="{ title: 'name', key: 'stepId', children: 'children' }"
|
||||||
:virtual-list-props="{
|
|
||||||
height: `calc(100vh - 454px)`,
|
|
||||||
threshold: 20,
|
|
||||||
fixedSize: true,
|
|
||||||
buffer: 15,
|
|
||||||
}"
|
|
||||||
title-class="step-tree-node-title"
|
title-class="step-tree-node-title"
|
||||||
node-highlight-class="step-tree-node-focus"
|
node-highlight-class="step-tree-node-focus"
|
||||||
action-on-node-click="expand"
|
action-on-node-click="expand"
|
||||||
|
@ -427,7 +427,4 @@
|
||||||
height: 1px;
|
height: 1px;
|
||||||
background: var(--color-text-n8);
|
background: var(--color-text-n8);
|
||||||
}
|
}
|
||||||
:deep(.foldContent .arco-scrollbar-track-direction-vertical) {
|
|
||||||
left: -12px !important;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
|
<!-- class="tiled-wrap h-[calc(100vh - 374px)] p-4" -->
|
||||||
<div
|
<div
|
||||||
class="tiled-wrap h-[calc(100vh - 374px)] p-4"
|
|
||||||
:class="{
|
:class="{
|
||||||
'border border-solid border-[var(--color-text-n8)]': props.showType === 'API',
|
'border border-solid border-[var(--color-text-n8)]': props.showType === 'API',
|
||||||
}"
|
}"
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
:mouse-enter-delay="100"
|
:mouse-enter-delay="100"
|
||||||
mini
|
mini
|
||||||
>
|
>
|
||||||
<div class="one-line-text">{{ getTableFields(record.customFields, item as MsTableColumn) }}</div>
|
<div class="one-line-text max-w-[300px]">{{ getTableFields(record.customFields, item as MsTableColumn) }}</div>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<!-- 渲染自定义字段结束 -->
|
<!-- 渲染自定义字段结束 -->
|
||||||
|
@ -584,6 +584,7 @@
|
||||||
dataIndex: 'tags',
|
dataIndex: 'tags',
|
||||||
showInTable: true,
|
showInTable: true,
|
||||||
isTag: true,
|
isTag: true,
|
||||||
|
width: 456,
|
||||||
showDrag: true,
|
showDrag: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -207,12 +207,24 @@
|
||||||
|
|
||||||
const confirmLoading = ref<boolean>(false);
|
const confirmLoading = ref<boolean>(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) {
|
async function saveHandler(params: TableQueryParams) {
|
||||||
try {
|
try {
|
||||||
confirmLoading.value = true;
|
confirmLoading.value = true;
|
||||||
await associationPublicCase(params);
|
await associationPublicCase(params);
|
||||||
Message.success(t('caseManagement.featureCase.AssociatedSuccess'));
|
Message.success(t('caseManagement.featureCase.AssociatedSuccess'));
|
||||||
innerVisible.value = false;
|
innerVisible.value = false;
|
||||||
|
getFetch();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -255,17 +267,6 @@
|
||||||
currentSelectCase.value = caseTypeOptions.value[0].value;
|
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) {
|
async function cancelLink(record: any) {
|
||||||
try {
|
try {
|
||||||
await cancelAssociatedCase({
|
await cancelAssociatedCase({
|
||||||
|
|
|
@ -189,6 +189,7 @@
|
||||||
v-model:visible="caseAssociateVisible"
|
v-model:visible="caseAssociateVisible"
|
||||||
v-model:project="caseAssociateProject"
|
v-model:project="caseAssociateProject"
|
||||||
:reviewers="reviewForm.reviewers"
|
:reviewers="reviewForm.reviewers"
|
||||||
|
:associated-ids="selectedAssociateCasesParams.selectIds"
|
||||||
@success="writeAssociateCases"
|
@success="writeAssociateCases"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -424,7 +425,6 @@
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
initModules();
|
initModules();
|
||||||
initReviewers();
|
initReviewers();
|
||||||
|
|
Loading…
Reference in New Issue