import { BasicColumn, FormSchema } from '@/components/Table';
import dayjs from 'dayjs';
import { getLoad } from '@/api/sys/sysDataItemDetail';

// 无人机发现违法行为情况统计明细表-table
export const columns: BasicColumn[] = [
  {
    title: 'countyid',
    dataIndex: '县区id',
    ifShow: false,
  },
  {
    title: '县区',
    dataIndex: 'countyname',
    width: 100,
    fixed: 'left',
  },
  {
    title: '下发问题总数',
    dataIndex: 'xfwtzs',
    width: 100,
  },
  {
    title: '合法',
    dataIndex: 'hf',
    width: 100,
  },
  {
    title: '其他',
    dataIndex: 'qt',
    width: 100,
  },
  {
    title: '违法',
    dataIndex: 'wf',
    width: 100,
  },
  {
    title: '已完成归档',
    dataIndex: 'ywcgd',
    width: 100,
  },
  {
    title: '未完成归档',
    dataIndex: 'wwcgd',
    width: 100,
  },
  {
    title: '未完成归档',
    width: 200,
    children: [
      {
        title: '违法采矿',
        dataIndex: 'wfck',
        width: 100,
      },
      {
        title: '违法加工',
        dataIndex: 'wfjg',
        width: 100,
      },
    ],
  },
  {
    title: '整改率',
    dataIndex: 'zgl',
    fixed: 'right',
    width: 100,
  },
  {
    title: '驳回率',
    dataIndex: 'bhl',
    fixed: 'right',
    width: 100,
  },
  {
    title: '上报率',
    dataIndex: 'sbl',
    fixed: 'right',
    width: 100,
  },
];

// 无人机发现违法行为情况统计明细表-table
export const columnsNew: BasicColumn[] = [
  {
    title: 'countyid',
    dataIndex: '县区id',
    ifShow: false,
  },
  {
    title: '县区',
    dataIndex: 'countyname',
    width: 100,
    fixed: 'left',
  },
  {
    title: '下发线索总数（个）',
    dataIndex: 'xfwtzs',
    width: 150,
  },
  {
    title: '总数',
    children: [
      {
        title: '已完成（个）',
        dataIndex: 'ywc',
        width: 100,
      },
      {
        title: '未完成（个）',
        dataIndex: 'wwc',
        width: 100,
      },
      {
        title: '完成率（%）',
        dataIndex: 'wcl',
        width: 100,
      },
    ]
  },
  {
    title: '定性',
    children: [
      {
        title: '合法（个）',
        dataIndex: 'dxhf',
        width: 100,
      },
      {
        title: '违法（个）',
        dataIndex: 'dxwf',
        width: 100,
      },
      {
        title: '其他（个）',
        dataIndex: 'dxqt',
        width: 100,
      },
      {
        title: '未定性（个）',
        dataIndex: 'dxwdx',
        width: 100,
      },
    ]
  },
  {
    title: '分类',
    children: [
      {
        title: '非法开采（个）',
        dataIndex: 'flffkc',
        width: 100,
      },
      {
        title: '非法加工（个）',
        dataIndex: 'flffjg',
        width: 100,
      },
    ]
  },
  {
    title: '超期未报（个）',
    dataIndex: 'cqwb',
    fixed: 'right',
    width: 100,
  },
];

// 无人机发现违法行为情况统计明细表-搜索
export const searchFormSchema: FormSchema[] = [
  {
    field: '[startTime, endTime]',
    label: '日期范围',
    component: 'RangePicker',
    colProps: { span: 8 },
    componentProps: {
      format: 'YYYY-MM-DD',
      placeholder: ['开始日期', '结束日期'],
      defaultValue: [dayjs('2024-08-01', 'YYYY-MM-DD'), dayjs(dayjs().add(-1, 'day'), 'YYYY-MM-DD')]
    },
  },
  {
    field: 'tubanlaiyuan',
    label: '图斑来源',
    component: 'ApiSelect',
    colProps: { span: 5 },
    componentProps: ({ formModel }) => {
      return {
        api: getLoad,
        params: { code: 'tubanlaiyuan' },
        // 接口参数
        resultField: 'result',
        labelField: 'itemName',
        valueField: 'itemValue',
        mode: 'multiple',
        maxTagCount: 1
      };
    },
  },
];
