<template>
  <div>
    <BasicTable :clickToRowSelect="false" @register="registerTable">
      <template #action="{ record }">
        <!-- v-if="dataCenter.editableData[record.ordern]" -->
        <!-- <div>{{dataCenter.editableData[record.ordern]}}</div> -->
        <TableAction
          :actions="[
            {
              label: '编辑',
              // auth: 'api:sw:hhgl:eidt',
              icon: 'clarity:note-edit-line',
              onClick: handleViewEidt.bind(null, record),
            },
          ]"
        />
      </template>
      <template #toolbar>
        <Authority>
          <a-button type="primary" @click="exportDataFn">导出</a-button>
        </Authority>
      </template>
    </BasicTable>
    <AccountModalLibrar2 @register="registerModal" @success="handleSuccess" />
  </div>
</template>
<script lang="ts" setup>
import { computed, defineComponent, createVNode, ref, watch, onMounted, reactive } from 'vue';
import { BasicTable, useTable, TableAction } from '/@/components/Table';
import { getHangduingConfigShow } from '/@/api/swHome/index';
import AccountModalLibrar2 from './components/AccountModalLibrar2.vue';
import { useModal } from '/@/components/Modal';
const [registerModal, { openModal }] = useModal();
import { exportData } from '/@/utils/fnUtils.ts';
import { getBasicColumns } from './columnsProcessing';
let dataCenter = reactive({
  
});
// 表格控件
const [
  registerTable,
  { reload,getColumns, getDataSource, getForm, setColumns, getSelectRowKeys, getRowSelection, setTableData },
] = useTable({
  title: '定时处理参数配置',
  api: getHangduingConfigShow,
  columns: getBasicColumns(),
  showIndexColumn: true,
  clickToRowSelect: false,
  inset: true,
  // rowSelection: { type: 'checkbox' },
  tableSetting: {
    redo: false,
    setting: false,
  },
  beforeFetch: (params: any) => {
    return {};
  },
  useSearchForm: false,
  showTableSetting: true,
  bordered: true,
  fetchSetting: {
    listField: 'data',
  },
  actionColumn: {
    width: 200,
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
    fixed: 'right',
  },
});
// 编辑
const handleViewEidt = (key, item) => {
  openModal(true, {
    isUpdate: true,
    data:key
  });
};
const exportDataFn = () => {
  exportData(getColumns(),getDataSource(),'定时处理参数配置.xlsx')
}
// 成功
const handleSuccess = () => {
  // console.log('成功啦')
  reload()
}
</script>