<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 ><span class="total">总物料数:{{ total }}</span> <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"> {{ scope.row.rows[0].toLocation }} </template> </el-table-column> <el-table-column label="容器编码" align="left" prop="containerCode"> <template slot-scope="scope"> {{ scope.row.rows[0].containerCode }} </template> </el-table-column> <el-table-column label="物料编码" align="left" prop="materialCode"> <template slot-scope="scope"> {{ scope.row.rows[0].materialCode }} </template> </el-table-column> <el-table-column label="物料名称" align="left" prop="materialName"> <template slot-scope="scope"> {{ scope.row.rows[0].materialName }} </template> </el-table-column> <el-table-column label="数量" align="left" prop="qty"> <template slot-scope="scope"> {{ scope.row.rows[0].qty }} </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 { name: "printTaskDialog", props: { showprint: { type: Boolean, default: false, }, printlist: { type: Array, }, }, data() { return { printDate: new Date(), visible: this.showprint, detailList: this.printlist, }; }, computed: { total() { return this.detailList .map((item) => item.rows[0].qty) .reduce((prev, cur) => prev + cur, 0); }, }, 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>