<template>
  <div class="dsion-step5">
    <BasicTable @register="registerTable">
      <template #toolbar>
        <!-- <a-button type="primary" @click="handelConfirm">分班确认</a-button> -->
      </template>
    </BasicTable>
  </div>
</template>

<script setup lang="ts">
  import { reactive, watch } from 'vue';
  import { BasicTable, useTable } from '/@/components/Table';
  import { table5Columns } from '../data.config';
  import { getBandingTaskClassClassSure } from '/@/services/apis/BandingTaskClassController';
  import { postBandingTaskSure } from '/@/services/apis/BandingTaskController';

  const [registerTable, { reload }] = useTable({
    api: getBandingTaskClassClassSure,
    title: '班级列表',
    rowKey: 'id',
    useSearchForm: false,
    columns: table5Columns,
    showTableSetting: true,
    bordered: true,
    immediate: true,
    canResize: true,
    pagination: false,
  });

  const searchInfo = reactive<Recordable>({});

  const props = defineProps({
    taskId: { type: String, default: '' },
  });

  watch(
    () => props.taskId,
    async (newVal) => {
      if (newVal) {
        searchInfo.bandingTaskId = newVal;
      }
    },
  );

  const validateStep = () => {
    return true;
  };

  const reloadStep = () => {
    reload();
  };

  const handelConfirm = async () => {
    await postBandingTaskSure({ id: props.taskId });
  };

  defineExpose({ validateStep, reloadStep });
</script>

<style lang="less" scoped>
  .dsion-step5 {
    margin: 16px 0;
  }
</style>
