Commit 84ece510 authored by 水落(YangLei)'s avatar 水落(YangLei)

feat: 国际化处理

parent d4bbf0d9
......@@ -35,5 +35,5 @@ export const getStaticDataApi = async (data) => {
};
export function getStaticDataByTwoParamsApi(paramModule, paramCode) {
return getStaticDataApi({ paramModule, paramCode });
return () => getStaticDataApi({ paramModule, paramCode });
}
......@@ -2,7 +2,7 @@
<a-select
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
placeholder="Please select"
:placeholder="$t('select.placeholder')"
allow-clear
:options="options"
v-on="$listeners"
......
<template>
<div :style="`min-width: ${width}px`" class="tw-overflow-x-auto">
<my-card v-if="$scopedSlots.search" class="tw-mb-2.5">
<my-card v-if="$scopedSlots.search" :class="{ 'tw-mb-2.5': !noMargin }">
<div class="tw-flex">
<slot name="search" :query="queryForm" />
</div>
......@@ -21,7 +21,7 @@
</div>
</my-card>
<my-card :class="noPadding ? 'tw-p-0' : ''">
<my-card :class="noPadding ? 'tw-p-0' : ''" :style="tableCardStyle">
<a-space class="tw-mb-2">
<a-button type="primary" v-if="newBtn" @click="addBtnClick">
{{ newBtn.text || '新增' }}
......@@ -104,6 +104,7 @@ export default {
type: Object,
default: () => ({}),
},
noMargin: Boolean,
},
data() {
......@@ -164,6 +165,13 @@ export default {
},
};
},
tableCardStyle() {
return this.noMargin
? {
paddingTop: 0,
}
: {};
},
},
methods: {
......
import selectLang from './select';
const zh_CN = {};
const en_US = {};
function formatLang(langObject) {
for (const key in langObject) {
const element = langObject[key];
zh_CN[key] = element[0];
en_US[key] = element[1];
}
}
formatLang(selectLang);
export { en_US, zh_CN };
// 0 中文, 1 英文
export default {
'select.placeholder': ['请选择', 'Please Select'],
};
......@@ -12,6 +12,7 @@ import { loadGuards, setAppOptions } from './utils/routerUtil';
import guards from './router/guards';
import { loadResponseInterceptor } from './utils/requestUtil';
import langUtils from '@/utils/langUtils';
import { en_US, zh_CN } from '@/local';
import 'tailwindcss/tailwind.css';
import 'animate.css/source/animate.css';
......@@ -43,6 +44,7 @@ const i18n = new VueI18n({
locale: localeLang,
fallbackLocale: langUtils.fallbackLocale,
silentFallbackWarn: true,
messages: { zh_CN, en_US },
});
//装载antd控件
......@@ -67,5 +69,5 @@ new Vue({
router,
store,
i18n,
render: h => h(App),
render: (h) => h(App),
}).$mount('#app');
<template>
<my-card class="tw-flex">
<div class="tw-mr-2.5" :class="$style.container" style="flex-basis: 500px">
<Table
url="/ranger/inspection/api/v1/items"
rowKey="itemId"
:width="700"
:buttons="buttons"
noMargin
>
<template #search="{ query }">
<MoreItem label="地区">
<UrlSelect
url="/ranger/inspection/api/v1/region/list"
v-model="query.regionId"
labelFiled="regionName"
valueFiled="regionId"
/>
</MoreItem>
<MoreItem label="指标名称">
<a-input v-model="query.itemName" />
</MoreItem>
</template>
<a-table-column title="巡检指标" data-index="itemName" />
<a-table-column title="单元" data-index="unitName" />
</Table>
</div>
<div :class="$style.container" class="tw-flex-1 tw-h-10"></div>
</my-card>
</template>
<script>
import Table from '@/components/table/table.vue';
import MoreItem from '@/components/table/more_item.vue';
import UrlSelect from '@/components/MySelect/url_select.vue';
export default {
components: { Table, MoreItem, UrlSelect },
data() {
return {
buttons: [
{
label: '添加',
click: this.addToChart,
isHidden(row) {
return row.__isHidden__;
},
},
],
};
},
methods: {
addToChart(row) {
console.log(row);
this.$set(row, '__isHidden__', true);
},
},
};
</script>
<style module>
.container {
@apply tw-border tw-border-gray-300 tw-border-solid tw-rounded;
}
</style>
......@@ -142,7 +142,7 @@ export default {
title: '备注 & 附件',
options: {
fixed: 'right',
width: 150,
width: 100,
},
data: [
{
......@@ -166,7 +166,6 @@ export default {
},
methods: {
viewDetail(row) {
console.log(row);
this.$refs.table.show({ row, title: '备注 & 附件' });
},
},
......
......@@ -81,13 +81,11 @@ const hasAuthorityRoutes = [
component: () => import('@/pages/ranger/basic/unit'),
},
{
path: 'major',
name: '专业配置',
component: () => import('@/pages/ranger/basic/major'),
},
{
path: 'item',
name: '项目配置',
component: () => import('@/pages/ranger/basic/item'),
......@@ -121,6 +119,11 @@ const hasAuthorityRoutes = [
name: '报表中心',
component: RouterView,
children: [
{
path: 'trend-analysis',
name: '趋势对比',
component: () => import('@/pages/ranger/report/trend/index.vue'),
},
{
path: 'week',
name: '巡检周报',
......
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