feat(接口测试): json-schema增加禁用
This commit is contained in:
parent
7724e7939f
commit
4341904360
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<a-form ref="formRef" :model="propsRes" layout="vertical">
|
<a-form ref="formRef" :model="propsRes" :disabled="props.disabled" layout="vertical">
|
||||||
<MsBaseTable
|
<MsBaseTable
|
||||||
v-bind="propsRes"
|
v-bind="propsRes"
|
||||||
v-model:original-selected-keys="originalSelectedKeys"
|
v-model:original-selected-keys="originalSelectedKeys"
|
||||||
|
@ -7,7 +7,10 @@
|
||||||
:hoverable="false"
|
:hoverable="false"
|
||||||
is-simple-setting
|
is-simple-setting
|
||||||
:span-method="props.spanMethod"
|
:span-method="props.spanMethod"
|
||||||
:class="!props.selectable && !props.draggable ? 'ms-form-table-no-left-action' : ''"
|
:class="[
|
||||||
|
!props.selectable && !props.draggable ? 'ms-form-table-no-left-action' : '',
|
||||||
|
props.disabled ? 'ms-form-table--disabled' : '',
|
||||||
|
]"
|
||||||
bordered
|
bordered
|
||||||
v-on="propsEvent"
|
v-on="propsEvent"
|
||||||
@drag-change="tableChange"
|
@drag-change="tableChange"
|
||||||
|
@ -38,7 +41,7 @@
|
||||||
validRepeat(rowIndex, item.dataIndex as string, value, callback);
|
validRepeat(rowIndex, item.dataIndex as string, value, callback);
|
||||||
},
|
},
|
||||||
}"
|
}"
|
||||||
:disabled="item.disabled || record.disabled"
|
:disabled="props.disabled || item.disabled || record.disabled"
|
||||||
>
|
>
|
||||||
<slot
|
<slot
|
||||||
:name="item.slotName"
|
:name="item.slotName"
|
||||||
|
@ -147,6 +150,7 @@
|
||||||
v-else-if="item.inputType === 'quickInput'"
|
v-else-if="item.inputType === 'quickInput'"
|
||||||
v-model:model-value="record[item.dataIndex as string]"
|
v-model:model-value="record[item.dataIndex as string]"
|
||||||
:title="item.title as string || ''"
|
:title="item.title as string || ''"
|
||||||
|
:disabled="props.disabled || item.disabled || record.disabled"
|
||||||
class="ms-form-table-input"
|
class="ms-form-table-input"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
@input="() => handleFormChange(record, rowIndex, item)"
|
@input="() => handleFormChange(record, rowIndex, item)"
|
||||||
|
@ -528,6 +532,11 @@
|
||||||
padding: 0 8px !important;
|
padding: 0 8px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.arco-table-th {
|
||||||
|
.arco-icon-settings {
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
}
|
||||||
.arco-table-tr-checked {
|
.arco-table-tr-checked {
|
||||||
.arco-table-td {
|
.arco-table-td {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
@ -536,6 +545,22 @@
|
||||||
.arco-scrollbar-track-direction-horizontal {
|
.arco-scrollbar-track-direction-horizontal {
|
||||||
bottom: -8px;
|
bottom: -8px;
|
||||||
}
|
}
|
||||||
|
.arco-textarea-disabled,
|
||||||
|
.arco-input-disabled,
|
||||||
|
.arco-select-view-disabled {
|
||||||
|
@apply !bg-transparent;
|
||||||
|
.arco-select-view-value {
|
||||||
|
color: var(--color-text-4) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.ms-form-table--disabled {
|
||||||
|
:deep(.arco-table-td-content) {
|
||||||
|
span,
|
||||||
|
div {
|
||||||
|
color: var(--color-text-4) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
:deep(.arco-table-content) {
|
:deep(.arco-table-content) {
|
||||||
border-top: 1px solid var(--color-text-n8) !important;
|
border-top: 1px solid var(--color-text-n8) !important;
|
||||||
|
|
|
@ -14,13 +14,14 @@
|
||||||
}"
|
}"
|
||||||
:table-key="TableKeyEnum.JSON_SCHEMA"
|
:table-key="TableKeyEnum.JSON_SCHEMA"
|
||||||
:scroll="{ x: 'max-content' }"
|
:scroll="{ x: 'max-content' }"
|
||||||
|
:disabled="props.disabled"
|
||||||
show-setting
|
show-setting
|
||||||
class="ms-json-schema"
|
class="ms-json-schema"
|
||||||
@row-select="handleSelect"
|
@row-select="handleSelect"
|
||||||
@select-all="handleSelectAll"
|
@select-all="handleSelectAll"
|
||||||
>
|
>
|
||||||
<template #batchAddTitle>
|
<template #batchAddTitle>
|
||||||
<MsButton type="text" size="mini" class="!mr-0" @click="batchAdd">
|
<MsButton v-if="!props.disabled" type="text" size="mini" class="!mr-0" @click="batchAdd">
|
||||||
{{ t('apiTestDebug.batchAdd') }}
|
{{ t('apiTestDebug.batchAdd') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</template>
|
</template>
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
type="icon"
|
type="icon"
|
||||||
class="!mr-[4px] !p-[4px]"
|
class="!mr-[4px] !p-[4px]"
|
||||||
size="mini"
|
size="mini"
|
||||||
|
:disabled="props.disabled"
|
||||||
@click="() => (record.required = !record.required)"
|
@click="() => (record.required = !record.required)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
@ -76,12 +78,19 @@
|
||||||
:options="getTypeOptions(record)"
|
:options="getTypeOptions(record)"
|
||||||
class="ms-form-table-input w-full"
|
class="ms-form-table-input w-full"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
@change="handleTypeChange(record)"
|
@change="handleTypeChange(record)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #example="{ record }">
|
<template #example="{ record }">
|
||||||
<div v-if="['object', 'array', 'null'].includes(record.type)" class="ms-form-table-td-text">-</div>
|
<div v-if="['object', 'array', 'null'].includes(record.type)" class="ms-form-table-td-text">-</div>
|
||||||
<MsParamsInput v-else v-model:value="record.example" size="medium" @dblclick="() => quickInputParams(record)" />
|
<MsParamsInput
|
||||||
|
v-else
|
||||||
|
v-model:value="record.example"
|
||||||
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
|
@dblclick="() => quickInputParams(record)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #minLength="{ record }">
|
<template #minLength="{ record }">
|
||||||
<a-input-number
|
<a-input-number
|
||||||
|
@ -91,6 +100,7 @@
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -102,6 +112,7 @@
|
||||||
:min="0"
|
:min="0"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -111,6 +122,7 @@
|
||||||
v-model:model-value="record.minimum"
|
v-model:model-value="record.minimum"
|
||||||
class="ms-form-table-input-number"
|
class="ms-form-table-input-number"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
v-else-if="record.type === 'integer'"
|
v-else-if="record.type === 'integer'"
|
||||||
|
@ -119,6 +131,7 @@
|
||||||
size="medium"
|
size="medium"
|
||||||
:step="1"
|
:step="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -128,6 +141,7 @@
|
||||||
v-model:model-value="record.maximum"
|
v-model:model-value="record.maximum"
|
||||||
class="ms-form-table-input-number"
|
class="ms-form-table-input-number"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
v-else-if="record.type === 'integer'"
|
v-else-if="record.type === 'integer'"
|
||||||
|
@ -136,6 +150,7 @@
|
||||||
size="medium"
|
size="medium"
|
||||||
:step="1"
|
:step="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -148,6 +163,7 @@
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="1"
|
:step="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -160,6 +176,7 @@
|
||||||
:min="0"
|
:min="0"
|
||||||
:step="1"
|
:step="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else class="ms-form-table-td-text">-</div>
|
<div v-else class="ms-form-table-td-text">-</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -169,6 +186,7 @@
|
||||||
v-model:model-value="record.defaultValue"
|
v-model:model-value="record.defaultValue"
|
||||||
class="ms-form-table-input-number"
|
class="ms-form-table-input-number"
|
||||||
size="medium"
|
size="medium"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<a-input-number
|
<a-input-number
|
||||||
v-else-if="record.type === 'integer'"
|
v-else-if="record.type === 'integer'"
|
||||||
|
@ -177,6 +195,7 @@
|
||||||
size="medium"
|
size="medium"
|
||||||
:step="1"
|
:step="1"
|
||||||
:precision="0"
|
:precision="0"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<a-select
|
<a-select
|
||||||
v-else-if="record.type === 'boolean'"
|
v-else-if="record.type === 'boolean'"
|
||||||
|
@ -193,6 +212,7 @@
|
||||||
value: false,
|
value: false,
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
<div v-else-if="['object', 'array', 'null'].includes(record.type)" class="ms-form-table-td-text"> - </div>
|
<div v-else-if="['object', 'array', 'null'].includes(record.type)" class="ms-form-table-td-text"> - </div>
|
||||||
<a-input
|
<a-input
|
||||||
|
@ -200,6 +220,7 @@
|
||||||
v-model:model-value="record.defaultValue"
|
v-model:model-value="record.defaultValue"
|
||||||
:placeholder="t('common.pleaseInput')"
|
:placeholder="t('common.pleaseInput')"
|
||||||
class="ms-form-table-input"
|
class="ms-form-table-input"
|
||||||
|
:disabled="props.disabled"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template #enumValues="{ record }">
|
<template #enumValues="{ record }">
|
||||||
|
@ -208,9 +229,10 @@
|
||||||
v-else
|
v-else
|
||||||
v-model:model-value="record.enumValues"
|
v-model:model-value="record.enumValues"
|
||||||
:title="t('ms.json.schema.enum')"
|
:title="t('ms.json.schema.enum')"
|
||||||
:popover-title="JSON.stringify(record.enumValues.split('\n'))"
|
:popover-title="record.enumValues ? JSON.stringify(record.enumValues.split('\n')) : ''"
|
||||||
class="ms-form-table-input"
|
class="ms-form-table-input"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
|
:disabled="props.disabled"
|
||||||
>
|
>
|
||||||
</MsQuickInput>
|
</MsQuickInput>
|
||||||
</template>
|
</template>
|
||||||
|
@ -221,12 +243,15 @@
|
||||||
<icon-settings class="text-[var(--color-text-4)]" />
|
<icon-settings class="text-[var(--color-text-4)]" />
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip v-if="['object', 'array'].includes(record.type)" :content="t('ms.json.schema.addChild')">
|
<a-tooltip
|
||||||
|
v-if="['object', 'array'].includes(record.type) && !props.disabled"
|
||||||
|
:content="t('ms.json.schema.addChild')"
|
||||||
|
>
|
||||||
<MsButton type="icon" class="ms-json-schema-icon-button" @click="addChild(record)">
|
<MsButton type="icon" class="ms-json-schema-icon-button" @click="addChild(record)">
|
||||||
<MsIcon type="icon-icon_add_outlined" class="text-[var(--color-text-4)]" />
|
<MsIcon type="icon-icon_add_outlined" class="text-[var(--color-text-4)]" />
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</a-tooltip>
|
</a-tooltip>
|
||||||
<a-tooltip v-if="record.id !== 'root'" :content="t('common.delete')">
|
<a-tooltip v-if="record.id !== 'root' && !props.disabled" :content="t('common.delete')">
|
||||||
<MsButton type="icon" class="ms-json-schema-icon-button" @click="deleteLine(record, rowIndex)">
|
<MsButton type="icon" class="ms-json-schema-icon-button" @click="deleteLine(record, rowIndex)">
|
||||||
<icon-minus-circle class="cursor-pointer text-[var(--color-text-4)]" size="18" />
|
<icon-minus-circle class="cursor-pointer text-[var(--color-text-4)]" size="18" />
|
||||||
</MsButton>
|
</MsButton>
|
||||||
|
@ -269,7 +294,7 @@
|
||||||
:ok-text="t('common.save')"
|
:ok-text="t('common.save')"
|
||||||
@confirm="applySetting"
|
@confirm="applySetting"
|
||||||
>
|
>
|
||||||
<a-form ref="setting" :model="activeRecord" layout="vertical">
|
<a-form ref="setting" :model="activeRecord" :disabled="props.disabled" layout="vertical">
|
||||||
<a-form-item
|
<a-form-item
|
||||||
:label="t('ms.json.schema.name')"
|
:label="t('ms.json.schema.name')"
|
||||||
:rules="[{ required: true, message: t('ms.json.schema.nameNotNull') }]"
|
:rules="[{ required: true, message: t('ms.json.schema.nameNotNull') }]"
|
||||||
|
@ -515,6 +540,9 @@
|
||||||
parseTableDataToJsonSchema,
|
parseTableDataToJsonSchema,
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
disabled?: boolean;
|
||||||
|
}>();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const defaultItem: JsonSchemaTableItem = {
|
const defaultItem: JsonSchemaTableItem = {
|
||||||
|
|
|
@ -74,7 +74,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #batchAddTitle>
|
<template #batchAddTitle>
|
||||||
<MsButton type="text" size="mini" class="!mr-0" @click="emit('batchAdd')">
|
<MsButton
|
||||||
|
v-if="!props.disabledExceptParam && !props.disabledParamValue"
|
||||||
|
type="text"
|
||||||
|
size="mini"
|
||||||
|
class="!mr-0"
|
||||||
|
@click="emit('batchAdd')"
|
||||||
|
>
|
||||||
{{ t('apiTestDebug.batchAdd') }}
|
{{ t('apiTestDebug.batchAdd') }}
|
||||||
</MsButton>
|
</MsButton>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -130,6 +130,7 @@
|
||||||
ref="jsonSchemaRef"
|
ref="jsonSchemaRef"
|
||||||
v-model:data="innerParams.jsonBody.jsonSchemaTableData"
|
v-model:data="innerParams.jsonBody.jsonSchemaTableData"
|
||||||
v-model:selectedKeys="selectedKeys"
|
v-model:selectedKeys="selectedKeys"
|
||||||
|
:disabled="props.disabledExceptParam"
|
||||||
/>
|
/>
|
||||||
<MsCodeEditor
|
<MsCodeEditor
|
||||||
v-else
|
v-else
|
||||||
|
@ -144,7 +145,13 @@
|
||||||
is-adaptive
|
is-adaptive
|
||||||
>
|
>
|
||||||
<template #rightTitle>
|
<template #rightTitle>
|
||||||
<a-button type="outline" class="arco-btn-outline--secondary p-[0_8px]" size="mini" @click="autoMakeJson">
|
<a-button
|
||||||
|
type="outline"
|
||||||
|
class="arco-btn-outline--secondary p-[0_8px]"
|
||||||
|
size="mini"
|
||||||
|
:disabled="props.disabledParamValue"
|
||||||
|
@click="autoMakeJson"
|
||||||
|
>
|
||||||
<div class="text-[var(--color-text-1)]">{{ t('apiTestManagement.autoMake') }}</div>
|
<div class="text-[var(--color-text-1)]">{{ t('apiTestManagement.autoMake') }}</div>
|
||||||
</a-button>
|
</a-button>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue