<template>
  <div class="tktjClass">
    <!--查询区域-->
      <a-form @keyup.enter.native="searchQuery" :model="queryParam"  >
        <a-row :gutter="24">
          <a-col :span="3">
            <a-form-item label="">
              <JDictSelectTag placeholder="听课身份" v-model:value="queryParam.tksf" dictCode="kc_tksf"/>
            </a-form-item>
          </a-col> 
          <a-col :span="4">
            <a-form-item label="">
              <JDictSelectTag placeholder="听课人所在单位" v-model:value="queryParam.szdw"  :dictCode="`tkrszdw_view,college,college`"/>
            </a-form-item>
          </a-col>
          <a-col :span="3">
            <a-form-item label="">
              <JDictSelectTag placeholder="开课单位" v-model:value="queryParam.kkdw" :dictCode="`kc_kkdw_view,kkdw,kkdw`"/>
            </a-form-item>
          </a-col>
          <a-col :span="3">
            <a-form-item label="">
              <JDictSelectTag placeholder="课程性质" v-model:value="queryParam.kcxz" dictCode="kc_kcxz"/>
            </a-form-item>
          </a-col>
          <a-col :span="3">
            <a-form-item label="">
              <a-date-picker
                :showTime="false"
                valueFormat="YYYY-MM-DD"
                :placeholder="'请选择开始时间'"
                v-model:value="queryParam.startTime"
              ></a-date-picker>
            </a-form-item>
          </a-col>
          <a-col :span="3">
            <a-form-item label="">
              <a-date-picker
                :showTime="false"
                valueFormat="YYYY-MM-DD"
                :placeholder="'请选择结束时间'"
                v-model:value="queryParam.endTime"
              ></a-date-picker>
            </a-form-item>
          </a-col>
          <a-col :span="4">
            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
                <a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
                <a-button  type="primary" preIcon="ant-design:export-outlined" style="margin-left: 10px;" @click="onExportXls"> 导出</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    <!--引用表格-->
    <BasicTable @register="registerTable">
    </BasicTable>
    <!-- 表单区域 -->
    <KcTingkeModal ref="registerModal" @success="handleSuccess"></KcTingkeModal>
  </div>
</template>

<script lang="ts" name="kcTingke-kcTingke" setup>
  import { ref, reactive ,onMounted} from 'vue';
  import { dateFormat } from '/@/utils/common/compUtils';
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import { useListPage } from '/@/hooks/system/useListPage';
  import { columns } from './KcTingke.data';
  import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './KcTingke.api';
  import { downloadFile } from '/@/utils/common/renderUtils';
  import KcTingkeModal from './components/KcTingkeModal.vue'
  import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';

  const queryParam = ref<any>({});
  const toggleSearchStatus = ref<boolean>(false);
  const registerModal = ref();
  //注册table数据
  const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
    tableProps: {
      api: list,
      columns,
      canResize:true,
      useSearchForm: false,
      showActionColumn: false,
      clickToRowSelect: true,
      pagination: {
        pageSize: 5
      },
      beforeFetch: (params) => {
        params.column = '',params.order = '';
        return Object.assign(params, queryParam.value);
      },
    },
    exportConfig: {
      name: "听课人员统计",
      url: getExportUrl,
      params: queryParam.value,
    },
	  importConfig: {
	    url: getImportUrl,
	    success: handleSuccess
	  },
  });
  const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
  const labelCol = reactive({
    xs: { span: 24 },
    sm: { span: 7 },
  });
  const wrapperCol = reactive({
    xs: { span: 24 },
    sm: { span: 16 },
  });
   
  //进入就加载
  onMounted(() => {
    const format = 'yyyy-MM-dd';
    const startTime = new Date();
    startTime.setTime(startTime.getTime()-60000*60*24*7)
    queryParam.value.startTime =  dateFormat(startTime, format)
    queryParam.value.endTime =  dateFormat(new Date(), format)
  });
  /**
   * 成功回调
   */
  function handleSuccess() {
    (selectedRowKeys.value = []) && reload();
  }
   
function daochu(){
  
}
  /**
   * 查询
   */
  function searchQuery() {
    reload();
  }
  
  /**
   * 重置
   */
  function searchReset() {
    queryParam.value = {};
    selectedRowKeys.value = [];
    //刷新数据
    reload();
  }
  




</script>

<style lang="less" scoped>
  .jeecg-basic-table-form-container {
    .table-page-search-submitButtons {
      display: block;
      margin-bottom: 24px;
      white-space: nowrap;
    }
    .query-group-cust{
      width: calc(50% - 15px);
      min-width: 100px !important;
    }
    .query-group-split-cust{
      width: 30px;
      display: inline-block;
      text-align: center
    }
  }
</style>
