From 14e02654e0545ee69456d64aef2f35c7c219d708 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 07 May 2021 11:26:49 +0800
Subject: [PATCH] 地图模式设备状态修改

---
 src/views/realTimePolice/real.vue |  707 ++++++++--------------------------------------------------
 1 files changed, 104 insertions(+), 603 deletions(-)

diff --git a/src/views/realTimePolice/real.vue b/src/views/realTimePolice/real.vue
index 3b88a0f..74dedae 100644
--- a/src/views/realTimePolice/real.vue
+++ b/src/views/realTimePolice/real.vue
@@ -1,9 +1,3 @@
-/*
- * @Author: Morpheus
- * @Date: 2021-03-17 15:21:33
- * @Last Modified by: Morpheus
- * @Last Modified time: 2021-04-09 09:59:32
- */
 <template>
   <basic-container>
     <avue-crud
@@ -66,9 +60,25 @@
           @click="getQBdata(3)"
           >全部
         </el-button>
-        <span>
-          <Legend :datas="datalistLIU"></Legend>
-        </span>
+      </template>
+
+      <template slot="menuLeft">
+        <el-button
+          type="warning"
+          size="mini"
+          plain
+          icon="el-icon-download"
+          @click="handleExport"
+          >导出
+        </el-button>
+        <el-button
+          type="warning"
+          size="mini"
+          plain
+          icon="el-icon-pie-chart"
+          @click="handleExportStatis"
+          >导出报表
+        </el-button>
       </template>
 
       <template slot-scope="{ row }" slot="jtype">
@@ -126,268 +136,7 @@
         </el-button>
       </template>
     </avue-crud>
-
-    <el-dialog
-      class="real-dialog"
-      title="警情核实"
-      :visible.sync="dialogTableVisible"
-      :append-to-body="true"
-      :close-on-click-modal="false"
-      @opened="realOpenVideoDialog"
-      @close="(videoConversationReal = false), (oldVideoSatart = false)"
-    >
-      <el-dialog
-        class="ss-video-dialog"
-        :modal="false"
-        width="100%"
-        title="视频通话"
-        :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="/oldVideo/ft.mp4"
-          muted="muted"
-          autoplay="autoplay"
-          loop
-          id="real_old_video"
-          style="width: 100%; height: 100%; object-fit: fill"
-          controls
-        ></video>
-      </el-dialog>
-
-      <el-form
-        :model="form"
-        label-position="right"
-        size="mini"
-        label-width="100px"
-      >
-        <el-row>
-          <el-col span="12">
-            <audio src="" id="real_audio"></audio>
-            <el-form-item label="报警人">
-              <el-input
-                disabled="true"
-                v-model="form.galarmPeople"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col span="12">
-            <el-form-item label="报警人电话">
-              <el-input
-                disabled="true"
-                v-model="form.phoneNumber"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col span="12">
-            <el-form-item label="负责人">
-              <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="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="省份" class="cityClassParams">
-              <avue-form :option="itemOption" v-model="form"></avue-form>
-            </el-form-item>
-          </el-col>
-          <el-col span="12">
-            <el-form-item label="事发地址">
-              <el-input
-                disabled="true"
-                v-model="form.place"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col span="12">
-            <el-form-item label="警情类型">
-              <el-input
-                disabled="true"
-                v-model="form.waringType"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <el-col span="12">
-            <el-form-item label="设备编号">
-              <el-input
-                disabled="true"
-                v-model="form.deviceNumber"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-        </el-row>
-        <el-row>
-          <el-col span="12">
-            <el-form-item label="接警人">
-              <el-input
-                disabled="true"
-                v-model="form.alarmPeople"
-                autocomplete="off"
-              ></el-input>
-            </el-form-item>
-          </el-col>
-          <!-- <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>
-          </el-col>
-        </el-row>
-
-        <el-row>
-          <el-col span="12">
-            <el-form-item label="报警时间">
-              <el-input
-                disabled="true"
-                v-model="form.alarmTime"
-                autocomplete="off"
-              ></el-input>
-            </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 :align="center">
-          <el-col class="opt-btn">
-            <el-form-item>
-              <!-- <el-button
-                :class="{ active: isActive }"
-                type="success"
-                @click.stop="aKeyToCall($event, form)"
-                >查看视频
-              </el-button> -->
-              <el-button
-                type="success"
-                @click.stop="updateJtyep(form, 1, '办结')"
-                >办结
-              </el-button>
-
-              <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>
-          </el-col>
-        </el-row>
-      </el-form>
-    </el-dialog>
-
+    <real-popup ref="realPopupView"> </real-popup>
     <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
       <iframe
         id="mapDiv"
