import { FormSchema } from '/@/components/Table';
import { findDictItemByCode } from '/@/api/system/dict';
import { BasicColumn } from '/@/components/Table';

export const accountFormSchema: FormSchema[] = [
  {
    field: 'title',
    label: '',
    slot: 'title',
    component: 'Input',
  },
  {
    field: 'id',
    label: 'id',
    component: 'Input',
    show: false,
    componentProps: {
      maxLength: 36,
    },
  },
  {
    field: 'code',
    label: '数据编码:',
    component: 'Input',
    colProps: { span: 12 },
    required: true,

    componentProps: {
      style: 'width:100%',
      maxLength: 50,
    },
  },
  {
    field: 'epsg',
    label: '坐标系编码:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      mix: 0,
      style: 'width:100%',
    },
  },

  {
    field: 'zymc',
    label: '数据名称:',
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 50,
    },
  },
  {
    field: 'fbdz',
    label: '发布地址:',
    component: 'InputTextArea',

    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 255,
    },
  },

  {
    field: 'scene',
    label: '使用场景:',
    component: 'RadioGroup',
    colProps: { span: 8 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: '地形', value: '1' },
        { label: '三维', value: '3' },
        { label: '二维', value: '2' },
      ],
      emptySpan: 4,
    },
  },
  {
    field: 'showInput',
    label: '',
    component: 'Input',
    colProps: { span: 4 },
    slot: 'showInput',
    show: ({ values }) => {
      return values.scene !== '2';
    },
  },
  {
    field: 'type',
    label: '',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'gis_map_type',
      },
      labelField: 'itemText',
      valueField: 'id',
      resultField: 'items',
    },
    show: ({ values }) => {
      return values.scene == '2';
    },
  },

  {
    field: 'show',
    label: '默认是否显示:',
    component: 'RadioGroup',
    colProps: { span: 6 },
    defaultValue: 1,
    componentProps: {
      labelAlign: 'right',
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
  {
    field: 'tmd',
    label: '透明度:',
    component: 'Slider',
    colProps: { span: 6 },
    slot: 'slider',
    componentProps: {
      min: 0,
      max: 1,
    },
  },
  {
    field: 'blc_min',
    label: '最小显示比例尺:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      mix: 0,
      style: 'width:100%',
    },
  },
  {
    field: 'blc_max',
    label: '最大显示比例尺:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      mix: 0,
      style: 'width:100%',
    },
  },


  {
    field: 'fwfz',
    label: '服务分组:',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      maxLength: 50,
    },
  },
  {
    field: 'fzxh',
    label: '分组序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',

      mix: 0,
    },
  },
  {
    field: 'fwxh',
    label: '服务序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',
      mix: 0,
    },
  },
  {
    field: 'jzxh',
    label: '加载序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',
      mix: 0,
    },
  },
  {
    field: 'tag',
    label: '标签:',
    component: 'Input',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 50,
    },
  },
  {
    field: 'note',
    label: '备注:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入备注',
    },
  },
  {
    field: 'icon',
    label: '缩略图:',
    slot: 'iconSelect',
    component: 'Input',
    componentProps: {
      maxLength: 255,
    },
  },
];
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: 'code',
    label: '数据编码:',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',
      maxLength: 50,
      disabled: true,
    },
  },
  {
    field: 'epsg',
    label: '坐标系编码:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      mix: 0,
      style: 'width:100%',
      disabled: true,
    },
  },

  {
    field: 'zymc',
    label: '数据名称:',
    component: 'Input',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 50,
      disabled: true,
    },
  },

  {
    field: 'fbdz',
    label: '发布地址:',
    slot: 'fbdz',
    component: 'InputTextArea',
    colProps: { span: 24 },
    required: true,
    componentProps: {
      maxLength: 255,
      disabled: true,
    },
  },

  {
    field: 'scene',
    label: '使用场景:',
    component: 'RadioGroup',
    colProps: { span: 8 },
    defaultValue: '1',
    componentProps: {
      options: [
        { label: '地形', value: '1' },
        { label: '三维', value: '3' },
        { label: '二维', value: '2' },
      ],
      emptySpan: 4,
      disabled: true,
    },
  },
  {
    field: 'showInput',
    label: '',
    component: 'Input',
    colProps: { span: 4 },
    slot: 'showInput',
    show: ({ values }) => {
      return values.scene !== '2';
    },
  },
  {
    field: 'type',
    label: '',
    component: 'ApiSelect',
    colProps: { span: 4 },
    componentProps: {
      api: findDictItemByCode,
      params: {
        dictCode: 'gis_map_type',
      },
      labelField: 'itemText',
      valueField: 'id',
      resultField: 'items',
      disabled: true,
    },
    show: ({ values }) => {
      return values.scene == '2';
    },
  },

  {
    field: 'show',
    label: '默认是否显示:',
    component: 'RadioGroup',
    colProps: { span: 6 },
    defaultValue: 1,
    componentProps: {
      labelAlign: 'right',
      disabled: true,
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
  {
    field: 'tmd',
    label: '透明度:',
    component: 'Slider',
    colProps: { span: 6 },
    slot: 'slider',
    componentProps: {
      disabled: true,
      min: 0,
      max: 1,
    },
  },
  {
    field: 'blc_min',
    label: '最小显示比例尺:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      disabled: true,
      mix: 0,
      style: 'width:100%',
    },
  },
  {
    field: 'blc_max',
    label: '最大显示比例尺:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      disabled: true,
      mix: 0,
      style: 'width:100%',
    },
  },
  {
    field: 'fwfz',
    label: '服务分组:',
    component: 'Input',
    colProps: { span: 12 },
    componentProps: {
      maxLength: 50,
      disabled: true,
    },
  },
  {
    field: 'fzxh',
    label: '分组序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',
      disabled: true,

      mix: 0,
    },
  },
  {
    field: 'fwxh',
    label: '服务序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      style: 'width:100%',
      disabled: true,

      mix: 0,
    },
  },
  {
    field: 'jzxh',
    label: '加载序号:',
    component: 'InputNumber',
    colProps: { span: 12 },
    componentProps: {
      disabled: true,
      style: 'width:100%',
      mix: 0,
    },
  },
  {
    field: 'tag',
    label: '标签:',
    component: 'Input',
    colProps: { span: 24 },
    componentProps: {
      disabled: true,
      maxLength: 50,
    },
  },
  {
    field: 'note',
    label: '备注:',
    component: 'InputTextArea',
    colProps: { span: 24 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入备注',
      disabled: true,
    },
  },
  {
    field: 'icon',
    label: '缩略图:',
    slot: 'iconSelect',
    component: 'Input',
 
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'searchStr',
    label: '关键字',
    componentProps: {
      maxLength: 32,
      placeholder: '请输入数据名称、数据编码',
    },
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'scene',
    label: '使用场景',
    component: 'ApiSelect',
    componentProps: {
      options: [
        { label: '地形', value: '1' },
        { label: '三维', value: '3' },
        { label: '二维', value: '2' },
      ],
    },
    colProps: { span: 6 },
  },
  {
    field: 'queryDate',
    label: '发布时间',
    component: 'RangePicker',
    colProps: { span: 6 },
  },
];

export const columns: BasicColumn[] = [
  {
    title: '数据名称',
    dataIndex: 'zymc',
    width: 160,
  },
  {
    title: '数据编码',
    dataIndex: 'code',
    width: 160,
  },
  {
    title: '服务分组',
    dataIndex: 'fwfz',
    width: 160,
  },
  {
    title: '分组序号',
    dataIndex: 'fzxh',
    width: 160,
  },
  {
    title: '服务序号',
    dataIndex: 'fwxh',
    width: 160,
  },
  {
    title: '加载序号',
    dataIndex: 'jzxh',
    width: 160,
  },
  {
    title: '标签',
    dataIndex: 'tag',
    width: 160,
  },
  {
    title: '默认是否显示',
    dataIndex: 'show',
    width: 160,
    format: (_text: string, record: Recordable) => {
      return record.show   ? '是' : '否'
    },
  },
 
 
];
