Browse Source

Merge remote-tracking branch 'origin/master'

master
常熟吴彦祖 3 weeks ago
parent
commit
96a8e93b61
  1. 2
      src/i18n/locales/labelSetting/cnLabelSetting.js
  2. 1
      src/i18n/locales/labelSetting/enLabelSetting.js
  3. 16
      src/views/modules/labelSetting/com_add_update_label.vue
  4. 7
      src/views/modules/labelSetting/components/DataSourceManagementDialog.vue
  5. 50
      src/views/modules/labelSetting/labelTypeDisplay.js
  6. 42
      src/views/modules/labelSetting/label_setting.vue

2
src/i18n/locales/labelSetting/cnLabelSetting.js

@ -81,6 +81,8 @@ export default {
outerBoxLabel: '外箱标签',
rollLabel: '卷标签',
innerBoxLabel: '内箱标签',
bilLabel: 'BIL标签',
finishedGoodsLabel: '库存成品标签',
printSoftware: '打印软件',
portrait: '纵向设计',
landscape: '横向设计',

1
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'
},

16
src/views/modules/labelSetting/com_add_update_label.vue

@ -16,7 +16,7 @@
<el-option
v-for="option in labelTypeOptions"
:key="option.value"
:label="option.label"
:label="displayLabelType(option.value)"
:value="option.value">
</el-option>
</el-select >
@ -30,7 +30,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<!-- <el-col :span="12">
<el-form-item class="customer-item" :label=labels.printDirection>
<el-select v-model="pageData.printDirection" >
<el-option :label="$t('labelSetting.options.portrait')" value="纵向设计"></el-option>
@ -38,18 +38,18 @@
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="12">
&lt;!&ndash; <el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelName>
<el-input v-model="pageData.labelName" ></el-input>
</el-form-item>
</el-col>-->
</el-col>&ndash;&gt;
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.labelClass>
<el-select v-model="pageData.labelClass" >
<el-option :label="$t('labelSetting.options.printSoftware')" value="打印软件"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-col>-->
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.remark>
<el-input v-model="pageData.remark" ></el-input>
@ -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;

7
src/views/modules/labelSetting/components/DataSourceManagementDialog.vue

@ -21,7 +21,7 @@
<el-option
v-for="item in labelTypes"
:key="item.value"
:label="item.label"
:label="displayLabelType(item.value)"
:value="item.value"
/>
</el-select>
@ -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({

50
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
}

42
src/views/modules/labelSetting/label_setting.vue

@ -57,7 +57,7 @@
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="!item.columnHidden"> {{ displayColumnValue(item.columnProp, scope.row[item.columnProp]) }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
@ -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 = {};

Loading…
Cancel
Save