fix(json-schema): 交互优化&部分问题修复
This commit is contained in:
parent
5c662aeb5c
commit
07eec731e1
|
@ -67,8 +67,8 @@
|
|||
<a-input
|
||||
v-else-if="item.inputType === 'input'"
|
||||
v-model:model-value="record[item.dataIndex as string]"
|
||||
:placeholder="t(item.locale)"
|
||||
class="ms-form-table-input"
|
||||
:placeholder="t(item.locale || 'common.pleaseInput')"
|
||||
class="ms-form-table-input ms-form-table-input--hasPlaceholder"
|
||||
:max-length="255"
|
||||
:size="item.size || 'medium'"
|
||||
@input="() => handleFormChange(record, rowIndex, item)"
|
||||
|
@ -628,6 +628,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
:deep(.ms-form-table-input--hasPlaceholder) {
|
||||
.arco-input::placeholder {
|
||||
@apply !visible;
|
||||
}
|
||||
}
|
||||
:deep(.ms-form-table-input-trigger) {
|
||||
width: 350px;
|
||||
.arco-select-dropdown-list {
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
</template>
|
||||
<a-input
|
||||
v-model:model-value="record.title"
|
||||
:placeholder="t(columnConfig.locale)"
|
||||
class="ms-form-table-input"
|
||||
:placeholder="t(columnConfig.locale || 'common.pleaseInput')"
|
||||
class="ms-form-table-input ms-form-table-input--hasPlaceholder"
|
||||
:max-length="255"
|
||||
size="medium"
|
||||
@input="addLineIfLast(record, rowIndex)"
|
||||
|
@ -543,6 +543,7 @@
|
|||
const props = defineProps<{
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const defaultItem: JsonSchemaTableItem = {
|
||||
|
|
|
@ -128,6 +128,7 @@ export interface ExecuteJsonBody {
|
|||
jsonValue: string;
|
||||
// 前端渲染字段
|
||||
jsonSchemaTableData?: JsonSchemaTableItem[];
|
||||
jsonSchemaTableSelectedRowKeys?: string[];
|
||||
}
|
||||
// 执行请求配置
|
||||
export interface ExecuteOtherConfig {
|
||||
|
|
|
@ -92,6 +92,7 @@ export const defaultResponseItem: ResponseDefinition = {
|
|||
enableJsonSchema: true,
|
||||
enableTransition: false,
|
||||
jsonSchemaTableData: [],
|
||||
jsonSchemaTableSelectedRowKeys: [],
|
||||
},
|
||||
xmlBody: {
|
||||
value: '',
|
||||
|
@ -120,6 +121,7 @@ export const defaultBodyParams: ExecuteBody = {
|
|||
jsonValue: '',
|
||||
enableJsonSchema: true,
|
||||
jsonSchemaTableData: [],
|
||||
jsonSchemaTableSelectedRowKeys: [],
|
||||
},
|
||||
xmlBody: { value: '' },
|
||||
rawBody: { value: '' },
|
||||
|
@ -317,6 +319,7 @@ export const mockDefaultParams: MockParams = {
|
|||
jsonValue: '',
|
||||
enableJsonSchema: true,
|
||||
jsonSchemaTableData: [],
|
||||
jsonSchemaTableSelectedRowKeys: [],
|
||||
},
|
||||
xmlBody: { value: '' },
|
||||
rawBody: { value: '' },
|
||||
|
@ -339,6 +342,7 @@ export const mockDefaultParams: MockParams = {
|
|||
enableJsonSchema: true,
|
||||
enableTransition: false,
|
||||
jsonSchemaTableData: [],
|
||||
jsonSchemaTableSelectedRowKeys: [],
|
||||
},
|
||||
xmlBody: {
|
||||
value: '',
|
||||
|
|
|
@ -105,7 +105,7 @@
|
|||
v-model:model-value="record[columnConfig.dataIndex as string]"
|
||||
:disabled="props.disabledExceptParam || columnConfig.disabledColumn"
|
||||
:data="getAutoCompleteData(columnConfig, record)"
|
||||
class="ms-form-table-input"
|
||||
class="ms-form-table-input ms-form-table-input--hasPlaceholder"
|
||||
:trigger-props="{ contentClass: 'ms-form-table-input-trigger' }"
|
||||
:filter-option="false"
|
||||
@focus="handleAutoCompleteFocus(record)"
|
||||
|
@ -124,7 +124,7 @@
|
|||
v-model:model-value="record[columnConfig.dataIndex as string]"
|
||||
:disabled="props.disabledExceptParam || columnConfig.disabledColumn"
|
||||
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||
class="ms-form-table-input"
|
||||
class="ms-form-table-input ms-form-table-input--hasPlaceholder"
|
||||
@input="() => addTableLine(rowIndex, columnConfig.addLineDisabled)"
|
||||
/>
|
||||
</a-popover>
|
||||
|
@ -147,7 +147,7 @@
|
|||
v-model:model-value="record[columnConfig.dataIndex as string]"
|
||||
:disabled="props.disabledExceptParam || columnConfig.disabledColumn"
|
||||
:placeholder="t('apiTestDebug.commonPlaceholder')"
|
||||
class="ms-form-table-input"
|
||||
class="ms-form-table-input ms-form-table-input--hasPlaceholder"
|
||||
@input="() => addTableLine(rowIndex, columnConfig.addLineDisabled)"
|
||||
/>
|
||||
</a-popover>
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
v-if="innerParams.jsonBody.enableJsonSchema"
|
||||
ref="jsonSchemaRef"
|
||||
v-model:data="innerParams.jsonBody.jsonSchemaTableData"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
v-model:selectedKeys="innerParams.jsonBody.jsonSchemaTableSelectedRowKeys"
|
||||
:disabled="props.disabledExceptParam"
|
||||
/>
|
||||
<MsCodeEditor
|
||||
|
@ -214,7 +214,6 @@
|
|||
const innerParams = defineModel<ExecuteBody>('params', {
|
||||
required: true,
|
||||
});
|
||||
const selectedKeys = ref<string[]>([]);
|
||||
const bodyLoading = ref(false);
|
||||
|
||||
const batchAddKeyValVisible = ref(false);
|
||||
|
@ -237,10 +236,13 @@
|
|||
if (innerParams.value.jsonBody.jsonSchema) {
|
||||
const { result, ids } = parseSchemaToJsonSchemaTableData(innerParams.value.jsonBody.jsonSchema);
|
||||
innerParams.value.jsonBody.jsonSchemaTableData = result;
|
||||
selectedKeys.value = ids;
|
||||
} else {
|
||||
innerParams.value.jsonBody.jsonSchemaTableSelectedRowKeys = ids;
|
||||
} else if (
|
||||
!innerParams.value.jsonBody.jsonSchemaTableData ||
|
||||
innerParams.value.jsonBody.jsonSchemaTableData.length === 0
|
||||
) {
|
||||
innerParams.value.jsonBody.jsonSchemaTableData = [];
|
||||
selectedKeys.value = [];
|
||||
innerParams.value.jsonBody.jsonSchemaTableSelectedRowKeys = [];
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -385,7 +387,7 @@
|
|||
if (schema) {
|
||||
// 再将 json schema 转换为 json 格式
|
||||
const res = await convertJsonSchemaToJson(schema);
|
||||
innerParams.value.jsonBody.jsonValue = JSON.stringify(res);
|
||||
innerParams.value.jsonBody.jsonValue = res;
|
||||
} else {
|
||||
Message.warning(t('apiTestManagement.pleaseInputJsonSchema'));
|
||||
}
|
||||
|
|
|
@ -424,7 +424,7 @@
|
|||
if (schema) {
|
||||
// 再将 json schema 转换为 json 格式
|
||||
const res = await convertJsonSchemaToJson(schema);
|
||||
activeResponse.value.body.jsonBody.jsonValue = JSON.stringify(res);
|
||||
activeResponse.value.body.jsonBody.jsonValue = res;
|
||||
} else {
|
||||
Message.warning(t('apiTestManagement.pleaseInputJsonSchema'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue