From ee53476ace0d5ec322905ee67a55f26015696976 Mon Sep 17 00:00:00 2001 From: baiqi Date: Wed, 17 Jul 2024 10:28:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95=20bugFix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/pure/ms-json-schema/index.vue | 20 +++++++++++++++++++ .../components/pure/ms-json-schema/types.ts | 2 ++ .../components/pure/ms-json-schema/utils.ts | 4 ++++ .../management/components/moduleTree.vue | 3 --- .../src/views/api-test/management/index.vue | 6 ++---- 5 files changed, 28 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/pure/ms-json-schema/index.vue b/frontend/src/components/pure/ms-json-schema/index.vue index ae9a9fa255..0691fcfa9e 100644 --- a/frontend/src/components/pure/ms-json-schema/index.vue +++ b/frontend/src/components/pure/ms-json-schema/index.vue @@ -98,6 +98,7 @@ :precision="0" size="medium" :disabled="props.disabled" + model-event="input" @change="emitChange('minLengthInput')" />
-
@@ -111,6 +112,7 @@ :precision="0" size="medium" :disabled="props.disabled" + model-event="input" @change="emitChange('maxLengthInput')" />
-
@@ -122,6 +124,7 @@ class="ms-form-table-input-number" size="medium" :disabled="props.disabled" + model-event="input" @change="emitChange('minimumInput')" />
-
@@ -143,6 +147,7 @@ class="ms-form-table-input-number" size="medium" :disabled="props.disabled" + model-event="input" @change="emitChange('maximumInput')" />
-
@@ -167,6 +173,7 @@ :step="1" :precision="0" :disabled="props.disabled" + model-event="input" @change="emitChange('minItemsInput')" />
-
@@ -181,6 +188,7 @@ :step="1" :precision="0" :disabled="props.disabled" + model-event="input" @change="emitChange('maxItemsInput')" />
-
@@ -192,6 +200,7 @@ class="ms-form-table-input-number" size="medium" :disabled="props.disabled" + model-event="input" @change="emitChange('defaultValueInput')" /> @@ -377,6 +388,7 @@ :min="0" :step="1" :precision="0" + model-event="input" @change="handleSettingFormChange" /> @@ -389,12 +401,14 @@ mode="button" :step="1" :precision="0" + model-event="input" @change="handleSettingFormChange" /> @@ -405,12 +419,14 @@ mode="button" :step="1" :precision="0" + model-event="input" @change="handleSettingFormChange" /> @@ -421,6 +437,7 @@ v-model:model-value="activeRecord.defaultValue" mode="button" :placeholder="t('common.pleaseInput')" + model-event="input" @change="handleSettingFormChange" /> @@ -486,6 +505,7 @@ :min="0" :step="1" :precision="0" + model-event="input" @change="handleSettingFormChange" /> diff --git a/frontend/src/components/pure/ms-json-schema/types.ts b/frontend/src/components/pure/ms-json-schema/types.ts index 0ee8c8f20b..5fa61f8cab 100644 --- a/frontend/src/components/pure/ms-json-schema/types.ts +++ b/frontend/src/components/pure/ms-json-schema/types.ts @@ -36,4 +36,6 @@ export interface JsonSchema { items?: JsonSchemaItem[]; required?: string[]; description?: string; + minItems?: number; + maxItems?: number; } diff --git a/frontend/src/components/pure/ms-json-schema/utils.ts b/frontend/src/components/pure/ms-json-schema/utils.ts index ec27f037e9..a3aa48d56d 100644 --- a/frontend/src/components/pure/ms-json-schema/utils.ts +++ b/frontend/src/components/pure/ms-json-schema/utils.ts @@ -65,6 +65,8 @@ export function parseTableDataToJsonSchema( type: 'array', enable: schemaItem.enable, items: schemaItem.children.map((child) => parseTableDataToJsonSchema(child, false) as JsonSchemaItem), + minItems: schemaItem.minItems, + maxItems: schemaItem.maxItems, }; } } @@ -205,6 +207,8 @@ export function parseSchemaToJsonSchemaTableData(schema: string | JsonSchema): { required: false, example: '', defaultValue: '', + maxItems: node.maxItems, + minItems: node.minItems, }; } else { // 子孙节点 diff --git a/frontend/src/views/api-test/management/components/moduleTree.vue b/frontend/src/views/api-test/management/components/moduleTree.vue index 2f35a949ba..0315e97584 100644 --- a/frontend/src/views/api-test/management/components/moduleTree.vue +++ b/frontend/src/views/api-test/management/components/moduleTree.vue @@ -455,9 +455,6 @@ path: e.path, fullPath, }; - if (!isSetDefaultKey && e.id === selectedKeys.value[0]) { - folderNodeSelect([selectedKeys.value[0]], e); - } return { ...e, hideMoreAction: e.id === 'root', diff --git a/frontend/src/views/api-test/management/index.vue b/frontend/src/views/api-test/management/index.vue index 0856e27234..9f0df7a146 100644 --- a/frontend/src/views/api-test/management/index.vue +++ b/frontend/src/views/api-test/management/index.vue @@ -118,9 +118,9 @@ function setActiveApi(params: RequestParam) { if (params.id === 'all') { // 切换到全部 tab 时需设置为上次激活的 api 节点的模块 - activeNodeId.value = params.moduleId; - } else { activeNodeId.value = params.id; + } else { + activeNodeId.value = params.moduleId; } } @@ -148,8 +148,6 @@ async function refreshModuleTree() { await moduleTreeRef.value?.refresh(); - // 涉及到模块树的刷新操作(比如删除),也会刷新回收站的数量 - selectRecycleCount(); } function refreshModuleTreeCount(params: ApiDefinitionGetModuleParams) {