fix:修复报告新增 category 部分选项 Params 国际化无法动态改变问题

This commit is contained in:
@changcode
2022-09-05 10:38:34 +08:00
parent f17860a228
commit ad8db552c0

View File

@@ -235,9 +235,7 @@
<!-- <el-input v-model="param.value" placeholder=" " v-for="(param, index) in editObject.categoryParams" :key="index" size="small" style="vertical-align: unset;" :disabled="!!editObject.id">
<template #prepend>{{param.key}}</template>
</el-input>-->
<el-select v-model="param.value"
v-for="(param, index) in editObject.categoryParams"
:key="index"
<el-select v-model="editObject.categoryParams[0].value"
class="right-box__select right-box__select--param"
placeholder=" "
filterable
@@ -246,10 +244,10 @@
size="small"
>
<template #prefix>
{{$t(param.i18n)}}
{{$t(editObject.categoryParams[0].i18n)}}
</template>
<template v-for="paramOption in paramsOptions">
<template v-if="paramOption.key === param.key">
<template v-if="paramOption.key === editObject.categoryParams[0].key">
<el-option :key="p" :value="p" v-for="p in paramOption.options"></el-option>
</template>
</template>
@@ -415,6 +413,8 @@ export default {
},
'editObject.categoryId': {
handler (n) {
const dom = document.getElementsByClassName('el-input__inner')
console.log(dom)
const category = this.categoryList.find(c => c.id === n)
if (category && category.config && category.config.queryParam) {
this.editObject.categoryParams = category.config.queryParam
@@ -460,6 +460,16 @@ export default {
}
} else if (this.currentCategoryId) {
this.editObject.categoryId = this.currentCategoryId
const category = this.categoryList.find(c => c.id === this.currentCategoryId)
if (category && category.config && category.config.queryParam) {
this.editObject.categoryParams = category.config.queryParam
if (!this.editObject.id) {
this.editObject.categoryParams.forEach(t => { t.value = '' })
}
this.loadParamOptions()
} else {
this.editObject.categoryParams = []
}
}
}
}