fix(接口测试): 定义预览请求体Json-Schema格式表格设置选项缺少必填字段&默认开启且置灰不可点击

This commit is contained in:
xinxin.wu 2024-08-14 18:10:30 +08:00 committed by 刘瑞斌
parent 4e91ace3ce
commit d50390c154
1 changed files with 174 additions and 152 deletions

View File

@ -54,7 +54,7 @@
</template>
<template #type="{ record }">
<a-tooltip
v-if="record.id !== 'root'"
v-if="record.id !== 'root' && !props.disabled"
:content="t(record.required ? 'apiTestDebug.paramRequired' : 'apiTestDebug.paramNotRequired')"
>
<div
@ -740,7 +740,9 @@
value: 'url',
},
];
const columns: FormTableColumn[] = [
const columns = computed(() => {
const staticColumns: FormTableColumn[] = [
{
title: t('ms.json.schema.name'),
dataIndex: 'title',
@ -750,6 +752,7 @@
columnSelectorDisabled: true,
fixed: 'left',
needValidRepeat: true,
sortIndex: 1,
},
{
title: t('ms.json.schema.type'),
@ -891,6 +894,25 @@
fixed: 'right',
},
];
const requiredColumn: FormTableColumn[] = [
{
title: t('msFormTable.paramRequired'),
dataIndex: 'required',
slotName: 'required',
size: 'medium',
inputType: 'text',
columnSelectorDisabled: true,
valueFormat: (record) => {
return record.required ? t('common.yes') : t('common.no');
},
width: 68,
},
];
if (props.disabled) {
return [...requiredColumn, ...staticColumns];
}
return staticColumns;
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function emitChange(from: string) {