南昌市物联网技防平台-前端
shuishen
2021-03-19 379f583706f35a5c9cd4010df1d940ee1129fa01
src/page/index/logo.vue
@@ -51,18 +51,27 @@
          <el-row>
            <el-col span="12">
              <el-form-item label="负责人">
                <el-input
                  disabled="true"
                  v-model="form.galarmPeople"
                  autocomplete="off"
                ></el-input>
                <el-select
                  v-model="peopleName"
                  placeholder="请选择"
                  @change="peopleOrPhone"
                  style="width: 100%"
                >
                  <el-option
                    v-for="item in peopleList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.label"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col span="12">
              <el-form-item label="负责人电话">
                <el-input
                  disabled="true"
                  v-model="form.phoneNumber"
                  v-model="peoplePhone"
                  autocomplete="off"
                  style="width: calc(100% - 110px)"
                ></el-input>
@@ -150,16 +159,23 @@
            </el-col>
            <el-col span="12">
              <el-form-item label="监控视频">
                <el-button type="success" @click.stop="queryOldVideo(form)"
                <el-button
                  type="success"
                  @click.stop="
                    (videoConversationReal = true), (oldVideoSatart = fasle)
                  "
                  >视频通话
                </el-button>
                <el-button type="primary" @click.stop="queryOldVideo(form)"
                <el-button
                  type="primary"
                  @click.stop="
                    (oldVideoSatart = true), (videoConversationReal = false)
                  "
                  >查看历史
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col span="12">
              <el-form-item label="报警内容">
@@ -176,13 +192,15 @@
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :align="center">
            <el-col class="opt-btn">
              <el-form-item>
                <el-button type="success" @click.stop="revoke(form)"
                  >办结</el-button
                >
                <el-button
                  type="success"
                  @click.stop="updateJtyep(form, 1, '办结')"
                  >办结
                </el-button>
                <img
                  src="/img/police-num.png"
                  style="
@@ -191,11 +209,14 @@
                    vertical-align: middle;
                  "
                  alt=""
                  @click.stop="updateJtyep(form, 2, '推送110')"
                />
                <el-button type="primary" @click.stop="generate(form)"
                  >派发保安</el-button
                >
                <el-button
                  type="primary"
                  @click.stop="updateJtyep(form, 3, '派送保安')"
                  >派送保安
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
@@ -206,15 +227,37 @@
        class="ss-video-dialog"
        :modal="false"
        width="100%"
        title="历史视频"
        :visible.sync="innerVisibleVideo"
        title="视频通话"
        :visible.sync="videoConversationReal"
        :close-on-press-escape="false"
        append-to-body
        @opened="openRealVideoBox"
        @close="closeRealVideoBox"
      >
        <video
          src=""
          id="video_conversation"
          style="width: 100%; height: 100%; object-fit: fill"
          controls
        ></video>
      </el-dialog>
      <el-dialog
        class="ss-video-dialog"
        :modal="false"
        width="100%"
        title="历史回放"
        :visible.sync="oldVideoSatart"
        :close-on-press-escape="false"
        append-to-body
        @opened="openOldVideoBox"
        @close="closeOldVideoBox"
      >
        <video
          src=""
          src="/oldVideo/ft.mp4"
          muted="muted"
          autoplay="autoplay"
          loop
          id="old_video"
          style="width: 100%; height: 100%; object-fit: fill"
          controls
