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