<template>
  <PageWrapper dense contentFullHeight fixedHeight>
    <BasicTable @register="registerTable" isMenuTable>
      <template #toolbar> </template>
    </BasicTable>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { getProcessTasksPage } from '/@/api/workflow/delegate';
  import { BasicTable, useTable, FormSchema, BasicColumn } from '/@/components/Table';

  import { PageWrapper } from '/@/components/Page';
  import { useI18n } from '/@/hooks/web/useI18n';
  const { t } = useI18n();
  const configColumns: BasicColumn[] = [
    {
      title: t('流程名称'),
      dataIndex: 'processName',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 1,
      },
    },
    {
      title: t('开始时间'),
      dataIndex: 'startTime',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 2,
      },
    },
    {
      title: t('结束时间'),
      dataIndex: 'endTime',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 2,
      },
    },
    {
      title: t('任务名称'),
      dataIndex: 'taskName',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 4,
      },
    },
    {
      title: t('审核人'),
      dataIndex: 'approveUserName',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 3,
      },
    },
    {
      title: t('是否异常'),
      dataIndex: 'isError',
      width: 180,
      resizable: true,
      sorter: {
        multiple: 5,
      },
      customRender: ({ record }) => {
        return record.isError ? '异常' : '正常';
      },
    },
  ];
  const searchFormSchema: FormSchema[] = [
    {
      field: 'keyword',
      label: t('关键字'),
      component: 'Input',
      colProps: { span: 8 },
      componentProps: {
        placeholder: t('请输入关键字'),
      },
    },
  ];
  const [registerTable] = useTable({
    title: t('流程任务分析列表'),
    api: getProcessTasksPage,
    columns: configColumns,
    formConfig: {
      rowProps: {
        gutter: 16,
      },
      schemas: searchFormSchema,
      showResetButton: false,
    },
    striped: false,
    useSearchForm: true,
    showTableSetting: true,
    tableSetting: {
      size: false,
    },
  });
</script>
