<template>
  <div class="detail-container">
    <el-page-header @back="goBack" content="详情"></el-page-header>

    <div id="printData">
      <div class="main-title">
        <div class="title">入库单</div>
      </div>

      <div class="diy-form-1">
        <el-row :gutter="20">
          <el-col :span="8" class="item">
            <div class="label">入库单号：</div>
            <div class="value">212212121212121</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">入库日期：</div>
            <div class="value">2022-12-22</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">仓库：</div>
            <div class="value">212212121212121</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">供货单位：</div>
            <div class="value">212212121212121</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">审核日期：</div>
            <div class="value">2022-12-22</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">备注：</div>
            <div class="value">212212121212121</div>
          </el-col>
        </el-row>
      </div>

      <div class="diy-table-2">
        <div class="head">
          <el-row :gutter="20">
            <el-col :span="2">序号</el-col>
            <el-col :span="4">产品编号</el-col>
            <el-col :span="8">产品名称</el-col>
            <el-col :span="2">规格型号</el-col>
            <el-col :span="2">内机编码</el-col>
            <el-col :span="2">外机编码</el-col>
            <el-col :span="2">单位</el-col>
            <el-col :span="2">数量</el-col>
          </el-row>
        </div>
        <div class="body">
          <el-row v-for="(item, index) in goodsList" :key="item.goodsId" :gutter="20">
            <el-col :span="2">{{ index + 1 }}</el-col>
            <el-col :span="4">{{ item.goodsId || 0 }}</el-col>
            <el-col :span="8">{{ item.goodsName || 0 }}</el-col>
            <el-col :span="2">{{ item.salesUnit || 0 }}</el-col>
            <el-col :span="2">{{ item.price || 0 }}</el-col>
            <el-col :span="2">{{ item.saleQty || 0 }}</el-col>
            <el-col :span="2">{{ item.saleValue || 0 }}</el-col>
            <el-col :span="2">{{ item.saleValue || 0 }}</el-col>
          </el-row>
        </div>
        <div class="foot">
          <el-row :gutter="20">
            <el-col :span="24">合计</el-col>
          </el-row>
        </div>
      </div>

      <div class="diy-form-1">
        <el-row :gutter="20">
          <el-col :span="8" class="item">
            <div class="label">制单人：</div>
            <div class="value">张三</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">审核人：</div>
            <div class="value">李四</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">现存量：</div>
            <div class="value">200</div>
          </el-col>
        </el-row>
      </div>
      
    </div>
    
    <div class="page-footer">
      <div class="footer" :class="classObj">
        <el-button  type="primary" icon="el-icon-printer" v-print="printObj">打 印</el-button>
        <el-popconfirm title="确定关闭吗？" @onConfirm="goBack" style="margin-left: 10px;">
          <el-button slot="reference">关 闭</el-button>
        </el-popconfirm>
      </div>
    </div>

  </div>
</template>

<script>
import print from 'vue-print-nb'
import { getList } from "@/api/supply/purchase";

export default {
  name: 'EnterDetail',
  componentName: 'EnterDetail',
  props: ['listItem'],
  directives: {
    print
  },
  data() {
    return {
      printObj: {
        id: 'printData'
      },
      goodsList: [{
        goodsId: 1,
      }]
    }
  },

  computed: {
    sidebar() {
      return this.$store.state.app.sidebar
    },
    classObj() {
      return {
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened
      }
    },
  },

  created() {

  },

  methods: {
    // 返回列表
    goBack() {
      this.$emit('backListFormDetail');
    },
  }
}
</script>

<style scoped lang="scss">
  .detail-container {
    width: 100%;
    height: 100%;
  }
  .main-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    height: 60px;
    border-bottom: 1px solid #DCDFE6;
    margin-bottom: 20px;
    .title {
      font-size: 16px;
      font-weight: 600;
      padding-left: 10px;
    }
  }

  .diy-form-1 {
    .item {
      display: flex;
      height: 40px;
      .label {
        width: 100px;
        display: flex;
        align-items: center;
        padding-right: 10px;
        box-sizing: border-box;
        font-size: 14px;
        color: #606266;
        font-weight: 700;
      }
      .value {
        flex: 1;
        display: flex;
        align-items: center;
        box-sizing: border-box;
        font-size: 14px;
        color: #333333;
        input {
          border: none;
          padding: 0;
        }
      }
    }
  }
</style>