提交 0c6a3c9e 编写于 作者: Cano1997's avatar Cano1997

update: 代码表多语言

上级 0b5c4415
<template>
<checkbox-group class="app-checkbox-list" v-model="selectArray">
<checkbox v-for="(item,index) in items" :key="index" :label="item.value" :disabled="isDisabled || item.disabled">
<span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+item.value) : item.text}}</span>
<span>{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}</span>
</checkbox>
</checkbox-group >
</template>
......
<template>
<el-radio-group class="app-radio-button" v-model="value">
<el-radio-button v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled">
<span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span>
<span>{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}</span>
</el-radio-button>
</el-radio-group>
</template>
......
<template>
<radio-group class="app-radio-group" v-model="currentVal">
<radio v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled">
<span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span>
<span>{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}</span>
</radio>
</radio-group>
</template>
......
<template>
<div class="codelist">
<span v-if="ifEmpty">{{$t('codelist.'+tag+'.empty')}}</span>
<span v-if="ifEmpty">{{emptytext}}</span>
<template v-if="!ifEmpty">
<template v-for="(item, index) in items">
<div class="codelist-item" :key="index" :style="{ color: item.color, borderColor: item.color }">
<i v-if="item.iconcls" :class="item.iconcls"></i>
<img v-if="item.icon" :src="getIcon(item.icon)" />
<span :class="item.class">
{{ isUseLangres ? $t(item.text) : item.text }}
{{ tem.text }}
</span>
<span v-if="index != items.length-1">{{ textSeparator }}</span>
</div>
......@@ -141,11 +141,11 @@ export default class CodeList extends Vue {
}
/**
* 是否使用多语言资源
* @type {boolean}
* 空值文本
* @type {string}
* @memberof CodeList
*/
public isUseLangres:boolean = false;
public emptytext: string = '';
/**
* 数据值变化
......@@ -178,7 +178,6 @@ export default class CodeList extends Vue {
* @memberof CodeList
*/
private dataHandle(){
this.isUseLangres = false;
let _this = this;
// 空值判断
if(Object.is(this.$util.typeOf(this.value), 'undefined') || Object.is(this.$util.typeOf(this.value), 'null')){
......@@ -201,8 +200,13 @@ export default class CodeList extends Vue {
});
// 静态处理
} else if(Object.is(this.codelistType, "STATIC")){
this.isUseLangres = true;
_this.setItems(this.$store.getters.getCodeListItems(this.tag), _this);
const codelist = this.$store.getters.getCodeList(this.tag);
if (codelist) {
this.emptytext = codelist.emptytextLanRes ? this.$t(codelist.emptytextLanRes, codelist.emptytext) : codelist.emptytext;
_this.setItems(codelist.items, _this);
}
console.log(codelist, 888);
}
}
......@@ -219,7 +223,6 @@ export default class CodeList extends Vue {
if (items) {
let result:any = [];
if(Object.is(_this.renderMode,"NUM")){
_this.isUseLangres = false;
items.map((_item: any, index: number)=>{
const nValue = parseInt((_this.value as any), 10);
const codevalue = _item.value;
......@@ -262,9 +265,11 @@ export default class CodeList extends Vue {
}
result = { ...arr[0] };
if(Object.is(this.codelistType,'STATIC')){
let value = JSON.parse(JSON.stringify(result));
value.text = 'codelist.'+this.tag+'.'+value.value;
return value;
let item = JSON.parse(JSON.stringify(result));
if (item.textLanRes) {
value.text = this.$t(item.textLanRes, item.text);
}
return item;
}else{
return result;
}
......
......@@ -9,7 +9,7 @@
:filterable="filterable"
@on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownListHidden.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :disabled="item.disabled" :class="item.class" :value="item.value">{{($t('codelist.'+tag+'.'+item.value)!== ('codelist.'+tag+'.'+item.value))?$t('codelist.'+tag+'.'+item.value) : item.text}}</i-option>
<i-option v-for="(item, index) in items" :key="index" :disabled="item.disabled" :class="item.class" :value="item.value">{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}</i-option>
</i-select>
<ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree>
</div>
......
......@@ -14,7 +14,7 @@
:placeholder="placeholder?placeholder:$t('components.dropDownListMpicker.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value ? item.value.toString():''" :label="item.text">
<Checkbox :value="(currentVal.indexOf(item.value ? item.value.toString() : '')) == -1 ? false : true">
{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+item.value) : item.text}}
{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}
</Checkbox>
</i-option>
</i-select>
......
......@@ -9,7 +9,7 @@
:filterable="filterable"
@on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownList.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :disabled="item.disabled" :class="item.class" :value="item.value">{{($t('codelist.'+tag+'.'+item.value)!== ('codelist.'+tag+'.'+item.value))?$t('codelist.'+tag+'.'+item.value) : item.text}}</i-option>
<i-option v-for="(item, index) in items" :key="index" :disabled="item.disabled" :class="item.class" :value="item.value">{{ item.textLanRes ? $t(item.textLanRes, item.text) : item.text }}</i-option>
</i-select>
<ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree>
</div>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册