南昌市物联网技防平台-前端
shuishen
2021-04-08 a4e06ccd3cd976fbe4eef99e188d42ec9f3ad054
src/views/realTimePolice/real.vue
@@ -1,3 +1,9 @@
/*
 * @Author: Morpheus
 * @Date: 2021-03-17 15:21:33
 * @Last Modified by: Morpheus
 * @Last Modified time: 2021-04-07 17:36:33
 */
<template>
  <basic-container>
    <avue-crud
@@ -13,6 +19,7 @@
      @row-save="rowSave"
      :before-open="beforeOpen"
      :row-style="rowStyle"
      row-class-name="tabFontSize"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
@@ -24,7 +31,8 @@
      <template slot="menuLeft">
        <el-button
          type="danger"
          size="small"
          v-show="true"
          size="mini"
          icon="el-icon-delete"
          plain
          v-if="permission.real_delete"
@@ -35,20 +43,26 @@
      <template slot="menuLeft">
        <el-button
          v-bind:class="activeClass == 0 ? 'btn-color' : ''"
          size="mini"
          @click="getBRdata(0)"
          >本日
        </el-button>
        <el-button
          v-bind:class="activeClass == 1 ? 'btn-color' : ''"
          size="small"
          size="mini"
          @click="getBZdata(1)"
          >本周
        </el-button>
        <el-button
          v-bind:class="activeClass == 2 ? 'btn-color' : ''"
          size="small"
          size="mini"
          @click="getBYdata(2)"
          >本月
        </el-button>
        <el-button
          v-bind:class="activeClass == 3 ? 'btn-color' : ''"
          size="small"
          size="mini"
          @click="getQBdata(3)"
          >全部
        </el-button>
@@ -56,7 +70,9 @@
      <template slot-scope="{ row }" slot="jtype">
        <el-tag
          >{{ row.jtype == "0" ? "否" : row.jtype == "1" ? "是" : "无" }}
          >{{
            row.jtype == "0" ? "未处理" : row.jtype == "1" ? "处理中" : "已处理"
          }}
        </el-tag>
      </template>
      <template slot-scope="{ row }" slot="cid">
@@ -83,11 +99,20 @@
          >视频
        </el-button>
        <el-button
          v-if="row.jtype == 0 || row.jtype == ''"
          icon="el-icon-edit"
          :size="size"
          :type="type"
          @click.stop="handleManage(row)"
          >核实
        </el-button>
        <el-button
          v-if="row.jtype != 0 && row.jtype != ''"
          icon="el-icon-s-order"
          :size="size"
          :type="type"
          @click.stop="PoliceTracking(row)"
          >追踪
        </el-button>
        <el-button
          icon="el-icon-location-outline"
@@ -100,25 +125,50 @@
    </avue-crud>
    <el-dialog
      class="real-dialog"
      title="警情核实"
      :visible.sync="dialogTableVisible"
      append-to-body="true"
      @close="innerVisibleVideo = false"
      :append-to-body="true"
      :close-on-click-modal="false"
      @opened="realOpenVideoDialog"
      @close="(videoConversationReal = false), (oldVideoSatart = false)"
    >
      <el-dialog
        class="old-video-dialog"
        class="ss-video-dialog"
        :modal="false"
        width="100%"
        title="视频通话"
        :visible.sync="innerVisibleVideo"
        :visible.sync="videoConversationReal"
        :close-on-press-escape="false"
        append-to-body
        @opened="openRealVideoBox"
        @close="closeRealVideoBox"
      >
        <video
          src=""
          id="real_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=""
          id="old_video"
          src="/oldVideo/ft.mp4"
          muted="muted"
          autoplay="autoplay"
          loop
          id="real_old_video"
          style="width: 100%; height: 100%; object-fit: fill"
          controls
        ></video>
@@ -132,6 +182,7 @@
      >
        <el-row>
          <el-col span="12">
            <audio src="" id="real_audio"></audio>
            <el-form-item label="报警人">
              <el-input
                disabled="true"
@@ -153,31 +204,50 @@
        <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>
              <el-button
                type="success"
                style="
                  margin-left: 10px;
                  padding: 0px 8px;
                  width: 100px;
                  height: 28px;
                  vertical-align: top;
                "
              >
                <i class="el-icon-phone-outline"></i>
                联系负责人
              </el-button>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col span="12">
            <el-form-item label="行政区">
              <el-input
                disabled="true"
                v-model="form.district"
                autocomplete="off"
              ></el-input>
            <el-form-item label="省份" class="cityClassParams">
              <avue-form :option="itemOption" v-model="form"></avue-form>
            </el-form-item>
          </el-col>
          <el-col span="12">
