config.ts 2.23 KB
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
export type VideoCancelModalParamsType = {
  canControl?: boolean;
  isGBT?: boolean;
  tbDeviceId?: string;
  channelId?: string;
  id?: string;
  playerProps?: Recordable;
  getPlayUrl: () => Promise<Record<'url' | 'type', string>>;
};

//视频通道权限标识枚举
export enum GBT28181_DEVICE_PERMISSION_ENUM {
  PLAY_SYNC = 'api:yt:video:control:play', //视频点播/预览和摄像头通道同步
  STOP = 'api:yt:video:control:stop', //停止点播
  CONTROL = 'api:yt:video:control:control', //云台控制
}

enum ChannelStatusEnum {
  ONLINE = 'ONLINE',
}

export const configColumns: BasicColumn[] = [
  {
    title: '通道编号',
    dataIndex: 'channelId',
  },
  {
    title: '国标编号',
    dataIndex: 'cameraCode',
  },
  {
    title: '通道名称',
    dataIndex: 'name',
  },
  {
    title: '型号',
    dataIndex: 'model',
  },
  {
    title: '厂商',
    dataIndex: 'manufacturer',
  },
  // {
  //   title: '开启音频',
  //   dataIndex: 'hasAudio',
  //   slots: { customRender: 'hasAudio' },
  // },
  {
    title: '状态',
    dataIndex: 'status',
    customRender: ({ text }: { text: ChannelStatusEnum }) => {
      return h(
        Tag,
        {
          color: text === ChannelStatusEnum.ONLINE ? 'green' : 'red',
        },
        () => (text === ChannelStatusEnum.ONLINE ? '在线' : '离线')
      );
    },
  },
  {
    title: '操作',
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
];

export const searchFormSchema: FormSchema[] | any = [
  {
    field: 'name',
    label: '通道名称',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
      placeholder: '请输入通道名称',
    },
  },
  {
    field: 'cameraCode',
    label: '国标编号',
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      placeholder: '请输入国标编号',
    },
  },
  {
    field: 'status',
    label: '状态',
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: [
        { label: '在线', value: 'ONLINE' },
        { label: '离线', value: 'OFFLINE' },
      ],
    },
  },
];