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/transfer/transferPage.helpers.js |   79 ++++++++++++++++++++++-----------------
 1 files changed, 44 insertions(+), 35 deletions(-)

diff --git a/rsf-design/src/views/orders/transfer/transferPage.helpers.js b/rsf-design/src/views/orders/transfer/transferPage.helpers.js
index d3fdeb3..2b3200a 100644
--- a/rsf-design/src/views/orders/transfer/transferPage.helpers.js
+++ b/rsf-design/src/views/orders/transfer/transferPage.helpers.js
@@ -1,24 +1,32 @@
 import { $t } from '@/locales'
 
-const TRANSFER_SOURCE_META = {
-  1: { text: $t('pages.orders.transfer.status.sourceErp'), type: 'info' },
-  2: { text: $t('pages.orders.transfer.status.sourceWms'), type: 'primary' },
-  3: { text: $t('pages.orders.transfer.status.sourceExcel'), type: 'warning' },
-  4: { text: $t('pages.orders.transfer.status.sourceQms'), type: 'success' }
+function getTransferSourceMetaMap(t = $t) {
+  return {
+    1: { text: t('pages.orders.transfer.status.sourceErp'), type: 'info' },
+    2: { text: t('pages.orders.transfer.status.sourceWms'), type: 'primary' },
+    3: { text: t('pages.orders.transfer.status.sourceExcel'), type: 'warning' },
+    4: { text: t('pages.orders.transfer.status.sourceQms'), type: 'success' }
+  }
 }
 
-const TRANSFER_EXCE_STATUS_META = {
-  0: { text: $t('pages.orders.transfer.status.pending'), type: 'info' },
-  1: { text: $t('pages.orders.transfer.status.running'), type: 'warning' },
-  2: { text: $t('pages.orders.transfer.status.completed'), type: 'success' }
+function getTransferExceStatusMetaMap(t = $t) {
+  return {
+    0: { text: t('pages.orders.transfer.status.pending'), type: 'info' },
+    1: { text: t('pages.orders.transfer.status.running'), type: 'warning' },
+    2: { text: t('pages.orders.transfer.status.completed'), type: 'success' }
+  }
 }
 
-const TRANSFER_STATUS_META = {
-  1: { text: $t('pages.orders.transfer.status.normal'), type: 'success', bool: true },
-  0: { text: $t('pages.orders.transfer.status.frozen'), type: 'danger', bool: false }
+function getTransferStatusMetaMap(t = $t) {
+  return {
+    1: { text: t('pages.orders.transfer.status.normal'), type: 'success', bool: true },
+    0: { text: t('pages.orders.transfer.status.frozen'), type: 'danger', bool: false }
+  }
 }
 
-export const TRANSFER_REPORT_TITLE = $t('pages.orders.transfer.reportTitle')
+export function getTransferReportTitle(t = $t) {
+  return t('pages.orders.transfer.reportTitle')
+}
 export const TRANSFER_REPORT_STYLE = {
   titleAlign: 'center',
   titleLevel: 'strong',
@@ -111,18 +119,18 @@
   ]
 }
 
-export function getTransferStatusOptions() {
+export function getTransferStatusOptions(t = $t) {
   return [
-    { label: $t('pages.orders.transfer.status.normal'), value: 1 },
-    { label: $t('pages.orders.transfer.status.frozen'), value: 0 }
+    { label: t('pages.orders.transfer.status.normal'), value: 1 },
+    { label: t('pages.orders.transfer.status.frozen'), value: 0 }
   ]
 }
 
-export function getTransferExceStatusOptions() {
+export function getTransferExceStatusOptions(t = $t) {
   return [
-    { label: $t('pages.orders.transfer.status.pending'), value: 0 },
-    { label: $t('pages.orders.transfer.status.running'), value: 1 },
-    { label: $t('pages.orders.transfer.status.completed'), value: 2 }
+    { label: t('pages.orders.transfer.status.pending'), value: 0 },
+    { label: t('pages.orders.transfer.status.running'), value: 1 },
+    { label: t('pages.orders.transfer.status.completed'), value: 2 }
   ]
 }
 
@@ -218,10 +226,10 @@
   return normalizeText(record[`${key}WareName$`] || record[`${key}WareName`] || record[`${key}WareId$`] || record[`${key}WareId`])
 }
 
-export function normalizeTransferRow(record = {}) {
-  const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, $t('common.status.unknown'))
-  const exceStatusMeta = metaByValue(record.exceStatus, TRANSFER_EXCE_STATUS_META, record.exceStatusText)
-  const sourceMeta = metaByValue(record.source, TRANSFER_SOURCE_META, record.sourceText)
+export function normalizeTransferRow(record = {}, t = $t) {
+  const statusMeta = metaByValue(record.statusBool ?? record.status, getTransferStatusMetaMap(t), t('common.status.unknown'))
+  const exceStatusMeta = metaByValue(record.exceStatus, getTransferExceStatusMetaMap(t), record.exceStatusText)
+  const sourceMeta = metaByValue(record.source, getTransferSourceMetaMap(t), record.sourceText)
   return {
     ...record,
     id: record.id ?? null,
@@ -246,13 +254,13 @@
   }
 }
 
-export function normalizeTransferDetailRecord(record = {}) {
-  return normalizeTransferRow(record)
+export function normalizeTransferDetailRecord(record = {}, t = $t) {
+  return normalizeTransferRow(record, t)
 }
 
-export function normalizeTransferOrderRow(record = {}) {
-  const statusMeta = metaByValue(record.statusBool ?? record.status, TRANSFER_STATUS_META, $t('common.status.unknown'))
-  const exceStatusMeta = metaByValue(record.exceStatus, TRANSFER_EXCE_STATUS_META, record.exceStatusText)
+export function normalizeTransferOrderRow(record = {}, t = $t) {
+  const statusMeta = metaByValue(record.statusBool ?? record.status, getTransferStatusMetaMap(t), t('common.status.unknown'))
+  const exceStatusMeta = metaByValue(record.exceStatus, getTransferExceStatusMetaMap(t), record.exceStatusText)
   return {
     ...record,
     id: record.id ?? null,
@@ -278,21 +286,22 @@
   }
 }
 
-export function buildTransferPrintRows(records = []) {
-  return Array.isArray(records) ? records.map((record) => normalizeTransferRow(record)) : []
+export function buildTransferPrintRows(records = [], t = $t) {
+  return Array.isArray(records) ? records.map((record) => normalizeTransferRow(record, t)) : []
 }
 
-export function buildTransferOrderPrintRows(records = []) {
-  return Array.isArray(records) ? records.map((record) => normalizeTransferOrderRow(record)) : []
+export function buildTransferOrderPrintRows(records = [], t = $t) {
+  return Array.isArray(records) ? records.map((record) => normalizeTransferOrderRow(record, t)) : []
 }
 
 export function buildTransferReportMeta({
   previewMeta = {},
   count = 0,
-  orientation = TRANSFER_REPORT_STYLE.orientation
+  orientation = TRANSFER_REPORT_STYLE.orientation,
+  t = $t
 } = {}) {
   return {
-    reportTitle: TRANSFER_REPORT_TITLE,
+    reportTitle: getTransferReportTitle(t),
     reportDate: previewMeta.reportDate,
     printedAt: previewMeta.printedAt,
     operator: previewMeta.operator,

--
Gitblit v1.9.1