@@ -400,47 +149,17 @@
     </el-drawer>
   </basic-container>
 </template>
-
+ 
 <script>
 import { getList, remove, update, add, getclient } from "@/api/real/real";
 import { mapGetters } from "vuex";
 
-import Hls from "hls.js";
-
-import axios from "axios";
-
-import Recorder from "js-audio-recorder";
-
-import Legend from '../../components/liu-legend/Legend'
-
 export default {
-  components:{
-      Legend,
-    },
   data() {
     return {
-      //legend-liu数据
-      datalistLIU:[
-                {
-                    color: 'rgb(233, 39, 25)',
-                    text: '未处理'
-                },
-                {
-                    color: 'rgb(17, 198, 253)',
-                    text: '处理中'
-                },
-                {
-                    color: 'black',
-                    text: '已处理'
-                }
-            ],
-
       showMap: false,
       hls: "",
       videoSource: "",
-      dialogTableVisible: false,
-      videoConversationReal: false,
-      oldVideoSatart: false,
       activeClass: 3,
       form: {},
       query: {},
@@ -455,7 +174,7 @@
       option: {
         height: "auto",
         indexLabel: "序号",
-        calcHeight: 30,
+        calcHeight: 54,
         labelWidth: "100",
         size: "mini",
         border: false,
@@ -502,6 +221,7 @@
             type: "datetime",
             format: "yyyy-MM-dd",
             valueFormat: "yyyy-MM-dd",
+            searchValue: [this.getStartTime(), this.getEndTime()],
             searchRange: true,
             searchSpan: 5,
             hide: true,
@@ -587,7 +307,7 @@
             cascaderItem: ["city", "district"],
             dicUrl: "/api/blade-system/region/select",
             span: 6,
-            className: "cityClass1",
+            className: "cityreal1",
             hide: true,
             addDisplay: true,
             editDisplay: true,
@@ -609,7 +329,7 @@
             dicUrl: "/api/blade-system/region/select?code={{key}}",
             span: 3,
             labelWidth: "0",
-            className: "cityClass2",
+            className: "cityreal2",
             hide: true,
             addDisplay: true,
             editDisplay: true,
@@ -631,7 +351,7 @@
             dicUrl: "/api/blade-system/region/select?code={{key}}",
             span: 3,
             labelWidth: "0",
-            className: "cityClass3",
+            className: "cityreal3",
             hide: true,
             addDisplay: true,
             editDisplay: true,
@@ -656,63 +376,9 @@
           },
         ],
       },
-      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: {
@@ -787,7 +453,10 @@
     },
     searchReset() {
       this.activeClass = 3;
+      //清空搜索框中的内容
       this.query = {};
+      //清空this.$route.query
+      this.$router.push({ query: {} });
       this.onLoad(this.page);
     },
     searchChange(params, done) {
@@ -1135,55 +804,30 @@
         };
       });
     },
+    getStartTime() {
+      if (
+        this.$route.query.startTime != undefined &&
+        this.$route.query.startTime != null &&
+        this.$route.query.startTime != ""
+      ) {
+        return this.$route.query.startTime;
+      }
+      return "";
+    },
+    getEndTime() {
+      if (
+        this.$route.query.endTime != undefined &&
+        this.$route.query.endTime != null &&
+        this.$route.query.endTime != ""
+      ) {
+        return this.$route.query.endTime;
+      }
+      return "";
+    },
     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;
+      this.$refs.realPopupView.onItemGetParentData(row);
     },
-    updateJtyep(row, jtype, t) {
-      var that = this;
 
-      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;
-
-          // 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,
-          });
-        });
-    },
     beginTimeOrEndTime(time) {
       var beginTime = new Date(time);
 
@@ -1243,230 +887,91 @@
         end: endY + endM + endD + endH + endm + ends,
       };
     },
