From eec62c12ff7127379e4c93bb2f266ec7dd9f45d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com> Date: Tue, 8 Nov 2022 18:51:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E8=AF=A6=E6=83=85-=E6=9B=B4=E6=96=B0=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=AE=BE=E7=BD=AE=E4=B8=BAfalse=E5=90=8E?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E7=82=B9=E5=87=BB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/assets/Platform/PlatformCreateUpdate.vue | 4 ++-- .../assets/Platform/PlatformDetail/Automation.vue | 10 +++++++--- src/views/assets/Platform/const.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/assets/Platform/PlatformCreateUpdate.vue b/src/views/assets/Platform/PlatformCreateUpdate.vue index 0fa3f9890..a73429202 100644 --- a/src/views/assets/Platform/PlatformCreateUpdate.vue +++ b/src/views/assets/Platform/PlatformCreateUpdate.vue @@ -62,7 +62,7 @@ export default { } return obj }, - object: {} + defaultOptions: {} } }, async mounted() { @@ -90,7 +90,7 @@ export default { const type = this.$route.query.type const url = `/api/v1/assets/categories/constraints/?category=${category}&type=${type}` const constraints = await this.$axios.get(url) - this.object = constraints + this.defaultOptions = constraints const fieldsCheck = ['protocols_enabled', 'domain_enabled', 'su_enabled'] for (const field of fieldsCheck) { diff --git a/src/views/assets/Platform/PlatformDetail/Automation.vue b/src/views/assets/Platform/PlatformDetail/Automation.vue index 958d7166a..ab18e1390 100644 --- a/src/views/assets/Platform/PlatformDetail/Automation.vue +++ b/src/views/assets/Platform/PlatformDetail/Automation.vue @@ -36,15 +36,19 @@ export default { submitMethod: () => 'patch', fields: [['', ['automation']]], fieldsMeta: platformFieldsMeta(this), - onSubmit: this.submit + onSubmit: this.submit, + defaultOptions: {} } }, computed: { ...mapGetters(['isSystemAdmin']) }, - mounted() { + async mounted() { try { - setAutomations(this) + const { category, type } = this.object + const url = `/api/v1/assets/categories/constraints/?category=${category.value}&type=${type.value}` + this.defaultOptions = await this.$axios.get(url) + await setAutomations(this) } finally { this.loading = false } diff --git a/src/views/assets/Platform/const.js b/src/views/assets/Platform/const.js index 879078956..163ca1a01 100644 --- a/src/views/assets/Platform/const.js +++ b/src/views/assets/Platform/const.js @@ -78,7 +78,7 @@ export const platformFieldsMeta = (vm) => { } export const setAutomations = (vm) => { - const automation = vm.object.automation || {} + const automation = vm.defaultOptions.automation || {} const autoFieldsMeta = vm.fieldsMeta.automation.fieldsMeta const autoFields = vm.fieldsMeta.automation.fields .filter(item => item.endsWith('_method'))