@@ -234,7 +277,8 @@
  data() {
    return {
      dialogTableVisible: false,
      innerVisibleVideo: false,
      videoConversationReal: false,
      oldVideoSatart: false,
      deviceId: null,
      form: {},
      itemOption: {
@@ -288,6 +332,9 @@
          },
        ],
      },
      peopleList: [],
      peopleName: "",
      peoplePhone: "",
    };
  },
  created() {
@@ -312,17 +359,25 @@
    layerRealtime() {
      var that = this;
      window.clearTimeout(window.realTimeQuery);
      // that.deviceId = 384; // 测试用
      // that.deviceId = 334; // 测试用
      window.realTimeQuery = setInterval(function () {
        axios({
          url: "/api/blade-jfpts/alarm/alarm/selecttx?id=" + that.deviceId,
          method: "post",
        }).then(function (response) {
          if (response.data.data.length > 0) {
          var userId = JSON.parse(window.localStorage.getItem('物联网安保云服务平台-userInfo')).content.user_id;
          if (response.data.data.length > 0 && response.data.data[0].waringType == "一键求助" && response.data.data[0].alarmId != userId) {
            that.deviceId = response.data.data[0].id;
            that.form = response.data.data[0];
            that.peopleList = [
              { label: that.form.oneContacts, value: that.form.onePhone },
              { label: that.form.twoContacts, value: that.form.twoPhone },
              { label: that.form.threeContacts, value: that.form.threePhone },
            ];
            that.peopleName = that.form.oneContacts;
            that.peoplePhone = that.form.onePhone;
            that.dialogTableVisible = true;
            that.innerVisibleVideo = true;
            that.videoConversationReal = true;
            that.$refs.realAudio.src = "./realVideo/audio.mp3";
            that.$refs.realAudio.play();
          }
@@ -333,149 +388,30 @@
      //关闭窗口回调,关闭警报
      this.$refs.realAudio.pause();
    },
    generate(row) {
    updateJtyep(row, jtype, t) {
      var that = this;
      //关闭窗口回调,关闭警报
      that.$refs.realAudio.pause();
      axios({
        url: "/api/blade-jfpts/jingdan/jingdan/submit",
        method: "post",
        data: {
          rName: row.rname,
          galarmPeople: row.galarmPeople,
          phoneNumber: row.phoneNumber,
          place: row.place,
          alarmPeople: row.alarmPeople,
          content: row.content,
          galarmTime: row.alarmTime,
          waringType: row.waringType,
          deviceNumber: row.deviceNumber,
          type: "0",
          handleP: null,
          handleTime: null,
          handName: null,
          level: row.level,
          coordinate: null,
          jd: row.jd,
          wd: row.wd,
          district: row.district,
          city: row.city,
          province: row.province,
          czTime: row.czTime,
          jjTime: row.jjTime,
          bz: row.bz,
        },
      })
        .then(function (response) {
          that.$message({
            message: "生成警单成功",
            type: "success",
          });
          that.updateJtyep(row);
          that.dialogTableVisible = false;
          that.innerVisibleVideo = false;
          var arr = [];
          that.$store.state.tags.tagList.forEach((item) => {
            if (item.label != "警情分发处置") {
              arr.push(item);
            }
          });
          that.$store.state.tags.tagList = arr;
          row.type = 0;
          row.id = response.data.data;
          that.$router.push({ path: "/distribution/index", query: row });
        })
        .catch(function (error) {
          that.dialogTableVisible = false;
          that.innerVisibleVideo = false;
        });
    },
    revoke(row) {
      var that = this;
      axios({
        url: "/api/blade-jfpts/alarm/alarm/deletejj?id=" + row.id,
        method: "post",
      }).then(function () {
        that.dialogTableVisible = false;
        that.innerVisibleVideo = false;
        //关闭窗口回调,关闭警报
        that.$refs.realAudio.pause();
      });
    },
    updateJtyep(row) {
      var that = this;
      axios({
        url:
          "/api/blade-jfpts/alarm/alarm/updateJtype?id=" +
          row.id +
          "&czTime=" +
          row.czTime +
          "&bz=" +
          row.bz,
        method: "post",
      }).then(function () {});
    },
    queryOldVideo(data) {
      var newAxios = axios.create({
        baseURL: "https://web.byisf.com:18000",
        withCredentials: false,
        headers: {
          "Content-type": "application/x-www-form-urlencoded",
        },
      });
      var time = this.beginTimeOrEndTime(data.alarmTime);
      newAxios
      axios
        .post(
          "/api_control",
          "/api/blade-jfpts/alarm/alarm/updateJtype",
          {},
          {
            params: {
              param: JSON.stringify({ PktType: "GetAccessToken" }),
              jid: row.id,
              jtype: jtype,
              rid: row.alarmId,
              bz: row.bz,
              snumber: row.alarmPeople,
              sname: row.alarmId,
              zc: t,
              zctime: that.getDate().current,
            },
          }
        )
        .then((res) => {
          newAxios
            .get(
              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${data.serialNumber}&chl=${data.channelNumber}`
            )
            .then((result) => {
              this.innerVisibleVideo = true;
              this.videoSource = result.data.data.m3u8;
            });
          //   newAxios
          //     .post(
          //       "/api_control",
          //       {},
          //       {
          //         params: {
          //           param: JSON.stringify({
          //             PktType: "RemotePlayback",
          //             accessToken: res.data.data.accessToken,
          //             deviceCode: "001231409472",
          //             startTime: "20210130150000",
          //             endTime: "20210130160000",
          //             chl: data.serialNumber
          //           })
          //         }
          //       }
          //     )
          //     .then(result => {
          //       this.innerVisibleVideo = true;
          //       this.videoSource = result.data.data.m3u8;
          //     });
        .then(function () {
          that.onLoad(that.page, that.query);
        });
    },
    beginTimeOrEndTime(time) {
      var beginTime = new Date(time);
@@ -535,27 +471,83 @@
        end: endY + endM + endD + endH + endm + ends,
      };
    },
    openOldVideoBox() {
      if (Hls.isSupported()) {
        var dom = document.getElementById("old_video");
        // if (dom.volume) dom.volume = 1.0;
    // 视频通话打开关闭事件
    openRealVideoBox() {
      var newAxios = axios.create({
        baseURL: "https://web.byisf.com:18000",
        withCredentials: false,
        headers: {
          "Content-type": "application/x-www-form-urlencoded",
        },
      });
        this.hls = new Hls();
      newAxios
        .post(
          "/api_control",
          {},
          {
            params: {
              param: JSON.stringify({ PktType: "GetAccessToken" }),
            },
          }
        )
        .then((res) => {
          newAxios
            .get(
              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${this.form.serialNumber}&chl=${this.form.channelNumber}`
            )
            .then((result) => {
              this.videoSource = result.data.data.m3u8;
        var m3u8Url = decodeURIComponent(this.videoSource);
              if (Hls.isSupported()) {
                var dom = document.getElementById("video_conversation");
        this.hls.loadSource(m3u8Url);
                // if (dom.volume) dom.volume = 1.0;
        this.hls.attachMedia(dom);
                this.hls = new Hls();
        this.hls.on(Hls.Events.MANIFEST_PARSED, function () {
          dom.play();
                var m3u8Url = decodeURIComponent(this.videoSource);
                this.hls.loadSource(m3u8Url);
                this.hls.attachMedia(dom);
                this.hls.on(Hls.Events.MANIFEST_PARSED, function () {
                  dom.play();
                });
              }
            });
          //   newAxios
          //     .post(
          //       "/api_control",
          //       {},
          //       {
          //         params: {
          //           param: JSON.stringify({
          //             PktType: "RemotePlayback",
          //             accessToken: res.data.data.accessToken,
          //             deviceCode: "001231409472",
          //             startTime: "20210130150000",
          //             endTime: "20210130160000",
          //             chl: data.serialNumber
          //           })
          //         }
          //       }
          //     )
          //     .then(result => {
          //       this.videoConversationReal = true;
          //       this.videoSource = result.data.data.m3u8;
          //     });
        });
      }
    },
    closeOldVideoBox() {
      var dom = document.getElementById("old_video");
    closeRealVideoBox() {
      var dom = document.getElementById("video_conversation");
      if (dom.getAttribute("src") != "") {
        dom.pause();
@@ -564,6 +556,26 @@
        this.hls.destroy();
      }
    },
    // 历史视频打开关闭事件
    openOldVideoBox() {
      var dom = document.getElementById("old_video");
      dom.currentTime = 0;
      dom.play();
    },
    closeOldVideoBox() {
      var dom = document.getElementById("old_video");
      dom.pause();
    },
    peopleOrPhone(e) {
      this.peopleList.forEach((item) => {
        if (item.label == e) {
          this.peoplePhone = item.value;
        }
      });
    },
  },
};
@@ -658,10 +670,10 @@
  position: absolute !important;
  top: 0px !important;
  left: auto !important;
  right: 0px !important;
  right: 5px !important;
  bottom: 0 !important;
  margin: auto !important;
  width: 660px !important;
  width: 670px !important;
}
.ss-video-dialog .el-dialog {
@@ -672,10 +684,16 @@
  bottom: 0 !important;
  margin: auto !important;
  height: 558px;
  border-radius: 10px 10px 10px 10px;
}
.ss-video-dialog .el-dialog .el-dialog__header {
  padding-top: 10px;
}
.ss-video-dialog .el-dialog .el-dialog__body {
  height: calc(100% - 54px);
  padding: 10px !important;
  height: calc(100% - 44px);
  box-sizing: border-box;
}
</style>