<template>
  <PageWrapper dense contentFullHeight fixedHeight contentClass="flex">
    <BasicTable
      class="w-4/4 xl:w-5/5"
      @register="registerTable"
      @fetch-success="onFetchSuccess"
      :searchInfo="searchInfo"
    >
    <template #bodyCell="{ column, record }">
      <template v-if="column.key === 'action'">
        <div class="handlebox">
          <div class="btnbox">查看<br />数据</div>
          <div class="btnbox">全部<br />审核</div>
          <div class="btnbox">发起<br />分析</div>
          <div class="btnbox">修改<br />任务</div>
          <div class="btnbox">审核<br />任务</div>
          <div class="btnbox">在线<br />报告</div>
        </div>      
      </template>
    </template>
    </BasicTable>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { reactive, nextTick, ref } from 'vue';

  import { BasicTable, useTable } from '@/components/Table';
  import { getButtonList } from '@/api/demo/system';
  import { PageWrapper } from '@/components/Page';

  import { columns, searchFormSchema } from './index.data';
  import { useMessage } from '@/hooks/web/useMessage';

  const { createConfirm, createMessage } = useMessage();
  defineOptions({ name: 'workreport' });
  const searchInfo = reactive<Recordable>({});

  const [registerTable, { reload, expandAll, getSelectRows, clearSelectedRowKeys }] = useTable({
    title: '智能分析',
    api: getButtonList,
    columns,
    rowKey: 'id',
    formConfig: {
      labelWidth: 120,
      schemas: searchFormSchema,
    },
    striped: false,
    useSearchForm: true,
    showTableSetting: true,
    bordered: true,
    rowSelection: false,
    showIndexColumn: false,
    actionColumn: {
      width: 320,
      title: '操作',
      dataIndex: 'action',
    },
    handleSearchInfoFn(info) {
      return info;
    },
  });

  function onFetchSuccess() {
    // 演示默认展开所有表项
    nextTick(expandAll);
  }
</script>
<style scoped>
.handlebox{
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  .btnbox{
    width: 42px;
    height: 42px;
    line-height: 15px;
    background: rgba(183,193,246,0.2);
    box-shadow: 0px 10px 13px 0px rgba(17,38,146,0.05);
    border-radius: 4px;
    border: 1px solid #3A57E8;
    font-size: 12px;
    color: #3A57E8;
    display: flex;
    align-items: center;
    justify-content: center;
    word-break: break-all;
    cursor: pointer
  }
  .active{
    background: #3A57E8;
    box-shadow: 0px 10px 13px 0px rgba(17,38,146,0.05);
    border-radius: 4px;
    border: 1px solid #3A57E8;
    color: #FFFFFF;
  }
}

</style>