Blame view

src/views/inventory/dialog/printDialog.vue 2.42 KB
yuanshuhui authored
1
2
3
4
5
6
7
8
9
10
<template>
  <el-dialog
    title="库存打印"
    :visible.sync="visible"
    :showprint="showprint"
    width="800px"
    append-to-body
    @close="$emit('update:showprint', false)"
  >
    <div ref="print">
yuanshuhui authored
11
      <el-row>
yuanshuhui authored
12
        <el-col :span="11"
yuanshuhui authored
13
          ><div>{{ parseTime(printDate) }}</div></el-col
yuanshuhui authored
14
        >
yuanshuhui authored
15
16
17
        <el-col :span="13"
          ><div class="ad-sheet">{{ printTitle }}</div></el-col
        >
yuanshuhui authored
18
      </el-row>
yuanshuhui authored
19
      <el-row class="no-print">
yuanshuhui authored
20
21
22
23
24
25
26
27
28
29
30
31
        <el-button
          size="mini"
          type="primary"
          icon="el-icon-printer"
          @click="print"
          class="pull-right"
          >打印</el-button
        >
      </el-row>

      <el-divider></el-divider>
      <el-table :data="detailList">
yuanshuhui authored
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
        <el-table-column
          label="货主"
          align="left"
          prop="companyName"
          min-width="180"
        />
        <el-table-column
          label="库位编码"
          align="left"
          prop="locationCode"
          min-width="100"
          v-if="printTitle == '库存明细'"
        />
        <el-table-column
          label="物料编码"
          align="left"
          prop="materialCode"
          min-width="120"
        />
        <el-table-column
          label="物料名称"
          align="left"
          prop="materialName"
          min-width="200"
        />
        <el-table-column
          label="物料规格"
          align="left"
          prop="materialSpec"
          v-if="printTitle == '库存物料汇总'"
        />
yuanshuhui authored
63
64
        <el-table-column label="在库数量" align="left" prop="qty" />
        <el-table-column label="单位" align="left" prop="materialUnit" />
yuanshuhui authored
65
66
67
68
69
70
71
72
73
74
75
76
77
78
      </el-table>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    showprint: {
      type: Boolean,
      default: false,
    },
    printlist: {
      type: Array,
yuanshuhui authored
79
      default: [],
yuanshuhui authored
80
    },
yuanshuhui authored
81
82
    title: {
      type: String,
yuanshuhui authored
83
84
      default: "",
    },
yuanshuhui authored
85
86
87
88
89
90
  },
  data() {
    return {
      printDate: new Date(),
      visible: this.showprint,
      detailList: this.printlist,
yuanshuhui authored
91
      printTitle: this.title,
yuanshuhui authored
92
93
94
95
96
97
98
99
100
101
102
103
    };
  },
  watch: {
    showprint() {
      this.visible = this.showprint;
    },
    printlist() {
      this.detailList = this.printlist;
    },
  },
  methods: {
    print() {
yuanshuhui authored
104
      this.$print(this.$refs.print);
yuanshuhui authored
105
106
107
108
109
110
111
112
113
114
115
116
117
    },
  },
};
</script>

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