提交 76f687c0 编写于 作者: RedPig97's avatar RedPig97

update:多语言优化

上级 cce1dd42
......@@ -22,8 +22,8 @@
</template>
<template v-if="!Object.is(this.navModel,'route')">
<el-breadcrumb-item v-for="(item, index) in breadcrumbs" :key="item.path">
<span v-if="index === breadcrumbs.length-1" class="no-redirect" >{{ $t(item.meta.caption)}}</span>
<a v-else @click.prevent="handleLink(item)" >{{ $t(item.meta.caption) }}</a>
<span v-if="index === breadcrumbs.length-1" class="no-redirect" >{{ getCaption(item.meta)}}</span>
<a v-else @click.prevent="handleLink(item)" >{{ getCaption(item.meta) }}</a>
</el-breadcrumb-item>
</template>
</transition-group>
......@@ -139,6 +139,18 @@ export default class Breadcrumb extends Vue {
return preNavData.data;
}
/**
* 获取项标题
*
* @memberof Breadcrumb
*/
public getCaption(meta: any): any {
const caption = meta.captionLanResTag ? this.$t(meta.captionLanResTag, meta.caption) : meta.caption;
return meta.info && !Object.is(meta.info, "")
? `${this.$t(caption)} - ${this.$t(meta.info)}`
: this.$t(caption);
}
/**
* 判断是否为当前选中项
*
......
<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>
......
......@@ -72,12 +72,7 @@
&nbsp;
<span>
<template v-if="detail.isShowCaption">
<template v-if="uiActionGroup.langbase && !Object.is(uiActionGroup.langbase, '') && detail.uiactiontag && !Object.is(detail.uiactiontag, '')">
{{$t(`${uiActionGroup.langbase}.uiactions.${detail.uiactiontag}`)}}
</template>
<template v-if="!(uiActionGroup.langbase && !Object.is(uiActionGroup.langbase, '') && detail.uiactiontag && !Object.is(detail.uiactiontag, ''))">
{{detail.caption}}
</template>
{{ getCaption(detail) }}
</template>
</span>
</span>
......@@ -277,6 +272,19 @@ export default class AppFormGroup extends Vue {
*/
@Prop({ default: 0 }) public titleBarCloseMode!: number | 0 | 1 | 2;
/**
* 获取标题
*
* @memberof AppFormGroup
*/
public getCaption (detail: any) {
if (detail.captionLanbase) {
return this.$t(detail.captionLanbase, detail.caption);
} else {
return detail.caption;
}
}
/**
* 收缩内容
*
......
......@@ -4,7 +4,7 @@
<template v-if="!item.hidden">
<div :bordered="false" v-if="item.items && Array.isArray(item.items)" :key="index" :class="item.textcls">
<p @click="$emit('menuClick',item.name, [item.name])">
<span>{{$t('app.menus.' + ctrlName + '.' + item.name)}}</span>
<span>{{$t(item.cappslanguageres, item.text)}}</span>
<span class="line"></span>
</p>
<p style=" display: 'flex' ">
......@@ -29,7 +29,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i>
</span>
<h4>{{$t('app.menus.' + ctrlName + '.' + item.name)}}</h4>
<h4>{{$t(item.cappslanguageres, item.text)}}</h4>
</div>
</el-card>
</template>
......
......@@ -13,7 +13,7 @@
<template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i>
</template>
<span ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(item.cappslanguageres, item.text)">{{$t(item.cappslanguageres, item.text)}}</span>
</template>
<app-menu-item :isCollapse="isCollapse" :menus="item.items" :ctrlName="ctrlName" :isFirst="false" :counterdata="counterdata" :popper-class="popperClass"></app-menu-item>
</el-submenu>
......@@ -23,18 +23,18 @@
<el-menu-item :class="[{'isFirst' : isFirst},item.textcls]" v-show="!item.hidden" :index="item.name" :key="item.id">
<template v-if="item.icon && item.icon != ''">
<img :src="item.icon" class='app-menu-icon' />
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(item.cappslanguageres, item.text)">{{$t(item.cappslanguageres, item.text)}}</span>
</template>
<template v-else-if="item.iconcls && item.iconcls != ''">
<i :class="[item.iconcls, 'app-menu-icon']"></i>
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(item.cappslanguageres, item.text)">{{$t(item.cappslanguageres, item.text)}}</span>
</template>
<template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i>
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span v-if="(isFirst && isCollapse) ? true : false" ref="circleText" :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(item.cappslanguageres, item.text)">{{$t(item.cappslanguageres, item.text)}}</span>
</template>
<template slot="title">
<span :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(`app.menus.${ctrlName}.${item.name}`)">{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span :class="{'app-menu-circle' : appMenuCollapseFlag, 'text' : true}" :title="$t(item.cappslanguageres, item.text)">{{$t(item.cappslanguageres, item.text)}}</span>
<template v-if="counterdata && counterdata[item.counterid] && counterdata[item.counterid] > 0">
<span class="pull-right">
<badge :count="counterdata[item.counterid]" :overflow-count="9999"></badge>
......
......@@ -8,7 +8,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i>
</span>
<span>{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span>
<span>{{$t(item.cappslanguageres, item.text)}}</span>
<span class="line"></span>
</p>
<p style=" display: 'flex' ">
......@@ -37,7 +37,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i>
</span>
<h4>{{$t(`app.menus.${ctrlName}.${item.name}`)}}</h4>
<h4>{{$t(item.cappslanguageres, item.text)}}</h4>
</div>
</card>
</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>
......
......@@ -2,10 +2,10 @@
<div :class="['app-sort-bar', isSort ? 'open-bar' : '',]">
<row v-if="sortModel && sortModel.length>0" class="page-sort-bar" :gutter="10" type="flex" justify="start" style="margin:0px;">
<template v-for="(item, index) in sortModel">
<i-col v-show="isSort" :key="index" :class="getSortClass(item)">
<i-col v-show="isSort" :key="index" :class="getSortClass(item.codeName)">
<div >
<div @click="sortItemClick(item)">
<span class="sort-field-text" >{{$t('entities.'+ entityName +'.fields.' + item)}}</span>
<div @click="sortItemClick(item.codeName)">
<span class="sort-field-text" >{{item.logicNameLenRes ? $t(item.logicNameLenRes, item.logicName) : item.logicName}}</span>
<span class="caret-wrapper">
<Icon type="md-arrow-dropup" />
<Icon type="md-arrow-dropdown" />
......
<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">
<i v-if="item.iconcls" :class="item.iconcls"></i>
<img v-if="item.icon" :src="getIcon(item.icon)" />
<span :class="item.class" :style="{ color: item.color }">
{{ isUseLangres ? $t(item.text) : item.text }}
<span :class="item.class">
{{ item.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,11 @@ 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);
}
}
}
......@@ -219,7 +221,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 +263,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;
}
......
......@@ -8,7 +8,7 @@
:filterable="filterable"
@on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownListDynamic.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value">{{($t('userCustom.'+tag+'.'+item.value)!== ('userCustom.'+tag+'.'+item.value))?$t('userCustom.'+tag+'.'+item.value) : item.text}}</i-option>
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value">{{item.text}}</i-option>
</i-select>
</template>
......
......@@ -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>
......
......@@ -14,7 +14,7 @@
:key="index+''"
>
<span slot="label"><span class="ivu-tag-dot-inner"></span>{{ getCaption(meta.caption, meta.info) }}</span>
<span slot="label"><span class="ivu-tag-dot-inner"></span>{{ getCaption(meta) }}</span>
</el-tab-pane>
</el-tabs>
</div>
......@@ -66,10 +66,11 @@ export default class TabPageExp extends Vue {
Vue.prototype.$tabPageExp = this;
}
public getCaption(caption: any, info: any): any {
return info && !Object.is(info, "")
? `${this.$t(caption)} - ${this.$t(info)}`
: this.$t(caption);
public getCaption(meta: any): any {
const caption = meta.captionLanResTag ? this.$t(meta.captionLanResTag, meta.caption) : meta.caption;
return meta.info && !Object.is(meta.info, "")
? `${caption} - ${meta.info}`
: caption;
}
/**
......@@ -226,13 +227,13 @@ export default class TabPageExp extends Vue {
* @param {*} caption
* @memberof TabPageExp
*/
public setCurPageCaption(caption: string, title: any, info: string) {
if (this.$route.meta && !Object.is(this.$t(this.$route.meta.caption), caption)) {
public setCurPageCaption(caption: string, info: string) {
if (this.$route.meta && !Object.is(this.$route.meta.caption, caption)) {
return;
}
this.$store.commit("setCurPageCaption", {
route: this.$route,
caption: title,
caption: caption,
info: info
});
setTimeout(() => {
......
......@@ -200,7 +200,7 @@ export default class EditViewEngine extends ViewEngine {
}
// 解决表格视图标题问题
if(this.view.$tabPageExp && this.view.viewDefaultUsage){
this.view.$tabPageExp.setCurPageCaption(this.view.$t(viewdata.srfCaption), viewdata.srfCaption, info);
this.view.$tabPageExp.setCurPageCaption(viewdata.srfCaption, info);
}
if(this.view.$route){
this.view.$route.meta.info = info;
......
// 用户自定义语言资源 英文
function getLocaleResource(){
const data:any = {};
return data;
}
export default getLocaleResource;
\ No newline at end of file
// 用户自定义语言资源 中文
function getLocaleResource(){
const data:any = {};
return data;
}
export default getLocaleResource;
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册