Commit 9cc93abb by 潘际乾

国际化

parent 0fe4be1b
<template> <template>
<div class="bus-button"> <div class="bus-button">
<c-button type="primary" v-on:click="save">提交</c-button> <c-button type="primary" v-on:click="save">{{ $t('buttons.submit') }}</c-button>
<c-button type="primary" v-on:click="pedding">暂存</c-button> <c-button type="primary" v-on:click="pedding">{{ $t('buttons.stash') }}</c-button>
<c-button type="primary" v-on:click="check">校核</c-button> <c-button type="primary" v-on:click="check">{{ $t('buttons.check') }}</c-button>
<c-button v-on:click="exit">退出</c-button> <c-button v-on:click="exit">{{ $t('buttons.quit') }}</c-button>
</div> </div>
</template> </template>
<script> <script>
...@@ -79,7 +79,7 @@ export default { ...@@ -79,7 +79,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(()=>{ }).then(()=>{
this.$router.history.push("/business/office") this.$router.history.push("/home")
}) })
}, },
getVM(){ getVM(){
......
<template>
<el-form-item
:label="getL18nLabel()"
:prop="prop"
v-bind="$attrs"
v-on="$listeners"
>
<c-highlight-content
:id="previewLabel || label || prop"
:path="preProp ? preProp + '.' + prop : prop"
v-if="prop"
>
<slot></slot>
</c-highlight-content>
<slot v-else></slot>
</el-form-item>
</template>
<script>
export default {
props: ["label", "prop", "previewLabel", "preProp"],
methods: {
getL18nLabel() {
if (!this.label || this.label.trim() === "") {
return "";
}
// 默认中文作 key
if (this.$store.state.I18n.lang === "zh") {
return this.label;
}
let vm = this,
root = null;
while (true) {
if (vm.root) {
root = vm.root;
break;
}
if (vm.$vnode.componentOptions.tag === "el-form") {
break;
}
vm = vm.$parent;
}
// 若找到了root,表明该form-item是在交易下的
if (root) {
const opts = root.$vnode.componentOptions
const name = opts.Ctor.options.name || opts.tag
// const key = `tx.${root.trnName}.${this.label}`;
const key = `tx.${name}.${this.label}`;
const tVal = this.$t(key);
return tVal === key ? this.label : tVal;
}
return this.label;
},
},
};
</script>
<style></style>
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
<template> <template>
<div class="m-Btn-eContainer" v-if="!buttonHide && ((!isReview && !funcBtnHide) || showSetBtn)"> <div class="m-Btn-eContainer" v-if="!buttonHide && ((!isReview && !funcBtnHide) || showSetBtn)">
<div class="m-funcBtn-eContainer" v-if="!isReview && !buttonHide && !funcBtnHide"> <div class="m-funcBtn-eContainer" v-if="!isReview && !buttonHide && !funcBtnHide">
<el-button type="primary" size="small" @click="start" :loading="$store.state.Status.loading.submit">提交</el-button> <el-button type="primary" size="small" @click="start" :loading="$store.state.Status.loading.submit">{{ $t('buttons.submit') }}</el-button>
<el-button size="small" @click="check" :loading="$store.state.Status.loading.check">检核</el-button> <el-button size="small" @click="check" :loading="$store.state.Status.loading.check">{{ $t('buttons.check') }}</el-button>
<el-button size="small" @click="save" :loading="$store.state.Status.loading.stash">暂存</el-button> <el-button size="small" @click="save" :loading="$store.state.Status.loading.stash">{{ $t('buttons.stash') }}</el-button>
<el-button size="small" @click="handleCancel">退出</el-button> <el-button size="small" @click="handleCancel">{{ $t('buttons.quit') }}</el-button>
</div> </div>
<div class="m-zhanWei-forfuncBtn" v-if="!buttonHide && showSetBtn && (funcBtnHide || isReview)"></div> <div class="m-zhanWei-forfuncBtn" v-if="!buttonHide && showSetBtn && (funcBtnHide || isReview)"></div>
<div class="m-openleft" v-if="!buttonHide && showSetBtn"> <div class="m-openleft" v-if="!buttonHide && showSetBtn">
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
class="m-setting-btn" class="m-setting-btn"
v-show="!openflag" v-show="!openflag"
@click="open" @click="open"
>展开 >
{{ $t('buttons.unfold') }}
<i class="el-icon-setting" size="mini"></i> <i class="el-icon-setting" size="mini"></i>
</el-button> </el-button>
<el-button <el-button
...@@ -29,7 +30,8 @@ ...@@ -29,7 +30,8 @@
class="m-setting-btn" class="m-setting-btn"
v-show="openflag" v-show="openflag"
@click="close" @click="close"
>收起 >
{{ $t('buttons.fold') }}
<i class="el-icon-setting" size="mini"></i> <i class="el-icon-setting" size="mini"></i>
</el-button> </el-button>
<div class="m-openleft-item" v-show="openflag"> <div class="m-openleft-item" v-show="openflag">
...@@ -103,7 +105,7 @@ export default { ...@@ -103,7 +105,7 @@ export default {
}, 500) }, 500)
} else { } else {
setTimeout(() => { setTimeout(() => {
this.$router.push('/business/office') this.$router.push('/home')
}, 500) }, 500)
} }
}) })
......
...@@ -2,16 +2,16 @@ ...@@ -2,16 +2,16 @@
<div class="m-table-search"> <div class="m-table-search">
<slot v-bind:searchToggle="searchToggle"></slot> <slot v-bind:searchToggle="searchToggle"></slot>
<div v-if="formCount>3" :class="searchToggle? (formCount%3 == 0?'m-table-search-operation':'m-table-search-operation-bottom'): 'm-table-search-operation-top'" > <div v-if="formCount>3" :class="searchToggle? (formCount%3 == 0?'m-table-search-operation':'m-table-search-operation-bottom'): 'm-table-search-operation-top'" >
<el-button size="small" @click="handleReset">重置</el-button> <el-button size="small" @click="handleReset">{{ $t('buttons.reset') }}</el-button>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">查询</el-button> <el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">{{ $t('buttons.query') }}</el-button>
<el-button type="text" @click="handleToggleSearch"> <el-button type="text" @click="handleToggleSearch">
{{searchToggle?'收起': '展开'}} {{searchToggle? $t('buttons.fold') : $t('buttons.unfold') }}
<i :class="searchToggle? 'el-icon-arrow-up': 'el-icon-arrow-down'"></i> <i :class="searchToggle? 'el-icon-arrow-up': 'el-icon-arrow-down'"></i>
</el-button> </el-button>
</div> </div>
<div v-if="formCount <= 3" :class="formCount == 3? 'm-table-search-operation': 'm-table-search-operation-top'"> <div v-if="formCount <= 3" :class="formCount == 3? 'm-table-search-operation': 'm-table-search-operation-top'">
<el-button size="small" @click="handleReset">重置</el-button> <el-button size="small" @click="handleReset">{{ $t('buttons.reset') }}</el-button>
<el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">查询</el-button> <el-button type="primary" icon="el-icon-search" size="small" @click="handleSearch">{{ $t('buttons.query') }}</el-button>
</div> </div>
</div> </div>
</template> </template>
......
<template>
<el-table-column :label="generateI18nLabel()" v-bind="$attrs" v-on="$listeners">
<slot />
</el-table-column>
</template>
<script>
export default {
prop: {
label: {
type: String
}
},
methods: {
/**
* 以英文为主
* 若 lang 为中文 zh ,则列 label 不变
* 若 lang 为英文 en ,则需将中文翻译为英文(得提前配置好表格头的国际化:中 --> 英)
*/
generateI18nLabel() {
const lang = this.$store.state.I18n.lang
if (lang === "zh") {
return this.label;
}
return this.$t(this.label)
}
}
};
</script>
<style></style>
...@@ -30,6 +30,8 @@ import List from "./List" ...@@ -30,6 +30,8 @@ import List from "./List"
import ListSearch from "./ListSearch" import ListSearch from "./ListSearch"
import HighlightContent from "./HighlightContent" import HighlightContent from "./HighlightContent"
import SearchInput from "./SearchInput.vue" import SearchInput from "./SearchInput.vue"
import FormItem from "./FormItem.vue"
import TableColumnItem from "./TableColumnItem.vue"
// 循环组件 // 循环组件
import MessageArea from '~/widget/SwfMessage/MessageArea' import MessageArea from '~/widget/SwfMessage/MessageArea'
import CycList from '~/widget/SwfMessage/CycList' import CycList from '~/widget/SwfMessage/CycList'
...@@ -85,6 +87,8 @@ export default { ...@@ -85,6 +87,8 @@ export default {
Vue.component("c-cascader", Cascader) Vue.component("c-cascader", Cascader)
Vue.component("c-highlight-content", HighlightContent) Vue.component("c-highlight-content", HighlightContent)
Vue.component("c-search-input", SearchInput) Vue.component("c-search-input", SearchInput)
Vue.component("c-form-item", FormItem)
Vue.component("c-table-column", TableColumnItem)
Vue.component("c-paged-select", PagedSelect) Vue.component("c-paged-select", PagedSelect)
Vue.component("c-function-btn", FunctionBtn) Vue.component("c-function-btn", FunctionBtn)
Vue.component("c-bus-button", BusinessButon) Vue.component("c-bus-button", BusinessButon)
......
/** /**
* 交易中的公共模块 * 码表值
*/ */
export default { export default {
......
/**
* 页面中的公共部分(顶部、左侧菜单栏、页签等)
*/
export default {
router: {
},
header: {
},
tagsView: {
refresh: "Refresh",
close: "Close",
closeOthers: "Close Others",
closeAll: "Close All",
},
login: {
namePlaceholder: "Please enter username",
pwdPlaceholder: "Please enter password",
loginBtn: "Login"
},
sideMenu: {
},
home: {
},
buttons: {
add: "Add",
delete: "Delete",
query: "Query",
edit: "Edit",
update: "Update",
details: "Details",
submit: "Submit",
check: "Check",
stash: "Stash",
quit: "Quit",
cancel: "Cancel",
fold: "Fold",
unfold: "Unfold",
reset: "Reset",
toolBar: "ToolBar"
}
};
import codeTable from "./codeTable";
import common from "./common";
import tx from "./tx";
export default { export default {
tagsView: { ...common,
refresh: "Refresh", codeTable,
close: "Close", tx,
closeOthers: "Close Others",
closeAll: "Close All",
},
}; };
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
/**
* 交易模块
*/
export default {
...modules
}
\ No newline at end of file
import Setpan from "../public/Setpan"
export default {
"电话": "Tel",
"邮编": "Email",
...Setpan
}
\ No newline at end of file
/**
* 对应交易中的公共组件(Setpan.vue)
*/
export default {
}
\ No newline at end of file
...@@ -2,19 +2,44 @@ ...@@ -2,19 +2,44 @@
* 页面中的公共部分(顶部、左侧菜单栏、页签等) * 页面中的公共部分(顶部、左侧菜单栏、页签等)
*/ */
export default { export default {
router: {
},
header: {
},
tagsView: { tagsView: {
refresh: "刷新", refresh: "刷新",
close: "关闭", close: "关闭",
closeOthers: "关闭其", closeOthers: "关闭其",
closeAll: "关闭所有", closeAll: "关闭所有",
}, },
login: { login: {
namePlaceholder: "请输入登录名",
pwdPlaceholder: "请输入密码",
loginBtn: "登录"
}, },
sideMenu: { sideMenu: {
}, },
home: { home: {
},
buttons: {
add: "添加",
delete: "删除",
query: "查询",
edit: "编辑",
update: "更新",
details: "详情",
submit: "提交",
check: "检核",
stash: "暂存",
quit: "退出",
cancel: "取消",
fold: "收起",
unfold: "展开",
reset: "重置",
toolBar: "工具条"
} }
}; };
const modulesFiles = require.context('./', true, /\.js$/) const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => { const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1') const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath) const value = modulesFiles(modulePath)
......
import Setpan from "../public/Setpan"
export default { export default {
...Setpan
} }
\ No newline at end of file
/**
* 对应交易中的公共组件(Setpan.vue)
*/
export default {
}
\ No newline at end of file
...@@ -8,13 +8,20 @@ import { Message } from "element-ui"; ...@@ -8,13 +8,20 @@ import { Message } from "element-ui";
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
// 限制页签的数量 // 限制页签的数量
if (to.path.startsWith("/business")) { if (to.path.startsWith("/business")) {
if (store.state.TagsView.visitedViews.length >= store.state.TagsView.visitedViewsMaxVal) { const visitedViews = store.state.TagsView.visitedViews;
const visitedViewsMaxVal = store.state.TagsView.visitedViewsMaxVal;
const fullPaths = visitedViews.map((tv) => tv.fullPath);
if (fullPaths.includes(to.fullPath)) {
next();
} else {
if (visitedViews.length >= visitedViewsMaxVal) {
Message.warning( Message.warning(
`页签数超过最大限制(${store.state.TagsView.visitedViewsMaxVal}),请先关闭其他页签!` `页签数超过最大限制(${visitedViewsMaxVal}),请先关闭其他页签!`
); );
return; return;
} }
} }
}
next(); next();
}); });
......
...@@ -505,16 +505,16 @@ ...@@ -505,16 +505,16 @@
</c-col> --> </c-col> -->
<c-col :span="14"> <c-col :span="14">
<el-form-item label="邮编" prop="didgrp.apl.pts.youzbm"> <c-form-item label="邮编" prop="didgrp.apl.pts.youzbm">
<c-input <c-input
v-model="model.didgrp.apl.pts.youzbm" v-model="model.didgrp.apl.pts.youzbm"
maxlength="6" maxlength="6"
placeholder="请输入邮编" placeholder="请输入邮编"
></c-input> ></c-input>
</el-form-item> </c-form-item>
</c-col> </c-col>
<c-col :span="10"> <c-col :span="10">
<el-form-item <c-form-item
label="电话" label="电话"
label-width="40px" label-width="40px"
style="margin-left: 12px" style="margin-left: 12px"
...@@ -525,7 +525,7 @@ ...@@ -525,7 +525,7 @@
maxlength="16" maxlength="16"
placeholder="请输入电话" placeholder="请输入电话"
></c-input> ></c-input>
</el-form-item> </c-form-item>
</c-col> </c-col>
<c-col :span="24"> <c-col :span="24">
......
...@@ -27,7 +27,7 @@ export default { ...@@ -27,7 +27,7 @@ export default {
<style> <style>
#business_container { #business_container {
/* height: 100%; */ /* height: 100%; */
height: calc(100% - 45px); height: calc(100% - 36px);
position: absolute; position: absolute;
width: 100%; width: 100%;
} }
......
...@@ -9,15 +9,20 @@ ...@@ -9,15 +9,20 @@
v-for="tag in visitedViews" v-for="tag in visitedViews"
ref="tag" ref="tag"
:key="tag.path" :key="tag.path"
:class="{'active': isActive(tag), activeIcon: !isAffix(tag)}" :class="{ active: isActive(tag), activeIcon: !isAffix(tag) }"
:to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
tag="span" tag="span"
class="tags-view-item" class="tags-view-item"
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''" @click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
@contextmenu.prevent.native="openMenu(tag, $event)" @contextmenu.prevent.native="openMenu(tag, $event)"
> >
<span v-if="isAffix(tag) && tag.meta.icon" :class="tag.meta.icon"></span> <span
{{ typeof tag.title === 'function' ? tag.title(tag.params) : tag.title }} v-if="isAffix(tag) && tag.meta.icon"
:class="tag.meta.icon"
></span>
{{
typeof tag.title === "function" ? tag.title(tag.params) : tag.title
}}
<span <span
v-if="!isAffix(tag)" v-if="!isAffix(tag)"
class="el-icon-close" class="el-icon-close"
...@@ -30,12 +35,14 @@ ...@@ -30,12 +35,14 @@
:style="{ left: left + 'px', top: top + 'px' }" :style="{ left: left + 'px', top: top + 'px' }"
class="contextmenu" class="contextmenu"
> >
<li @click="refreshSelectedTag(selectedTag)">{{ $t('tagsView.refresh') }}</li> <li @click="refreshSelectedTag(selectedTag)">
{{ $t("tagsView.refresh") }}
</li>
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"> <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
{{ $t('tagsView.close') }} {{ $t("tagsView.close") }}
</li> </li>
<li @click="closeOthersTags">{{ $t('tagsView.closeOthers') }}</li> <li @click="closeOthersTags">{{ $t("tagsView.closeOthers") }}</li>
<li @click="closeAllTags(selectedTag)">{{ $t('tagsView.closeAll') }}</li> <li @click="closeAllTags(selectedTag)">{{ $t("tagsView.closeAll") }}</li>
</ul> </ul>
</div> </div>
</template> </template>
...@@ -43,7 +50,7 @@ ...@@ -43,7 +50,7 @@
<script> <script>
import ScrollPane from "./ScrollPane"; import ScrollPane from "./ScrollPane";
import path from "path"; import path from "path";
import { routes as allRoute } from "~/routers" import { routes as allRoute } from "~/routers";
export default { export default {
components: { ScrollPane }, components: { ScrollPane },
...@@ -151,6 +158,10 @@ export default { ...@@ -151,6 +158,10 @@ export default {
}); });
}, },
closeSelectedTag(view) { closeSelectedTag(view) {
this.$confirm("您有未保存的数据,确定退出吗, 是否继续?", "提示", {
showCancelButton: true,
type: "warning",
}).then(() => {
this.$store this.$store
.dispatch("TagsView/delView", view) .dispatch("TagsView/delView", view)
.then(({ visitedViews }) => { .then(({ visitedViews }) => {
...@@ -158,6 +169,7 @@ export default { ...@@ -158,6 +169,7 @@ export default {
this.toLastView(visitedViews, view); this.toLastView(visitedViews, view);
} }
}); });
});
}, },
closeOthersTags() { closeOthersTags() {
this.$router.push(this.selectedTag); this.$router.push(this.selectedTag);
...@@ -254,7 +266,9 @@ export default { ...@@ -254,7 +266,9 @@ export default {
color: #fff; color: #fff;
border-color: var(--themecolor); border-color: var(--themecolor);
} }
.tags-view-container .tags-view-wrapper .tags-view-item.active.activeIcon::before { .tags-view-container
.tags-view-wrapper
.tags-view-item.active.activeIcon::before {
content: ""; content: "";
background: #fff; background: #fff;
display: inline-block; display: inline-block;
...@@ -264,7 +278,7 @@ export default { ...@@ -264,7 +278,7 @@ export default {
position: relative; position: relative;
margin-right: 2px; margin-right: 2px;
} }
.tags-view-container .tags-view-wrapper .tags-view-item [class^=el-icon-] { .tags-view-container .tags-view-wrapper .tags-view-item [class^="el-icon-"] {
font-size: 15px; font-size: 15px;
} }
.tags-view-container .tags-view-wrapper .tags-view-item .el-icon-close { .tags-view-container .tags-view-wrapper .tags-view-item .el-icon-close {
......
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
<p style="text-align:left;font-size:1.2em;color:#888">用户登录 / LOGIN IN</p> <p style="text-align:left;font-size:1.2em;color:#888">用户登录 / LOGIN IN</p>
<el-form :model="loginForm" status-icon :rules="rules" ref="loginForm" size="small" > <el-form :model="loginForm" status-icon :rules="rules" ref="loginForm" size="small" >
<el-form-item prop="username" > <el-form-item prop="username" >
<el-input prefix-icon="el-icon-user" placeholder="请输入登录名" v-model="loginForm.username"></el-input> <el-input prefix-icon="el-icon-user" :placeholder="$t('login.namePlaceholder')" v-model="loginForm.username"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="password" > <el-form-item prop="password" >
<el-input prefix-icon="el-icon-lock" placeholder="请输入密码" type="password" v-model="loginForm.password" autocomplete="off"></el-input> <el-input prefix-icon="el-icon-lock" :placeholder="$t('login.pwdPlaceholder')" type="password" v-model="loginForm.password" autocomplete="off"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button style="width:100%;margin-top:1em;margin:0 0" type="primary" @click="submitForm('loginForm')">登录</el-button> <el-button style="width:100%;margin-top:1em;margin:0 0" type="primary" @click="submitForm('loginForm')">{{$t('login.loginBtn')}}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
type="primary" type="primary"
@click="onAplpDet" @click="onAplpDet"
> >
详情 {{ $t('buttons.details') }}
</c-button> </c-button>
<!-- </el-form-item> --> <!-- </el-form-item> -->
</c-col> </c-col>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment