[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 :value="undefined">请选择</a-select-option>
<a-select-option v-for="(item, key) in dictOptions" :key="key" :value="item.value" :disabled="item.disabled || false"> <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 "> <span style="display: inline-block;width: 100%" :title=" $i18n.locale === EN ? item.enText : (item.text || item.label) ">
{{ item.text || item.label }} {{ $i18n.locale === EN ? item.enText : (item.text || item.label) }}
</span> </span>
</a-select-option> </a-select-option>
</a-select> </a-select>
@@ -56,6 +56,7 @@ export default {
}, },
data () { data () {
return { return {
EN: 'en-us',
dictOptions: [], dictOptions: [],
tagType: '' tagType: ''
} }
@@ -105,6 +106,7 @@ export default {
// 优先从缓存中读取字典配置 // 优先从缓存中读取字典配置
if (getDictItemsFromCache(this.dictCode)) { if (getDictItemsFromCache(this.dictCode)) {
this.dictOptions = getDictItemsFromCache(this.dictCode) this.dictOptions = getDictItemsFromCache(this.dictCode)
console.log('-----------缓存获取', this.dictCode, this.dictOptions)
return return
} }
@@ -112,6 +114,7 @@ export default {
ajaxGetDictItems(this.dictCode, null).then((res) => { ajaxGetDictItems(this.dictCode, null).then((res) => {
if (res.success) { if (res.success) {
this.dictOptions = res.result 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' : ''" :class="(openSelectedAll && arrayValue[0] === selectedAllValue) ? 'multi-select-tag-check-all' : ''"
v-bind="$attrs"> v-bind="$attrs">
<a-select-option :key="-1" :value="selectedAllValue" v-if="openSelectedAll && dictOptions.length > 0">{{ $t('checkedAll') }}</a-select-option> <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> </a-select>
</template> </template>
@@ -61,6 +61,7 @@ export default {
}, },
data () { data () {
return { return {
EN: 'en-us',
// 全选的value // 全选的value
selectedAllValue, selectedAllValue,
dictOptions: [], dictOptions: [],