headerprintDialog.vue 2.75 KB
<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="4"><div class="ad-sheet">入库单</div></el-col>
        <el-col :span="9"><div class="pull-right"> <qrcode-vue :value="code" size="60" level="H" renderAs="svg" ></qrcode-vue></div></el-col>
      </el-row>
      <el-row>
        <div class="pull-right detail">
        <span>明细条数:{{list.length}}</span><span class="total">明细总数:123</span>
        <el-button
          size="mini"
          type="primary"
          icon="el-icon-printer"
          @click="print"
         class="no-print"
          >打印</el-button
        >
        </div>
      </el-row>
      <!-- <div class="horizontal-line"></div> -->
      <el-divider></el-divider>
      <el-table :data="list"  >
        <el-table-column label="物料编码" align="left" prop="materialCode" />
        <el-table-column label="物料名称" align="left" prop="materialName" />
        <el-table-column label="批次" align="left" prop="batch" />
        <el-table-column label="批号" align="left" prop="lot" />
        <el-table-column label="工程号" align="left" prop="projectNo" />
        <el-table-column label="数量" align="left" prop="totalQty" />
        <el-table-column label="条码" align="left" prop="materialUnit">
          <template slot-scope="scope">
            
              <qrcode-vue :value="scope.row.materialCode" size="60" level="H" renderAs="svg" style="margin-top:5px;"></qrcode-vue>
        
          </template>
        </el-table-column>
      </el-table>
    </div>
  </el-dialog>
</template>

<script>
import QrcodeVue from 'qrcode.vue'
export default {
  components: {
      QrcodeVue,
    },
  props: {
    showprint: {
      type: Boolean,
      default: false,
    },
    printlist: {
      type: Array,
    },
    code: {
      type: String
    }
  },
  data() {
    return {
      printDate: new Date(),
      visible: this.showprint,
      code: this.code,
      list: this.printlist,

    };
  },
  watch: {
    showprint() {
      this.visible = this.showprint;
    },
    printlist() {
      this.list = 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;
}
// .horizontal-line {
//   margin: 25px 0;
//   width: 100%;
//   border-top: none;
//   border-bottom:1px solid #DCDFE6;
 
// }

</style>