From 4f7f16803ab5ed7b8a8a0dc087792d9b2fcefe2b Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期三, 15 六月 2022 14:39:15 +0800
Subject: [PATCH] 统计查询

---
 src/views/search/components/imgDown.vue          |  147 ++++++++++++------------
 src/views/search/index.vue                       |   91 ++++++++++++++
 src/views/search/components/ModelCard.vue        |   12 +-
 src/views/search/components/wasmPlayer/index.vue |    4 
 src/views/search/components/UploadImg.vue        |    6 
 src/views/search/Searching.vue                   |   34 ++++-
 src/views/search/components/CardItem.vue         |    2 
 src/Pool/VideoPhotoData.ts                       |   11 +
 8 files changed, 209 insertions(+), 98 deletions(-)

diff --git a/src/Pool/VideoPhotoData.ts b/src/Pool/VideoPhotoData.ts
index e73e50d..db514fd 100644
--- a/src/Pool/VideoPhotoData.ts
+++ b/src/Pool/VideoPhotoData.ts
@@ -82,7 +82,8 @@
       inputValue: this.inputValue,
       tabs: this.queryTabs,
       tasks: this.queryTasks,
-      treeNodes: this.treeNodes
+      treeNodes: this.treeNodes,
+      dataSource: "camera"
     }
     if (this.searchFrom == 'cluster') {
       param.isAll = true
@@ -225,20 +226,20 @@
     this.tabsForUploadImg.splice(0, this.tabsForUploadImg.length)
     if (rsp && rsp.success) {
       var arr1 = new Array
-      arr1 = rsp.data.filter(i => {
+      arr1 = rsp.data&&rsp.data.tags.filter(i => {
         if (i.status === 1) {
           i.title = i.title + '(宸插垹闄�)'
           return i
         }
       });
-      this.tabs = rsp.data.filter(function (i) {
+      this.tabs = rsp.data&&rsp.data.tags.filter(function (i) {
         if (i.status !== 1) {
           return i
         }
       })
       this.tabs.push(...arr1)
       this.tabsForUploadImg.push({ key: "esData", title: "鎶撴媿搴�" });
-      rsp.data.forEach(element => {
+      rsp.data.tags.forEach(element => {
         this.tabsForUploadImg.push(element as any);
       });
       // 鏀剧疆榛戠櫧鍚嶅崟 0涓虹櫧鍚嶅崟
@@ -246,7 +247,7 @@
       this.whiteList.length = 0
       var josn = JSON.stringify(rsp)
       var resp = JSON.parse(josn)
-      resp.data.forEach(i => {
+      resp.data.tags.forEach(i => {
         if (i.status === 0 && i.bwType === "0") { //鐧藉悕鍗�
           if (i.analyServerId === "") { //鍚屾搴�
             i.title = i.title + '(鍚屾搴�)'
diff --git a/src/views/search/Searching.vue b/src/views/search/Searching.vue
index f9bd1de..eb7d71d 100644
--- a/src/views/search/Searching.vue
+++ b/src/views/search/Searching.vue
@@ -37,7 +37,7 @@
               "
             ></el-button>
           </el-tooltip>
-          <p class="p-label" style="width: 16%">
+          <!--     <p class="p-label" style="width: 16%">
             <b>鏍囩锛�</b>
             <el-select
               v-model="tagValues"
@@ -58,7 +58,7 @@
                 :title="item.title"
               ></el-option>
             </el-select>
-          </p>
+          </p> -->
           <p class="p-task" style="width: 16%">
             <b>鍦烘櫙锛�</b>
             <el-select
@@ -318,15 +318,16 @@
     this.TreeDataPool.gbReadonly = true;
     this.TreeDataPool.multiple = true;
     this.TreeDataPool.clean();
-    this.TreeDataPool.fetchTreeData();
   },
   mounted() {
     this.$nextTick(() => {
       let scrollContain = this.$refs.scrollContain;
       this.VideoPhotoData.scrollContainDom = scrollContain;
-      let list = this.TreeDataPool.localVedioList.filter((i) => {
-        return i.progress == 100;
-      });
+      let list =
+        this.TreeDataPool.localVedioList &&
+        this.TreeDataPool.localVedioList.filter((i) => {
+          return i.progress == 100;
+        });
       this.TreeDataPool.localVedioList = list;
     });
     window.addEventListener("resize", this.getHeight);
@@ -665,12 +666,18 @@
       ];
     },
     format(array) {
+      if (!array || array.length === 0) {
+        return [];
+      }
       return [
         this.$moment(array[0]).format("YYYY-MM-DD HH:mm:ss"),
         this.$moment(array[1]).format("YYYY-MM-DD HH:mm:ss"),
       ];
     },
     searchingBtn() {
+      if (!this.searchTime) {
+        this.searchTime = [];
+      }
       // let obj = document.getElementById('searchMid');
       // let load = this.$loading({
       //   target:obj,
@@ -682,23 +689,35 @@
       //澶勭悊鎼滅储绫诲瀷
       var tempArr = this.taskValues.map((task) => task.split(","));
       var tasks = [];
+      console.log("1");
+
       tempArr.forEach((arr) => {
         tasks = tasks.concat(arr);
       });
       this.VideoPhotoData.queryTasks = tasks;
+      console.log("2");
 
       this.VideoPhotoData.queryAlarmlevel = this.stringToNum();
+      console.log("3");
+      console.log(this.searchTime);
+
       this.VideoPhotoData.searchTime = this.format(this.searchTime);
+      console.log(this.VideoPhotoData.searchTime);
+
       //this.VideoPhotoData.inputValue = this.searchText;
       this.VideoPhotoData.showType = this.showType;
       if (!this.VideoPhotoData.uploadType) {
         this.VideoPhotoData.uploadDiaplay = false;
         //this.VideoPhotoData.page = this.currentPage;
         // this.VideoPhotoData.querySearchList();
+        console.log("4");
+
         this.setLoadSearch(this.VideoPhotoData.querySearchList());
       } else {
         //this.VideoPhotoData.page = this.currentPage;
         // this.VideoPhotoData.findPersonByPage();
+        console.log("5");
+
         this.setLoadSearch(this.VideoPhotoData.findPersonByPage());
       }
     },
@@ -769,6 +788,9 @@
       this.VideoPhotoData.queryAlarmlevel = [];
       this.VideoPhotoData.searchTime = this.getDateInit();
       this.VideoPhotoData.inputValue = "";
+
+      console.log(this.searchTime);
+
       this.searchTime = this.getDateInit();
       if (!this.VideoPhotoData.uploadType) {
         // this.VideoPhotoData.querySearchList();
diff --git a/src/views/search/components/CardItem.vue b/src/views/search/components/CardItem.vue
index f192109..44f2365 100644
--- a/src/views/search/components/CardItem.vue
+++ b/src/views/search/components/CardItem.vue
@@ -733,7 +733,7 @@
         return "";
       }
       return (
-        "/httpImage/" + url + (url.indexOf("?") >= 0 ? "&" : "?") + "width=160"
+        "http://" + url + (url.indexOf("?") >= 0 ? "&" : "?") + "width=160"
       );
     },
   },
diff --git a/src/views/search/components/ModelCard.vue b/src/views/search/components/ModelCard.vue
index f13d2c2..c96ab47 100644
--- a/src/views/search/components/ModelCard.vue
+++ b/src/views/search/components/ModelCard.vue
@@ -170,7 +170,7 @@
             ref="picSmBox"
           >
             <div class="card-img-box-compear-left">
-              <!-- <img :src="'/httpImage/'+data.targetInfo[0].picSmUrl" ref="picSm" /> -->
+              <!-- <img :src="'http://'+data.targetInfo[0].picSmUrl" ref="picSm" /> -->
               <img-down
                 :url="data.targetInfo[0].picSmUrl"
                 :isPreview="false"
@@ -189,7 +189,7 @@
                 v-for="(item, index) in data.baseInfo"
                 :key="index"
               >
-                <!-- <img :src="'/httpImage/'+item.targetPicUrl" /> -->
+                <!-- <img :src="'http://'+item.targetPicUrl" /> -->
                 <img-down
                   :url="item.targetPicUrl"
                   :isPreview="false"
@@ -217,7 +217,7 @@
               class="card-img-box-compear-left"
               style="width: 60%; margin-top: 5px"
             >
-              <!-- <img :src="'/httpImage/'+data.targetInfo[0].picSmUrl" /> -->
+              <!-- <img :src="'http://'+data.targetInfo[0].picSmUrl" /> -->
               <img-down
                 :url="data.targetInfo[0].picSmUrl"
                 :isPreview="false"
@@ -287,7 +287,7 @@
         >
           <div class="img-box">
             <!-- <video
-              :src="'/httpImage/' + data.videoUrl"
+              :src="'http://' + data.videoUrl"
               controls
               style="margin-top: 12px;"
             >
@@ -336,7 +336,7 @@
                 v-for="(item, index) in data.baseInfo"
                 :key="index"
               >
-                <!-- <img :src="'/httpImage/'+item.targetPicUrl" /> -->
+                <!-- <img :src="'http://'+item.targetPicUrl" /> -->
                 <img-down
                   :url="item.targetPicUrl"
                   :isPreview="false"
@@ -361,7 +361,7 @@
               class="card-img-box-compear-left"
               style="width: 60%; margin-top: 5px"
             >
-              <!-- <img :src="'/httpImage/'+data.targetInfo[0].picSmUrl" /> -->
+              <!-- <img :src="'http://'+data.targetInfo[0].picSmUrl" /> -->
               <img-down
                 :url="data.targetInfo[0].picSmUrl"
                 :isPreview="false"
diff --git a/src/views/search/components/UploadImg.vue b/src/views/search/components/UploadImg.vue
index a802d14..f89927b 100644
--- a/src/views/search/components/UploadImg.vue
+++ b/src/views/search/components/UploadImg.vue
@@ -30,7 +30,7 @@
       </p>
       <div class="upload-img-box">
         <img
-          :src="'/httpImage/' + tempUploadImg"
+          :src="'http://' + tempUploadImg"
           alt="涓存椂娴嬭瘯"
           v-show="!displayUpload"
           class="bigPhoto"
@@ -88,7 +88,7 @@
           :key="index"
         >
           <img
-            :src="item ? '/httpImage/' + item : tempImg"
+            :src="item ? 'http://' + item : tempImg"
             @click="selected($event, index)"
             style="max-height: 100%"
             :style="index == clickNum ? 'border:1px solid #FF7733' : ''"
@@ -255,7 +255,7 @@
       console.log("鍒囧浘杩斿洖锛�", res);
       if (res.success) {
         document.querySelector(".el-upload-list").querySelector("img").src =
-          "/httpImage/" + res.data.uploadImage;
+          "http://" + res.data.uploadImage;
         this.resReady = true;
         this.realSmallPath = res.data.smImage;
         this.VideoPhotoData.isHaveRealSmallImg =
diff --git a/src/views/search/components/imgDown.vue b/src/views/search/components/imgDown.vue
index bef240a..6382bb8 100644
--- a/src/views/search/components/imgDown.vue
+++ b/src/views/search/components/imgDown.vue
@@ -1,97 +1,98 @@
 <template>
-    <div class="imgBox">
-        <img 
-          :src="'/httpImage/'+url" 
-          class="cursor-pointer"
-          v-if="isPreview"
-          preview
-        />
-        <img 
-          :src="'/httpImage/'+url" 
-          v-if="!isPreview"
-        />
-        <el-button class="btn" @click="downloadIamge('/httpImage/'+url)">
-          <i class="iconfont iconxiazai"></i>
-        </el-button>
-    </div>
+  <div class="imgBox">
+    <img
+      :src="'http://' + url"
+      class="cursor-pointer"
+      v-if="isPreview"
+      preview
+    />
+    <img :src="'http://' + url" v-if="!isPreview" />
+    <el-button class="btn" @click="downloadIamge('http://' + url)">
+      <i class="iconfont iconxiazai"></i>
+    </el-button>
+  </div>
 </template>
 <script>
-import axios from "axios"
+import axios from "axios";
 export default {
-   props:{
-      url: {
-          default: "",
-          type: String
-      },
-      isPreview: {
-        default: true,
-        type: Boolean
-      }
-   },
-   methods:{
+  props: {
+    url: {
+      default: "",
+      type: String,
+    },
+    isPreview: {
+      default: true,
+      type: Boolean,
+    },
+  },
+  methods: {
     downloadIamge(url) {
       this.$notify.info({
-          title: '娑堟伅',
-          message: '璧勬簮涓嬭浇涓�,璇风◢鍚�...'
-        });
+        title: "娑堟伅",
+        message: "璧勬簮涓嬭浇涓�,璇风◢鍚�...",
+      });
       axios({
         method: "get",
         url: url,
-        responseType: 'blob'
-      }).then(res => {
-        if (res.status == 200) {
-          var a = document.createElement('a')
-          var strs = url.split('/')
-          var href = new Blob([res.data],{type: 'image/jpeg'})
-          a.href = URL.createObjectURL(href);
-          a.download  = strs[strs.length - 1]+'.jpg'
-          a.click()
-        }
-      }).catch(err => {
-        this.$notify({
-          type: "error",
-          message: "涓嬭浇澶辫触锛�"+err+"璇烽噸璇曪紒",
-        })
+        responseType: "blob",
       })
+        .then((res) => {
+          if (res.status == 200) {
+            var a = document.createElement("a");
+            var strs = url.split("/");
+            var href = new Blob([res.data], { type: "image/jpeg" });
+            a.href = URL.createObjectURL(href);
+            a.download = strs[strs.length - 1] + ".jpg";
+            a.click();
+          }
+        })
+        .catch((err) => {
+          this.$notify({
+            type: "error",
+            message: "涓嬭浇澶辫触锛�" + err + "璇烽噸璇曪紒",
+          });
+        });
     },
-   } 
-   
-}
+  },
+};
 </script>
 <style lang="scss" scoped>
-.imgBox{
+.imgBox {
+  width: 100%;
+  height: 100%;
+  position: relative;
+  img {
     width: 100%;
     height: 100%;
-    position: relative;
-    img {
-        width: 100%;
-        height: 100%;
-        object-fit: contain
+    object-fit: contain;
+  }
+  .btn {
+    width: 30px;
+    height: 30px;
+    position: absolute;
+    padding: 0;
+    right: 20%;
+    opacity: 1;
+    bottom: 10px;
+    -webkit-animation: fadenum 0.7s ease;
+    display: none;
+    i {
+      font-size: 20px;
     }
-    .btn {
-        width: 30px;
-        height: 30px;
-        position: absolute;
-        padding: 0;
-        right: 20%;
-        opacity: 1;
-        bottom: 10px;
-        -webkit-animation: fadenum 0.7s ease;
-        display: none;
-        i {
-          font-size: 20px
-        }
-    }
+  }
 }
 .imgBox:hover .btn {
   display: inline;
 }
-@-webkit-keyframes fadenum{ /*璁剧疆鍐呭鐢辨樉绀哄彉涓洪殣钘�*/
+@-webkit-keyframes fadenum {
+  /*璁剧疆鍐呭鐢辨樉绀哄彉涓洪殣钘�*/
 
-    0%{opacity: 0;}
+  0% {
+    opacity: 0;
+  }
 
-    100%{opacity: 1;}
-
+  100% {
+    opacity: 1;
+  }
 }
-
 </style>
\ No newline at end of file
diff --git a/src/views/search/components/wasmPlayer/index.vue b/src/views/search/components/wasmPlayer/index.vue
index 2a7fec6..367497d 100644
--- a/src/views/search/components/wasmPlayer/index.vue
+++ b/src/views/search/components/wasmPlayer/index.vue
@@ -456,7 +456,7 @@
 
         url = this.videoUrl;
       } else {
-        url = "/httpImage/" + this.videoUrls[this.playerIndex];
+        url = "http://" + this.videoUrls[this.playerIndex];
       }
 
       this.videoLoading = true;
@@ -532,7 +532,7 @@
 
       let url = "http://" + window.location.host + this.loadUrl;
 
-      // let url = "http://localhost:8080/httpImage/192.168.20.189:6700/283,2f49bf283ad7?collection=2021-09-28-DSVAD010120190703-video"
+      // let url = "http://localhost:8080http://192.168.20.189:6700/283,2f49bf283ad7?collection=2021-09-28-DSVAD010120190703-video"
       let name = url.substring(url.lastIndexOf("/") + 1);
       let responsePromise = await fetch(url);
       let blob = await responsePromise.blob();
diff --git a/src/views/search/index.vue b/src/views/search/index.vue
index addbb62..756f2f8 100644
--- a/src/views/search/index.vue
+++ b/src/views/search/index.vue
@@ -1,10 +1,25 @@
 <template>
   <div class="column">
+    <div class="search_cluster">
+      <el-select
+        v-model="cluster"
+        placeholder="璇烽�夋嫨闆嗙兢"
+        @change="selectCluster"
+      >
+        <el-option
+          v-for="item in clusterArr"
+          :key="item.value"
+          :label="item.label"
+          :value="item.value"
+        >
+        </el-option>
+      </el-select>
+    </div>
     <div class="column-left">
       <div class="resize-bar"></div>
       <div class="resize-line"></div>
       <div class="resize-save">
-        <left-nav :appName="'Search'" :height="screenHeight - 40"></left-nav>
+        <left-nav :appName="'Camera'"></left-nav>
       </div>
     </div>
     <div class="column-right">
@@ -15,9 +30,10 @@
 </template>
 
 <script>
-import LeftNav from "./components/LeftNav";
+import LeftNav from "@/components/CameraLeft";
 import RightSide from "./Searching";
 import CardWindow from "./components/CardWindow";
+import { getClusterDevList } from "@/api/clusterManage";
 
 export default {
   name: "SearchPage",
@@ -29,10 +45,13 @@
   data() {
     return {
       screenHeight: 0,
+      clusterArr: [],
+      cluster: "",
     };
   },
   created() {
     // this.parseUrl();
+    this.getCluster();
   },
   mounted() {
     this.screenHeight = document.documentElement.clientHeight - 20;
@@ -44,6 +63,66 @@
   },
   methods: {
     parseUrl() {},
+    selectCluster(val) {
+      const arr = val.split("$$");
+      if (arr[0] == "0") {
+        sessionStorage.setItem("clusterId", arr[1]);
+        sessionStorage.setItem("devId", "");
+        console.log(this.clusterData);
+        this.clusterData.forEach((item) => {
+          if (arr[1] == item.cluster_id) {
+            sessionStorage.setItem("nodeId", item.nodeList[0].devId);
+          }
+        });
+      }
+      if (arr[0] == "1") {
+        sessionStorage.setItem("clusterId", "");
+        sessionStorage.setItem("devId", arr[1]);
+        sessionStorage.setItem("nodeId", arr[1]);
+      }
+      this.TreeDataPool.fetchTreeData();
+      this.PollData.statisticTaskInfo();
+      this.VideoManageData.init();
+      this.PollData.statistics();
+    },
+    async getCluster() {
+      const res = await getClusterDevList();
+      if (res && res.success) {
+        this.clusterData = res.data.clusterList;
+        if (res.data.clusterList <= 0 && res.data.devList <= 0) {
+          this.$confirm(
+            "绯荤粺妫�娴嬪埌鎮ㄨ繕鏈坊鍔犺澶�, 璇峰湪璁惧绠$悊椤甸潰缁存姢",
+            "鎻愮ず",
+            {
+              confirmButtonText: "璺宠浆",
+              cancelButtonText: "鍙栨秷",
+              type: "warning",
+            }
+          )
+            .then(() => {
+              this.$router.push("/manageCenter");
+            })
+            .catch(() => {});
+        }
+
+        res.data.clusterList.forEach((item) => {
+          this.clusterArr.push({
+            label: item.cluster_name,
+            value: "0$$" + item.cluster_id,
+          });
+        });
+
+        res.data.devList.forEach((item) => {
+          this.clusterArr.push({
+            label: item.devName,
+            value: "1$$" + item.devId,
+          });
+        });
+
+        this.cluster = this.clusterArr[0].value;
+        this.selectCluster(this.clusterArr[0].value);
+      }
+    },
   },
 };
 </script>
@@ -119,6 +198,14 @@
   height: inherit;
 }
 
+.search_cluster {
+  top: 12px;
+  left: 172px;
+  position: fixed;
+  width: 135px;
+  z-index: 4;
+}
+
 /* Firefox鍙湁涓嬮潰涓�灏忓潡鍖哄煙鍙互鎷変几 */
 @supports (-moz-user-select: none) {
   .resize-bar:hover ~ .resize-line,

--
Gitblit v1.8.0