2
0

fix:终端界面中英适配以及字段修改

This commit is contained in:
zhongzm
2025-02-07 19:24:01 +08:00
parent 5b4f4b4ae1
commit 5eeaa824ff
5 changed files with 94 additions and 36 deletions

View File

@@ -8,7 +8,7 @@
@search="handleSearch"
/>
<ACard
title="终端设备"
:title="t('page.terminal.title')"
:bordered="false"
:body-style="{ flex: 1, overflow: 'hidden' }"
class="flex-col-stretch sm:flex-1-hidden card-wrapper"
@@ -35,7 +35,7 @@
total: mobilePagination.total,
current: searchParams.pageNum,
pageSize: searchParams.pageSize,
showTotal: (total: number) => ` ${total} `
showTotal: (total: number) => `${t('page.terminal.total')} ${total} `
}"
:scroll="scrollConfig"
class="h-full"
@@ -59,7 +59,8 @@ import { fetchTerminalList } from '@/service/api/auth';
import { Card as ACard, Table as ATable, Tag as ATag } from 'ant-design-vue';
import TerminalSearch from './modules/terminal-search.vue';
import { formatStorage, formatTime } from '@/utils/units';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const wrapperEl = shallowRef<HTMLElement | null>(null);
const { height: wrapperElHeight } = useElementSize(wrapperEl);
@@ -76,7 +77,7 @@ const getAuthStatusText = (status: number) => {
case 2:
return 'authorized';
default:
return '未知';
return t('page.terminal.unknow');
}
};
@@ -98,10 +99,10 @@ const formatDetailedTime = (seconds: number): string => {
const remainingSeconds = seconds % 60;
const parts = [];
if (days > 0) parts.push(`${days}`);
if (hours > 0) parts.push(`${hours}小时`);
if (minutes > 0) parts.push(`${minutes}分钟`);
if (remainingSeconds > 0 || parts.length === 0) parts.push(`${remainingSeconds}`);
if (days > 0) parts.push(`${days}${t('page.terminal.day')}`);
if (hours > 0) parts.push(`${hours}${t('page.terminal.hour')}`);
if (minutes > 0) parts.push(`${minutes}${t('page.terminal.min')}`);
if (remainingSeconds > 0 || parts.length === 0) parts.push(`${remainingSeconds}${t('page.terminal.second')}`);
return parts.join('');
};
@@ -154,21 +155,21 @@ const {
{
key: 'name',
dataIndex: 'name',
title: '设备名称',
title: t('page.terminal.name'),
align: 'center',
width: 150
},
{
key: 'ip',
dataIndex: 'ip',
title: 'IP地址',
title: t('page.terminal.ip'),
align: 'center',
width: 150
},
{
key: 'authStatus',
dataIndex: 'authStatus',
title: '状态',
title: t('page.terminal.status'),
align: 'center',
width: 120,
customRender: ({ text }) => h(ATag, {
@@ -178,21 +179,28 @@ const {
{
key: 'ssid',
dataIndex: 'ssid',
title: '网络',
title: t('page.terminal.ssid'),
align: 'center',
width: 150
width: 120
},
{
key: 'apName',
dataIndex: 'apName',
title: '所属AP设备',
title: t('page.terminal.apname'),
align: 'center',
width: 120
},
{
key: 'clientMac',
dataIndex: 'clientMac',
title: t('page.terminal.mac'),
align: 'center',
width: 150
},
{
key: 'activity',
dataIndex: 'activity',
title: '下载速率',
title: t('page.terminal.activity'),
align: 'center',
width: 120,
customRender: ({ text }) => {
@@ -203,7 +211,7 @@ const {
{
key: 'trafficDown',
dataIndex: 'trafficDown',
title: '下载量',
title: t('page.terminal.down'),
align: 'center',
width: 120,
customRender: ({ text }) => {
@@ -214,7 +222,7 @@ const {
{
key: 'trafficUp',
dataIndex: 'trafficUp',
title: '上传量',
title: t('page.terminal.up'),
align: 'center',
width: 120,
customRender: ({ text }) => {
@@ -225,7 +233,7 @@ const {
{
key: 'uptime',
dataIndex: 'uptime',
title: '在线时长',
title: t('page.terminal.uptime'),
align: 'center',
width: 150,
customRender: ({ text }) => formatDetailedTime(text)