import { BasicColumn } from '@/components/Table';
import { FormSchema } from '/@/components/Form';
import { listDictModel } from '@/api/common';

export const columnsBed: BasicColumn[] = [
  {
    title: '病区',
    dataIndex: 'wardName',
    align: 'left',
    width: 90,
  },
  {
    title: '病区属性',
    dataIndex: 'wardPropertyName',
    align: 'left',
    width: 90,
  },
  {
    title: '床位',
    dataIndex: 'bedName',
    align: 'left',
  },
  {
    title: '设备编号',
    dataIndex: 'deviceId',
    align: 'left',
  },
  {
    title: '设备信息',
    dataIndex: 'deviceName',
    align: 'left',
  },
];

export const columnsDevice: BasicColumn[] = [
  {
    title: '操作时间',
    dataIndex: 'createTime',
    align: 'left',
  },
  {
    title: '操作类型',
    dataIndex: 'bindDevice',
    align: 'left',
  },
  {
    title: '设备类型',
    dataIndex: 'deviceType',
    align: 'left',
  },
  {
    title: '设备编号',
    dataIndex: 'deviceId',
    align: 'left',
  },
  {
    title: '设备备注',
    dataIndex: 'remark',
    align: 'left',
  },
];

// 表单新增编辑
export const dataFormSchema: FormSchema[] = [
  {
    field: 'PlainTitle',
    component: 'PlainTitle',
    defaultValue: '新增床位',
    colProps: {
      span: 24,
    },
  },
  {
    label: '病区属性',
    field: 'wardPropertyName',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: listDictModel,
      placeholder: '请选择病区属性',
      params: {
        dictCode: 'pb_blood',
      },
    },
  },
  {
    label: '病区',
    field: 'wardId',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: listDictModel,
      placeholder: '请选择病区',
      params: {
        dictCode: 'pb_blood',
      },
    },
  },
  {
    label: '床位',
    field: 'bedName',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入床位',
      maxLength: 60,
    },
  },
  {
    field: 'PlainTitle1',
    component: 'PlainTitle',
    defaultValue: '绑定设备',
    colProps: {
      span: 24,
    },
  },
  {
    label: '设备编号',
    field: 'deviceId',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: listDictModel,
      placeholder: '请选择设备编号',
    },
  },
  {
    label: '设备信息',
    field: 'deviceName',
    component: 'PlainText',
    colProps: {
      span: 12,
    },
  },
  {
    label: '设备类型',
    field: 'deviceModel',
    component: 'PlainText',
    colProps: {
      span: 12,
    },
  },
  {
    label: '设备备注',
    field: 'remark',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入设备备注',
    },
  },
];

// 床位信息搜索
export const searchFormSchema = {
  bed: [
    {
      name: 'wardId',
      componentType: 'Select',
      placeholder: '请选择病区',
      width: 150,
      defaultValue: '1',
      dicts: [{ label: '全部', value: '1' }],
    },
    {
      name: 'bindDevice',
      componentType: 'Select',
      placeholder: '请选择',
      width: 150,
      defaultValue: null,
      dicts: [
        { label: '全部', value: null },
        { label: '未绑定', value: 0 },
        { label: '已绑定', value: 1 },
      ],
    },
  ],
  device: [
    {
      name: 'createTime',
      componentType: 'RangePicker',
      placeholder: '请输入',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    {
      name: 'deviceId',
      componentType: 'Input',
      placeholder: '请输入',
      prefix: 'icon-xt-search',
      width: 200,
    },
  ],
};
