<template>
  <div>
    <table-item :tableData="tableData" :col="col"> </table-item>
  </div>
</template>
<script>
import tableItem from "./tableItem";
export default {
  name: "TableView",
  components: {
    tableItem,
  },
  data() {
    return {
      // 树型结构表头数据
      col: [
        {
          prop: "pm",
          label: "品名",
        },
        {
          prop: "portName",
          label: "港口名称",
        },
        {
          prop: "tonnage",
          label: "下游港口吨位",
        },
        {
          label: "未到闸船舶",
          children: [
            {
              prop: "capacity1",
              label: "船名",
            },
            {
              prop: "capacityNumber1",
              label: "吨位",
            },
            {
              prop: "locationValue1",
              label: "位置",
            },
            {
              prop: "outPortTime1",
              label: "离港时间",
            },
          ],
        },
        {
          label: "等闸船舶",
          children: [
            {
              prop: "capacity2",
              label: "船名",
            },
            {
              prop: "capacityNumber2",
              label: "吨位",
            },
            {
              prop: "locationValue2",
              label: "位置",
            },
            {
              prop: "outPortTime2",
              label: "离港时间",
            },
          ],
        },
        {
          label: "已过闸船舶",
          children: [
            {
              prop: "capacity3",
              label: "船名",
            },
            {
              prop: "capacityNumber3",
              label: "吨位",
            },
            {
              prop: "locationValue3",
              label: "位置",
            },
            {
              prop: "outPortTime3",
              label: "离港时间",
            },
          ],
        },
        {
          label: "到港待卸船舶",
          children: [
             {
              prop: "capacity4",
              label: "船名",
            },
            {
              prop: "capacityNumber4",
              label: "吨位",
            },
            {
              prop: "locationValue4",
              label: "位置",
            },
            {
              prop: "outPortTime4",
              label: "离港时间",
            },
            {
              prop: "dgsj",
              label: "到港时间",
            },
          ],
        },
      ],
      // 表格数据
      tableData: [],
    };
  },
  created(){
    this.initialization();
  },
  methods: {
    initialization() {
      this.$axios.post("/api/v1/tms/selectAll").then((res) => {
        console.log(res.data.data)
        this.tableData = res.data.data;
      });
    },
  },
};
</script>
