fix: 修复平台详情-更新平台信息设置为false后不能点击问题

This commit is contained in:
“huailei000” 2022-11-08 18:51:37 +08:00 committed by huailei
parent beced802f0
commit eec62c12ff
3 changed files with 10 additions and 6 deletions

View File

@ -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) {

View File

@ -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
}

View File

@ -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'))