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/orders/wave/wavePage.helpers.js | 97 ++++++++++++++++++++++++++----------------------
1 files changed, 53 insertions(+), 44 deletions(-)
diff --git a/rsf-design/src/views/orders/wave/wavePage.helpers.js b/rsf-design/src/views/orders/wave/wavePage.helpers.js
index 1e3c9f6..705c383 100644
--- a/rsf-design/src/views/orders/wave/wavePage.helpers.js
+++ b/rsf-design/src/views/orders/wave/wavePage.helpers.js
@@ -1,4 +1,12 @@
-export const WAVE_REPORT_TITLE = '娉㈡鍗曟姤琛�'
+import { $t } from '@/locales'
+
+function translate(t, key, params) {
+ return (typeof t === 'function' ? t : $t)(key, params)
+}
+
+export function getWaveReportTitle(t) {
+ return translate(t, 'pages.orders.wave.reportTitle')
+}
export const WAVE_REPORT_STYLE = {
titleAlign: 'center',
titleLevel: 'strong',
@@ -7,19 +15,19 @@
showSequence: true
}
-const WAVE_STATUS_MAP = {
- 0: { label: '绛夊緟鎵ц', tagType: 'info' },
- 1: { label: '姝e湪鎵ц', tagType: 'warning' },
- 2: { label: '鏆傚仠鎵ц', tagType: 'warning' },
- 3: { label: '鎵ц瀹屾垚', tagType: 'success' }
+const WAVE_STATUS_TAG_MAP = {
+ 0: 'info',
+ 1: 'warning',
+ 2: 'warning',
+ 3: 'success'
}
-const WAVE_ITEM_STATUS_MAP = {
- 0: { label: '鏈墽琛�', tagType: 'info' },
- 1: { label: '鎵ц涓�', tagType: 'warning' },
- 2: { label: '鏆傚仠', tagType: 'warning' },
- 3: { label: '宸蹭笅鍙�', tagType: 'primary' },
- 4: { label: '浠诲姟瀹屾垚', tagType: 'success' }
+const WAVE_ITEM_STATUS_TAG_MAP = {
+ 0: 'info',
+ 1: 'warning',
+ 2: 'warning',
+ 3: 'primary',
+ 4: 'success'
}
function normalizeText(value) {
@@ -34,25 +42,21 @@
return Number.isFinite(numericValue) ? numericValue : 0
}
-function getStatusConfig(status, statusText) {
- const fallback = WAVE_STATUS_MAP[Number(status)] || {
- label: statusText || '-',
- tagType: 'info'
- }
+function getStatusConfig(status, statusText, t) {
+ const statusKey = `pages.orders.wave.status.exceStatus.${Number(status)}`
+ const fallbackLabel = statusText || translate(t, statusKey)
return {
- label: statusText || fallback.label,
- tagType: fallback.tagType
+ label: fallbackLabel || '-',
+ tagType: WAVE_STATUS_TAG_MAP[Number(status)] || 'info'
}
}
-function getItemStatusConfig(status, statusText) {
- const fallback = WAVE_ITEM_STATUS_MAP[Number(status)] || {
- label: statusText || '-',
- tagType: 'info'
- }
+function getItemStatusConfig(status, statusText, t) {
+ const statusKey = `pages.orders.waveItem.status.exceStatus.${Number(status)}`
+ const fallbackLabel = statusText || translate(t, statusKey)
return {
- label: statusText || fallback.label,
- tagType: fallback.tagType
+ label: fallbackLabel || '-',
+ tagType: WAVE_ITEM_STATUS_TAG_MAP[Number(status)] || 'info'
}
}
@@ -123,8 +127,8 @@
}
}
-export function normalizeWaveRow(record = {}) {
- const statusConfig = getStatusConfig(record.exceStatus, record['exceStatus$'])
+export function normalizeWaveRow(record = {}, t) {
+ const statusConfig = getStatusConfig(record.exceStatus, record['exceStatus$'], t)
const progress = normalizeNumber(record.anfme) > 0
? Math.min(Math.round((normalizeNumber(record.workQty) / normalizeNumber(record.anfme)) * 100), 100)
: 0
@@ -132,10 +136,14 @@
return {
...record,
code: record.code || '-',
- typeLabel: record['type$'] || record.type || '-',
+ typeLabel: record['type$'] || translate(t, `pages.orders.wave.status.type.${record.type}`) || record.type || '-',
exceStatusText: statusConfig.label,
exceStatusTagType: statusConfig.tagType,
- statusLabel: record['status$'] || record.status || '-',
+ statusLabel:
+ record['status$'] ||
+ translate(t, Number(record.status) === 1 ? 'common.status.normal' : 'common.status.disabled') ||
+ record.status ||
+ '-',
anfme: normalizeNumber(record.anfme),
qty: normalizeNumber(record.qty),
workQty: normalizeNumber(record.workQty),
@@ -157,8 +165,8 @@
}
}
-export function normalizeWaveItemRow(record = {}) {
- const statusConfig = getItemStatusConfig(record.exceStatus, record['exceStatus$'])
+export function normalizeWaveItemRow(record = {}, t) {
+ const statusConfig = getItemStatusConfig(record.exceStatus, record['exceStatus$'], t)
return {
...record,
waveCode: record.waveCode || '-',
@@ -183,20 +191,21 @@
}
}
-export function buildWavePrintRows(records = []) {
+export function buildWavePrintRows(records = [], t) {
if (!Array.isArray(records)) {
return []
}
- return records.map((record) => normalizeWaveRow(record))
+ return records.map((record) => normalizeWaveRow(record, t))
}
export function buildWaveReportMeta({
previewMeta = {},
count = 0,
- orientation = WAVE_REPORT_STYLE.orientation
+ orientation = WAVE_REPORT_STYLE.orientation,
+ t
} = {}) {
return {
- reportTitle: WAVE_REPORT_TITLE,
+ reportTitle: getWaveReportTitle(t),
reportDate: previewMeta.reportDate,
printedAt: previewMeta.printedAt,
operator: previewMeta.operator,
@@ -208,41 +217,41 @@
}
}
-export function getWaveActionList(row = {}) {
- const normalizedRow = normalizeWaveRow(row)
+export function getWaveActionList(row = {}, t) {
+ const normalizedRow = normalizeWaveRow(row, t)
return [
{
key: 'view',
- label: '鏌ョ湅璇︽儏',
+ label: translate(t, 'pages.orders.wave.actions.view'),
icon: 'ri:eye-line'
},
{
key: 'publicTask',
- label: '涓嬪彂浠诲姟',
+ label: translate(t, 'pages.orders.wave.actions.publicTask'),
icon: 'ri:play-circle-line',
disabled: !normalizedRow.canPublicTask
},
{
key: 'pause',
- label: '鏆傚仠',
+ label: translate(t, 'pages.orders.wave.actions.pause'),
icon: 'ri:pause-circle-line',
disabled: !normalizedRow.canPause
},
{
key: 'continue',
- label: '缁х画',
+ label: translate(t, 'pages.orders.wave.actions.continue'),
icon: 'ri:play-line',
disabled: !normalizedRow.canContinue
},
{
key: 'stop',
- label: '缁堟',
+ label: translate(t, 'pages.orders.wave.actions.stop'),
icon: 'ri:stop-circle-line',
disabled: !normalizedRow.canStop
},
{
key: 'print',
- label: '鎵撳嵃',
+ label: translate(t, 'pages.orders.wave.actions.print'),
icon: 'ri:printer-line'
}
]
--
Gitblit v1.9.1