-    // 视频通话打开关闭事件
-    openRealVideoBox() {
-      var that = this;
-      var newAxios = axios.create({
-        baseURL: "https://web.byisf.com:18000",
-        withCredentials: false,
-        headers: {
-          "Content-type": "application/x-www-form-urlencoded",
-        },
-      });
 
-      //this.form.serialNumber
-      newAxios
-        .post(
-          "/api_control",
-          {},
-          {
-            params: {
-              param: JSON.stringify({ PktType: "GetAccessToken" }),
-            },
-          }
-        )
-        .then((res) => {
-          newAxios
-            .get(
-              `https://web.byisf.com:18000/GetPlayUrl?deviceCode=${that.form.serialNumber}&chl=${this.form.channelNumber}`
-            )
-            .then((result) => {
-              that.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;
-                    }
-                  }
-                });
-              }
-            });
-        });
-    },
-    closeRealVideoBox() {
-      var dom = document.getElementById("real_video_conversation");
-
-      if (dom.getAttribute("src") != "") {
-        dom.pause();
-
-        dom.setAttribute("src", "");
-
-        this.hls.destroy();
-      }
-    },
-    // 历史视频打开关闭事件
-    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: "https://web.byisf.com:18000",
-        withCredentials: false,
-        headers: {
-          "Content-Type": "application/json;",
-        },
-      });
-      var that = this;
-
-      newCallAxios
-        .post(
-          `/api_control`,
-          {},
-          {
-            params: {
-              param: { PktType: "GetAccessToken" },
-            },
-          }
-        )
-        .then((result) => {
-          var formData = new FormData();
-          // that.recorder.downloadWAV("新文件");
-
-          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: "Talk",
-                  accessToken: result.data.data.accessToken,
-                  deviceCode: this.form.serialNumber,
-                },
-              },
-            })
-            .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;
+
+    //数据导出
+    handleExport() {
+      this.$confirm("是否导出实时警情数据?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        window.open(
+          `/api/blade-jfpts/alarm/alarm/export-alarm?beginTime=${this.$route.query.startTime}&endTime=${this.$route.query.endTime}&waringType=${this.$route.query.waringType}&timeDesc=${this.$route.query.timeDesc}`
+        );
+      });
+    },
+    //数据报表导出
+    handleExportStatis() {
+      let beginTime =
+        this.$route.query.startTime == undefined
+          ? ""
+          : this.$route.query.startTime;
+      let endTime =
+        this.$route.query.endTime == undefined ? "" : this.$route.query.endTime;
+      let waringType =
+        this.$route.query.waringType == undefined
+          ? ""
+          : this.$route.query.waringType;
+      let timeDesc =
+        this.$route.query.timeDesc == undefined
+          ? ""
+          : this.$route.query.timeDesc;
+      window.open(
+        `https://web.byisf.com/api/blade-report/ureport/preview?_u=blade-alarm.statis.ureport.xml&beginTime=${beginTime}&endTime=${endTime}&waringType=${waringType}&timeDesc=${timeDesc}`
+      );
+      //window.open(`http://localhost:8108/ureport/excel?_u=blade-alarm.statis.ureport.xml&beginTime=${beginTime}&endTime=${endTime}&waringType=${waringType}&timeDesc=${timeDesc}`);
     },
   },
 };
 </script>
-
+ 
 <style>
 .el-card__body .waringTypeClass {
   width: 12%;
 }
 
+.cityreal2 div label,
+.cityreal3 div label {
+  display: none;
+}
+
 /*页面样式*/
-.el-card__body .cityClass1 {
-  width: 155px;
+.el-card__body .cityreal1 {
+  width: 150px;
   padding-right: 0px !important;
 }
 
-.el-card__body .cityClass2 {
+.el-card__body .cityreal2 {
   width: 100px;
-  padding-left: 0px !important;
+  padding-left: 10px !important;
   padding-right: 0px !important;
 }
 
-.el-card__body .cityClass3 {
+.el-card__body .cityreal3 {
   width: 100px;
-  padding-left: 0px !important;
+  padding-left: 10px !important;
   padding-right: 0px !important;
 }
 
 /*新增窗体样式*/
-.el-dialog .cityClass1 {
-  width: 220px;
+.el-dialog .cityreal1 {
+  width: 216px;
   padding-right: 0px !important;
 }
 
-.el-dialog .cityClass2 {
-  width: 110px;
-  padding-left: 5px !important;
-  padding-right: 5px !important;
+.el-dialog .cityreal2 {
+  width: 130px;
+  padding-left: 10px !important;
+  padding-right: 10px !important;
 }
 
-.el-dialog .cityClass3 {
-  width: 110px;
+.el-dialog .cityreal3 {
+  width: 105px;
   padding-left: 0px !important;
   padding-right: 0px !important;
 }
@@ -1531,10 +1036,6 @@
   box-sizing: border-box;
 }
 
-.el-button.active {
-  background: #ff0000 !important;
-}
-
 .el-button.btn-color {
   color: rgb(255, 255, 255);
   background-color: rgb(64, 158, 255);
@@ -1544,4 +1045,4 @@
 .tabFontSize {
   font-size: 15px;
 }
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.3