Browse Source

标签支持公式

master
han\hanst 2 days ago
parent
commit
a2732c4f68
  1. 25
      src/views/modules/labelSetting/com_add_update_customer_label.vue
  2. 32
      src/views/modules/labelSetting/customer_label_setting.vue

25
src/views/modules/labelSetting/com_add_update_customer_label.vue

@ -61,18 +61,16 @@
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item class="customer-item">
<el-checkbox v-model="pageData.printStandardOuterLabel">
<el-col :span="12">
<el-form-item class="customer-item" :label=" ' ' ">
<el-checkbox v-model="pageData.printStandardOuterLabel" :disabled="!canPrintStandardOuterLabel">
{{ $t('labelSetting.fields.standardOuterLabel') }}
</el-checkbox>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-col :span="12">
<el-form-item class="customer-item" :label=labels.remark>
<el-input v-model="pageData.remark" style="width: 310px;" ></el-input>
<el-input v-model="pageData.remark" ></el-input>
</el-form-item>
</el-col>
</el-row>
@ -173,6 +171,11 @@ export default {
},
}
},
computed: {
canPrintStandardOuterLabel() {
return (this.pageData.labelType || '').trim() === '外箱标签' && this.pageData.subLabelFlag === 'N';
},
},
methods: {
//初始化组件的参数
init(currentRow) {
@ -180,7 +183,7 @@ export default {
this.pageData = Object.assign({ printStandardOuterLabel: false }, JSON.parse(JSON.stringify(currentRow)));
//统一子报表标识和值,避免页面展示为*
this.pageData.subLabelFlag = this.pageData.subLabelFlag === 'Y' ? 'Y' : 'N';
this.pageData.printStandardOuterLabel = this.pageData.printStandardOuterLabel === true;
this.pageData.printStandardOuterLabel = this.canPrintStandardOuterLabel && this.pageData.printStandardOuterLabel === true;
this.pageData.parentLabelNo = this.getDisplayParentLabelNo(this.pageData.parentLabelNo, this.pageData.subLabelFlag);
//打开页面
this.visible = true;
@ -262,7 +265,8 @@ export default {
submitData.labelName = (submitData.labelName || '').trim();
submitData.remark = (submitData.remark || '').trim();
submitData.subLabelFlag = submitData.subLabelFlag === 'Y' ? 'Y' : 'N';
submitData.printStandardOuterLabel = submitData.printStandardOuterLabel === true;
submitData.printStandardOuterLabel = submitData.labelType === '外箱标签'
&& submitData.subLabelFlag === 'N' && submitData.printStandardOuterLabel === true;
let parentLabelNo = (submitData.parentLabelNo || '').trim().toUpperCase();
submitData.parentLabelNo = submitData.subLabelFlag === 'Y' ? parentLabelNo : '*';
return submitData;
@ -395,6 +399,9 @@ export default {
pageData: {
deep: true,
handler: function (newV, oldV) {
if (!this.canPrintStandardOuterLabel && this.pageData.printStandardOuterLabel) {
this.pageData.printStandardOuterLabel = false;
}
let labelNo = (this.pageData.labelNo || '').toUpperCase();
let parentLabelNo = (this.pageData.parentLabelNo || '').toUpperCase();
if(this.pageData.labelNo !== labelNo){

32
src/views/modules/labelSetting/customer_label_setting.vue

@ -38,7 +38,7 @@
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :key="index"
v-for="(item,index) in displayColumnList" :key="item.columnProp || index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
@ -48,7 +48,12 @@
: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">
<template v-if="item.columnProp === 'printStandardOuterLabel'">
{{ $t(scope.row.printStandardOuterLabel === true ? 'labelSetting.common.yes' : 'labelSetting.common.no') }}
</template>
<template v-else>{{ scope.row[item.columnProp] }}</template>
</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
@ -315,6 +320,29 @@ export default {
comAddUpdateLabel,/*标签新增或者修改的组件*/
},
computed: {
displayColumnList() {
// 已保存的用户/默认列配置可能没有新字段,显示时补齐且不重复添加。
if (this.columnList.some(item => item.columnProp === 'printStandardOuterLabel')) {
return this.columnList;
}
const columns = this.columnList.slice();
const subLabelIndex = columns.findIndex(item => item.columnProp === 'parentLabelNo');
columns.splice(subLabelIndex < 0 ? columns.length : subLabelIndex + 1, 0, {
columnProp: 'printStandardOuterLabel',
columnLabel: this.$t('labelSetting.fields.standardOuterLabel'),
columnWidth: 140,
headerAlign: 'center',
align: 'center',
columnHidden: false,
columnImage: false,
columnSortable: true,
fixed: ''
});
return columns;
},
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 165;

Loading…
Cancel
Save