<template>
  <el-dialog v-model="visible" width="80%" title="学校变更历史">
        <el-table  ref="tableRef"
                   :data="state.dataList"
                   v-loading="state.loading"
                   border
                   stripe
                   row-key="id"
                   :cell-style="tableStyle.cellStyle"
                   :header-cell-style="tableStyle.headerCellStyle">
          <el-table-column label="学校代码" prop="schoolCode"></el-table-column>
          <el-table-column label="旧名称" prop="oldName"></el-table-column>
          <el-table-column label="新名称" prop="newName"></el-table-column>
          <el-table-column label="变动时间" prop="createTime"></el-table-column>
        </el-table>

      <pagination
          v-bind="state.pagination"
          @current-change="currentChangeHandle"
          @size-change="sizeChangeHandle"
      />

  </el-dialog>
</template>


<script setup lang="ts">
import {useTable,BasicTableProps} from "/@/hooks/table";
import {fetchList} from "/@/api/recruit/recruitSchoolHistory";

// 表格状态
const state: BasicTableProps = reactive<BasicTableProps>({
  queryForm: {},
  createdIsNeed: false,
  pageList: async (params: any) => {
    const response = await fetchList(params)
    return {
      data: {
        records: response.data.records,
        total: response.data.total
      }
    }
  },
  createdIsNeed: false
})
const visible = ref(false)

const { getDataList, currentChangeHandle, sizeChangeHandle, tableStyle } = useTable(state)


const init=()=>{
  visible.value = true
  getDataList()
}

defineExpose({
  init
})
</script>

<style scoped lang="scss">

</style>