fix: 根据配置隐藏多语言选择

This commit is contained in:
TsMask
2023-11-29 19:27:49 +08:00
parent 1784941670
commit 95fbce6b0e
9 changed files with 78 additions and 39 deletions

View File

@@ -20,11 +20,22 @@
// host = ip:prot // host = ip:prot
const host = '192.168.2.166:3030'; const host = '192.168.2.166:3030';
const configs = {
// internationalization 国际化禁用,默认语言选择
i18nDisable: false,
i18nDisableDefault: 'en_US',
// Service Address 服务地址 // Service Address 服务地址
const baseUrl = `http://${host}`; baseUrl: `http://${host}`,
sessionStorage.setItem('baseUrl', baseUrl);
// websocket Address // websocket Address
const wsUrl = `ws://${host}`; wsUrl: `ws://${host}`,
sessionStorage.setItem('wsUrl', wsUrl); };
if(!configs.i18nDisable){
localStorage.setItem('cache:local:i18n', configs.i18nDisableDefault);
}
for (const key in configs) {
console.log(key, `${configs[key]}`);
sessionStorage.setItem(key, `${configs[key]}`);
}
})(); })();

View File

@@ -26,5 +26,17 @@ export async function listIMS(query: Record<string, any>) {
data.total = rows.length; data.total = rows.length;
data.rows = rows; data.rows = rows;
} }
// 测试数据
// data.rows = [
// {
// activeTime: '2023-11-29 17:04:54',
// barring: 0,
// impu: 'sip:12307551232@ims.mnc000.mcc460.3gppnetwork.org',
// imsi: '460001230000002',
// msisdn: '12307551232',
// regState: 1,
// },
// ];
return data; return data;
} }

View File

