fix(接口测试): 定义预览请求体Json-Schema格式表格设置选项缺少必填字段&默认开启且置灰不可点击
This commit is contained in:
parent
4e91ace3ce
commit
d50390c154
|
@ -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,157 +740,179 @@
|
||||||
value: 'url',
|
value: 'url',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const columns: FormTableColumn[] = [
|
|
||||||
{
|
const columns = computed(() => {
|
||||||
title: t('ms.json.schema.name'),
|
const staticColumns: FormTableColumn[] = [
|
||||||
dataIndex: 'title',
|
{
|
||||||
slotName: 'title',
|
title: t('ms.json.schema.name'),
|
||||||
inputType: 'input',
|
dataIndex: 'title',
|
||||||
size: 'medium',
|
slotName: 'title',
|
||||||
columnSelectorDisabled: true,
|
inputType: 'input',
|
||||||
fixed: 'left',
|
size: 'medium',
|
||||||
needValidRepeat: true,
|
columnSelectorDisabled: true,
|
||||||
},
|
fixed: 'left',
|
||||||
{
|
needValidRepeat: true,
|
||||||
title: t('ms.json.schema.type'),
|
sortIndex: 1,
|
||||||
dataIndex: 'type',
|
},
|
||||||
slotName: 'type',
|
{
|
||||||
titleSlotName: 'typeTitle',
|
title: t('ms.json.schema.type'),
|
||||||
size: 'medium',
|
dataIndex: 'type',
|
||||||
width: 120,
|
slotName: 'type',
|
||||||
addLineDisabled: true,
|
titleSlotName: 'typeTitle',
|
||||||
columnSelectorDisabled: true,
|
size: 'medium',
|
||||||
},
|
width: 120,
|
||||||
{
|
addLineDisabled: true,
|
||||||
title: t('ms.json.schema.value'),
|
columnSelectorDisabled: true,
|
||||||
dataIndex: 'example',
|
},
|
||||||
slotName: 'example',
|
{
|
||||||
addLineDisabled: true,
|
title: t('ms.json.schema.value'),
|
||||||
columnSelectorDisabled: true,
|
dataIndex: 'example',
|
||||||
},
|
slotName: 'example',
|
||||||
{
|
addLineDisabled: true,
|
||||||
title: t('common.desc'),
|
columnSelectorDisabled: true,
|
||||||
dataIndex: 'description',
|
},
|
||||||
slotName: 'description',
|
{
|
||||||
inputType: 'quickInput',
|
title: t('common.desc'),
|
||||||
size: 'medium',
|
dataIndex: 'description',
|
||||||
addLineDisabled: true,
|
slotName: 'description',
|
||||||
},
|
inputType: 'quickInput',
|
||||||
{
|
size: 'medium',
|
||||||
title: t('ms.json.schema.minLength'),
|
addLineDisabled: true,
|
||||||
dataIndex: 'minLength',
|
},
|
||||||
slotName: 'minLength',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.minLength'),
|
||||||
size: 'medium',
|
dataIndex: 'minLength',
|
||||||
min: 0,
|
slotName: 'minLength',
|
||||||
precision: 0,
|
inputType: 'inputNumber',
|
||||||
addLineDisabled: true,
|
size: 'medium',
|
||||||
showInTable: false,
|
min: 0,
|
||||||
width: 120,
|
precision: 0,
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.maxLength'),
|
width: 120,
|
||||||
dataIndex: 'maxLength',
|
},
|
||||||
slotName: 'maxLength',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.maxLength'),
|
||||||
size: 'medium',
|
dataIndex: 'maxLength',
|
||||||
min: 0,
|
slotName: 'maxLength',
|
||||||
precision: 0,
|
inputType: 'inputNumber',
|
||||||
addLineDisabled: true,
|
size: 'medium',
|
||||||
showInTable: false,
|
min: 0,
|
||||||
width: 120,
|
precision: 0,
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.minimum'),
|
width: 120,
|
||||||
dataIndex: 'minimum',
|
},
|
||||||
slotName: 'minimum',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.minimum'),
|
||||||
size: 'medium',
|
dataIndex: 'minimum',
|
||||||
addLineDisabled: true,
|
slotName: 'minimum',
|
||||||
showInTable: false,
|
inputType: 'inputNumber',
|
||||||
width: 120,
|
size: 'medium',
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.maximum'),
|
width: 120,
|
||||||
dataIndex: 'maximum',
|
},
|
||||||
slotName: 'maximum',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.maximum'),
|
||||||
size: 'medium',
|
dataIndex: 'maximum',
|
||||||
addLineDisabled: true,
|
slotName: 'maximum',
|
||||||
showInTable: false,
|
inputType: 'inputNumber',
|
||||||
width: 120,
|
size: 'medium',
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.minItems'),
|
width: 120,
|
||||||
dataIndex: 'minItems',
|
},
|
||||||
slotName: 'minItems',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.minItems'),
|
||||||
size: 'medium',
|
dataIndex: 'minItems',
|
||||||
min: 0,
|
slotName: 'minItems',
|
||||||
precision: 0,
|
inputType: 'inputNumber',
|
||||||
addLineDisabled: true,
|
size: 'medium',
|
||||||
showInTable: false,
|
min: 0,
|
||||||
width: 120,
|
precision: 0,
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.maxItems'),
|
width: 120,
|
||||||
dataIndex: 'maxItems',
|
},
|
||||||
slotName: 'maxItems',
|
{
|
||||||
inputType: 'inputNumber',
|
title: t('ms.json.schema.maxItems'),
|
||||||
size: 'medium',
|
dataIndex: 'maxItems',
|
||||||
min: 0,
|
slotName: 'maxItems',
|
||||||
precision: 0,
|
inputType: 'inputNumber',
|
||||||
addLineDisabled: true,
|
size: 'medium',
|
||||||
showInTable: false,
|
min: 0,
|
||||||
width: 120,
|
precision: 0,
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.default'),
|
width: 120,
|
||||||
dataIndex: 'defaultValue',
|
},
|
||||||
slotName: 'defaultValue',
|
{
|
||||||
inputType: 'input',
|
title: t('ms.json.schema.default'),
|
||||||
size: 'medium',
|
dataIndex: 'defaultValue',
|
||||||
addLineDisabled: true,
|
slotName: 'defaultValue',
|
||||||
showInTable: false,
|
inputType: 'input',
|
||||||
},
|
size: 'medium',
|
||||||
{
|
addLineDisabled: true,
|
||||||
title: t('ms.json.schema.enum'),
|
showInTable: false,
|
||||||
dataIndex: 'enumValues',
|
},
|
||||||
slotName: 'enumValues',
|
{
|
||||||
inputType: 'textarea',
|
title: t('ms.json.schema.enum'),
|
||||||
size: 'medium',
|
dataIndex: 'enumValues',
|
||||||
addLineDisabled: true,
|
slotName: 'enumValues',
|
||||||
showInTable: false,
|
inputType: 'textarea',
|
||||||
},
|
size: 'medium',
|
||||||
{
|
addLineDisabled: true,
|
||||||
title: t('ms.json.schema.regex'),
|
showInTable: false,
|
||||||
dataIndex: 'pattern',
|
},
|
||||||
slotName: 'pattern',
|
{
|
||||||
size: 'medium',
|
title: t('ms.json.schema.regex'),
|
||||||
addLineDisabled: true,
|
dataIndex: 'pattern',
|
||||||
showInTable: false,
|
slotName: 'pattern',
|
||||||
isNull: (record) => record.type !== 'string',
|
size: 'medium',
|
||||||
},
|
addLineDisabled: true,
|
||||||
{
|
showInTable: false,
|
||||||
title: t('ms.json.schema.format'),
|
isNull: (record) => record.type !== 'string',
|
||||||
dataIndex: 'format',
|
},
|
||||||
slotName: 'format',
|
{
|
||||||
size: 'medium',
|
title: t('ms.json.schema.format'),
|
||||||
showInTable: false,
|
dataIndex: 'format',
|
||||||
isNull: (record) => record.type !== 'string',
|
slotName: 'format',
|
||||||
width: 100,
|
size: 'medium',
|
||||||
},
|
showInTable: false,
|
||||||
{
|
isNull: (record) => record.type !== 'string',
|
||||||
title: '',
|
width: 100,
|
||||||
dataIndex: 'operation',
|
},
|
||||||
slotName: 'action',
|
{
|
||||||
titleSlotName: 'batchAddTitle',
|
title: '',
|
||||||
addLineDisabled: true,
|
dataIndex: 'operation',
|
||||||
width: 100,
|
slotName: 'action',
|
||||||
showInTable: true,
|
titleSlotName: 'batchAddTitle',
|
||||||
fixed: 'right',
|
addLineDisabled: true,
|
||||||
},
|
width: 100,
|
||||||
];
|
showInTable: true,
|
||||||
|
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) {
|
||||||
|
|
Loading…
Reference in New Issue