<template>
  <el-table :data="tableData" id="tableStyle" :height="tableHeight" border>
    <el-table-column prop="operationName" label="工序名称" />
    <el-table-column prop="workSection" label="工段" />
    <el-table-column prop="currentState" label="状态" />
    <el-table-column prop="realStartWhen" label="开始时间" />
    <el-table-column prop="realEndWhen" label="结束时间" />
    <el-table-column prop="creator" label="操作人" />
    <el-table-column prop="standardWorktime" label="工时" />
    <el-table-column prop="operationSort" label="工步" />
    <template #empty>
      <div class="empty">
        <Empty />
      </div>
    </template>
  </el-table>
  <Pagination position="right" :page="page" :limit="limit" :total="total" @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,
  });
  total.value = data.totalCount;
  tableData.value = data.records;
};
onMounted(() => {
  getPagination();
  setTableHeight();
});
</script>

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