南昌市物联网技防平台-前端
shuishen
2021-01-30 c69d47643630ce4c8e6874f8cf288a28efde6491
src/views/realTimePolice/real.vue
@@ -33,7 +33,7 @@
        </el-button>
      </template>
      <template slot="menuRight">
      <template slot="menuLeft">
        <el-button
          size="small"
          type="primary"
@@ -241,6 +241,7 @@
              <el-date-picker
                v-model="form.czTime"
                type="datetime"
                value-format="yyyy-MM-dd hh:mm:ss"
                placeholder="选择日期时间"
              >
              </el-date-picker>
@@ -255,10 +256,14 @@
        <el-row :align="center">
          <el-col :offset="4">
            <el-form-item>
              <el-button type="success">一件呼叫</el-button>
              <el-button type="success">一键呼叫</el-button>
              <el-button type="success">视频对讲</el-button>
              <el-button type="primary">生成警单</el-button>
              <el-button type="warning">警情撤销</el-button>
              <el-button type="primary" @click.stop="generate(form)"
                >生成警单</el-button
              >
              <el-button type="warning" @click.stop="revoke(form)"
                >警情撤销</el-button
              >
              <el-button type="danger">推送110</el-button>
            </el-form-item>
          </el-col>
@@ -811,98 +816,95 @@
        end: endY + endM + endD + endH + endm + ends
      };
    },
    queryOldVideo(data) {
      console.log(data);
      var newAxios = axios.create({
        baseURL: "http://s16s652780.51mypc.cn",
        withCredentials: false,
        headers: {
          "Content-type": "application/x-www-form-urlencoded"
        }
    handleStart(row) {
      this.$router.push({
        path: `/real/video/${row.channelNumber}/${row.serialNumber}`
      });
      //s16s652780.51mypc.cn/api_control
      var time = this.beginTimeOrEndTime(data.alarmTime);
     newAxios
        .post(
          "/api_control",
          {},
          {
            params: {
              param: JSON.stringify({ PktType: "GetAccessToken" })
            }
    },
    handleHistory(row) {
      this.$router.push({ path: `/real/history/${row.deviceNumber}` });
    },
    handleAdd11() {
      this.qwe = true;
    },
    handleManage(row) {
      this.form = row;
      this.dialogTableVisible = true;
    },
    generate(row) {
      var that = this;
      if (row.czTime == "" || row.czTime == null) {
        this.$message({
          message: "请选择处置时间",
          type: "warning"
        });
      } else {
        axios({
          url:
            "http://192.168.0.103:1888/api/blade-jfpts/jingdan/jingdan/submit",
          method: "post",
          data: {
            rName: row.rname,
            galarmPeople: row.galarmPeople,
            phoneNumber: row.phoneNumber,
            place: row.place,
            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,
            addvcd: row.district,
            czTime: row.czTime,
            jjTime: row.jjTime,
            bz: row.bz
          }
        )
        .then(res => {
          console.log(res.data.data.accessToken);
          newAxios
            .get(
              `/GetPlayUrl?deviceCode=${data.channelNumber}&chl=${data.serialNumber}`
            )
            .then(result => {
              this.innerVisibleVideo = true;
              this.videoSource = result.data.data.m3u8;
        })
          .then(function(response) {
            that.$message({
              message: "生成警单成功",
              type: "success"
            });
          // newAxios
          //   .post(
          //     "/api_control",
          //     {},
          //     {
          //       params: {
          //         param: JSON.stringify({
          //           PktType: "RemotePlayback",
          //           accessToken: res.data.data.accessToken,
          //           deviceCode: data.channelNumber,
          //           startTime: time.end,
          //           endTime: time.begin,
          //           chl: data.serialNumber
          //         })
          //       }
          //     }
          //   )
          //   .then(result => {
          //     this.videoSource = result.data.data.m3u8
          //     this.innerVisibleVideo = true
          //   });
        });
    },
    openOldVideoBox() {
      if (Hls.isSupported()) {
        var dom = document.getElementById("old_video");
        // if (dom.volume) dom.volume = 1.0;
        this.hls = new Hls();
        var m3u8Url = decodeURIComponent(this.videoSource);
        this.hls.loadSource(m3u8Url);
        this.hls.attachMedia(dom);
        this.hls.on(Hls.Events.MANIFEST_PARSED, function() {
          dom.play();
        });
            that.updateJtyep(row);
            that.dialogTableVisible = false;
          })
          .catch(function(error) {
            that.dialogTableVisible = false;
          });
      }
    },
    closeOldVideoBox() {
      var dom = document.getElementById("old_video");
      if (dom.getAttribute("src") != "") {
        dom.pause();
        dom.setAttribute("");
      }
    revoke(row) {
      var that = this;
      axios({
        url:
          "http://192.168.0.103:1888/api/blade-jfpts/alarm/alarm/deletejj?id=" +
          row.id,
        method: "post"
      }).then(function() {
        that.dialogTableVisible = false;
        that.onLoad(that.page, that.query);
      });
    },
    updateJtyep(row) {
      var that = this;
      axios({
        url:
          "http://192.168.0.103:1888/api/blade-jfpts/alarm/alarm/updateJtype?id=" +
          row.id +
          "&czTime=" +
          row.czTime +
          "&bz=" +
          row.bz,
        method: "post"
      }).then(function() {
        that.onLoad(that.page, that.query);
      });
    }
  }
};