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

update:多语言优化

上级 cce1dd42
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
</template> </template>
<template v-if="!Object.is(this.navModel,'route')"> <template v-if="!Object.is(this.navModel,'route')">
<el-breadcrumb-item v-for="(item, index) in breadcrumbs" :key="item.path"> <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> <span v-if="index === breadcrumbs.length-1" class="no-redirect" >{{ getCaption(item.meta)}}</span>
<a v-else @click.prevent="handleLink(item)" >{{ $t(item.meta.caption) }}</a> <a v-else @click.prevent="handleLink(item)" >{{ getCaption(item.meta) }}</a>
</el-breadcrumb-item> </el-breadcrumb-item>
</template> </template>
</transition-group> </transition-group>
...@@ -139,6 +139,18 @@ export default class Breadcrumb extends Vue { ...@@ -139,6 +139,18 @@ export default class Breadcrumb extends Vue {
return preNavData.data; 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> <template>
<checkbox-group class="app-checkbox-list" v-model="selectArray"> <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"> <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>
</checkbox-group > </checkbox-group >
</template> </template>
......
...@@ -72,12 +72,7 @@ ...@@ -72,12 +72,7 @@
&nbsp; &nbsp;
<span> <span>
<template v-if="detail.isShowCaption"> <template v-if="detail.isShowCaption">
<template v-if="uiActionGroup.langbase && !Object.is(uiActionGroup.langbase, '') && detail.uiactiontag && !Object.is(detail.uiactiontag, '')"> {{ getCaption(detail) }}
{{$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>
</template> </template>
</span> </span>
</span> </span>
...@@ -277,6 +272,19 @@ export default class AppFormGroup extends Vue { ...@@ -277,6 +272,19 @@ export default class AppFormGroup extends Vue {
*/ */
@Prop({ default: 0 }) public titleBarCloseMode!: number | 0 | 1 | 2; @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 @@ ...@@ -4,7 +4,7 @@
<template v-if="!item.hidden"> <template v-if="!item.hidden">
<div :bordered="false" v-if="item.items && Array.isArray(item.items)" :key="index" :class="item.textcls"> <div :bordered="false" v-if="item.items && Array.isArray(item.items)" :key="index" :class="item.textcls">
<p @click="$emit('menuClick',item.name, [item.name])"> <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> <span class="line"></span>
</p> </p>
<p style=" display: 'flex' "> <p style=" display: 'flex' ">
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" /> <img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i> <i class="fa fa-cogs" v-else></i>
</span> </span>
<h4>{{$t('app.menus.' + ctrlName + '.' + item.name)}}</h4> <h4>{{$t(item.cappslanguageres, item.text)}}</h4>
</div> </div>
</el-card> </el-card>
</template> </template>
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<template v-else> <template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i> <i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i>
</template> </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> </template>
<app-menu-item :isCollapse="isCollapse" :menus="item.items" :ctrlName="ctrlName" :isFirst="false" :counterdata="counterdata" :popper-class="popperClass"></app-menu-item> <app-menu-item :isCollapse="isCollapse" :menus="item.items" :ctrlName="ctrlName" :isFirst="false" :counterdata="counterdata" :popper-class="popperClass"></app-menu-item>
</el-submenu> </el-submenu>
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
<el-menu-item :class="[{'isFirst' : isFirst},item.textcls]" v-show="!item.hidden" :index="item.name" :key="item.id"> <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 != ''"> <template v-if="item.icon && item.icon != ''">
<img :src="item.icon" class='app-menu-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>
<template v-else-if="item.iconcls && item.iconcls != ''"> <template v-else-if="item.iconcls && item.iconcls != ''">
<i :class="[item.iconcls, 'app-menu-icon']"></i> <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>
<template v-else> <template v-else>
<i v-if="isFirst" class='fa fa-cogs app-menu-icon'></i> <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>
<template slot="title"> <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"> <template v-if="counterdata && counterdata[item.counterid] && counterdata[item.counterid] > 0">
<span class="pull-right"> <span class="pull-right">
<badge :count="counterdata[item.counterid]" :overflow-count="9999"></badge> <badge :count="counterdata[item.counterid]" :overflow-count="9999"></badge>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" /> <img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i> <i class="fa fa-cogs" v-else></i>
</span> </span>
<span>{{$t(`app.menus.${ctrlName}.${item.name}`)}}</span> <span>{{$t(item.cappslanguageres, item.text)}}</span>
<span class="line"></span> <span class="line"></span>
</p> </p>
<p style=" display: 'flex' "> <p style=" display: 'flex' ">
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" /> <img :src="item.iconcls" v-else-if="!Object.is(item.iconcls, '')" />
<i class="fa fa-cogs" v-else></i> <i class="fa fa-cogs" v-else></i>
</span> </span>
<h4>{{$t(`app.menus.${ctrlName}.${item.name}`)}}</h4> <h4>{{$t(item.cappslanguageres, item.text)}}</h4>
</div> </div>
</card> </card>
</template> </template>
......
<template> <template>
<radio-group class="app-radio-group" v-model="currentVal"> <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"> <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>
</radio-group> </radio-group>
</template> </template>
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
<div :class="['app-sort-bar', isSort ? 'open-bar' : '',]"> <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;"> <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"> <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 >
<div @click="sortItemClick(item)"> <div @click="sortItemClick(item.codeName)">
<span class="sort-field-text" >{{$t('entities.'+ entityName +'.fields.' + item)}}</span> <span class="sort-field-text" >{{item.logicNameLenRes ? $t(item.logicNameLenRes, item.logicName) : item.logicName}}</span>
<span class="caret-wrapper"> <span class="caret-wrapper">
<Icon type="md-arrow-dropup" /> <Icon type="md-arrow-dropup" />
<Icon type="md-arrow-dropdown" /> <Icon type="md-arrow-dropdown" />
......
<template> <template>
<div class="codelist"> <div class="codelist">
<span v-if="ifEmpty">{{$t('codelist.'+tag+'.empty')}}</span> <span v-if="ifEmpty">{{emptytext}}</span>
<template v-if="!ifEmpty"> <template v-if="!ifEmpty">
<template v-for="(item, index) in items"> <template v-for="(item, index) in items">
<div class="codelist-item" :key="index"> <div class="codelist-item" :key="index">
<i v-if="item.iconcls" :class="item.iconcls"></i> <i v-if="item.iconcls" :class="item.iconcls"></i>
<img v-if="item.icon" :src="getIcon(item.icon)" /> <img v-if="item.icon" :src="getIcon(item.icon)" />
<span :class="item.class" :style="{ color: item.color }"> <span :class="item.class">
{{ isUseLangres ? $t(item.text) : item.text }} {{ item.text }}
</span> </span>
<span v-if="index != items.length-1">{{ textSeparator }}</span> <span v-if="index != items.length-1">{{ textSeparator }}</span>
</div> </div>
...@@ -141,11 +141,11 @@ export default class CodeList extends Vue { ...@@ -141,11 +141,11 @@ export default class CodeList extends Vue {
} }
/** /**
* 是否使用多语言资源 * 空值文本
* @type {boolean} * @type {string}
* @memberof CodeList * @memberof CodeList
*/ */
public isUseLangres:boolean = false; public emptytext: string = '';
/** /**
* 数据值变化 * 数据值变化
...@@ -178,7 +178,6 @@ export default class CodeList extends Vue { ...@@ -178,7 +178,6 @@ export default class CodeList extends Vue {
* @memberof CodeList * @memberof CodeList
*/ */
private dataHandle(){ private dataHandle(){
this.isUseLangres = false;
let _this = this; let _this = this;
// 空值判断 // 空值判断
if(Object.is(this.$util.typeOf(this.value), 'undefined') || Object.is(this.$util.typeOf(this.value), 'null')){ 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 { ...@@ -201,8 +200,11 @@ export default class CodeList extends Vue {
}); });
// 静态处理 // 静态处理
} else if(Object.is(this.codelistType, "STATIC")){ } else if(Object.is(this.codelistType, "STATIC")){
this.isUseLangres = true; const codelist = this.$store.getters.getCodeList(this.tag);
_this.setItems(this.$store.getters.getCodeListItems(this.tag), _this); 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 { ...@@ -219,7 +221,6 @@ export default class CodeList extends Vue {
if (items) { if (items) {
let result:any = []; let result:any = [];
if(Object.is(_this.renderMode,"NUM")){ if(Object.is(_this.renderMode,"NUM")){
_this.isUseLangres = false;
items.map((_item: any, index: number)=>{ items.map((_item: any, index: number)=>{
const nValue = parseInt((_this.value as any), 10); const nValue = parseInt((_this.value as any), 10);
const codevalue = _item.value; const codevalue = _item.value;
...@@ -262,9 +263,11 @@ export default class CodeList extends Vue { ...@@ -262,9 +263,11 @@ export default class CodeList extends Vue {
} }
result = { ...arr[0] }; result = { ...arr[0] };
if(Object.is(this.codelistType,'STATIC')){ if(Object.is(this.codelistType,'STATIC')){
let value = JSON.parse(JSON.stringify(result)); let item = JSON.parse(JSON.stringify(result));
value.text = 'codelist.'+this.tag+'.'+value.value; if (item.textLanRes) {
return value; value.text = this.$t(item.textLanRes, item.text);
}
return item;
}else{ }else{
return result; return result;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
:filterable="filterable" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownListDynamic.placeholder')"> :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> </i-select>
</template> </template>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:filterable="filterable" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownListHidden.placeholder')"> :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> </i-select>
<ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree> <ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree>
</div> </div>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
:placeholder="placeholder?placeholder:$t('components.dropDownListMpicker.placeholder')"> :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"> <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"> <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> </Checkbox>
</i-option> </i-option>
</i-select> </i-select>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:filterable="filterable" :filterable="filterable"
@on-open-change="onClick" @on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownList.placeholder')"> :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> </i-select>
<ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree> <ibiz-select-tree v-if="hasChildren" class="tree-dropdown-list" :disabled="disabled" :NodesData="items" v-model="currentVal" :multiple="false"></ibiz-select-tree>
</div> </div>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
:key="index+''" :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-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
...@@ -66,10 +66,11 @@ export default class TabPageExp extends Vue { ...@@ -66,10 +66,11 @@ export default class TabPageExp extends Vue {
Vue.prototype.$tabPageExp = this; Vue.prototype.$tabPageExp = this;
} }
public getCaption(caption: any, info: any): any { public getCaption(meta: any): any {
return info && !Object.is(info, "") const caption = meta.captionLanResTag ? this.$t(meta.captionLanResTag, meta.caption) : meta.caption;
? `${this.$t(caption)} - ${this.$t(info)}` return meta.info && !Object.is(meta.info, "")
: this.$t(caption); ? `${caption} - ${meta.info}`
: caption;
} }
/** /**
...@@ -226,13 +227,13 @@ export default class TabPageExp extends Vue { ...@@ -226,13 +227,13 @@ export default class TabPageExp extends Vue {
* @param {*} caption * @param {*} caption
* @memberof TabPageExp * @memberof TabPageExp
*/ */
public setCurPageCaption(caption: string, title: any, info: string) { public setCurPageCaption(caption: string, info: string) {
if (this.$route.meta && !Object.is(this.$t(this.$route.meta.caption), caption)) { if (this.$route.meta && !Object.is(this.$route.meta.caption, caption)) {
return; return;
} }
this.$store.commit("setCurPageCaption", { this.$store.commit("setCurPageCaption", {
route: this.$route, route: this.$route,
caption: title, caption: caption,
info: info info: info
}); });
setTimeout(() => { setTimeout(() => {
......
...@@ -200,7 +200,7 @@ export default class EditViewEngine extends ViewEngine { ...@@ -200,7 +200,7 @@ export default class EditViewEngine extends ViewEngine {
} }
// 解决表格视图标题问题 // 解决表格视图标题问题
if(this.view.$tabPageExp && this.view.viewDefaultUsage){ 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){ if(this.view.$route){
this.view.$route.meta.info = info; 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 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册