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

export const columns: BasicColumn[] = [
  {
    dataIndex: 'case_no',
    title: '案件编号',
  },
  {
    dataIndex: 'countyname',
    title: '县区',
    defaultHidden: true,
  },
  {
    dataIndex: 'streetname',
    title: '乡镇',
  },
  {
    dataIndex: 'communityname',
    title: '村/社区',
  },
  {
    dataIndex: 'address',
    title: '详细地址',
    defaultHidden: true,
  },
  {
    dataIndex: 'lng',
    title: '经度',
    defaultHidden: true,
  },
  {
    dataIndex: 'lat',
    title: '纬度',
    defaultHidden: true,
  },
  {
    dataIndex: 'area',
    title: '占地面积',
    defaultHidden: true,
  },
  {
    dataIndex: 'case_description',
    title: '案件描述',
  },
  {
    dataIndex: 'typename',
    title: '案件类型',
  },
  {
    dataIndex: 'handle_status_name',
    title: '案件状态',
  },
  {
    dataIndex: 'deal_username',
    title: '处理人',
    defaultHidden: true,
  },
  {
    dataIndex: 'deal_time',
    title: '处理时间',
    defaultHidden: true,
  },
  {
    dataIndex: 'identification_user',
    title: '判读人',
    defaultHidden: true,
  },
  {
    dataIndex: 'verifystatusname',
    title: '审核流程',
    defaultHidden: true,
  },
  {
    dataIndex: 'createusername',
    title: '上报人',
    defaultHidden: true,
  },
  {
    dataIndex: 'createtime',
    title: '上报时间',
    defaultHidden: true,
  },
  {
    dataIndex: 'verifytime',
    title: '审核时间',
    defaultHidden: true,
  },
  {
    dataIndex: 'verifyuser',
    title: '审核人',
    defaultHidden: true,
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    defaultValue: 1,
    field: 'is_dealer',
    component: 'Input',
    label: '案件编号',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '案件编号',
    },
    ifShow: false,
  },
  {
    field: 'is_drawback',
    component: 'Select',
    label: '新增退回',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '新增退回',
      options: [
        { label: '新增', value: 0, key: '0' },
        { label: '退回', value: 1, key: '1' },
      ],
    },
  },
  {
    field: 'handle_status_id',
    component: 'Select',
    label: '办理状态',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '办理状态',
      options: [
        { value: 0, label: '未办理' },
        { value: 1, label: '待审核' },
        { value: 2, label: '已办结' },
      ],
    },
  },
  {
    field: 'typeid',
    component: 'ApiSelect',
    label: '案件类型',
    colProps: { span: 4 },
    componentProps: () => {
      return {
        api: getLoadCaseType, // 接口
        // 接口参数
        resultField: 'result',
        labelField: 'itemName',
        valueField: 'itemDetailId',
      };
    },
  },
  {
    field: 'countyid',
    component: 'ApiTreeSelect',
    colProps: { span: 4 },
    label: '查询地区',
    componentProps: () => {
      return {
        api: getDeptList,
        // 接口返回数据
        resultField: 'result',
        labelField: 'name',
        valueField: 'id',
      };
    },
  },
  {
    field: 'is_illegal',
    component: 'Select',
    colProps: { span: 4 },
    label: '现场状况',
    componentProps: {
      placeholder: '现场状况',
      options: [
        { value: 0, label: '合法' },
        { value: 1, label: '违法' },
        { value: 2, label: '伪变化' },
      ],
    },
  },
  {
    field: 'case_no',
    component: 'Input',
    label: '案件编号',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '案件编号',
    },
  },
  {
    field: 'key',
    component: 'Input',
    label: '关键字',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '请输入关键字',
    },
  },
  {
    field: 'identification_user',
    label: '判读人姓名',
    component: 'Input',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '判读人姓名',
    },
  },
  {
    field: 'deal_username',
    component: 'Input',
    label: '处理人姓名',
    colProps: { span: 4 },
    componentProps: {
      placeholder: '处理人姓名',
    },
  },
  {
    field: '[report_start_time, report_end_time]',
    component: 'RangePicker',
    label: '日期范围',
    componentProps: {
      format: 'YYYY-MM-DD',
      placeholder: ['开始日期', '结束日期'],
    },
    colProps: { span: 8 },
  },
];
