import { BasicColumn, FormSchema } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '案件编号',
    dataIndex: 'case_no',
  },
  {
    title: '案件详情',
    dataIndex: 'case_description',
  },
  {
    title: '办理人',
    dataIndex: 'deal_username',
  },
  {
    title: '办理时间',
    dataIndex: 'deal_time',
  },
  {
    title: '新增退回',
    dataIndex: 'is_drawback',
    customRender: ({ record }) => {
      const status = record.is_drawback;
      const enable = ~~status === 1;
      const text = enable ? '退回案件' : '新增案件';
      return text;
    },
  },
  {
    title: '是否违法',
    dataIndex: 'is_illegal',
    customRender: ({ record }) => {
      const status = record.is_illegal;
      if (status == 1) {
        const text = '违法';
        return text;
      } else if (status == 2) {
        const text = '伪变化';
        return text;
      } else {
        const text = '合法';
        return text;
      }
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'case_no',
    label: '案件编号：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'typename',
    label: '案件类型：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'case_description',
    label: '案件描述：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'homeAddress',
    label: '案件地址：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'area',
    label: '占用土地面积：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'handle_status_name',
    label: '案件状态：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'verifystatusname',
    label: '审核状态：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'lngLat',
    label: '经纬度：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'field1',
    label: '现场照片：',
    slot: 'imgSlot',
  },
  {
    field: 'field1',
    label: '现场视频：',
    slot: 'videoSlot',
  },
  {
    field: 'identification_user',
    label: '上报人：',
    component: 'Input',
    dynamicDisabled: true,
  },
  {
    field: 'identification_time',
    label: '上报时间：',
    component: 'Input',
    dynamicDisabled: true,
  },
];
