From 50e95b985a72fcec4a93a2470e9efdfb2620148a Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期四, 02 四月 2026 15:46:09 +0800
Subject: [PATCH] #i18n
---
rsf-design/src/views/basic-info/companys/index.vue | 60 ++++++++++++++++++++++++++++++++----------------------------
1 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/rsf-design/src/views/basic-info/companys/index.vue b/rsf-design/src/views/basic-info/companys/index.vue
index abc0bf2..7629628 100644
--- a/rsf-design/src/views/basic-info/companys/index.vue
+++ b/rsf-design/src/views/basic-info/companys/index.vue
@@ -12,7 +12,7 @@
<ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData">
<template #left>
<ElSpace wrap>
- <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple>鏂板浼佷笟</ElButton>
+ <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple>{{ t('pages.basicInfo.companys.buttons.add') }}</ElButton>
<ElButton
v-auth="'delete'"
type="danger"
@@ -20,7 +20,7 @@
@click="handleBatchDelete"
v-ripple
>
- 鎵归噺鍒犻櫎
+ {{ t('common.actions.batchDelete') }}
</ElButton>
<ListExportPrint
class="inline-flex"
@@ -70,6 +70,7 @@
<script setup>
import { computed, onMounted, ref } from 'vue'
+ import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
import { useUserStore } from '@/store/modules/user'
import { useAuth } from '@/hooks/core/useAuth'
@@ -94,7 +95,6 @@
import { createCompanysTableColumns } from './companysTable.columns'
import {
COMPANYS_REPORT_STYLE,
- COMPANYS_REPORT_TITLE,
buildCompanysDialogModel,
buildCompanysPageQueryParams,
buildCompanysSavePayload,
@@ -104,11 +104,13 @@
buildCompanysTypeOptions,
createCompanysSearchState,
getCompanysPaginationKey,
+ getCompanysReportTitle,
normalizeCompanysListRow
} from './companysPage.helpers'
defineOptions({ name: 'Companys' })
+ const { t } = useI18n()
const { hasAuth } = useAuth()
const userStore = useUserStore()
@@ -119,7 +121,7 @@
const detailData = ref({})
let handleDeleteAction = null
- const reportTitle = COMPANYS_REPORT_TITLE
+ const reportTitle = computed(() => getCompanysReportTitle(t))
const reportQueryParams = computed(() => buildCompanysSearchParams(searchForm.value))
const typeLabelMap = computed(
() =>
@@ -136,20 +138,20 @@
const searchItems = computed(() => [
{
- label: '鍏抽敭瀛�',
+ label: t('table.keyword'),
key: 'condition',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ヤ紒涓氬悕绉�/缂栫爜/鑱旂郴浜�/鐢佃瘽'
+ placeholder: t('pages.basicInfo.companys.search.conditionPlaceholder')
}
},
- { label: '浼佷笟缂栫爜', key: 'code', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ヤ紒涓氱紪鐮�' } },
- { label: '浼佷笟鍚嶇О', key: 'name', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ヤ紒涓氬悕绉�' } },
- { label: '鑻辨枃鍒悕', key: 'nameEn', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ヨ嫳鏂囧埆鍚�' } },
- { label: '鍔╄鐮�', key: 'breifCode', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ュ姪璁扮爜' } },
+ { label: t('pages.basicInfo.companys.table.code'), key: 'code', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.codePlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.name'), key: 'name', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.namePlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.nameEn'), key: 'nameEn', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.nameEnPlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.briefCode'), key: 'breifCode', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.briefCodePlaceholder') } },
{
- label: '浼佷笟绫诲瀷',
+ label: t('pages.basicInfo.companys.table.type'),
key: 'type',
type: 'select',
props: {
@@ -158,26 +160,26 @@
options: typeOptions.value
}
},
- { label: '鑱旂郴浜�', key: 'contact', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ヨ仈绯讳汉' } },
- { label: '鑱旂郴鐢佃瘽', key: 'tel', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ヨ仈绯荤數璇�' } },
- { label: '閭', key: 'email', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ラ偖绠�' } },
- { label: '閭紪', key: 'pcode', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ラ偖缂�' } },
- { label: '鐪佷唤', key: 'province', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ョ渷浠�' } },
- { label: '鍩庡競', key: 'city', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ュ煄甯�' } },
- { label: '鍦板潃', key: 'address', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ュ湴鍧�' } },
+ { label: t('pages.basicInfo.companys.table.contact'), key: 'contact', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.contactPlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.tel'), key: 'tel', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.telPlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.email'), key: 'email', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.emailPlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.postCode'), key: 'pcode', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.postCodePlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.province'), key: 'province', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.provincePlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.city'), key: 'city', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.cityPlaceholder') } },
+ { label: t('pages.basicInfo.companys.table.address'), key: 'address', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.addressPlaceholder') } },
{
- label: '鐘舵��',
+ label: t('table.status'),
key: 'status',
type: 'select',
props: {
clearable: true,
options: [
- { label: '姝e父', value: 1 },
- { label: '鍐荤粨', value: 0 }
+ { label: t('common.status.normal'), value: 1 },
+ { label: t('common.status.frozen'), value: 0 }
]
}
},
- { label: '澶囨敞', key: 'memo', type: 'input', props: { clearable: true, placeholder: '璇疯緭鍏ュ娉�' } }
+ { label: t('table.remark'), key: 'memo', type: 'input', props: { clearable: true, placeholder: t('pages.basicInfo.companys.search.memoPlaceholder') } }
])
async function openDetail(row) {
@@ -185,13 +187,13 @@
detailLoading.value = true
try {
const detail = await guardRequestWithMessage(fetchGetCompanysDetail(row.id), {}, {
- timeoutMessage: '寰�鏉ヤ紒涓氳鎯呭姞杞借秴鏃讹紝宸插仠姝㈢瓑寰�'
+ timeoutMessage: t('pages.basicInfo.companys.messages.detailTimeout')
})
detailData.value = normalizeCompanysListRow(detail, resolveTypeLabel)
} catch (error) {
detailDrawerVisible.value = false
detailData.value = {}
- ElMessage.error(error?.message || '鑾峰彇寰�鏉ヤ紒涓氳鎯呭け璐�')
+ ElMessage.error(error?.message || t('pages.basicInfo.companys.messages.detailFailed'))
} finally {
detailLoading.value = false
}
@@ -200,11 +202,11 @@
async function openEditDialog(row) {
try {
const detail = await guardRequestWithMessage(fetchGetCompanysDetail(row.id), {}, {
- timeoutMessage: '寰�鏉ヤ紒涓氳鎯呭姞杞借秴鏃讹紝宸插仠姝㈢瓑寰�'
+ timeoutMessage: t('pages.basicInfo.companys.messages.detailTimeout')
})
showDialog('edit', detail)
} catch (error) {
- ElMessage.error(error?.message || '鑾峰彇寰�鏉ヤ紒涓氳鎯呭け璐�')
+ ElMessage.error(error?.message || t('pages.basicInfo.companys.messages.detailFailed'))
}
}
@@ -230,6 +232,7 @@
paginationKey: getCompanysPaginationKey(),
columnsFactory: () =>
createCompanysTableColumns({
+ t,
handleView: openDetail,
handleEdit: hasAuth('update') ? openEditDialog : null,
handleDelete: hasAuth('delete') ? (row) => handleDeleteAction?.(row) : null,
@@ -265,7 +268,7 @@
saveRequest: fetchSaveCompanys,
updateRequest: fetchUpdateCompanys,
deleteRequest: fetchDeleteCompanys,
- entityName: '寰�鏉ヤ紒涓�',
+ entityName: t('pages.basicInfo.companys.entity'),
resolveRecordLabel: (record) => record?.name || record?.code || record?.id,
refreshCreate,
refreshUpdate,
@@ -276,6 +279,7 @@
const buildPreviewMeta = (rows) => {
const now = new Date()
return {
+ reportTitle: reportTitle.value,
reportDate: now.toLocaleDateString('zh-CN'),
printedAt: now.toLocaleString('zh-CN', { hour12: false }),
operator: userStore.getUserInfo?.name || userStore.getUserInfo?.username || '',
@@ -344,7 +348,7 @@
status: 1
}),
{ records: [] },
- { timeoutMessage: '浼佷笟绫诲瀷鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟' }
+ { timeoutMessage: t('pages.basicInfo.companys.messages.typeOptionsTimeout') }
)
typeOptions.value = buildCompanysTypeOptions(defaultResponseAdapter(response).records)
}
--
Gitblit v1.9.1