import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { list } from '../substationTabel/substation.api';

export const columns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'strname',
    width: 120,
  },
  {
    title: '安装位置',
    dataIndex: 'strinstallpos',
    width: 100,
  },
  {
    title: '类型',
    dataIndex: 'strtype_dictText',
    width: 100,
  },
  {
    title: '所属分站',
    width: 150,
    dataIndex: 'stationname',
  },
];

export const recycleColumns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'strname',
    width: 100,
  },
  {
    title: '是否为常闭型',
    dataIndex: 'bnormalclose',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'strname',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '安装位置',
    field: 'strinstallpos',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '所属分站',
    field: 'nsubstationid',
    component: 'ApiSelect',
    componentProps: {
      api: list,
      labelField: 'strname',
      valueField: 'nsubstationid',
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: '名称',
    field: 'strname',
    component: 'Input',
  },
  {
    label: '安装位置',
    field: 'strinstallpos',
    component: 'Input',
  },
  {
    label: '类型',
    field: 'ntype',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'ledtype',
      placeholder: '请选择状态',
      stringToNumber: true,
    },
  },
  {
    label: '所属分站',
    field: 'nsubstationid',
    component: 'ApiSelect',
    componentProps: {
      api: list,
      labelField: 'strname',
      valueField: 'nsubstationid',
    },
  },
  {
    label: '点表',
    field: 'strtype',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'ledkind',
      placeholder: '请选择状态',
    },
  },
  {
    label: '是否模拟数据',
    field: 'testflag',
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: () => {
      return {
        options: [
          { label: '是', value: 1, key: '1' },
          { label: '否', value: 0, key: '2' },
        ],
      };
    },
  },
];