@@ -192,7 +262,7 @@
        </el-row>
        <el-row>
          <el-col span="12">
            <el-form-item label="警情类别">
            <el-form-item label="警情类型">
              <el-input
                disabled="true"
                v-model="form.waringType"
@@ -220,11 +290,20 @@
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col span="12">
          <!-- <el-col span="12">
            <el-form-item label="接警时间">
              <el-input
                disabled="true"
                v-model="form.jjTime"
                autocomplete="off"
              ></el-input>
            </el-form-item>
          </el-col> -->
          <el-col span="12">
            <el-form-item label="报警内容">
              <el-input
                disabled="true"
                v-model="form.content"
                autocomplete="off"
              ></el-input>
            </el-form-item>
@@ -242,35 +321,33 @@
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="监控视频">
              <el-button
                :class="{ active: isActive }"
                type="success"
                @click.stop="
                  (videoConversationReal = true), (oldVideoSatart = false)
                "
                @mousedown.native="aKeyToCall"
                @mouseup.native="aKeyStopCall"
                >视频通话
              </el-button>
              <el-button
                v-show="false"
                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="备注">
              <el-input v-model="form.bz" autocomplete="off"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="报警内容">
            <el-input
              disabled="true"
              v-model="form.content"
              autocomplete="off"
            ></el-input>
          </el-form-item>
        </el-row>
        <el-row>
          <el-col span="12">
            <el-form-item label="视频通话">
              <el-button type="primary" @click.stop="queryOldVideo(form)"
                >查看视频
              </el-button>
            </el-form-item>
          </el-col>
          <el-col span="12">
            <el-form-item label="历史视频">
              <el-button type="primary" @click.stop="queryOldVideo(form)"
                >查看视频
              </el-button>
            </el-form-item>
          </el-col>
        </el-row>
@@ -284,11 +361,22 @@
                @click.stop="aKeyToCall($event, form)"
                >查看视频
              </el-button> -->
              <el-button type="warning" @click.stop="revoke(form)"
              <el-button
                type="success"
                @click.stop="updateJtyep(form, 1, '办结')"
                >办结
              </el-button>
              <el-button type="danger" class="push-nmb-btn">推送110</el-button>
              <el-button type="primary" @click.stop="generate(form)"
              <img
                src="/img/police-num.png"
                style="margin-top: -20px; height: 80px; vertical-align: middle"
                alt=""
                @click.stop="updateJtyep(form, 1, '推送110')"
              />
              <el-button
                type="primary"
                @click.stop="updateJtyep(form, 1, '派送保安')"
                >派送保安
              </el-button>
            </el-form-item>
@@ -327,8 +415,9 @@
      hls: "",
      videoSource: "",
      dialogTableVisible: false,
      innerVisibleVideo: false,
      activeClass: -1,
      videoConversationReal: false,
      oldVideoSatart: false,
      activeClass: 3,
      form: {},
      query: {},
      dateTime: [],
@@ -345,23 +434,25 @@
        calcHeight: 30,
        labelWidth: "100",
        size: "mini",
        border: false,
        stripe: true,
        menuWidth: 240,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        border: true,
        align: "center",
        index: true,
        viewBtn: true,
        selection: false,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "警情类型",
            prop: "waringType",
            search: true,
            search: false,
            searchSpan: 3,
            width: 130,
            width: 85,
            className: "waringTypeClass",
            searchPlaceholder: "请选择",
            type: "select",
@@ -376,7 +467,7 @@
          {
            label: "报警时间",
            type: "datetime",
            width: 130,
            width: 160,
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            prop: "alarmTime",
@@ -403,21 +494,27 @@
            ],
          },
          {
            label: "报警内容",
            prop: "content",
            label: "主要负责人",
            prop: "oneContacts",
            width: 90,
          },
          {
            label: "负责人电话",
            prop: "onePhone",
            width: 110,
          },
          {
            label: "报警人",
            prop: "galarmPeople",
            width: 90,
          },
          {
            label: "联系电话",
            label: "报警人电话",
            prop: "phoneNumber",
            width: 130,
          },
          {
            label: "事发地址",
            width: 200,
            prop: "place",
          },
          {
@@ -428,22 +525,26 @@
            prop: "deviceNumber",
          },
          {
            label: "生成警单",
            label: "警情状态",
            searchSpan: 3,
            width: 96,
            search: true,
            searchSpan: 2,
            slot: true,
            searchPlaceholder: " ",
            searchPlaceholder: "请选择",
            prop: "jtype",
            type: "select",
            className: "jtypeClass",
            dicData: [
              {
                label: "否",
                label: "未处理",
                value: "0",
              },
              {
                label: "是",
                label: "处理中",
                value: "1",
              },
              {
                label: "已处理",
                value: "2",
              },
            ],
          },
