ZZJ
2022-06-10 58bf48cea61c6c5b4381a4b8ff5b4a39eb4671eb
src/Pool/VideoRuleData.ts
@@ -1,4 +1,4 @@
import { getCameraInfo } from "@/api/camera";
import { getCameraInfo,getGB28181CameraInfo } from "@/api/camera";
import { getAllPolygon } from "@/api/polygon";
import { getDirDetails, findAllFileByStackId } from "@/api/localVedio";
import { getCameraSceneRule } from '@/api/scene'
@@ -23,7 +23,7 @@
  public selectResolution: string;
  public hasCtrlC: boolean;
  constructor(id: string) {
  constructor(id: string,isGB:boolean) {
    this.loading = false;
    this.baseImg = "";
    this.cameraId = id ? id : "";
@@ -44,7 +44,7 @@
    this.rules = [];
    if (id && id !== "") {
      this.update();
      this.update(isGB);
    }
    this.resolutionOption = [
@@ -65,23 +65,40 @@
    this.hasCtrlC = false
  }
  public async update() {
    await this.getInfo();
  public async update(isGB) {
    await this.getInfo(isGB);
    await this.getSceneRule();
    await this.getPolygon();
  }
  public async getInfo() {
  public async getInfo(isGB) {
    // 判断选中的是摄像机还是数据栈
    if (this.cameraId.indexOf("stack") === -1) {
      try {
        const rsp: any = await getCameraInfo(this.cameraId);
      //处理国标摄像机
      if(isGB) {
        try {
        const rsp: any = await getGB28181CameraInfo(this.cameraId);
        if (rsp.success) {
          this.cameraName = rsp.data.name ? rsp.data.name : "";
        }
      } catch {
        this.cameraName = "";
      }
      }
      else {
        try {
        const rsp: any = await getCameraInfo(this.cameraId);
        if (rsp.success) {
          this.cameraName = rsp.data.name ? rsp.data.name : "";
        }
        } catch {
          this.cameraName = "";
        }
      }
    } else {
      const rsp: any = await findAllFileByStackId({ stackId: this.cameraId });
      if (rsp.success && rsp.data.dataList.length) {