config.ts 2.16 KB
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
import { withInstall } from '/@/utils/index';
import { DeviceTypeEnum } from '/@/api/device/model/deviceModel';

import VideoPlay from './video.vue';
export const Video = withInstall(VideoPlay);

export const configColumns: BasicColumn[] = [
  {
    title: '通道编号',
    dataIndex: 'channellNumber',
  },
  {
    title: '设备名称',
    dataIndex: 'deviceName',
  },
  {
    title: '通道名称',
    dataIndex: 'channelName',
  },
  {
    title: '厂家',
    dataIndex: 'manufacturer',
  },
  {
    title: '开启音频',
    dataIndex: 'turnOnAudio',
    slots: { customRender: 'turnOnAudio' },
  },
  {
    title: '状态',
    dataIndex: 'state',
    format: (text) => {
      return h(
        Tag,
        {
          color: Number(text) === 1 ? 'green' : 'blue',
        },
        () => (Number(text) === 1 ? '在线' : '离线')
      );
    },
  },
  {
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
];

export const searchFormSchema: FormSchema[] | any = [
  {
    field: 'name',
    label: '设备名称',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入设备名称',
    },
  },
  {
    field: 'deviceType',
    label: '设备类型',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: [
        { label: '网关设备', value: DeviceTypeEnum.GATEWAY },
        { label: '直连设备', value: DeviceTypeEnum.DIRECT_CONNECTION },
        { label: '网关子设备', value: DeviceTypeEnum.SENSOR },
      ],
      placeholder: '请选择设备类型',
    },
  },
  // {
  //   field: 'channelName',
  //   label: '通道名称',
  //   component: 'Input',
  //   colProps: { span: 6 },
  //   componentProps: {
  //     maxLength: 255,
  //     placeholder: '请输入通道名称',
  //   },
  // },
  {
    field: 'manufacturer',
    label: '厂家',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: [{}],
      placeholder: '请选择厂家',
    },
  },
];