@@ -463,6 +564,10 @@
            dicUrl: "/api/blade-system/region/select",
            span: 6,
            className: "cityClass1",
            hide: true,
            addDisplay: true,
            editDisplay: true,
            viewDisplay: true,
          },
          {
            label: "地市",
@@ -481,6 +586,10 @@
            span: 3,
            labelWidth: "0",
            className: "cityClass2",
            hide: true,
            addDisplay: true,
            editDisplay: true,
            viewDisplay: true,
          },
          {
            label: "区县",
@@ -499,29 +608,15 @@
            span: 3,
            labelWidth: "0",
            className: "cityClass3",
          },
          {
            label: "警情状态",
            searchSpan: 3,
            prop: "cid",
            slot: true,
            hide: true,
            width: 100,
            type: "select",
            dicData: [
              {
                label: "事件发生",
                value: "1",
              },
              {
                label: "事件恢复",
                value: "3",
              },
            ],
            addDisplay: true,
            editDisplay: true,
            viewDisplay: true,
          },
          {
            label: "接警人",
            prop: "alarmPeople",
            width: 90,
          },
          {
            label: "接警时间",
@@ -530,12 +625,70 @@
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            width: 130,
            prop: "jjTime",
            hide: true,
            addDisplay: true,
            editDisplay: true,
            viewDisplay: true,
          },
        ],
      },
      itemOption: {
        menuBtn: false,
        column: [
          {
            disabled: true,
            row: false,
            prop: "province",
            type: "select",
            placeholder: "省份",
            props: {
              label: "name",
              value: "code",
            },
            cascaderItem: ["city", "district"],
            dicUrl: "/api/blade-system/region/select",
            span: 1,
            labelWidth: "0",
            className: "cityClassSelect",
          },
          {
            disabled: true,
            row: false,
            prop: "city",
            type: "select",
            placeholder: "地市",
            props: {
              label: "name",
              value: "code",
            },
            dicUrl: "/api/blade-system/region/select?code={{key}}",
            span: 1,
            labelWidth: "0",
            className: "cityClassSelect",
          },
          {
            disabled: true,
            row: false,
            prop: "district",
            type: "select",
            placeholder: "区县",
            props: {
              label: "name",
              value: "code",
            },
            dicUrl: "/api/blade-system/region/select?code={{key}}",
            span: 1,
            labelWidth: "0",
            className: "cityClassSelect",
          },
        ],
      },
      data: [],
      isActive: false,
      recorder: null,
      peopleList: [],
      peopleName: "",
      peoplePhone: "",
    };
  },
  computed: {
@@ -544,8 +697,8 @@
      return {
        addBtn: this.vaildData(this.permission.real_add, false),
        viewBtn: this.vaildData(null, false),
        delBtn: this.vaildData(this.permission.real_delete, false),
        editBtn: this.vaildData(this.permission.real_edit, false),
        delBtn: this.vaildData(null, false),
        editBtn: this.vaildData(null, false),
      };
    },
    ids() {
@@ -558,13 +711,6 @@
  },
  created() {
    this.dateTime = this.getDate();
    this.recorder = new Recorder({
      sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
      sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
      numChannels: 1, // 声道,支持 1 或 2, 默认是1
      // compiling: false,(0.x版本中生效,1.x增加中)  // 是否边录边转换,默认是false
    });
  },
  methods: {
    rowSave(row, done, loading) {
@@ -578,7 +724,6 @@
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
@@ -595,7 +740,6 @@
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
@@ -618,7 +762,7 @@
        });
    },
    searchReset() {
      this.activeClass = -1;
      this.activeClass = 3;
      this.query = {};
      this.onLoad(this.page);
    },
