6 changed files with 77 additions and 41 deletions
-
2src/i18n/locales/labelSetting/cnLabelSetting.js
-
1src/i18n/locales/labelSetting/enLabelSetting.js
-
16src/views/modules/labelSetting/com_add_update_label.vue
-
7src/views/modules/labelSetting/components/DataSourceManagementDialog.vue
-
50src/views/modules/labelSetting/labelTypeDisplay.js
-
42src/views/modules/labelSetting/label_setting.vue
@ -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 |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue