import { BasicColumn, FormSchema } from '@/components/Table';
import { getChildrenTree } from '@/api/demo/system';
import { getLoad } from '@/api/sys/sysDataItemDetail';
import {
  patchSourceOptions,
  yearOptions,
  markTypeOptions,
  xcsjNowStatusOptions,
  xcsjMapTypeOptions,
} from '@/utils/global';
import { yongtufenleiOptions } from '@/components/farmland/util'
import { getAppEnvConfig } from '@/utils/env';

const {  VITE_GLOB_GEOSERVER_PREFECTURE_CITY } = getAppEnvConfig();

export const columns: BasicColumn[] = [
  {
    title: '区县',
    dataIndex: 'countyname',
    width: 100,
  },
  {
    title: '乡镇',
    dataIndex: 'streetname',
  },
  {
    title: '社区/村',
    dataIndex: 'communityname',
  },
  {
    title: '项目名称',
    dataIndex: 'case_name',
    width: 200,
  },
  {
    title: '线索编号',
    dataIndex: 'caseno',
    width: 200,
  },
 
  {
    title: '线索面积',
    dataIndex: 'area',
    width: 110,
  },
  {
    title: '耕地面积',
    dataIndex: 'gengdi_area',
    width: 110,
  },
  {
    title: '永农面积',
    dataIndex: 'yongjiujibennongtian_area',
    width: 110,
  },
  {
    title: '当前状态',
    dataIndex: 'handle_status_name',
    width: 80,
  },
  {
    title: '三调建设用地面积',
    dataIndex: 'sandiaojsyd_area',
    width: 80,
  },
  {
    title: '三调农用地面积',
    dataIndex: 'sandiaonyd_area',
    width: 80,
  },
  {
    title: '三调耕地面积',
    dataIndex: 'sandiaogd_area',
    width: 80,
  },
  {
    title: '2022建设用地面积',
    dataIndex: 'jsyd_area_2022',
    width: 80,
  },
  {
    title: '2022农用地面积',
    dataIndex: 'nyd_area_2022',
    width: 80,
  },
  {
    title: '2022耕地面积',
    dataIndex: 'gd_area_2022',
    width: 80,
  },
  {
    title: '套合永农面积',
    dataIndex: 'taoheyn_area',
    width: 80,
  },
  {
    title: '是否占用生态红线',
    dataIndex: 'is_zhanyongsthx',
    width: 80,
  },
  {
    title: '是否占用重点区域',
    dataIndex: 'is_zhanyongzdqy',
    width: 80,
  },
  {
    title: '用途分类',
    dataIndex: 'yongtufenlei',
    width: 80,
  },
  {
    title: '是否处罚完成',
    dataIndex: 'is_chufa',
    width: 80,
  },
  {
    title: '处置措施',
    dataIndex: 'is_chuzhicuosi',
    width: 80,
  },
  {
    title: '是否处置完成',
    dataIndex: 'is_chuzhiwancheng',
    width: 80,
  },
  {
    title: '完善手续情况',
    dataIndex: 'wanshanshouxu',
    width: 80,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'countyid',
    label: '区县',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: ({ tableAction, formModel }) => {
      return {
        api: getChildrenTree,
        params: { parentId: VITE_GLOB_GEOSERVER_PREFECTURE_CITY },
        // 接口参数
        resultField: 'result',
        labelField: 'name',
        valueField: 'id',
        onChange: () => {
          formModel.streetid = '';
        },
      };
    },
  },
  {
    field: 'streetid',
    label: '乡镇',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: ({ formModel }) => {
      return {
        api: formModel.countyid && getChildrenTree,
        params: { parentId: formModel.countyid },
        // 接口参数
        resultField: 'result',
        labelField: 'name',
        valueField: 'id',
      };
    },
  },
  {
    field: 'is_chuzhiwancheng',
    label: '处置情况',
    component: 'Select',
    componentProps: {
      options: [
        { label: '未处置', value: 99 },
        { label: '拟处置', value: 0 },
        { label: '已处置', value: 1 },
      ],
    },
    colProps: { span: 4 },
  },
  {
    field: 'yongtufenlei',
    label: '用途分类',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
       options: yongtufenleiOptions,
    },
  },
  {
    field: 'measure_name',
    label: '整改措施',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '拆除复耕', value: '拆除复耕' },
        { label: '补办建设用地手续', value: '补办建设用地手续' },
        { label: '补办设施农用地手续', value: '补办设施农用地手续' },
      ],
    },
  },
  {
    field: 'is_fuheguihua',
    label: '是否符合规划',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
  {
    field: 'nowStatus',
    label: '当前状态',
    component: 'Select',
    componentProps: {
      options: [
        { label: '待填报', value: '待填报' },
        { label: '已完成', value: '已完成' },
      ],
    },
    colProps: { span: 4 },
  },
  {
    field: 'juzheng',
    label: '举证情况',
    component: 'Select',
    componentProps: {
      options: [
        { label: '全部', value: 0 },
        { label: '已举证', value: 1 },
        { label: '未举证', value: 2 },
      ],
    },
    colProps: { span: 4 },
  },
  {
    field: 'case_name',
    label: '项目名称',
    component: 'Input',
    colProps: { span: 5 },
  },
  {
    field: 'caseNo',
    label: '线索编号',
    component: 'Input',
    colProps: { span: 5 },
  },
];
