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