import { FormSchema } from '/@/components/Table';
import { findDictItemByCode } from '/@/api/system/dict';
import { BasicColumn } from '/@/components/Table';
import {
  getBasinInformationPage,
  getProjectInfoPage,
  getDisasterInformationCardPage,
} from '/@/views/dataSupport/method/api';
export const accountFormSchema: FormSchema[] = [
  {
    field: 'title',
    label: '',
    slot: 'title',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
    },
  },
  {
    field: 'fbdz',
    label: '发布地址:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 255,
    },
  },
  {
    field: 'zymc',
    label: '数据名称:',
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 50,
    },
  },
  {
    field: 'sjsj',
    label: '数据时间:',
    component: 'DatePicker',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    field: 'icon',
    label: '缩略图:',
    slot: 'iconSelect',
    component: 'Input',
    componentProps: {
      maxLength: 255,
    },
  },

  {
    field: 'note',
    label: '备注:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入备注',
    },
  },
  {
    field: 'titleT',
    label: '',
    slot: 'titleT',
    component: 'Input',
  },
  {
    field: 'jclx',
    label: '监测类型:',
    colProps: { span: 8 },
    component: 'ApiSelect',
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'disaster_monitoring_type',
      },
      labelField: 'itemText',
      valueField: 'id',
      resultField: 'items',
    },
  },
  {
    field: 'sjlx',
    label: '数据类型:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'disaster_data_type',
      },
      labelField: 'itemText',
      valueField: 'id',
      resultField: 'items',
    },
  },

  {
    field: 'sjjd',
    label: '数据精度:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      maxLength: 50,
    },
  },
  {
    field: 'sshdid',
    label: '所属河段:',
    colProps: { span: 8 },
    component: 'ApiSelect',
    componentProps: {
      api: getBasinInformationPage,
      params: {
        size: 1000,
      },
      labelField: 'lymc',
      valueField: 'id',
      resultField: 'result.records',
    },
  },
  {
    field: 'ssgcid',
    label: '所属工程:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: getProjectInfoPage,
      params: {
        size: 1000,
      },
      labelField: 'gcmc',
      valueField: 'id',
      resultField: 'result.records',
    },
  },

  {
    field: 'ssdzdid',
    label: '所属地灾点:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: getDisasterInformationCardPage,
      params: {
        size: 1000,
      },
      labelField: 'dzmc',
      valueField: 'id',
      resultField: 'result.records',
    },
  },
  {
    field: 'sjms',
    label: '数据描述:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入备注',
    },
  },
];
export const accountFormSchemaT: FormSchema[] = [
  {
    field: 'title',
    label: '',
    slot: 'title',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
      disabled: true,
    },
  },
  {
    field: 'fbdz',
    label: '发布地址:',
    component: 'Input',
    slot: 'fbdz',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 255,
      disabled: true,
    },
  },
  {
    field: 'zymc',
    label: '数据名称:',
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 50,
      disabled: true,
    },
  },
  {
    field: 'sjsj',
    label: '数据时间:',
    component: 'DatePicker',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      disabled: true,
    },
  },
  {
    field: 'icon',
    label: '缩略图:',
    slot: 'iconSelect',
    component: 'Input',
    componentProps: {
      maxLength: 255,
      disabled: true,
    },
  },

  {
    field: 'note',
    label: '备注:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      disabled: true,
    },
  },
  {
    field: 'titleT',
    label: '',
    slot: 'titleT',
    component: 'Input',
  },
  {
    field: 'jclx',
    label: '监测类型:',
    colProps: { span: 8 },
    component: 'ApiSelect',
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'disaster_monitoring_type',
      },
      labelField: 'itemText',
      valueField: 'id',

      disabled: true,
    },
  },
  {
    field: 'sjlx',
    label: '数据类型:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'disaster_data_type',
      },
      labelField: 'itemText',
      valueField: 'id',
      resultField: 'items',
      disabled: true,
    },
  },

  {
    field: 'sjjd',
    label: '数据精度:',
    component: 'Input',
    colProps: { span: 8 },
    componentProps: {
      maxLength: 50,
      disabled: true,
    },
  },
  {
    field: 'sshdid',
    label: '所属河段:',
    colProps: { span: 8 },
    component: 'ApiSelect',
    componentProps: {
      api: getBasinInformationPage,
      params: {
        size: 1000,
      },
      labelField: 'lymc',
      valueField: 'id',
      disabled: true,
      resultField: 'result.records',
    },
  },
  {
    field: 'ssgcid',
    label: '所属工程:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: getProjectInfoPage,
      params: {
        size: 1000,
      },
      labelField: 'gcmc',
      valueField: 'id',
      disabled: true,
      resultField: 'result.records',
    },
  },

  {
    field: 'ssdzdid',
    label: '所属地灾点:',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      api: getDisasterInformationCardPage,
      params: {
        size: 1000,
      },
      labelField: 'dzmc',
      valueField: 'id',
      disabled: true,
      resultField: 'result.records',
    },
  },
  {
    field: 'sjms',
    label: '数据描述:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      disabled: true,
    },
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'jclx',
    label: '监测类型',
    component: 'ApiSelect',
    componentProps: () => {
      return {
        labelField: 'itemText',
        valueField: 'id',
        placeholder: '请选择监测类型',
        params: {
          dictCode: 'disaster_monitoring_type',
        },
        api: findDictItemByCode,
      };
    },
    colProps: { span: 6 },
  },
  {
    field: 'sjlx',
    label: '数据类型',
    component: 'ApiSelect',
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'disaster_data_type',
      },
      labelField: 'itemText',
      valueField: 'id',
    },
    colProps: { span: 6 },
  },
  {
    field: 'queryDate',
    label: '发布时间',
    component: 'RangePicker',
    colProps: { span: 6 },
    // rules: [{ message: '查询时间必填项' }],
    // defaultValue: ['',],
  },
];
let getSjlx;
let getJclx;

async function formatTextFunc() {
  getSjlx = await findDictItemByCode({ dictCode: 'disaster_monitoring_type' });
  getJclx = await findDictItemByCode({ dictCode: 'disaster_data_type' });
}
formatTextFunc();
export const columns: BasicColumn[] = [
  {
    title: '资源名称',
    dataIndex: 'zymc',
    width: 160,
  },
  {
    title: '监测类型',
    dataIndex: 'jclxmc',
    width: 160,
 
  },
  {
    title: '数据类型',
    dataIndex: 'sjlxmc',
    width: 160,
  },

  {
    title: '发布人',
    dataIndex: 'createdName',
    width: 160,
  },
  {
    title: '发布时间',
    dataIndex: 'createdTime',
    width: 160,
  },
];
