detailprintDialog.vue 4.25 KB
<template>
  <el-dialog
    title="出库单铭牌打印"
    :visible.sync="visible"
    :showdetailprint="showdetailprint"
    width="800px"
    append-to-body
    @close="$emit('update:showdetailprint', false)">
    <div ref="print">
      <el-row>
        <el-col :span="24">
          <el-button size="mini"
                     type="info"
                     plain icon="el-icon-printer"
                     @click="print"
                     class="no-print pull-right"
                     >打印</el-button>
        </el-col>
      </el-row>
      <block v-for="(item, index) in list" :key="index">
        <div class="table-container">
          <table
            border="0"
            cellspacing="0"
            cellpadding="0"
            class="table-bordered"
          >
            <caption>
              {{ item.companyName }}
            </caption>
            <tbody>
            <tr>
              <td width="23%" scope="col">物料编码</td>
              <td colspan="2" scope="col" class="center">
                <span>{{ item.materialCode }}</span>
              </td>
            </tr>

            <tr>
              <td>物料名称</td>
              <td class="center">
                <span>{{ item.materialName }}</span>
              </td>
              <td rowspan="3" width="15%">
                <qrcode-vue
                  :value="
                      item.materialCode +
                      '/' +
                      item.materialName +
                      '//' +
                      item.shipQty
                    "
                  size="60"
                  level="H"
                  renderAs="svg"
                  style="padding-top: 4px"
                ></qrcode-vue>
              </td>
            </tr>
            <tr>
              <td>物料规格</td>
              <td class="center">
                <span>{{ item.materialSpec }}</span>
              </td>
            </tr>
            <tr>
              <!--<td><span class="fl">数</span><span class="fr">量</span></td>-->
              <td><span>数</span><span style="padding-left: 2em">量</span></td>
              <td class="center" style="padding: 0">
                <input
                  :value="item.shipQty"
                  class="input-control"
                  type="text"
                />
              </td>
            </tr>
            <tr>
              <td colspan="3" scope="col" class="center" style="height: 30px;">
                <span></span>
              </td>
            </tr>
            </tbody>
          </table>
        </div>
      </block>
    </div>
  </el-dialog>
</template>

<script>
  import QrcodeVue from "qrcode.vue";
  export default {
    components: {
      QrcodeVue,
    },
    props: {
      showdetailprint: {
        type: Boolean,
        default: false
      },
      printlist: {
        type: Array,
      },
    },
    data() {
      return {
        visible: this.showdetailprint,
        list: this.printlist,
      }
    },
    watch: {
      showdetailprint() {
        this.visible = this.showdetailprint
      },
      printlist() {
        this.list = this.printlist;
      },
    },

    methods: {
      print() {
        this.$print(this.$refs.print);
      },

    },
  };
</script>

<style lang="scss" scoped>
  .no-print {
    margin-bottom: 20px;
  }
  .table-container {
    width: 320px;
    margin-right: auto;
    margin-left: auto;
    table {
      white-space: wrap;
      border-collapse: collapse;
    }
    .table-bordered {
      width: 100%;
      margin-bottom: 30px;
      border: 1px solid #EBEBEB;
      caption {
        font-size: 17px;
        text-align: center;
        color: #333;
        padding-bottom: 5px;
      }
      tbody {
        tr {
          .center {
            text-align: center;
          }
          td {
            padding: 3px;
            line-height: 24px;
            text-align: center;
            box-sizing: border-box;
            vertical-align: middle;
            border: 1px solid #000;
            color: #333;
            span {
              color: #333;
            }
            .input-control {
              height: 28px;
              border: none;
              outline: none;
              text-align: center;
            }
          }
        }
      }
    }
  }
</style>