@@ -8,7 +8,6 @@ import { parseObjLineToHump } from '@/utils/parse-utils';
* @returns object * @returns object
*/ */
export async function listN3iwf(query: Record<string, any>) { export async function listN3iwf(query: Record<string, any>) {
query.nbId = query.id;
const result = await request({ const result = await request({
url: '/api/rest/ueManagement/v1/elementType/n3iwf/objectType/ueInfo', url: '/api/rest/ueManagement/v1/elementType/n3iwf/objectType/ueInfo',
method: 'get', method: 'get',

View File

@@ -6,6 +6,7 @@ import useI18n from '@/hooks/useI18n';
import useAppStore from '@/store/modules/app'; import useAppStore from '@/store/modules/app';
import useUserStore from '@/store/modules/user'; import useUserStore from '@/store/modules/user';
import useAlarmStore from '@/store/modules/alarm'; import useAlarmStore from '@/store/modules/alarm';
import { sessionGet } from '@/utils/cache-session-utils';
const { isFullscreen, toggle } = useFullscreen(); const { isFullscreen, toggle } = useFullscreen();
const { t, changeLocale, optionsLocale } = useI18n(); const { t, changeLocale, optionsLocale } = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
@@ -42,6 +43,9 @@ function fnClickHelpDoc(language?: string) {
window.open(href, '_blank'); window.open(href, '_blank');
} }
// 兼容旧前端可改配置文件
const i18nDisable = sessionGet('i18nDisable') === 'false';
/**改变多语言 */ /**改变多语言 */
function fnChangeLocale(e: any) { function fnChangeLocale(e: any) {
changeLocale(e.key); changeLocale(e.key);
@@ -81,7 +85,11 @@ function fnChangeLocale(e: any) {
</a-button> </a-button>
</a-tooltip> </a-tooltip>
<a-dropdown placement="bottom" :trigger="['click', 'hover']"> <a-dropdown
placement="bottom"
:trigger="['click', 'hover']"
v-if="!i18nDisable"
>
<a-button size="small" type="default"> <a-button size="small" type="default">
{{ t('i18n') }} {{ t('i18n') }}
<DownOutlined /> <DownOutlined />

View File

@@ -8,6 +8,7 @@ import { useRouter, useRoute } from 'vue-router';
import useI18n from '@/hooks/useI18n'; import useI18n from '@/hooks/useI18n';
import { toRaw } from 'vue'; import { toRaw } from 'vue';
import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants';
import { sessionGet } from '@/utils/cache-session-utils';
const { t, changeLocale, optionsLocale } = useI18n(); const { t, changeLocale, optionsLocale } = useI18n();
const appStore = useAppStore(); const appStore = useAppStore();
const router = useRouter(); const router = useRouter();
@@ -115,6 +116,9 @@ onMounted(() => {
fnGetCaptcha(); fnGetCaptcha();
}); });
// 兼容旧前端可改配置文件
const i18nDisable = sessionGet('i18nDisable') === 'false';
/**改变多语言 */ /**改变多语言 */
function fnChangeLocale(e: any) { function fnChangeLocale(e: any) {
changeLocale(e.key); changeLocale(e.key);
@@ -270,6 +274,7 @@ function fnChangeLocale(e: any) {
justify="space-between" justify="space-between"
align="middle" align="middle"
style="margin-top: 18px" style="margin-top: 18px"
v-if="!i18nDisable"
> >
<a-col :offset="18" :span="6"> <a-col :offset="18" :span="6">
<a-dropdown :trigger="['click', 'hover']"> <a-dropdown :trigger="['click', 'hover']">

View File

@@ -861,7 +861,7 @@ onMounted(() => {
:size="tableState.size" :size="tableState.size"
:row-class-name="fnTableStriped" :row-class-name="fnTableStriped"
:pagination="tablePagination" :pagination="tablePagination"
:scroll="{ y: 450 }" :scroll="{ y: 'calc(100vh - 480px)' }"
@change="fnTableChange" @change="fnTableChange"
@resizeColumn="(w:number, col:any) => (col.width = w)" @resizeColumn="(w:number, col:any) => (col.width = w)"
> >
@@ -1293,4 +1293,8 @@ onMounted(() => {
.table :deep(.table-striped) td { .table :deep(.table-striped) td {
background-color: #fafafa; background-color: #fafafa;
} }
.table :deep(.ant-pagination) {
padding: 0 24px;
}
</style> </style>

View File

@@ -69,26 +69,26 @@ let tableColumns: ColumnsType = [
{ {
title: 'NodeB ID', title: 'NodeB ID',
dataIndex: 'id', dataIndex: 'id',
align: 'center', align: 'left',
width: 2, width: 150,
}, },
{ {
title: 'NodeB Address', title: 'UE Number',
dataIndex: 'address', dataIndex: 'ueNum',
align: 'center', align: 'left',
width: 3, width: 150,
}, },
{ {
title: 'NodeB Name', title: 'NodeB Name',
dataIndex: 'name', dataIndex: 'name',
align: 'left', align: 'left',
width: 2, width: 150,
}, },
{ {
title: 'UE Number', title: 'NodeB Address',
dataIndex: 'ueNum', dataIndex: 'address',
align: 'center', align: 'left',
width: 2, minWidth: 150,
}, },
]; ];

View File

@@ -72,38 +72,38 @@ let tableColumns: ColumnsType = [
{ {
title: 'IMSI', title: 'IMSI',
dataIndex: 'imsi', dataIndex: 'imsi',
align: 'center', align: 'left',
width: 3, width: 150,
}, },
{ {
title: 'MSISDN', title: 'MSISDN',
dataIndex: 'msisdn', dataIndex: 'msisdn',
align: 'center', align: 'left',
width: 3, width: 150,
},
{
title: 'IMPU',
dataIndex: 'impu',
align: 'center',
width: 5,
}, },
{ {
title: 'Barring', title: 'Barring',
dataIndex: 'barring', dataIndex: 'barring',
align: 'center', align: 'left',
width: 2, width: 150,
}, },
{ {
title: 'Registration State', title: 'Registration State',
dataIndex: 'regState', dataIndex: 'regState',
align: 'center', align: 'left',
width: 2, width: 150,
}, },
{ {
title: 'Active Time', title: 'Active Time',
dataIndex: 'activeTime', dataIndex: 'activeTime',
align: 'center', align: 'left',
width: 3, width: 150,
},
{
title: 'IMPU',
dataIndex: 'impu',
align: 'left',
}, },
]; ];

View File

@@ -1100,7 +1100,7 @@ onMounted(() => {
:size="tableState.size" :size="tableState.size"
:row-class-name="fnTableStriped" :row-class-name="fnTableStriped"
:pagination="tablePagination" :pagination="tablePagination"
:scroll="{ x: tableColumnsDnd.length * 200, y: 450 }" :scroll="{ x: tableColumnsDnd.length * 200, y: 'calc(100vh - 480px)' }"
@change="fnTableChange" @change="fnTableChange"
@resizeColumn="(w:number, col:any) => (col.width = w)" @resizeColumn="(w:number, col:any) => (col.width = w)"
> >