fix(接口测试): 响应表格样式修复&

This commit is contained in:
baiqi 2024-08-12 19:11:11 +08:00 committed by Craftsman
parent 42b0850ed0
commit 6444e3f9da
5 changed files with 25 additions and 10 deletions

View File

@ -174,13 +174,13 @@
@change="() => handleFormChange(record, rowIndex, item)" @change="() => handleFormChange(record, rowIndex, item)"
> >
</MsQuickInput> </MsQuickInput>
<template v-else-if="item.inputType === 'text'"> <div v-else-if="item.inputType === 'text'" class="pl-[8px]">
{{ {{
typeof item.valueFormat === 'function' typeof item.valueFormat === 'function'
? item.valueFormat(record) ? item.valueFormat(record)
: record[item.dataIndex as string] || '-' : record[item.dataIndex as string] || '-'
}} }}
</template> </div>
<template v-else-if="item.dataIndex === 'action'"> <template v-else-if="item.dataIndex === 'action'">
<div <div
:key="item.dataIndex" :key="item.dataIndex"

View File

@ -174,7 +174,7 @@
/> />
<a-tooltip <a-tooltip
v-else v-else
position="top" position="tl"
content-class="max-w-[400px]" content-class="max-w-[400px]"
:content="String(record[item.dataIndex as string])" :content="String(record[item.dataIndex as string])"
:disabled="record[item.dataIndex as string] === '' || record[item.dataIndex as string] === undefined || record[item.dataIndex as string] === null" :disabled="record[item.dataIndex as string] === '' || record[item.dataIndex as string] === undefined || record[item.dataIndex as string] === null"

View File

@ -20,11 +20,13 @@
</a-tooltip> </a-tooltip>
</template> </template>
<template #condition="{ record }"> <template #condition="{ record }">
<div class="pl-[8px]">
{{ {{
record.assertionType === FullResponseAssertionType.RESPONSE_TIME record.assertionType === FullResponseAssertionType.RESPONSE_TIME
? t('advanceFilter.operator.le') ? t('advanceFilter.operator.le')
: t(statusCodeOptions.find((item) => item.value === record.condition)?.label || '-') : t(statusCodeOptions.find((item) => item.value === record.condition)?.label || '-')
}} }}
</div>
</template> </template>
<template #status="{ record }"> <template #status="{ record }">
<MsTag :type="record.pass === true ? 'success' : 'danger'" theme="light"> <MsTag :type="record.pass === true ? 'success' : 'danger'" theme="light">
@ -69,7 +71,9 @@
{ {
title: 'apiTestDebug.actualValue', title: 'apiTestDebug.actualValue',
dataIndex: 'actualValue', dataIndex: 'actualValue',
slotName: 'actualValue',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 200, width: 200,
}, },
{ {
@ -81,7 +85,9 @@
{ {
title: 'apiTestDebug.expectedValue', title: 'apiTestDebug.expectedValue',
dataIndex: 'expectedValue', dataIndex: 'expectedValue',
slotName: 'expectedValue',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 200, width: 200,
}, },
{ {
@ -93,7 +99,9 @@
{ {
title: 'apiTestDebug.reason', title: 'apiTestDebug.reason',
dataIndex: 'message', dataIndex: 'message',
slotName: 'message',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 300, width: 300,
}, },
]; ];

View File

@ -7,7 +7,7 @@
:scroll="props.scroll" :scroll="props.scroll"
> >
<template #type="{ record }"> <template #type="{ record }">
{{ t(extractTypeOptions.find((item) => item.value === record.type)?.label || '') }} <div class="pl-[8px]">{{ t(extractTypeOptions.find((item) => item.value === record.type)?.label || '') }}</div>
</template> </template>
</MsFormTable> </MsFormTable>
</a-scrollbar> </a-scrollbar>
@ -38,25 +38,32 @@
{ {
title: 'apiTestDebug.paramName', title: 'apiTestDebug.paramName',
dataIndex: 'name', dataIndex: 'name',
slotName: 'name',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 200, width: 200,
}, },
{ {
title: 'apiTestDebug.extractValue', title: 'apiTestDebug.extractValue',
dataIndex: 'value', dataIndex: 'value',
slotName: 'value',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 200, width: 200,
}, },
{ {
title: 'apiTestDebug.paramType', title: 'apiTestDebug.paramType',
dataIndex: 'type', dataIndex: 'type',
slotName: 'type', slotName: 'type',
inputType: 'text',
width: 120, width: 120,
}, },
{ {
title: 'apiTestDebug.expression', title: 'apiTestDebug.expression',
dataIndex: 'expression', dataIndex: 'expression',
slotName: 'expression',
showTooltip: true, showTooltip: true,
inputType: 'text',
width: 200, width: 200,
}, },
]; ];

View File

@ -247,7 +247,7 @@ export function filterAssertions(assertionConfig: ExecuteAssertionConfig, isExec
return assertionConfig.assertions.map((assertItem: any) => { return assertionConfig.assertions.map((assertItem: any) => {
const lastItem = const lastItem =
assertItem?.jsonPathAssertion?.assertions[(assertItem?.jsonPathAssertion?.assertions.length || 1) - 1]; assertItem?.jsonPathAssertion?.assertions[(assertItem?.jsonPathAssertion?.assertions.length || 1) - 1];
if (lastItem.expression === '' && lastItem.expectedValue === '' && lastItem.enable === true) { if (lastItem && lastItem.expression === '' && lastItem.expectedValue === '' && lastItem.enable === true) {
// 最后一行是空行,将其删除 // 最后一行是空行,将其删除
assertItem.jsonPathAssertion.assertions.splice(-1, 1); assertItem.jsonPathAssertion.assertions.splice(-1, 1);
} }