import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { projectInfoList } from '@/api/basicInfo/projectsInfo';

export const formSchemas: FormSchema[] = [
  {
    label: '组织',
    field: 'organizationId',
    component: 'ApiSelect',
    componentProps: {
      api: projectInfoList,
      labelField: 'name',
      valueField: 'id',
      placeholder: '请选择项目',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },

  {
    label: '维保单位',
    field: 'name',
    component: 'Input',
  },
];

export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },
  // {
  //   title: '组织',
  //   dataIndex: 'organizationId',
  // },
  {
    title: '单位编号',
    dataIndex: 'code',
    ifShow: false,
  },
  {
    title: '维保单位',
    dataIndex: 'name',
  },
  // {
  //   title: '营业执照名称',
  //   dataIndex: 'licenseName',
  // },
  {
    title: '地址',
    dataIndex: 'address',
  },
  // {
  //   title: '行政区域',
  //   dataIndex: 'areaCode',
  // },
  // {
  //   title: '经度',
  //   dataIndex: 'lng',
  // },
  // {
  //   title: '纬度',
  //   dataIndex: 'lat',
  // },
  {
    title: '维保负责人',
    dataIndex: 'principal',
  },
  {
    title: '维保负责人手机',
    dataIndex: 'principalPhone',
  },
  {
    title: '资质有效期',
    dataIndex: 'validDate',
  },
  {
    title: '资质证书编号',
    dataIndex: 'certificateNumber',
  },
  {
    title: '资质等级',
    dataIndex: 'level',
  },
  // {
  //   title: '组织机构代码',
  //   dataIndex: 'institutionCode',
  // },
  // {
  //   title: '许可信息',
  //   dataIndex: 'licence',
  // },
  // {
  //   title: '24 小时值班电话',
  //   dataIndex: 'telephone',
  // },
  // {
  //   title: '法人代表',
  //   dataIndex: 'legal',
  // },
  // {
  //   title: '法人手机',
  //   dataIndex: 'legalPhone',
  // },
  // {
  //   title: '应急救援负责人',
  //   dataIndex: 'urgency',
  // },
  // {
  //   title: '应急救援负责人手机',
  //   dataIndex: 'urgencyPhone',
  // },
  // {
  //   title: '备注',
  //   dataIndex: 'remark',
  // },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '项目',
    field: 'deptId',
    required: true,
    component: 'TreeSelect',
    helpMessage: ['注意绑定的角色要带相应的部门权限, 否则无法正常登录'],
  },
  {
    label: '单位编号',
    field: 'code',
    required: true,
    component: 'Input',
  },
  {
    label: '维保单位',
    field: 'name',
    required: true,
    component: 'Input',
  },
  {
    label: '营业执照名称',
    field: 'licenseName',
    required: false,
    component: 'Input',
  },
  {
    label: '地址',
    field: 'address',
    required: true,
    component: 'Input',
  },
  {
    label: '行政区域',
    field: 'areaCode',
    required: true,
    component: 'TreeSelect',
    componentProps: {
      treeData: [
        {
          label: '行政区域',
          value: '1',
          children: [
            {
              label: '湖北省',
              value: '1-1',
              children: [
                {
                  label: '武汉市',
                  value: '1-1-1',
                  children: [
                    {
                      label: '江夏区',
                      value: '1-1-1-1',
                    },
                  ],
                },
              ],
            },
          ],
        },
      ],
    },
  },
  // {
  //   label: '经度',
  //   field: 'lng',
  //   required: false,
  //   component: 'Input',
  //   componentProps: { disabled: true, placeholder: '请点击经纬度选择按钮选择经纬度' },
  // },
  // {
  //   label: '纬度',
  //   field: 'lat',
  //   required: false,
  //   component: 'Input',
  //   componentProps: { disabled: true, placeholder: '请点击经纬度选择按钮选择经纬度' },
  // },
  // {
  //   label: '经纬度获取',
  //   field: '',
  //   required: false,
  //   slot: 'getLatLng',
  // },
  {
    label: '维保负责人',
    field: 'principal',
    required: true,
    component: 'Input',
  },
  {
    label: '维保负责人手机',
    field: 'principalPhone',
    required: true,
    component: 'Input',
  },
  {
    label: '资质有效期',
    field: 'validDate',
    required: true,
    component: 'DatePicker',
    componentProps: {
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '资质证书编号',
    field: 'certificateNumber',
    required: true,
    component: 'Input',
  },
  {
    label: '资质等级',
    field: 'level',
    required: true,
    component: 'Input',
  },
  // {
  //   label: '资质证书',
  //   field: 'certificate',
  //   required: true,
  //   component: 'Upload',
  // },
  {
    label: '统一社会信用代码',
    field: 'institutionCode',
    required: true,
    component: 'Input',
  },
  {
    label: '许可信息',
    field: 'licence',
    required: true,
    component: 'Input',
  },
  {
    label: '24 小时值班电话',
    field: 'telephone',
    required: true,
    component: 'Input',
  },
  {
    label: '法人代表',
    field: 'legal',
    required: true,
    component: 'Input',
  },
  {
    label: '法人手机',
    field: 'legalPhone',
    required: true,
    component: 'Input',
  },
  {
    label: '应急救援负责人',
    field: 'urgency',
    required: true,
    component: 'Input',
  },
  {
    label: '应急救援负责人手机',
    field: 'true',
    required: false,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    required: false,
    component: 'InputTextArea',
  },
];
