device.data.ts 1.83 KB
import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { DeviceTypeEnum, DeviceState } from '/@/api/device/model/deviceModel';
// 表格列数据
export const columns: BasicColumn[] = [
  {
    title: '设备名称',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '设备类型',
    dataIndex: 'deviceType',
    width: 100,
    slots: { customRender: 'deviceType' },
  },
  {
    title: '设备配置',
    dataIndex: 'deviceProfile.name',
    width: 160,
    slots: { customRender: 'deviceProfile' },
  },

  {
    title: '所属组织',
    dataIndex: 'organizationId',
    slots: { customRender: 'organizationId' },
  },
  {
    title: '标签',
    dataIndex: 'label',
    width: 180,
  },
  {
    title: '状态',
    dataIndex: 'deviceState',
    width: 120,
    slots: { customRender: 'deviceState' },
  },

  {
    title: '最后连接时间',
    dataIndex: 'lastConnectTime',
    width: 180,
  },
];

// 查询字段
export const searchFormSchema: FormSchema[] = [
  {
    field: 'deviceType',
    label: '设备类型',
    component: 'Select',
    componentProps: {
      options: [
        { label: '网关设备', value: DeviceTypeEnum.GATEWAY },
        { label: '直连设备', value: DeviceTypeEnum.DIRECT_CONNECTION },
        { label: '网关子设备', value: DeviceTypeEnum.SENSOR },
      ],
    },
    colProps: { span: 4 },
  },
  {
    field: 'deviceState',
    label: '设备状态',
    component: 'Select',
    componentProps: {
      options: [
        { label: '待激活', value: DeviceState.INACTIVE },
        { label: '在线', value: DeviceState.ONLINE },
        { label: '离线', value: DeviceState.OFFLINE },
      ],
    },
    colProps: { span: 4 },
  },
  {
    field: 'name',
    label: '设备名称',
    component: 'Input',
    colProps: { span: 8 },
  },
];