diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index d0ad989..b131f93 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -757,7 +757,25 @@ const local: any = { pleemail:'Please enter email address', search:'Search', reset:'Reset', - + }, + cdr:{ + hour:'hour', + min:',in', + sec:'s', + username:'User Name', + clientname:'Client Name', + clientmac:'Client MAC', + up:'Traffic Up', + down:'Traffic Down', + start:'Start Time', + end:'End Time', + duration:'Duration', + title:'CDR Records', + total:'Total', + pleusername:'Please enter username', + pleclientname:'Please enter device name', + search:'Search', + reset:'Reset', }, }, form: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index a523334..0111eb5 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -757,6 +757,25 @@ const local:any = { pleemail:'请输入邮箱', search:'搜索', reset:'重置', + }, + cdr:{ + hour:'时', + min:'分', + sec:'秒', + username:'用户名', + clientname:'设备名', + clientmac:'设备MAC地址', + up:'上行流量', + down:'下行流量', + start:'开始时间', + end:'结束时间', + duration:'时长', + title:'话单记录', + total:'共', + pleusername:'请输入用户名', + pleclientname:'请输入设备名', + search:'搜索', + reset:'重置', }, }, diff --git a/src/views/user-center/cdr/index.vue b/src/views/user-center/cdr/index.vue index b895e57..2a058c0 100644 --- a/src/views/user-center/cdr/index.vue +++ b/src/views/user-center/cdr/index.vue @@ -6,6 +6,9 @@ import { computed, shallowRef } from 'vue'; import { useElementSize } from '@vueuse/core'; import { fetchCdrHistory } from '@/service/api/auth'; import { formatStorage } from '@/utils/units'; +import { useI18n } from 'vue-i18n'; +const { t } = useI18n(); + // 搜索模型 type SearchModel = { @@ -22,9 +25,9 @@ const formatDuration = (seconds: number) => { const remainingSeconds = seconds % 60; const parts = []; - if (hours > 0) parts.push(`${hours}时`); - if (minutes > 0) parts.push(`${minutes}分`); - parts.push(`${remainingSeconds}秒`); + if (hours > 0) parts.push(`${hours}${t('page.cdr.hour')}`); + if (minutes > 0) parts.push(`${minutes}${t('page.cdr.min')}`); + parts.push(`${remainingSeconds}${t('page.cdr.sec')}`); return parts.join(''); }; @@ -75,28 +78,28 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP { key: 'userName', dataIndex: 'userName', - title: '用户名', + title: t('page.cdr.username'), align: 'center', width: 150 }, { key: 'clientName', dataIndex: 'clientName', - title: '设备名', + title: t('page.cdr.clientname'), align: 'center', width: 120 }, { key: 'clientMac', dataIndex: 'clientMac', - title: '设备MAC地址', + title: t('page.cdr.clientmac'), align: 'center', width: 120 }, { key: 'trafficUp', dataIndex: 'trafficUp', - title: '上行流量', + title: t('page.cdr.up'), align: 'center', width: 120, customRender: ({ text }) => { @@ -107,7 +110,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP { key: 'trafficDown', dataIndex: 'trafficDown', - title: '下行流量', + title: t('page.cdr.down'), align: 'center', width: 120, customRender: ({ text }) => { @@ -118,7 +121,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP { key: 'startTime', dataIndex: 'startTime', - title: '开始时间', + title: t('page.cdr.start'), align: 'center', width: 180, customRender: ({ text }) => { @@ -129,7 +132,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP { key: 'endTime', dataIndex: 'endTime', - title: '结束时间', + title: t('page.cdr.end'), align: 'center', width: 180, customRender: ({ text }) => { @@ -140,7 +143,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP { key: 'duration', dataIndex: 'duration', - title: '时长', + title: t('page.cdr.duration'), align: 'center', width: 120, customRender: ({ text }) => formatDuration(text) @@ -158,7 +161,7 @@ const { columns, columnChecks, data, loading, getData, mobilePagination, searchP @search="getData" /> `共 ${total} 条` + showTotal: (total: number) => `${t('page.cdr.total')} ${total} ` }" :scroll="scrollConfig" class="h-full" diff --git a/src/views/user-center/cdr/modules/cdr-search.vue b/src/views/user-center/cdr/modules/cdr-search.vue index fdd94ea..a0aa99a 100644 --- a/src/views/user-center/cdr/modules/cdr-search.vue +++ b/src/views/user-center/cdr/modules/cdr-search.vue @@ -2,6 +2,8 @@ import { ref, computed } from 'vue'; import { Form } from 'ant-design-vue'; import type { FormInstance } from 'ant-design-vue'; +import { useI18n } from 'vue-i18n'; +const { t } = useI18n(); interface SearchModel { pageNum: number; @@ -53,24 +55,30 @@ function handleSearch() { layout="inline" class="flex flex-wrap gap-16px items-center" > - + - + - 重置 - 查询 + + {{ t('page.cdr.search') }} + + {{ t('page.cdr.reset') }}