import { buildingInfoList } from '@/api/basicInfo/buildingsInfo';
import { maintenanceInfoList } from '@/api/basicInfo/maintenance';
import { infoList } from '@/api/basicInfo/tenement';
import { FormSchema } from '@/components/Form';
import { BasicColumn } from '@/components/Table';

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '电梯名称',
    field: 'elevatorName',
    required: false,
    component: 'Input',
  },
  {
    label: '楼宇',
    field: 'buildingId',
    required: false,
    component: 'ApiSelect',
    componentProps: {
      api: buildingInfoList,
      labelField: 'name',
      valueField: 'id',
      placeholder: '请选择楼宇',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },
  {
    label: '物业单位',
    field: 'tenementId',
    required: false,
    component: 'ApiSelect',
    componentProps: {
      api: infoList,
      labelField: 'name',
      valueField: 'id',
      placeholder: '请选择物业',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },
  {
    label: '维保单位',
    field: 'maintenanceId',
    required: false,
    component: 'ApiSelect',
    componentProps: {
      api: maintenanceInfoList,
      labelField: 'name',
      valueField: 'id',
      placeholder: '请选择维保单位',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },
  {
    label: '超期未检',
    field: 'checkStateExt',
    required: false,
    component: 'Select',
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
  {
    label: '超期未保',
    field: 'mainStateExt',
    required: false,
    component: 'Select',
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 0 },
      ],
    },
  },
];
export const columns: BasicColumn[] = [
  {
    title: '电梯名称',
    dataIndex: 'elevatorName',
  },
];
