config.ts 2.91 KB
import { h } from 'vue';
import { BasicColumn, FormSchema } from '/@/components/Table';
import { Tag } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { VideoPlatformEnum } from '/@/views/camera/manage/config.data';
export type VideoCancelModalParamsType = {
  canControl?: boolean;
  videoPlatformType: VideoPlatformEnum;
  isGBT?: boolean;
  tbDeviceId?: string;
  channelId?: string;
  id?: string;
  playerProps?: Recordable;
  getPlayUrl: () => Promise<Record<'url' | 'type', string> & { withToken?: 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',
}
const { t } = useI18n();
export const configColumns: BasicColumn[] = [
  {
    title: t('deviceManagement.device.channelCodeText'),
    dataIndex: 'channelId',
  },
  {
    title: t('deviceManagement.device.cameraCodeText'),
    dataIndex: 'cameraCode',
  },
  {
    title: t('deviceManagement.device.channelNameText'),
    dataIndex: 'name',
  },
  {
    title: t('deviceManagement.device.modelNumberText'),
    dataIndex: 'model',
  },
  {
    title: t('deviceManagement.device.brandText'),
    dataIndex: 'manufacturer',
  },
  // {
  //   title: '开启音频',
  //   dataIndex: 'hasAudio',
  //   slots: { customRender: 'hasAudio' },
  // },
  {
    title: t('business.deviceStatusText'),
    dataIndex: 'status',
    customRender: ({ text }: { text: ChannelStatusEnum }) => {
      return h(
        Tag,
        {
          color: text === ChannelStatusEnum.ONLINE ? 'green' : 'red',
        },
        () => text && t(`enum.deviceStatus.${text}`)
      );
    },
  },
  {
    title: t('common.actionText'),
    dataIndex: 'action',
    slots: { customRender: 'action' },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: t('deviceManagement.device.channelNameText'),
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
    },
  },
  {
    field: 'cameraCode',
    label: t('deviceManagement.device.cameraCodeText'),
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {},
  },
  {
    field: 'status',
    label: t('business.deviceStatusText'),
    component: 'Select',
    colProps: { span: 6 },
    componentProps: {
      options: [
        { label: t('enum.deviceStatus.ONLINE'), value: 'ONLINE' },
        { label: t('enum.deviceStatus.OFFLINE'), value: 'OFFLINE' },
      ],
    },
  },
];

export enum VideoControlEnum {
  Up = 'UP',
  Right = 'RIGHT',
  Left = 'LEFT',
  Down = 'DOWN',
  ZoomIn = 'ZOOM_IN',
  ZoomOut = 'ZOOM_OUT',
}

export enum EzvizVideoControlEnum {
  UP,
  DOWN,
  LEFT,
  RIGHT,
  LEFT_UP,
  LEFT_DOWN,
  RIGHT_UP,
  RIGHT_DOWN,
  ZOOM_IN,
  ZOOM_OUT,
}