ZZJ
2022-06-10 58bf48cea61c6c5b4381a4b8ff5b4a39eb4671eb
src/pages/cameraAccess/components/CameraInfo.vue
@@ -230,6 +230,7 @@
  createCamera,
  updateCameraInfo,
  getCameraInfo,
  getGB28181CameraInfo,
  delCamera,
} from "@/api/camera";
import { getSoundList } from "@/api/event";
@@ -367,49 +368,99 @@
      this.$refs.addForm.resetFields();
      this.voice = null;
      console.log(node);
      // this.initFormData();
      // this.$refs.addForm.clearValidate();
      if (node.type === "4") {
        getCameraInfo(node.id).then((res) => {
          if (res.success) {
            // console.log(res, '获取摄像机信息')
            if (res.data.resolutions) {
              let list = res.data.resolutions.map((i) => {
                let obj = {};
                if (i.width == 0 && i.height == 0) {
                  obj.label = "本机分辨率";
                  obj.value = "0*0";
                } else {
                  obj.label = i.width + "*" + i.height;
                  obj.value = i.width + "*" + i.height;
                }
                return obj;
              });
              this.resolutionList = list;
              this.sensors = res.data.sensors;
              console.log(list);
            }
            this.$nextTick(() => {
              this.initFormData();
              Object.assign(this.form, res.data);
              this.soundList.forEach((element) => {
                if (this.form.voiceId == element.id) {
                  this.voice = element;
                }
              });
              if (this.form.run_type !== -1) {
                this.form.isAI = true;
              } else {
                this.form.isAI = false;
        // 国标摄像机
        if (node.cameraType === 1) {
          getGB28181CameraInfo(node.id).then((res) => {
            if (res.success) {
              // console.log(res, '获取摄像机信息')
              if (res.data.resolutions) {
                let list = res.data.resolutions.map((i) => {
                  let obj = {};
                  if (i.width == 0 && i.height == 0) {
                    obj.label = "本机分辨率";
                    obj.value = "0*0";
                  } else {
                    obj.label = i.width + "*" + i.height;
                    obj.value = i.width + "*" + i.height;
                  }
                  return obj;
                });
                this.resolutionList = list;
                this.sensors = res.data.sensors;
                console.log(list);
              }
              this.form.resolution =
                this.form.resolution_width + "*" + this.form.resolution_height;
            });
          }
        });
              this.$nextTick(() => {
                this.initFormData();
                Object.assign(this.form, res.data);
                this.soundList.forEach((element) => {
                  if (this.form.voiceId == element.id) {
                    this.voice = element;
                  }
                });
                if (this.form.run_type !== -1) {
                  this.form.isAI = true;
                } else {
                  this.form.isAI = false;
                }
                this.form.resolution =
                  this.form.resolution_width +
                  "*" +
                  this.form.resolution_height;
              });
            }
          });
        } else {
          getCameraInfo(node.id).then((res) => {
            if (res.success) {
              // console.log(res, '获取摄像机信息')
              if (res.data.resolutions) {
                let list = res.data.resolutions.map((i) => {
                  let obj = {};
                  if (i.width == 0 && i.height == 0) {
                    obj.label = "本机分辨率";
                    obj.value = "0*0";
                  } else {
                    obj.label = i.width + "*" + i.height;
                    obj.value = i.width + "*" + i.height;
                  }
                  return obj;
                });
                this.resolutionList = list;
                this.sensors = res.data.sensors;
                console.log(list);
              }
              this.$nextTick(() => {
                this.initFormData();
                Object.assign(this.form, res.data);
                this.soundList.forEach((element) => {
                  if (this.form.voiceId == element.id) {
                    this.voice = element;
                  }
                });
                if (this.form.run_type !== -1) {
                  this.form.isAI = true;
                } else {
                  this.form.isAI = false;
                }
                this.form.resolution =
                  this.form.resolution_width +
                  "*" +
                  this.form.resolution_height;
              });
            }
          });
        }
      }
    },
    // 保存