import { BasicColumn, FormSchema } from '@/components/Table';
import { getLoadCaseType } from '@/api/sys/sysDataItemDetail';
import { getDeptList } from '@/api/demo/system';

export const tableColums: BasicColumn[] = [
  {
    title: '案件编号',
    dataIndex: 'case_no',
    width: 120,
  },
  {
    title: '上报时间',
    dataIndex: 'createtime',
    width: 120,
  },
  {
    title: '地点',
    dataIndex: 'address',
    width: 150,
  },
  {
    title: '案件描述',
    dataIndex: 'case_description',
    width: 150,
  },
  {
    title: '处理时间',
    dataIndex: 'deal_time',
    width: 120,
  },
  {
    title: '案件处理人',
    dataIndex: 'deal_username',
    width: 80,
  },
  {
    title: '处理进度',
    dataIndex: 'verifystatusname',
    width: 80,
  },
  // {
  //   title: '处理状态',
  //   dataIndex: 'handle_status_name',
  //   width: 80,
  // },
  {
    title: '案件审核人',
    dataIndex: 'verifyuser',
    width: 80,
  },
  {
    title: '办结时间',
    dataIndex: 'verifytime',
    width: 120,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: '[report_start_time, report_end_time]',
    component: 'RangePicker',
    label: '日期范围',
    componentProps: {
      format: 'YYYY-MM-DD',
      placeholder: ['开始日期', '结束日期'],
    },
    colProps: { span: 6 },
  },
  {
    field: 'countyid',
    component: 'ApiTreeSelect',
    colProps: { span: 6 },
    label: '查询地区',
    componentProps: () => {
      return {
        api: getDeptList,
        // 接口返回数据
        resultField: 'result',
        labelField: 'name',
        valueField: 'id',
      };
    },
  },
  {
    field: 'typeid',
    component: 'ApiSelect',
    label: '案件类型',
    colProps: { span: 6 },
    componentProps: () => {
      return {
        api: getLoadCaseType, // 接口
        // 接口参数
        resultField: 'result',
        labelField: 'itemName',
        valueField: 'itemDetailId',
      };
    },
  },

  {
    field: 'is_illegal',
    component: 'Select',
    colProps: { span: 6 },
    label: '现场状况',
    componentProps: {
      placeholder: '现场状况',
      options: [
        { value: 0, label: '合法' },
        { value: 1, label: '违法' },
        { value: 2, label: '伪变化' },
      ],
    },
  },
  {
    field: 'case_no',
    component: 'Input',
    label: '案件编号',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '案件编号',
    },
  },
  {
    field: 'deal_username',
    component: 'Input',
    label: '处理人姓名',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '处理人姓名',
    },
  },
  {
    field: 'verify_user',
    component: 'Input',
    label: '审核人姓名',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '审核人姓名',
    },
  },
  {
    field: 'key',
    label: '关键字',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入关键字',
    },
  },
];
