<template>
  <el-dialog
    :visible.sync="visible"
    center
    width="90%"
    :title="`货位号${title}`"
  >
    <el-table :data="tableData" height="50vh">
      <el-table-column label="序号" type="index"></el-table-column>
      <el-table-column
        label="编码"
        prop="onlyCode"
        sortable
        width="200"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        label="名称"
        prop="assetName"
        width="180"
        show-overflow-tooltip
      ></el-table-column>
      <el-table-column
        label="批次号"
        prop="batchNum"
        sortable
      ></el-table-column>
      <el-table-column label="包装编码" prop="num"></el-table-column>
      <el-table-column
        label="计量数量"
        prop="measurementUnit"
      ></el-table-column>
      <el-table-column label="最小单元" prop="minPackUnit">
        <template slot-scope="{ row }">
          {{ row.unit }}/{{ row.minPackUnit }}
        </template>
      </el-table-column>
      <el-table-column
        label="入库时间"
        prop="createTime"
        width="180"
        sortable
      ></el-table-column>
      <el-table-column
        label="有效期"
        prop="expirationTime"
        sortable
        width="180"
      ></el-table-column>
      <!-- <el-table-column label="条码号" prop="">
        <template slot-scope="{ row }">
          <el-link type="primary" @click="codeView(row)">查看</el-link>
        </template>
      </el-table-column> -->
    </el-table>
  </el-dialog>
</template>

<script>
  // import { getGoodsInfo } from '@/api/stockManagement/warehouseDefinition'
  export default {
    data() {
      return {
        visible: false,
        tableData: [],
        title: ''
      };
    },

    methods: {
      async open(cargoSpaceId, title) {
        this.title = title;
        this.visible = true;

        const res = await getGoodsInfo({ cargoSpaceId });
        if (res?.success) {
          this.tableData = res.data;
        }
      },
      codeView(row) {}
    }
  };
</script>
