[update] 字典和字典多选增加双语

This commit is contained in:
lideqin
2024-08-01 19:00:31 +08:00
parent c4429ca023
commit 2273ce0489
2 changed files with 7 additions and 3 deletions
+5 -2
View File
@@ -24,8 +24,8 @@
>
<a-select-option :value="undefined">请选择</a-select-option>
<a-select-option v-for="(item, key) in dictOptions" :key="key" :value="item.value" :disabled="item.disabled || false">
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
{{ item.text || item.label }}
<span style="display: inline-block;width: 100%" :title=" $i18n.locale === EN ? item.enText : (item.text || item.label) ">
{{ $i18n.locale === EN ? item.enText : (item.text || item.label) }}
</span>
</a-select-option>
</a-select>
@@ -56,6 +56,7 @@ export default {
},
data () {
return {
EN: 'en-us',
dictOptions: [],
tagType: ''
}
@@ -105,6 +106,7 @@ export default {
// 优先从缓存中读取字典配置
if (getDictItemsFromCache(this.dictCode)) {
this.dictOptions = getDictItemsFromCache(this.dictCode)
console.log('-----------缓存获取', this.dictCode, this.dictOptions)
return
}
@@ -112,6 +114,7 @@ export default {
ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) {
this.dictOptions = res.result
console.log('-----------接口获取', this.dictCode, this.dictOptions)
}
})
},
+2 -1
View File
@@ -20,7 +20,7 @@
:class="(openSelectedAll && arrayValue[0] === selectedAllValue) ? 'multi-select-tag-check-all' : ''"
v-bind="$attrs">
<a-select-option :key="-1" :value="selectedAllValue" v-if="openSelectedAll && dictOptions.length > 0">{{ $t('checkedAll') }}</a-select-option>
<a-select-option v-for="(item, key) in dictOptions" :key="key" :value="item.value">{{ item.text || item.label }}</a-select-option>
<a-select-option v-for="(item, key) in dictOptions" :key="key" :value="item.value">{{ $i18n.locale === EN ? item.enText : (item.text || item.label) }}</a-select-option>
</a-select>
</template>
@@ -61,6 +61,7 @@ export default {
},
data () {
return {
EN: 'en-us',
// 全选的value
selectedAllValue,
dictOptions: [],