detail.config.ts 2.93 KB
import { FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';

export const columns: BasicColumn[] = [
  {
    title: '设备名称',
    dataIndex: 'name',
    width: 120,
    key: 'name',
  },
  {
    title: '设备标签',
    dataIndex: 'label',
    width: 100,
    key: 'label',
  },
  {
    title: '设备配置',
    dataIndex: 'deviceProfile.name',
    width: 160,
    key: 'deviceProfile.name',
  },

  {
    title: '设备类型',
    dataIndex: 'deviceType',
    key: 'deviceType',
    customRender({ text }) {
      return text === DeviceTypeEnum.GATEWAY
        ? '网关设备'
        : text == DeviceTypeEnum.DIRECT_CONNECTION
        ? '直连设备'
        : '网关子设备';
    },
  },
  {
    title: '描述',
    dataIndex: 'description',
    width: 180,
    key: 'description',
  },
];

// 实时数据
export const realTimeDataSearchSchemas: FormSchema[] = [
  {
    field: 'key',
    label: '键 / 值',
    component: 'Input',
    colProps: { span: 12 },
  },
];
export const realTimeDataColumns: BasicColumn[] = [
  {
    title: '最后更新时间',
    dataIndex: 'update',
    width: 120,
  },
  {
    title: '键',
    dataIndex: 'label',
    width: 100,
  },
  {
    title: '值',
    dataIndex: 'name',
    width: 160,
  },
];

// 告警
export const alarmSearchSchemas: FormSchema[] = [
  {
    field: 'icon',
    label: '告警状态',
    component: 'Select',
    colProps: { span: 6 },
  },
  {
    field: 'icon',
    label: '告警类型',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'icon',
    label: '      ',
    component: 'DatePicker',
    colProps: { span: 6 },
  },
];
export const alarmColumns: BasicColumn[] = [
  {
    title: '告警时间',
    dataIndex: 'aaa',
    width: 120,
  },
  {
    title: '告警设备',
    dataIndex: 'label',
    width: 100,
  },
  {
    title: '类型',
    dataIndex: 'ccc',
    width: 160,
  },
  {
    title: '告警级别',
    dataIndex: 'ddd',
    width: 160,
  },
  {
    title: '状态',
    dataIndex: 'eee',
    width: 160,
  },
  {
    title: '操作',
    dataIndex: 'name',
    width: 160,
  },
];

// 子设备
export const childDeviceSchemas: FormSchema[] = [
  {
    field: 'icon',
    label: '设备配置',
    component: 'Select',
    colProps: { span: 12 },
  },
  {
    field: 'icon',
    label: '设备名称',
    component: 'Input',
    colProps: { span: 12 },
  },
];
export const childDeviceColumns: BasicColumn[] = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 120,
  },
  {
    title: '设备配置',
    dataIndex: 'label',
    width: 100,
  },
  {
    title: '标签',
    dataIndex: 'aaa',
    width: 160,
  },
  {
    title: '状态',
    dataIndex: 'bbb',
    width: 160,
  },
  {
    title: '最后连接时间',
    dataIndex: 'ccc',
    width: 160,
  },
  {
    title: '创建时间',
    dataIndex: 'ddd',
    width: 160,
  },
];