From 6281905a55d52371abfd4fd55d15e72dac45d86e Mon Sep 17 00:00:00 2001 From: zhengkunwang223 Date: Fri, 23 Dec 2022 17:45:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=E4=B8=8D=E8=AF=A5?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E7=9A=84=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/app-store/detail/index.vue | 1 - .../views/app-store/detail/install/index.vue | 23 +++++++++---------- .../views/app-store/detail/params/index.vue | 11 ++++++--- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/frontend/src/views/app-store/detail/index.vue b/frontend/src/views/app-store/detail/index.vue index 62a611fe0..761ce4f74 100644 --- a/frontend/src/views/app-store/detail/index.vue +++ b/frontend/src/views/app-store/detail/index.vue @@ -54,7 +54,6 @@ show-icon :closable="false" /> - diff --git a/frontend/src/views/app-store/detail/install/index.vue b/frontend/src/views/app-store/detail/install/index.vue index 21613d928..85b55a900 100644 --- a/frontend/src/views/app-store/detail/install/index.vue +++ b/frontend/src/views/app-store/detail/install/index.vue @@ -2,13 +2,18 @@ - + @@ -30,7 +35,7 @@ import { App } from '@/api/interface/app'; import { InstallApp } from '@/api/modules/app'; import { Rules } from '@/global/form-rules'; import { FormInstance, FormRules } from 'element-plus'; -import { nextTick, reactive, ref } from 'vue'; +import { reactive, ref } from 'vue'; import { useRouter } from 'vue-router'; import Params from '../params/index.vue'; const router = useRouter(); @@ -61,22 +66,16 @@ const handleClose = () => { resetForm(); }; -const opened = () => { - nextTick(() => { - if (paramForm.value) { - paramForm.value.clearValidate(); - } - }); -}; - const resetForm = () => { if (paramForm.value) { + paramForm.value.clearValidate(); paramForm.value.resetFields(); } }; const acceptParams = (props: InstallRrops): void => { installData.value = props; + resetForm(); open.value = true; }; diff --git a/frontend/src/views/app-store/detail/params/index.vue b/frontend/src/views/app-store/detail/params/index.vue index 516a63ab1..6f6096482 100644 --- a/frontend/src/views/app-store/detail/params/index.vue +++ b/frontend/src/views/app-store/detail/params/index.vue @@ -91,7 +91,6 @@ const updateParam = () => { const handleParams = () => { rules = props.rules; - if (params.value != undefined && params.value.formFields != undefined) { for (const p of params.value.formFields) { const pObj = p; @@ -129,7 +128,11 @@ const getServices = async (envKey: string, key: string | undefined, pObj: ParamO form[envKey] = res.data[0].value; if (res.data[0].config) { Object.entries(res.data[0].config).forEach(([k, v]) => { - form[k] = v; + params.value.formFields.forEach((field) => { + if (field.envKey === k) { + form[k] = v; + } + }); }); } updateParam(); @@ -141,7 +144,9 @@ const changeService = (value: string, services: App.AppService[]) => { services.forEach((item) => { if (item.value === value) { Object.entries(item.config).forEach(([k, v]) => { - form[k] = v; + if (form.hasOwnProperty(k)) { + form[k] = v; + } }); } });