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/wh-mat/index.vue | 60 ++++++++++++++++++++++++++++++++----------------------------
1 files changed, 32 insertions(+), 28 deletions(-)
diff --git a/rsf-design/src/views/basic-info/wh-mat/index.vue b/rsf-design/src/views/basic-info/wh-mat/index.vue
index 240aff5..fb852a1 100644
--- a/rsf-design/src/views/basic-info/wh-mat/index.vue
+++ b/rsf-design/src/views/basic-info/wh-mat/index.vue
@@ -5,30 +5,30 @@
<ElCard class="wh-mat-page__sidebar-card">
<div class="mb-3 flex items-center justify-between gap-3">
<div>
- <div class="text-base font-medium text-[var(--art-text-primary)]">鐗╂枡鍒嗙粍</div>
+ <div class="text-base font-medium text-[var(--art-text-primary)]">{{ t('pages.basicInfo.whMat.title') }}</div>
<div class="text-xs text-[var(--art-text-secondary)]">
{{ selectedGroupLabel }}
</div>
</div>
- <ElButton text @click="handleResetGroup">鍏ㄩ儴</ElButton>
+ <ElButton text @click="handleResetGroup">{{ t('common.actions.viewAll') }}</ElButton>
</div>
<div class="mb-3 flex items-center gap-2">
<ElInput
v-model.trim="groupSearch"
clearable
- placeholder="鎼滅储鐗╂枡鍒嗙粍"
+ :placeholder="t('pages.basicInfo.whMat.search.groupKeywordPlaceholder')"
@clear="handleGroupSearch"
@keyup.enter="handleGroupSearch"
/>
- <ElButton @click="handleGroupSearch">鎼滅储</ElButton>
+ <ElButton @click="handleGroupSearch">{{ t('common.actions.search') }}</ElButton>
</div>
<ElScrollbar class="wh-mat-page__tree-scroll pr-1">
<div v-if="groupTreeLoading" class="py-6">
<ElSkeleton :rows="10" animated />
</div>
- <ElEmpty v-else-if="!groupTreeData.length" description="鏆傛棤鐗╂枡鍒嗙粍" />
+ <ElEmpty v-else-if="!groupTreeData.length" :description="t('pages.basicInfo.whMat.messages.emptyGroups')" />
<ElTree
v-else
:data="groupTreeData"
@@ -41,8 +41,8 @@
>
<template #default="{ data }">
<div class="flex items-center gap-2">
- <span class="font-medium">{{ data.name || '--' }}</span>
- <span class="text-xs text-[var(--art-text-secondary)]">{{ data.code || '--' }}</span>
+ <span class="font-medium">{{ data.name || t('common.placeholder.empty') }}</span>
+ <span class="text-xs text-[var(--art-text-secondary)]">{{ data.code || t('common.placeholder.empty') }}</span>
</div>
</template>
</ElTree>
@@ -89,6 +89,7 @@
<script setup>
import { ElMessage } from 'element-plus'
import { computed, onMounted, reactive, ref } from 'vue'
+ import { useI18n } from 'vue-i18n'
import ArtButtonTable from '@/components/core/forms/art-button-table/index.vue'
import { useTableColumns } from '@/hooks/core/useTableColumns'
import { guardRequestWithMessage } from '@/utils/sys/requestGuard'
@@ -106,6 +107,7 @@
} from './whMatPage.helpers'
defineOptions({ name: 'WhMat' })
+ const { t } = useI18n()
const loading = ref(false)
const groupTreeLoading = ref(false)
@@ -131,64 +133,65 @@
const searchItems = computed(() => [
{
- label: '鍏抽敭瀛�',
+ label: t('pages.basicInfo.whMat.search.condition'),
key: 'condition',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ョ墿鏂欑紪鐮�/鐗╂枡鍚嶇О'
+ placeholder: t('pages.basicInfo.whMat.search.conditionPlaceholder')
}
},
{
- label: '鐗╂枡缂栫爜',
+ label: t('pages.basicInfo.whMat.search.code'),
key: 'code',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ョ墿鏂欑紪鐮�'
+ placeholder: t('pages.basicInfo.whMat.search.codePlaceholder')
}
},
{
- label: '鐗╂枡鍚嶇О',
+ label: t('pages.basicInfo.whMat.search.name'),
key: 'name',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ョ墿鏂欏悕绉�'
+ placeholder: t('pages.basicInfo.whMat.search.namePlaceholder')
}
},
{
- label: '瑙勬牸',
+ label: t('pages.basicInfo.whMat.search.spec'),
key: 'spec',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ヨ鏍�'
+ placeholder: t('pages.basicInfo.whMat.search.specPlaceholder')
}
},
{
- label: '鏉$爜',
+ label: t('pages.basicInfo.whMat.search.barcode'),
key: 'barcode',
type: 'input',
props: {
clearable: true,
- placeholder: '璇疯緭鍏ユ潯鐮�'
+ placeholder: t('pages.basicInfo.whMat.search.barcodePlaceholder')
}
}
])
const { columnChecks, columns } = useTableColumns(() =>
createWhMatTableColumns({
+ t,
handleViewDetail: openDetailDrawer
})
)
const selectedGroupLabel = computed(() => {
if (!selectedGroupId.value) {
- return '鍏ㄩ儴鐗╂枡'
+ return t('pages.basicInfo.whMat.labels.allMaterials')
}
const found = findGroupNode(groupTreeData.value, selectedGroupId.value)
- return found ? getWhMatTreeNodeLabel(found) : '鍏ㄩ儴鐗╂枡'
+ return found ? getWhMatTreeNodeLabel(found) : t('pages.basicInfo.whMat.labels.allMaterials')
})
function findGroupNode(nodes, targetId) {
@@ -219,16 +222,16 @@
const records = await guardRequestWithMessage(
fetchMatnrGroupTree(buildMatnrGroupTreeQueryParams({ condition: groupSearch.value })),
[],
- { timeoutMessage: '鐗╂枡鍒嗙粍鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟' }
+ { timeoutMessage: t('pages.basicInfo.whMat.messages.groupTimeout') }
)
- const normalizedTree = normalizeMatnrGroupTreeRows(Array.isArray(records) ? records : [])
+ const normalizedTree = normalizeMatnrGroupTreeRows(Array.isArray(records) ? records : [], t)
groupTreeData.value = normalizedTree
if (selectedGroupId.value && !findGroupNode(normalizedTree, selectedGroupId.value)) {
selectedGroupId.value = null
}
} catch (error) {
groupTreeData.value = []
- ElMessage.error(error?.message || '鐗╂枡鍒嗙粍鍔犺浇澶辫触')
+ ElMessage.error(error?.message || t('pages.basicInfo.whMat.messages.groupLoadFailed'))
} finally {
groupTreeLoading.value = false
}
@@ -252,15 +255,15 @@
current: pagination.current,
size: pagination.size
},
- { timeoutMessage: '鐗╂枡鍒楄〃鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟' }
+ { timeoutMessage: t('pages.basicInfo.whMat.messages.listTimeout') }
)
tableData.value = Array.isArray(response?.records)
- ? response.records.map((record) => normalizeMatnrRow(record))
+ ? response.records.map((record) => normalizeMatnrRow(record, t))
: []
updatePaginationState(pagination, response, pagination.current, pagination.size)
} catch (error) {
tableData.value = []
- ElMessage.error(error?.message || '鐗╂枡鍒楄〃鍔犺浇澶辫触')
+ ElMessage.error(error?.message || t('pages.basicInfo.whMat.messages.listLoadFailed'))
} finally {
loading.value = false
}
@@ -272,13 +275,14 @@
try {
detailData.value = normalizeMatnrDetail(
await guardRequestWithMessage(fetchMatnrDetail(row.id), {}, {
- timeoutMessage: '鐗╂枡璇︽儏鍔犺浇瓒呮椂锛屽凡鍋滄绛夊緟'
- })
+ timeoutMessage: t('pages.basicInfo.whMat.messages.detailTimeout')
+ }),
+ t
)
} catch (error) {
detailDrawerVisible.value = false
detailData.value = {}
- ElMessage.error(error?.message || '鑾峰彇鐗╂枡璇︽儏澶辫触')
+ ElMessage.error(error?.message || t('pages.basicInfo.whMat.messages.detailLoadFailed'))
} finally {
detailLoading.value = false
}
--
Gitblit v1.9.1