From 5eeaa824ff672a0c53726380c484f4e54adc3c98 Mon Sep 17 00:00:00 2001 From: zhongzm Date: Fri, 7 Feb 2025 19:24:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=BB=88=E7=AB=AF=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=B8=AD=E8=8B=B1=E9=80=82=E9=85=8D=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 26 ++++++++++- src/locales/langs/zh-cn.ts | 26 ++++++++++- src/typings/api.d.ts | 1 + src/views/device/terminal/index.vue | 44 +++++++++++-------- .../terminal/modules/terminal-search.vue | 33 +++++++------- 5 files changed, 94 insertions(+), 36 deletions(-) diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 1fce58f..e844f61 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -713,8 +713,32 @@ const local: any = { plemac:'Please enter MAC address', search:'Search', reset:'Reset', - }, + terminal:{ + title:'Terminal', + total:'Total', + unknow:'Unknow', + day:'Day', + hour:'Hour', + min:'min', + second:'s', + name:'Device Name', + ip:'IP', + status:'Status', + ssid:'Ssid', + apname:'Affiliated AP device', + activity:'Rate', + down:'Traffic Down', + up:'Traffic Up', + uptime:'Online Time', + pledevice:'Please enter device name', + model:'Model', + plemodel:'Please enter type of device', + mac:'MAC', + plemac:'Please enter MAC address', + search:'Search', + reset:'Reset', + } }, form: { required: 'Cannot be empty', diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index ca569af..e8ac1ae 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -713,8 +713,32 @@ const local:any = { plemac:'请输入MAC地址', search:'搜索', reset:'重置', - }, + terminal:{ + title:'终端设备', + total:'共', + unknow:'未知', + day:'天', + hour:'小时', + min:'分钟', + second:'秒', + name:'设备名称', + ip:'IP地址', + status:'状态', + ssid:'网络', + apname:'所属AP设备', + activity:'下载速率', + down:'下载量', + up:'上传量', + uptime:'在线时长', + pledevice:'请输入设备名称', + model:'设备类型', + plemodel:'请输入设备类型', + mac:'MAC地址', + plemac:'请输入MAC地址', + search:'搜索', + reset:'重置', + } }, form: { required: '不能为空', diff --git a/src/typings/api.d.ts b/src/typings/api.d.ts index 1a371c9..12b56b0 100644 --- a/src/typings/api.d.ts +++ b/src/typings/api.d.ts @@ -575,6 +575,7 @@ declare namespace Api { trafficDown: number; trafficUp: number; uptime: number; + clientMac:string; createBy: string | null; createTime: string; updateBy: string | null; diff --git a/src/views/device/terminal/index.vue b/src/views/device/terminal/index.vue index dc0404b..f670649 100644 --- a/src/views/device/terminal/index.vue +++ b/src/views/device/terminal/index.vue @@ -8,7 +8,7 @@ @search="handleSearch" /> `共 ${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(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) diff --git a/src/views/device/terminal/modules/terminal-search.vue b/src/views/device/terminal/modules/terminal-search.vue index 37a64b1..b178738 100644 --- a/src/views/device/terminal/modules/terminal-search.vue +++ b/src/views/device/terminal/modules/terminal-search.vue @@ -1,28 +1,28 @@ - 搜索 + {{ t('page.terminal.search') }} - 重置 + {{ t('page.terminal.reset') }} @@ -50,7 +50,8 @@