From 3ce7be0898d26f9bde0be548bf97b6f7869c19ba Mon Sep 17 00:00:00 2001 From: "han\\hanst" Date: Fri, 23 Oct 2026 15:27:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=87=E7=AD=BE=E5=88=97=E8=A1=A8=E7=BF=BB?= =?UTF-8?q?=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../locales/labelSetting/cnLabelSetting.js | 2 + .../locales/labelSetting/enLabelSetting.js | 1 + .../labelSetting/com_add_update_label.vue | 16 ++++-- .../components/DataSourceManagementDialog.vue | 7 ++- .../modules/labelSetting/labelTypeDisplay.js | 50 +++++++++++++++++++ .../modules/labelSetting/label_setting.vue | 42 +++------------- 6 files changed, 77 insertions(+), 41 deletions(-) create mode 100644 src/views/modules/labelSetting/labelTypeDisplay.js diff --git a/src/i18n/locales/labelSetting/cnLabelSetting.js b/src/i18n/locales/labelSetting/cnLabelSetting.js index 8c0c56f..7a64e31 100644 --- a/src/i18n/locales/labelSetting/cnLabelSetting.js +++ b/src/i18n/locales/labelSetting/cnLabelSetting.js @@ -81,6 +81,8 @@ export default { outerBoxLabel: '外箱标签', rollLabel: '卷标签', innerBoxLabel: '内箱标签', + bilLabel: 'BIL标签', + finishedGoodsLabel: '库存成品标签', printSoftware: '打印软件', portrait: '纵向设计', landscape: '横向设计', diff --git a/src/i18n/locales/labelSetting/enLabelSetting.js b/src/i18n/locales/labelSetting/enLabelSetting.js index 1b7d3c8..722a91b 100644 --- a/src/i18n/locales/labelSetting/enLabelSetting.js +++ b/src/i18n/locales/labelSetting/enLabelSetting.js @@ -23,6 +23,7 @@ export default { }, options: { outerBoxLabel: 'Outer-box label', rollLabel: 'Roll label', innerBoxLabel: 'Inner-box label', + bilLabel: 'BIL label', finishedGoodsLabel: 'Finished-goods label', printSoftware: 'Print software', portrait: 'Portrait design', landscape: 'Landscape design', text: 'Text', integer: 'Number (integer)', decimal: 'Number (decimal)', date: 'Date' }, diff --git a/src/views/modules/labelSetting/com_add_update_label.vue b/src/views/modules/labelSetting/com_add_update_label.vue index d82b668..efed4bd 100644 --- a/src/views/modules/labelSetting/com_add_update_label.vue +++ b/src/views/modules/labelSetting/com_add_update_label.vue @@ -16,7 +16,7 @@ @@ -30,7 +30,7 @@ - + + –> - + --> @@ -71,6 +71,7 @@ import { updateLabelSetting, getLabelTypeList, } from '@/api/labelSetting/com_add_update_label.js'; +import { labelTypeDisplayText } from './labelTypeDisplay'; import { searchSysLanguagePackList, @@ -161,6 +162,11 @@ export default { this.titleCon = this.labels.titleCon; }, + // 展示走语言包,value 仍是库里的中文类型名 + displayLabelType(storedName) { + return labelTypeDisplayText(this.$i18n, storedName) + }, + // 加载标签类型列表 loadLabelTypeList() { this.dataListLoading = true; diff --git a/src/views/modules/labelSetting/components/DataSourceManagementDialog.vue b/src/views/modules/labelSetting/components/DataSourceManagementDialog.vue index 5bd0216..c6ee230 100644 --- a/src/views/modules/labelSetting/components/DataSourceManagementDialog.vue +++ b/src/views/modules/labelSetting/components/DataSourceManagementDialog.vue @@ -21,7 +21,7 @@ @@ -100,6 +100,7 @@ import { getViewFieldsByLabelType, saveFieldDescriptions } from '@/api/labelSetting/com_add_update_label.js'; +import { labelTypeDisplayText } from '../labelTypeDisplay'; export default { name: 'DataSourceManagementDialog', @@ -140,6 +141,10 @@ export default { this.loadLabelTypes(); }, + displayLabelType(storedName) { + return labelTypeDisplayText(this.$i18n, storedName) + }, + async loadLabelTypes() { try { const response = await getLabelTypeList({ diff --git a/src/views/modules/labelSetting/labelTypeDisplay.js b/src/views/modules/labelSetting/labelTypeDisplay.js new file mode 100644 index 0000000..a33cd13 --- /dev/null +++ b/src/views/modules/labelSetting/labelTypeDisplay.js @@ -0,0 +1,50 @@ +/** + * report_family_list.name / ReportFamily 是标签类型主键,打印、视图和保存都按这个中文名称匹配。 + * 下拉和列表只能翻译展示文案,不能把英文写回 value,否则切语言后选中项对不上,保存也会改掉原类型。 + * 未收录的自定义名称保持原样,避免把用户自己维护的类型名翻译错。 + */ +const LABEL_TYPE_I18N_KEY = { + '外箱标签': 'labelSetting.options.outerBoxLabel', + '内箱标签': 'labelSetting.options.innerBoxLabel', + '卷标签': 'labelSetting.options.rollLabel', + 'BIL标签': 'labelSetting.options.bilLabel', + '库存成品标签': 'labelSetting.options.finishedGoodsLabel' +} + +const PRINT_DIRECTION_I18N_KEY = { + '纵向设计': 'labelSetting.options.portrait', + '横向设计': 'labelSetting.options.landscape' +} + +const LABEL_CLASS_I18N_KEY = { + '打印软件': 'labelSetting.options.printSoftware' +} + +function translateStoredName(i18n, storedName, keyMap) { + const name = storedName == null ? '' : String(storedName).trim() + const key = keyMap[name] + if (!key || !i18n) { + return storedName + } + return i18n.t(key) +} + +export function labelTypeDisplayText(i18n, storedName) { + return translateStoredName(i18n, storedName, LABEL_TYPE_I18N_KEY) +} + +/** + * 列表单元格只换展示文案。行对象里的中文原值要留给编辑、复制和绘制跳转,不能在这里改掉。 + */ +export function labelSettingColumnText(i18n, columnProp, storedValue) { + if (columnProp === 'labelType') { + return labelTypeDisplayText(i18n, storedValue) + } + if (columnProp === 'printDirection') { + return translateStoredName(i18n, storedValue, PRINT_DIRECTION_I18N_KEY) + } + if (columnProp === 'labelClass') { + return translateStoredName(i18n, storedValue, LABEL_CLASS_I18N_KEY) + } + return storedValue +} diff --git a/src/views/modules/labelSetting/label_setting.vue b/src/views/modules/labelSetting/label_setting.vue index c961e61..95f455c 100644 --- a/src/views/modules/labelSetting/label_setting.vue +++ b/src/views/modules/labelSetting/label_setting.vue @@ -57,7 +57,7 @@ :width="item.columnWidth" :label="item.columnLabel"> @@ -124,6 +124,7 @@ import comShowLabelContent from "./com_show_label_content";/*打印内容定义 import PaperManagementDialog from "./components/PaperManagementDialog.vue";/*纸张管理对话框*/ import DataSourceManagementDialog from "./components/DataSourceManagementDialog.vue";/*数据源管理对话框*/ import LabelTypeManagementDialog from "./components/LabelTypeManagementDialog.vue";/*标签类型管理对话框*/ +import { labelSettingColumnText } from "./labelTypeDisplay"; /* 动态表头 */ import { saveTableDefaultList, @@ -222,40 +223,6 @@ export default { status: true, fixed: '' }, - { - userId: this.$store.state.user.name, - functionId: '100008001', - serialNumber: '100008001LabelPrintDirection', - tableId: '100008001Label', - tableName: this.$t('labelSetting.list.customLabelList'), - columnProp: 'printDirection', - headerAlign: 'center', - align: 'center', - columnLabel: this.$t('labelSetting.fields.printDirection'), - columnHidden: false, - columnImage: false, - columnSortable: true, - sortLv: 0, - status: true, - fixed: '' - }, - { - userId: this.$store.state.user.name, - functionId: '100008001', - serialNumber: '100008001LabelLabelClass', - tableId: '100008001Label', - tableName: this.$t('labelSetting.list.customLabelList'), - columnProp: 'labelClass', - headerAlign: 'center', - align: 'left', - columnLabel: this.$t('labelSetting.fields.labelClass'), - columnHidden: false, - columnImage: false, - columnSortable: false, - sortLv: 0, - status: true, - fixed: '' - }, { userId: this.$store.state.user.name, functionId: '100008001', @@ -350,6 +317,11 @@ export default { }) }, methods: { + /* 列表展示走语言包,不改行数据里的中文原值 */ + displayColumnValue(columnProp, storedValue) { + return labelSettingColumnText(this.$i18n, columnProp, storedValue) + }, + /* 刷新页面table */ refreshPageTables() { this.currentRow = {};