<!-- 采购入库单 -->
<!--虽然在store-out-record里引用但未使用，打印已改成vue-easy-print-->
<template>
  <modal v-model="modal" width="700px">
    <!--  表单主要内容  -->
    <div class="content" ref="print">
      <div class="title">
        领料申请单
      </div>
      <div class="sub-title border">
        <span>申请信息</span>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">领料单号：</div>
          <div class="value">{{ data.applyBillNo }}</div>
        </div>
        <div class="col">
          <div class="label">申请日期：</div>
          <div class="value">{{ data.applyDate }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">申请部门：</div>
          <div class="value">{{ data.applyDepartment }}</div>
        </div>
        <div class="col">
          <div class="label">申请人：</div>
          <div class="value">{{ data.applyUser }}</div>
        </div>
      </div>
      <div class="sub-title border">
        <span>物料信息</span>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">物料编码：</div>
          <div class="value">{{ data.materialCode }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">物料名称：</div>
          <div class="value">{{ data.materialName }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">物料规格：</div>
          <div class="value">{{ data.spec }}</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">物料单位：</div>
          <div class="value">米</div>
        </div>
      </div>
      <div class="row">
        <div class="col">
          <div class="label">领料数量：</div>
          <div class="value">
            {{ data.applyTakeQuantity }}
          </div>
        </div>
        <div class="col"></div>
      </div>
    </div>
    <div class="footer" slot="footer">
      <Button @click="cfm" class="btn" type="primary">提交</Button>
      <Button @click="cancel" class="btn">关闭</Button>
    </div>
    <vue-easy-print ref="print">
      <template>
        <div class="content" ref="print">
          <div class="title">
            领料申请单
          </div>
          <div class="sub-title border">
            <span>申请信息</span>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">领料单号：</div>
              <div class="value">{{ data.applyBillNo }}</div>
            </div>
            <div class="col">
              <div class="label">申请日期：</div>
              <div class="value">{{ data.applyDate }}</div>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">申请部门：</div>
              <div class="value">{{ data.applyDepartment }}</div>
            </div>
            <div class="col">
              <div class="label">申请人：</div>
              <div class="value">{{ data.applyUser }}</div>
            </div>
          </div>
          <div class="sub-title border">
            <span>物料信息</span>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">物料编码：</div>
              <div class="value">{{ data.materialCode }}</div>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">物料名称：</div>
              <div class="value">{{ data.materialName }}</div>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">物料规格：</div>
              <div class="value">{{ data.spec }}</div>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">物料单位：</div>
              <div class="value">米</div>
            </div>
          </div>
          <div class="row">
            <div class="col">
              <div class="label">领料数量：</div>
              <div class="value">
                {{ data.applyTakeQuantity }}
              </div>
            </div>
            <div class="col"></div>
          </div>
        </div>
      </template>
    </vue-easy-print>
  </modal>
</template>

<script>
import VueEasyPrint from 'vue-easy-print'
export default {
  name: 'store-in-form',
  data () {
    return {
      modal: false
    }
  },
  components: {
    VueEasyPrint
  },
  props: {
    data: {
      type: Object,
      default () {
        return {}
      }
    },
    value: {
      type: Boolean,
      default: false,
      require: true
    }
  },
  watch: {
    value: {
      handler (n) {
        this.modal = n
      },
      immediate: true
    },
    modal (n) {
      this.$emit('input', n)
    }
  },
  methods: {
    cfm () {
      this.$refs.print.print()
    },
    cancel () {
      this.modal = false
    }
  }
}
</script>

<style lang="less" scoped>
.content {
  .title {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
  }
  .sub-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px;
    font-size: 14px;
    font-weight: bold;
    &.border {
      border-bottom: 1px solid #000000;
    }
    .go {
      font-size: 10px;
      font-weight: normal;
      color: #0000ff;
    }
  }
  .row {
    padding: 0 20px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .col {
      flex: 1;
      display: flex;
      align-items: center;
      .table {
        width: 100%;
        table {
          border-collapse:collapse;
          border:none;
          width: 100%;
          tr {
            td,th {
              padding: 5px;
              text-align: center;
              border:solid #dcdee2 1px;
              position: relative;
              font-size: 12px;
              th {
                background-color: #eeeeee;
              }
            }
          }
        }
      }
    }
  }
  .card {
    margin-bottom: 5px;
    background-color: #FFFFFF;
    border: 1px solid rgba(215, 215, 215, 1);
    border-radius: 5px;
    .border {
      border-bottom: 1px solid #5d6c7b;
    }
    .line {
      width: 100%;
      border-bottom: 1px solid #5d6c7b;
    }
  }
}
</style>