@@ -679,6 +823,62 @@
      let values = {
        ...params,
      };
      if (
        this.$route.query.waringType &&
        this.$route.query != undefined &&
        this.$route.query != null &&
        this.$route.query != ""
      ) {
        if (
          this.$route.query.status != undefined &&
          this.$route.query.status != null &&
          this.$route.query.status == ""
        ) {
          this.activeClass = this.$route.query.status;
          this.page.currentPage = 1;
          if (this.$route.query.status == 0) {
            params = {
              waringType: this.$route.query.waringType,
              beginTime: this.dateTime.day.beginTime,
              endTime: this.dateTime.day.endTime,
            };
          } else if (this.$route.query.status == 1) {
            params = {
              waringType: this.$route.query.waringType,
              beginTime: this.dateTime.week.beginTime,
              endTime: this.dateTime.week.endTime,
            };
          } else if (this.$route.query.status == 2) {
            params = {
              waringType: this.$route.query.waringType,
              beginTime: this.dateTime.month.beginTime,
              endTime: this.dateTime.month.endTime,
            };
          }
        } else {
          this.activeClass = 0;
          this.page.currentPage = 1;
          params = {
            waringType: this.$route.query.waringType,
            beginTime: this.dateTime.day.beginTime,
            endTime: this.dateTime.day.endTime,
          };
        }
        if (
          this.$route.query.startTime != undefined &&
          this.$route.query.startTime != null &&
          this.$route.query.startTime != ""
        ) {
          params = {
            waringType: this.$route.query.waringType,
            beginTime: this.$route.query.startTime,
            endTime: this.$route.query.endTime,
          };
        }
      }
      if (releaseTimeRange) {
        values = {
          ...params,
@@ -693,9 +893,13 @@
          ...this.query,
        };
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        data.records.forEach((item) => {
          item.waringType == "紧急求救" ? (item.waringType = "一键求助") : "";
        });
        this.page.total = data.total;
        data.records.sort((a, b) => {
@@ -703,6 +907,7 @@
        });
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
@@ -752,8 +957,27 @@
        currentData.getMinutes() < 10
          ? "0" + currentData.getMinutes()
          : currentData.getMinutes();
      //秒
      var currenS =
        currentData.getSeconds() < 10
          ? "0" + currentData.getSeconds()
          : currentData.getSeconds();
      return {
        day: {
          beginTime: currentY + "-" + currentM + "-" + currentD + " 00:00:00",
          endTime:
            currentY +
            "-" +
            currentM +
            "-" +
            currentD +
            " " +
            currenH +
            ":" +
            currenM +
            ":00",
        },
        week: {
          beginTime: mondayY + "-" + mondayM + "-" + mondayD + " 00:00:00",
          endTime:
@@ -782,7 +1006,29 @@
            currenM +
            ":00",
        },
        current:
          currentY +
          "-" +
          currentM +
          "-" +
          currentD +
          " " +
          currenH +
          ":" +
          currenM +
          ":" +
          currenS,
      };
    },
    getBRdata(e) {
      this.activeClass = e;
      var params = {
        beginTime: this.dateTime.day.beginTime,
        endTime: this.dateTime.day.endTime,
      };
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
    },
    getBZdata(e) {
      this.activeClass = e;
@@ -812,13 +1058,17 @@
      this.onLoad(this.page, params);
    },
    rowStyle({ row, column, rowIndex }) {
      if (row.jtype == "1") {
      if (row.jtype == "0") {
        return {
          color: "#ff2727",
        };
      } else if (row.jtype == "1") {
        return {
          color: "#15a2fe",
        };
      } else {
        return {
          color: "#ff2727",
          color: "#000000",
        };
      }
    },
@@ -855,98 +1105,53 @@
    },
    handleManage(row) {
      this.form = row;
      this.peopleList = [
        { label: row.oneContacts, value: row.onePhone },
        { label: row.twoContacts, value: row.twoPhone },
        { label: row.threeContacts, value: row.threePhone },
      ];
      this.peopleName = row.oneContacts;
      this.peoplePhone = row.onePhone;
      this.dialogTableVisible = true;
    },
    generate(row) {
      console.log(row);
      return;
    updateJtyep(row, jtype, t) {
      var that = this;
      if (row.czTime == "" || row.czTime == null) {
        this.$message({
          message: "请选择处置时间",
          type: "warning",
        });
      } else {
        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;
            var arr = [];
            that.$store.state.tags.tagList.forEach((item) => {
              if (item.label != "警情分发处置") {
                arr.push(item);
              }
            });
            that.$store.state.tags.tagList = arr;
      axios
        .post(
          "/api/blade-jfpts/alarm/alarm/updateJtype",
          {},
          {
            params: {
              jid: row.id,
              jtype: jtype,
              rid: row.alarmId,
              bz: row.bz,
              snumber: row.alarmId,
              sname: row.alarmPeople,
              zc: t,
              zctime: that.getDate().current,
            },
          }
        )
        .then(function () {
          that.dialogTableVisible = false;
            row.type = 0;
            row.id = response.data.data;
            that.$router.push({ path: "/distribution/index", query: row });
          })
          .catch(function (error) {
            that.dialogTableVisible = false;
          axios({
            method: "post",
            url: `/api/blade-jfpts/rvideo/stop`,
            params: {
              jid: row.id,
            },
          }).then((resdata) => {});
          that.onLoad(that.page, that.query);
          that.$router.push({
            path: "/policeTracking/track",
            query: that.form,
          });
      }
        });
    },
    revoke(row) {
      var that = this;
      axios({
        url: "/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:
          "/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);
      });
    },
    beginTimeOrEndTime(time) {
      var beginTime = new Date(time);
@@ -1006,17 +1211,18 @@
        end: endY + endM + endD + endH + endm + ends,
      };
    },
    queryOldVideo(data) {
    // 视频通话打开关闭事件
    openRealVideoBox() {
      var that = this;
      var newAxios = axios.create({
        baseURL: "http://36.134.81.48:18000",
        baseURL: "https://web.byisf.com:18000",
        withCredentials: false,
        headers: {
          "Content-type": "application/x-www-form-urlencoded",
        },
      });
      var time = this.beginTimeOrEndTime(data.alarmTime);
      //this.form.serialNumber
      newAxios
        .post(
          "/api_control",
@@ -1030,61 +1236,56 @@
        .then((res) => {
          newAxios
            .get(
              `/GetPlayUrl?deviceCode=${data.channelNumber}&chl=${data.serialNumber}`
              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${that.form.serialNumber}&chl=${this.form.channelNumber}`
            )
            .then((result) => {
              this.innerVisibleVideo = true;
              that.videoSource = result.data.data.m3u8;
              this.videoSource = result.data.data.m3u8;
              if (Hls.isSupported()) {
                var dom = document.getElementById("real_video_conversation");
                that.hls = new Hls();
                var m3u8Url = decodeURIComponent(that.videoSource);
                that.hls.loadSource(m3u8Url);
                that.hls.attachMedia(dom);
                that.hls.on(Hls.Events.MANIFEST_PARSED, function () {
                  dom.play();
                });
                that.hls.on(Hls.Events.ERROR, function (event, data) {
                  console.log(data, 4566824159, "视频播放有问题!!!");
                  if (data.fatal) {
                    switch (data.type) {
                      case Hls.ErrorTypes.NETWORK_ERROR:
                        // try to recover network error
                        console.log(
                          "fatal network error encountered, try to recover"
                        );
                        that.hls.startLoad();
                        break;
                      case Hls.ErrorTypes.MEDIA_ERROR:
                        console.log(
                          "fatal media error encountered, try to recover"
                        );
                        that.hls.recoverMediaError();
                        break;
                      default:
                        // cannot recover
                        that.hls.destroy();
                        break;
                    }
                  }
                });
              }
            });
          //   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;
          //     });
        });
    },
    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();
        });
      }
    },
    closeOldVideoBox() {
      var dom = document.getElementById("old_video");
    closeRealVideoBox() {
      var dom = document.getElementById("real_video_conversation");
      if (dom.getAttribute("src") != "") {
        dom.pause();
@@ -1094,74 +1295,110 @@
        this.hls.destroy();
      }
    },
    aKeyToCall(e, form) {
    // 历史视频打开关闭事件
    openOldVideoBox() {
      var dom = document.getElementById("real_old_video");
      dom.currentTime = 0;
      dom.play();
    },
    closeOldVideoBox() {
      var dom = document.getElementById("real_old_video");
      dom.pause();
    },
    aKeyToCall() {
      this.isActive = true;
      var that = this;
      if (this.recorder == null) {
        this.recorder = new Recorder({
          sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
          sampleRate: 8000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
          numChannels: 1, // 声道,支持 1 或 2, 默认是1
          // compiling: false,(0.x版本中生效,1.x增加中)  // 是否边录边转换,默认是false
        });
      }
      // 一键呼叫相关函数
      that.recorder.start().then(
        () => {
          // 开始录音
        },
        (error) => {
          // 出错了
          console.log(`${error.name} : ${error.message}`);
        }
      );
    },
    // 序列号后期待修改
    aKeyStopCall() {
      this.isActive = false;
      var newCallAxios = axios.create({
        baseURL: "http://36.134.81.48:18000",
        baseURL: "https://web.byisf.com:18000",
        withCredentials: false,
        headers: {
          "Content-Type": "application/json;",
        },
      });
      var that = this;
      // 一键呼叫相关函数
      if (this.isActive == true) {
        this.isActive = false;
      newCallAxios
        .post(
          `/api_control`,
          {},
          {
            params: {
              param: { PktType: "GetAccessToken" },
            },
          }
        )
        .then((result) => {
          var formData = new FormData();
          // that.recorder.downloadWAV("新文件");
        newCallAxios
          .post(
            `/api_control`,
            {},
            {
          var blob = that.recorder.getPCMBlob(); //获取pcm格式音频数据
          //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData
          var newbolb = new Blob([blob], { type: "audio/pcm" });
          var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm");
          formData.append("file", fileOfBlob);
          newCallAxios
            .post(`/api_control`, blob, {
              params: {
                param: { PktType: "GetAccessToken" },
              },
            }
          )
          .then((result) => {
            var formData = new FormData();
            var blob = this.recorder.getPCMBlob(); //获取pcm格式音频数据
            //此处获取到blob对象后需要设置fileName满足当前项目上传需求,其它项目可直接传把blob作为file塞入formData
            var newbolb = new Blob([blob], { type: "audio/pcm" });
            var fileOfBlob = new File([newbolb], new Date().getTime() + ".pcm");
            formData.append("file", fileOfBlob);
            document
              .getElementById("real_audio")
              .setAttribute("src", URL.createObjectURL(blob));
            this.recorder.play();
            newCallAxios
              .post(`/api_control`, blob, {
                params: {
                  param: {
                    PktType: "Talk",
                    accessToken: result.data.data.accessToken,
                    deviceCode: form.channelNumber,
                  },
                param: {
                  PktType: "Talk",
                  accessToken: result.data.data.accessToken,
                  deviceCode: this.form.serialNumber,
                },
              })
              .then((result) => {});
          });
      } else {
        this.isActive = true;
        Recorder.getPermission().then(() => {
          this.recorder.start().then(() => {
            // 开始录音
          });
              },
            })
            .then(() => {
              that.recorder.destroy().then(function () {
                that.recorder = null;
              });
            });
        });
      }
    },
    peopleOrPhone(e) {
      this.peopleList.forEach((item) => {
        if (item.label == e) {
          this.peoplePhone = item.value;
        }
      });
    },
    PoliceTracking(row) {
      //警情追踪
      this.$router.push({ path: "/policeTracking/track", query: row });
    },
    realOpenVideoDialog() {
      Recorder.getPermission().then(() => {});
      this.videoConversationReal = true;
    },
  },
};
</script>
<style>
.el-card__body .jtypeClass {
  width: 10%;
}
.el-card__body .waringTypeClass {
  width: 12%;
}
@@ -1202,6 +1439,31 @@
  padding-right: 0px !important;
}
.cityClassParams .avue-form__group.avue-form__group--flex {
  display: flex;
  justify-content: space-between;
}
.cityClassParams .cityClassSelect {
  flex: 1;
  margin: 0 !important;
  padding-left: 0px !important;
  padding-right: 0px !important;
}
.cityClassParams .cityClassSelect:nth-child(2) {
  margin: 0 10px !important;
}
.cityClassParams .cityClassSelect .el-form-item {
  margin-bottom: 0px !important;
}
.cityClassParams .cityClassSelect .el-form-item .el-input__inner {
  height: 28px !important;
  line-height: 28px !important;
}
.cityClass2 div label {
  display: none;
}
@@ -1238,7 +1500,7 @@
}
.el-button.active {
  background: #ff0000;
  background: #ff0000 !important;
}
.el-button.btn-color {
@@ -1246,4 +1508,8 @@
  background-color: rgb(64, 158, 255);
  border-color: rgb(64, 158, 255);
}
.tabFontSize {
  font-size: 15px;
}
</style>