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