<template>
  <el-scrollbar :height="tableHeight + 100">
    <el-table :data="tableData" id="tableStyle" :height="tableHeight" border>
      <el-table-column prop="operationName" label="冻结状态">
        <template #default="scope">
          {{ dictS.getLableByValue("escalation_fault_state", scope.row.state) }}
        </template>
      </el-table-column>
      <el-table-column prop="creator" label="报故人" />
      <el-table-column prop="stationName" label="报故工位" />
      <el-table-column prop="created" label="报故时间" />
      <el-table-column prop="disposalMeasures" label="处理结果">
        <template #default="scope">
          {{
            dictS.getLableByValue(
              "disposal_measures_type",
              scope.row.disposalMeasures
            )
          }}
        </template>
      </el-table-column>
      <el-table-column prop="standard" label="备注" />
      <template #empty>
        <div class="empty">
          <Empty />
        </div>
      </template>
    </el-table>
    <Pagination
      position="right"
      :page="page"
      :limit="limit"
      :total="total"
      @pagination="getPagination"
    />
  </el-scrollbar>
</template>

<script lang="ts" setup>
import { useProcessStore } from "@/store";
import { escalationRecordInfo } from "@/api/process/traceability";
import { useDictionaryStore } from "@/store";
const dictS = useDictionaryStore();
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) - 110;
};
const getPagination = async () => {
  const { data } = await escalationRecordInfo({
    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>
