<template>
  <el-table id="tableStyle" :data="tableData" :height="tableHeight" border>
    <el-table-column label="工序名称" prop="operationName" />
    <el-table-column label="工段" prop="workSection" />
    <el-table-column label="状态" prop="currentState" />
    <el-table-column label="开始时间" prop="realStartWhen" />
    <el-table-column label="结束时间" prop="realEndWhen" />
    <el-table-column label="操作人" prop="operator" />
    <el-table-column label="报工人" prop="reportName" />
    <el-table-column label="工时" prop="standardWorktime" />
    <el-table-column label="工步" prop="operationSort" />
    <el-table-column label="备注" prop="operateCondition" />
    <template #empty>
      <div class="empty">
        <Empty />
      </div>
    </template>
  </el-table>
  <Pagination
    :limit="limit"
    :page="page"
    :total="total"
    position="right"
    @pagination="getPagination"
  />
</template>

<script lang="ts" setup>
import { useProcessStore } from "@/store";
import { getInfo } from "@/api/process/traceability";

const store = useProcessStore();
const page = ref(1);
const limit = ref(10);
const total = ref(10);
const tableData = ref([]);
const tableHeight = ref(null);
//动态控制表格高度
const setTableHeight = () => {
  tableHeight.value =
    Number(document.getElementById("tabBox").offsetHeight) - 60;
};
const getPagination = async () => {
  const { data } = await getInfo({
    pageNo: page.value,
    pageSize: limit.value,
    seqNo: store.useSeqNo,
    workOrderCode: store.odersData.workOrderCode,
  });
  total.value = data.totalCount;
  tableData.value = data.records;
};
onMounted(() => {
  getPagination();
  setTableHeight();
});
</script>

<style lang="scss" scoped></style>
