zouyu
2023-11-17 7b10179a35a079a098126a1cb3aea2e8d010704d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<template>
  <el-dialog
    width="40%"
    title="标签信息"
    top="3vh"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    :show="currshowlist"
    :close-on-click-modal="false"
    class="print-label-dialog"
  >
    <el-form :model="dataForm" ref="dataForm" label-width="80px" class="l-mes">
      <el-row>
        <el-col :span="24">
          <el-form-item label="零件号" prop="partNo">
            <el-input v-model="dataForm.partNo" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="零件描述" prop="partName">
            <el-input v-model="dataForm.partName" disabled></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="SN号" prop="outBatchNo"
            ><el-input
              v-model="dataForm.outBatchNo"
              placeholder="SN号"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="生产数量" prop="productQty">
            <el-input
              v-model="dataForm.productQty"
              placeholder="生产数量"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="备注" prop="remark"
            ><el-input v-model="dataForm.remark" placeholder="备注"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="innerVisible = false">取消</el-button>
      <el-button type="primary" v-thinclick="`beginSmalllPrint`"
        >打印</el-button
      >
    </span>
  </el-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
import getLodop from '@/util/lodop'
export default {
  props: {
    currshowlist: {
      type: Boolean,
      default: false
    },
    printLabelInfo: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      innerVisible: false,
      dataForm: {}
    }
  },
  watch: {
    currshowlist() {
      this.innerVisible = this.currshowlist
      if (this.currshowlist) {
        this.$nextTick(() => {
          this.dataForm = {
            partNo: this.printLabelInfo.partNo,
            partName: this.printLabelInfo.partName,
            outBatchNo: this.printLabelInfo.outBatchNo,
            productQty: this.printLabelInfo.productQty,
            lotTrackingIfs: this.printLabelInfo.lotTrackingIfs,
            unit: this.printLabelInfo.unit,
            customerOrderNo: this.printLabelInfo.customerOrderNo,
            customerName: this.printLabelInfo.customerName,
            operationName: this.printLabelInfo.operationName,
            workstationName: this.printLabelInfo.workstationName,
            grossWeight: this.printLabelInfo.grossWeight,
            netWeight: this.printLabelInfo.netWeight,
            theoryWeight: this.printLabelInfo.theoryWeight,
            segmentDesc: this.printLabelInfo.segmentDesc,
            reelNumber: this.printLabelInfo.reelNumber,
            reelWeight: this.printLabelInfo.reelWeight,
            nowTime: this.printLabelInfo.nowTime,
            productionPerson: this.printLabelInfo.productionPerson,
            remark: this.printLabelInfo.remark
          }
          console.log('this.dataForm', this.dataForm)
        })
      }
    }
  },
  computed: {
    ...mapGetters(['userInfo'])
  },
  methods: {
    beginSmalllPrint() {
      this.LODOP = getLodop()
      this.LODOP.SET_LICENSES(
        '南通市鑫阳软件开发有限公司',
        '60F8E5078AE17DEB340C94BC7E83CAFF',
        '',
        ''
      )
      this.LODOP.PRINT_INITA(0, 0, 300, 100, '')
      this.LODOP.SET_PRINT_PAGESIZE(0, 600, 200, '')
      this.LODOP.SET_PRINT_MODE('PRINT_NOCOLLATE', 1)
      this.LODOP.ADD_PRINT_BARCODE(
        4,
        30,
        170,
        18,
        'Code39',
        this.dataForm.outBatchNo
      )
      this.LODOP.SET_PRINT_STYLEA(0, 'ShowBarText', 0)
      this.LODOP.ADD_PRINT_TEXT(25, 25, 85, 20, 'SN号:')
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      this.LODOP.ADD_PRINT_TEXT(25, 65, 105, 20, this.dataForm.outBatchNo)
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      this.LODOP.ADD_PRINT_TEXT(26, 155, 126, 20, this.dataForm.productQty)
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 7)
      this.LODOP.ADD_PRINT_TEXT(37, 25, 85, 20, '零件名称:')
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      this.LODOP.ADD_PRINT_TEXT(37, 75, 146, 35, this.dataForm.partName)
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      this.LODOP.ADD_PRINT_TEXT(58, 25, 85, 20, '备注:')
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      this.LODOP.ADD_PRINT_TEXT(58, 65, 154, 31, this.dataForm.remark)
      this.LODOP.SET_PRINT_STYLEA(0, 'FontSize', 6)
      // this.LODOP.PREVIEW()
      this.LODOP.PRINT()
    }
  }
}
</script>
<style scoped></style>