Browse Source

数字固定位数

master
han\hanst 4 weeks ago
parent
commit
21633d6362
  1. 2
      src/i18n/locales/labelSetting/cnLabelSetting.js
  2. 1
      src/i18n/locales/labelSetting/enLabelSetting.js
  3. 3
      src/views/modules/labelSetting/LabelDesigner.vue
  4. 10
      src/views/modules/labelSetting/components/PropertyForm.vue

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

@ -376,6 +376,8 @@ export default {
showDecimalPlaces: '整数显示小数位',
thousandsSeparator: '千位分隔符',
roundHalfUp: '四舍五入',
fixedDigits: '固定位数',
fixedDigitsPlaceholder: '例如 6 -> 000200',
dataSource: '数据源',
fieldValue: '字段值',
currentDate: '当前日期',

1
src/i18n/locales/labelSetting/enLabelSetting.js

@ -133,6 +133,7 @@ export default {
bold: 'Bold', autoWrap: 'Auto wrap', italic: 'Italic', underline: 'Underline', characterSpacing: 'Character spacing:',
textWidthMm: 'Text width (mm)', textLines: 'Text lines', decimalPlaces: 'Decimal places',
showDecimalPlaces: 'Show decimals for integers', thousandsSeparator: 'Thousands separator', roundHalfUp: 'Round half up',
fixedDigits: 'Fixed digits', fixedDigitsPlaceholder: 'Leave empty to disable, e.g. 6 -> 000200',
dataSource: 'Data source', fieldValue: 'Field value', currentDate: 'Current date', extractType: 'Extraction type',
fullDate: 'Full date', extractYear: 'Year', extractMonth: 'Month', extractDay: 'Day', extractWeek: 'Week',
extractWeekday: 'Weekday', dateOffset: 'Day offset', firstDayOfWeek: 'First day of week', firstDayWeekday: 'Weekday of first day',

3
src/views/modules/labelSetting/LabelDesigner.vue

@ -463,7 +463,7 @@ export default {
const defaultElement = {reportId: '',
type: '', x: 0, y: 0, data: '', fontSize: 30, bold: false, newline: false, lineRows: 2,
lineWidth: 200, digits: 2, step: 1, width: 100, height: 30, previewUrl: '', barcodeType: '', showContent: true, showElement: true, showSerialNumber: false,
showMainSeq: false,parentSerialLabelNo:'', seqName: '', isChecked: false, decimalPlaces: '', showDecimalPlaces: false, thousandsSeparator: false, roundHalfUp: true, dateOffsetDays: 0,
showMainSeq: false,parentSerialLabelNo:'', seqName: '', isChecked: false, decimalPlaces: '', showDecimalPlaces: false, thousandsSeparator: false, roundHalfUp: true, fixedDigits: '', dateOffsetDays: 0,
//
fontFamily: 'default', textAlign: 'left', letterSpacing: 0, fontItalic: false, fontUnderline: false
};
@ -537,6 +537,7 @@ export default {
newline: false,
lineRows: 2,
lineWidth: 200,
fixedDigits: '',
digits: 2,
step: 1,
showSerialNumber: false

10
src/views/modules/labelSetting/components/PropertyForm.vue

@ -149,6 +149,14 @@
<el-checkbox v-model="element.roundHalfUp" size="small" class="inline-checkbox">{{ $t('labelSetting.property.roundHalfUp') }}</el-checkbox>
</div>
</el-form-item>
<el-form-item :label="$t('labelSetting.property.fixedDigits')">
<el-input
v-model="element.fixedDigits"
controls-position="right"
size="mini" width="100%"
:placeholder="$t('labelSetting.property.fixedDigitsPlaceholder')"
/>
</el-form-item>
</template>
<!-- 日期类型设置 -->
<template v-if="element.dataType === 'date'">
@ -766,6 +774,7 @@ export default {
this.setElementDefault('step', 1)
} else if (this.element.dataType === 'number') {
this.setElementDefault('roundHalfUp', true)
this.setElementDefault('fixedDigits', '')
} else if (this.element.dataType === 'string') {
this.setElementDefault('stringProcessType', 'none')
this.setElementDefault('substringStartLength', '')
@ -821,6 +830,7 @@ export default {
this.$set(this.element, 'step', 1)
} else if (newType === 'number') {
this.$set(this.element, 'roundHalfUp', true)
this.$set(this.element, 'fixedDigits', '')
} else if (newType === 'string') {
this.$set(this.element, 'stringProcessType', 'none')
this.$set(this.element, 'substringStartLength', '')

Loading…
Cancel
Save