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/asn-order/asnOrderPage.helpers.js |   47 ++++++++++++++++++++++++++---------------------
 1 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/rsf-design/src/views/orders/asn-order/asnOrderPage.helpers.js b/rsf-design/src/views/orders/asn-order/asnOrderPage.helpers.js
index 3c58d73..1e3063d 100644
--- a/rsf-design/src/views/orders/asn-order/asnOrderPage.helpers.js
+++ b/rsf-design/src/views/orders/asn-order/asnOrderPage.helpers.js
@@ -1,22 +1,14 @@
 import { $t } from '@/locales'
 
-export const ASN_ORDER_REPORT_TITLE = $t('pages.orders.asnOrder.reportTitle')
+export function getAsnOrderReportTitle(t = $t) {
+  return t('pages.orders.asnOrder.reportTitle')
+}
 export const ASN_ORDER_REPORT_STYLE = {
   titleAlign: 'center',
   titleLevel: 'strong',
   orientation: 'landscape',
   density: 'compact',
   showSequence: true
-}
-
-const ASN_ORDER_STATUS_MAP = {
-  0: { label: $t('pages.orders.asnOrder.status.pending'), tagType: 'info' },
-  1: { label: $t('pages.orders.asnOrder.status.running'), tagType: 'warning' },
-  2: { label: $t('pages.orders.asnOrder.status.receiving'), tagType: 'success' },
-  3: { label: $t('pages.orders.asnOrder.status.taskRunning'), tagType: 'warning' },
-  4: { label: $t('pages.orders.asnOrder.status.completed'), tagType: 'success' },
-  8: { label: $t('pages.orders.asnOrder.status.cancelled'), tagType: 'danger' },
-  9: { label: $t('pages.orders.asnOrder.status.closed'), tagType: 'info' }
 }
 
 function normalizeText(value) {
@@ -39,9 +31,21 @@
   return Number.isFinite(numericValue) ? numericValue : '-'
 }
 
-function getStatusConfig(status, statusText) {
+function getAsnOrderStatusMap(t = $t) {
+  return {
+    0: { label: t('pages.orders.asnOrder.status.pending'), tagType: 'info' },
+    1: { label: t('pages.orders.asnOrder.status.running'), tagType: 'warning' },
+    2: { label: t('pages.orders.asnOrder.status.receiving'), tagType: 'success' },
+    3: { label: t('pages.orders.asnOrder.status.taskRunning'), tagType: 'warning' },
+    4: { label: t('pages.orders.asnOrder.status.completed'), tagType: 'success' },
+    8: { label: t('pages.orders.asnOrder.status.cancelled'), tagType: 'danger' },
+    9: { label: t('pages.orders.asnOrder.status.closed'), tagType: 'info' }
+  }
+}
+
+function getStatusConfig(status, statusText, t = $t) {
   const numericStatus = Number(status)
-  const fallback = ASN_ORDER_STATUS_MAP[numericStatus] || {
+  const fallback = getAsnOrderStatusMap(t)[numericStatus] || {
     label: statusText || '-',
     tagType: 'info'
   }
@@ -123,8 +127,8 @@
   }
 }
 
-export function normalizeAsnOrderRow(record = {}) {
-  const statusConfig = getStatusConfig(record.exceStatus, record['exceStatus$'])
+export function normalizeAsnOrderRow(record = {}, t = $t) {
+  const statusConfig = getStatusConfig(record.exceStatus, record['exceStatus$'], t)
   return {
     ...record,
     id: record.id ?? null,
@@ -206,20 +210,21 @@
   }
 }
 
-export function buildAsnOrderPrintRows(records = []) {
+export function buildAsnOrderPrintRows(records = [], t = $t) {
   if (!Array.isArray(records)) {
     return []
   }
-  return records.map((record) => normalizeAsnOrderRow(record))
+  return records.map((record) => normalizeAsnOrderRow(record, t))
 }
 
 export function buildAsnOrderReportMeta({
   previewMeta = {},
   count = 0,
-  orientation = ASN_ORDER_REPORT_STYLE.orientation
+  orientation = ASN_ORDER_REPORT_STYLE.orientation,
+  t = $t
 } = {}) {
   return {
-    reportTitle: ASN_ORDER_REPORT_TITLE,
+    reportTitle: getAsnOrderReportTitle(t),
     reportDate: previewMeta.reportDate,
     printedAt: previewMeta.printedAt,
     operator: previewMeta.operator,
@@ -231,8 +236,8 @@
   }
 }
 
-export function getAsnOrderStatusOptions() {
-  return Object.entries(ASN_ORDER_STATUS_MAP).map(([value, item]) => ({
+export function getAsnOrderStatusOptions(t = $t) {
+  return Object.entries(getAsnOrderStatusMap(t)).map(([value, item]) => ({
     label: item.label,
     value: Number(value)
   }))

--
Gitblit v1.9.1