Blame view

src/views/task/taskHeader/dialog/printTaskDialog.vue 3.35 KB
yuanshuhui authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<template>
  <el-dialog
    title="任务打印"
    :visible.sync="visible"
    :showprint="showprint"
    width="800px"
    append-to-body
    @close="$emit('update:showprint', false)"
  >
    <div ref="print">
      <el-row>
        <el-col :span="11"
          ><div>{{ parseTime(printDate) }}</div></el-col
        >
        <el-col :span="13"><div class="ad-sheet">拣货明细</div></el-col>
      </el-row>
      <el-row>
        <div class="pull-right detail">
          <span>总条数:{{ detailList.length }}</span
yuanshuhui authored
20
          ><span class="total">总物料数:{{ total }}</span>
yuanshuhui authored
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
          <el-button
            size="mini"
            type="primary"
            icon="el-icon-printer"
            @click="print"
            class="no-print"
            >打印</el-button
          >
        </div>
      </el-row>

      <el-divider></el-divider>
      <el-table :data="detailList">
        <el-table-column label="目的库位" align="left" prop="toLocation">
          <template slot-scope="scope">
yuanshuhui authored
36
            {{ scope.row.rows[0].toLocation }}
yuanshuhui authored
37
38
39
          </template>
        </el-table-column>
        <el-table-column label="容器编码" align="left" prop="containerCode">
yuanshuhui authored
40
41
          <template slot-scope="scope">
            {{ scope.row.rows[0].containerCode }}
yuanshuhui authored
42
43
44
          </template>
        </el-table-column>
        <el-table-column label="物料编码" align="left" prop="materialCode">
yuanshuhui authored
45
46
          <template slot-scope="scope">
            {{ scope.row.rows[0].materialCode }}
yuanshuhui authored
47
48
49
          </template>
        </el-table-column>
        <el-table-column label="物料名称" align="left" prop="materialName">
yuanshuhui authored
50
51
          <template slot-scope="scope">
            {{ scope.row.rows[0].materialName }}
yuanshuhui authored
52
53
54
          </template>
        </el-table-column>
        <el-table-column label="数量" align="left" prop="qty">
yuanshuhui authored
55
56
          <template slot-scope="scope">
            {{ scope.row.rows[0].qty }}
yuanshuhui authored
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
          </template>
        </el-table-column>
        <el-table-column label="条码" align="left">
          <template slot-scope="scope">
            <qrcode-vue
              :value="
                scope.row.rows[0].materialCode +
                '/' +
                scope.row.rows[0].materialName +
                '//' +
                scope.row.rows[0].qty
              "
              size="60"
              level="H"
              renderAs="svg"
              style="margin-top: 5px"
            ></qrcode-vue>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </el-dialog>
</template>

<script>
export default {
yuanshuhui authored
83
  name: "printTaskDialog",
yuanshuhui authored
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
  props: {
    showprint: {
      type: Boolean,
      default: false,
    },
    printlist: {
      type: Array,
    },
  },
  data() {
    return {
      printDate: new Date(),
      visible: this.showprint,
      detailList: this.printlist,
    };
  },
  computed: {
    total() {
yuanshuhui authored
102
103
104
105
      return this.detailList
        .map((item) => item.rows[0].qty)
        .reduce((prev, cur) => prev + cur, 0);
    },
yuanshuhui authored
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
  },
  watch: {
    showprint() {
      this.visible = this.showprint;
    },
    printlist() {
      this.detailList = this.printlist;
    },
  },
  methods: {
    print() {
      this.$print(this.$refs.print);
    },
  },
};
</script>

<style lang="scss" scoped>
.detail {
  margin-top: 15px;
  .total {
    padding-left: 20px;
  }
  .no-print {
    margin-left: 20px;
  }
}
.ad-sheet {
  font-size: 22px;
}
</style>