From d7be21eeb3175000f8ffdbe12b04f84c8f6cd086 Mon Sep 17 00:00:00 2001
From: Jin Lei <jinlei_182@163.com>
Date: 星期三, 15 十一月 2023 23:13:48 +0800
Subject: [PATCH] [历史影像]1.修改历史影像注记问题

---
 src/components/map/viewer1.vue |  219 +++++++++++++++++--------------------------
 src/components/map/viewer.vue  |   74 ++++++--------
 2 files changed, 120 insertions(+), 173 deletions(-)

diff --git a/src/components/map/viewer.vue b/src/components/map/viewer.vue
index 33d48fa..b01caeb 100644
--- a/src/components/map/viewer.vue
+++ b/src/components/map/viewer.vue
@@ -2,54 +2,30 @@
   <div>
     <div id="sdkContainer"></div>
     <div class="listBox" v-show="viewer1Show && !isLand">
-      <ul>
-        <li
-          v-for="(item, index) in arr"
-          :key="index"
-          @click="changeLeftMap($event, item, index)"
-        >
+      <ul id="viewer_lsyx">
+        <li v-for="(item, index) in arr" :key="index" @click="changeLeftMap($event, item, index)">
           {{ item }}
         </li>
       </ul>
     </div>
     <layerTreeTwoScreen v-if="layerTreeTwoScreen" />
     <!-- <div id="bottomInfo" v-html="bottomInfo"></div> -->
-    <div
-      id="switchImagerLayer"
-      :style="{
-        transform: `scale(${scale}) translate(${offset},${offset})`,
-        '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
-      }"
-    >
-      <transition
-        name="animate__animated animate__bounce"
-        @click="switchImagerLayerShowOrHide"
-        enter-active-class="animate__backInRight"
-        leave-active-class="animate__backOutRight"
-        appear
-      >
+    <div id="switchImagerLayer" :style="{
+      transform: `scale(${scale}) translate(${offset},${offset})`,
+      '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
+    }">
+      <transition name="animate__animated animate__bounce" @click="switchImagerLayerShowOrHide"
+        enter-active-class="animate__backInRight" leave-active-class="animate__backOutRight" appear>
         <switchImagerLayer ref="switchImagerLayer" v-show="switchImagerLayer" />
       </transition>
 
-      <img
-        class="swichImg"
-        @click="switchImagerLayerShowOrHide"
-        :src="switchImage"
-      />
+      <img class="swichImg" @click="switchImagerLayerShowOrHide" :src="switchImage" />
       <div class="bgbox">
-        <img
-          class="swichImg"
-          @click="switchImagerLayerShowOrHide"
-          src="@/assets/img/new/shiliang.png"
-        />
-        <img
-          class="swichImg bgbox"
-          @click="switchImagerLayerShowOrHide"
-          src="@/assets/img/new/shiliang.png"
-        />
+        <img class="swichImg" @click="switchImagerLayerShowOrHide" src="@/assets/img/new/shiliang.png" />
+        <img class="swichImg bgbox" @click="switchImagerLayerShowOrHide" src="@/assets/img/new/shiliang.png" />
       </div>
     </div>
   </div>
@@ -101,11 +77,17 @@
     viewer1Show(newvalue, oldvalue) {
       if (!newvalue) {
         this.destroyImageLayer();
+      } else {
+        if (!this.isLand) {
+          this.initLSYX();
+        }
       }
     },
     isLand(newvalue, oldvalue) {
       if (newvalue) {
         this.destroyImageLayer();
+      } else {
+        this.initLSYX();
       }
     },
   },
@@ -162,8 +144,8 @@
         }
       );
       window.Viewer = sgworld._Viewer;
-      
-      window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer,Cesium);
+
+      window.sgwfs = new SmartEarth.WFSTool(sgworld._Viewer, Cesium);
       Viewer.shadows = false;
       //娣卞害妫�娴�
       sgworld.Analysis.depthTestAgainstTerrain(true);
@@ -279,6 +261,11 @@
         this.destroyImageLayer();
       }
     },
+    initLSYX() {
+      let ul = document.getElementById("viewer_lsyx");
+      let lis = ul.getElementsByTagName('li');
+      lis[19].click();
+    },
     destroyImageLayer() {
       if (activeLi) {
         activeLi.classList.remove("active");
@@ -309,9 +296,14 @@
         nLayer = null;
       }
       nLayer = this.loadBJ54ImageLayer(year);
-      if (!LWLayer) {
+      if (!LWLayer||Viewer.imageryLayers.indexOf(LWLayer)<0) {
+        if(LWLayer)
+        {
+          LWLayer.destroy();
+        }
         LWLayer = this.loadBJ54LWLayer();
       }
+
     },
     loadBJ54LWLayer() {
       let url = "http://172.26.64.84/service/ImageEngine/picdis/abc";
diff --git a/src/components/map/viewer1.vue b/src/components/map/viewer1.vue
index 109f06b..498e38c 100644
--- a/src/components/map/viewer1.vue
+++ b/src/components/map/viewer1.vue
@@ -2,20 +2,13 @@
   <div>
     <div id="sdkContainer1" style="height: 100%"></div>
     <div class="listBox" v-show="!isLand">
-      <ul>
-        <li
-          v-for="(item, index) in arr"
-          :key="index"
-          @click="changeLeftMap($event, item, index)"
-        >
+      <ul id="viewer1_lsyx">
+        <li v-for="(item, index) in arr" :key="index" @click="changeLeftMap($event, item, index)">
           {{ item }}
         </li>
       </ul>
     </div>
-    <layerTreeTwoScreenRight
-      v-if="layerTreeTwoScreen"
-      id="layerTreeTwoScreen111"
-    />
+    <layerTreeTwoScreenRight v-if="layerTreeTwoScreen" id="layerTreeTwoScreen111" />
     <div class="tdInfo" v-if="showTDinfo">
       <div class="tdInfo_close" @click="tdInfoClose">脳</div>
       <p v-if="dikuanxinxi" class="noInfo">鏆傛棤璇ュ湴鍧椾俊鎭�</p>
@@ -52,12 +45,7 @@
         <div v-else class="title">
           <li>
             浼佷笟
-            <el-tooltip
-              class="item"
-              effect="dark"
-              content="鐐瑰嚮鏌ョ湅浼佷笟淇℃伅"
-              placement="bottom"
-            >
+            <el-tooltip class="item" effect="dark" content="鐐瑰嚮鏌ョ湅浼佷笟淇℃伅" placement="bottom">
               <a @click="showYZCQY"> {{ qysl }}</a>
             </el-tooltip>
             瀹�
@@ -65,63 +53,31 @@
         </div>
       </ul>
     </div>
-    <div
-      :style="{
-        width: `${size}`,
-        height: `${size}`,
-        transform: `scale(${scale}) translate(${offset},${offset})`,
-        '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
-        '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
-      }"
-    >
-      <el-dialog
-        class="aboutDialog"
-        title="浼佷笟淇℃伅"
-        append-to-body
-        width="50%"
-        height="55%"
-        style="overflow: auto"
-        :visible.sync="QYbox"
-        :before-close="dialogClose"
-      >
+    <div :style="{
+      width: `${size}`,
+      height: `${size}`,
+      transform: `scale(${scale}) translate(${offset},${offset})`,
+      '-webkit-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-moz-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-o-transform': `scale(${scale}) translate(${offset},${offset})`,
+      '-ms-transform': `scale(${scale}) translate(${offset},${offset})`,
+    }">
+      <el-dialog class="aboutDialog" title="浼佷笟淇℃伅" append-to-body width="50%" height="55%" style="overflow: auto"
+        :visible.sync="QYbox" :before-close="dialogClose">
         <div class="el-dialog-div">
           <div class="inquire">
-            <el-form
-              size="medium"
-              ref="queryForm"
-              :model="queryForm"
-              :inline="true"
-            >
+            <el-form size="medium" ref="queryForm" :model="queryForm" :inline="true">
               <el-form-item label="鏌ヨ鍐呭" prop="name">
-                <el-input
-                  v-model="queryForm.content"
-                  placeholder="璇疯緭鍏ユ煡璇㈠唴瀹�"
-                />
+                <el-input v-model="queryForm.content" placeholder="璇疯緭鍏ユ煡璇㈠唴瀹�" />
               </el-form-item>
               <el-form-item>
-                <el-button
-                  @click="queryInfo('queryForm')"
-                  icon="el-icon-search"
-                  class="primary"
-                  >鏌ヨ</el-button
-                >
+                <el-button @click="queryInfo('queryForm')" icon="el-icon-search" class="primary">鏌ヨ</el-button>
               </el-form-item>
             </el-form>
           </div>
-          <el-table
-            fit
-            style="width: 100%"
-            :data="tableData"
-            highlight-current-row
-            height="50"
-          >
+          <el-table fit style="width: 100%" :data="tableData" highlight-current-row height="50">
             <el-table-column type="index" width="50"></el-table-column>
-            <el-table-column
-              property="浼佷笟鍚嶇О"
-              label="浼佷笟鍚嶇О"
-            ></el-table-column>
+            <el-table-column property="浼佷笟鍚嶇О" label="浼佷笟鍚嶇О"></el-table-column>
             <!-- <el-table-column
               property="浼佷笟绫诲瀷"
               label="浼佷笟绫诲瀷"
@@ -139,35 +95,16 @@
               label="娉曚汉"
               width="100"
             ></el-table-column> -->
-            <el-table-column
-              property="娉ㄥ唽鍦板潃"
-              label="娉ㄥ唽鍦板潃"
-            ></el-table-column>
+            <el-table-column property="娉ㄥ唽鍦板潃" label="娉ㄥ唽鍦板潃"></el-table-column>
             <el-table-column label="鎿嶄綔" width="100">
               <template slot-scope="scope">
-                <el-button
-                  @click="handleClick(scope.row)"
-                  type="text"
-                  size="small"
-                  >璇︽儏</el-button
-                >
+                <el-button @click="handleClick(scope.row)" type="text" size="small">璇︽儏</el-button>
               </template>
             </el-table-column>
           </el-table>
-          <div
-            slot="footer"
-            class="dialog-footer"
-            style="text-align: center; margin-top: 5px"
-          >
-            <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
-              :current-page.sync="currentPage"
-              :page-size="10"
-              :pager-count="11"
-              layout="total, pager"
-              :total="searchNum"
-            >
+          <div slot="footer" class="dialog-footer" style="text-align: center; margin-top: 5px">
+            <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+              :current-page.sync="currentPage" :page-size="10" :pager-count="11" layout="total, pager" :total="searchNum">
             </el-pagination>
           </div>
         </div>
@@ -195,7 +132,7 @@
   activeLi,
   nLayer,
   TDLayer,
-  LWLayer;
+  LWLayer1;
 export default {
   name: "viewer1",
   components: { layerTreeTwoScreenRight },
@@ -241,7 +178,7 @@
       offset: "0%",
     };
   },
-  created() {},
+  created() { },
   computed: {
     ...mapState(["viewer1Show", "isLand", "layerTreeTwoScreen"]),
   },
@@ -262,6 +199,8 @@
             );
           }
         }, 2000);
+
+
       },
     },
     isLand(newvalue, oldvalue) {
@@ -276,6 +215,7 @@
         if (line1) {
           sgworld1.Creator.DeleteObject(line1);
         }
+        this.initLSYX();
       } else {
         this.destroyImageLayer();
         if (!TDLayer) {
@@ -328,6 +268,9 @@
           if (this.isLand) {
             this.loadTDGLLayer();
           }
+          else {
+            this.initLSYX();
+          }
           var p = {
             destination: sgworld.Navigate.getPosition(),
             orientation: {
@@ -367,6 +310,11 @@
     });
   },
   methods: {
+    initLSYX() {
+      let ul = document.getElementById("viewer1_lsyx");
+      let lis = ul.getElementsByTagName('li');
+      lis[9].click();
+    },
     setImageComparison(isStart) {
       this.isImage = isStart;
       if (!this.isImage) {
@@ -382,9 +330,9 @@
         Viewer1.imageryLayers.remove(nLayer, true);
         nLayer = null;
       }
-      if (LWLayer) {
-        Viewer1.imageryLayers.remove(LWLayer, true);
-        LWLayer = null;
+      if (LWLayer1) {
+        Viewer1.imageryLayers.remove(LWLayer1);
+        LWLayer1 = undefined;
       }
     },
     changeLeftMap(event, item, index) {
@@ -403,11 +351,16 @@
         nLayer = null;
       }
       nLayer = this.loadBJ54ImageLayer(year);
-      if (!LWLayer) {
-        LWLayer = this.loadBJ54LWLayer();
+
+      if (!LWLayer1 || Viewer1.imageryLayers.indexOf(LWLayer1) < 0) {
+        if(LWLayer1)
+        {
+          LWLayer1.destroy();
+        }
+        LWLayer1 = this.loadBJ54LWLayer1();
       }
     },
-    loadBJ54LWLayer() {
+    loadBJ54LWLayer1() {
       let url = "http://172.26.64.84/service/ImageEngine/picdis/abc";
       //let url = option.url;
       //let year = option.year;
@@ -475,6 +428,7 @@
         brightness: 1.0,
       });
       Viewer1.imageryLayers.add(imageLayer, 2);
+
       return imageLayer;
     },
     loadTDGLLayer() {
@@ -538,10 +492,10 @@
             axios
               .get(
                 "http://10.10.4.115:8022/geowinmap_xncs/ds?r=0.9158559377752831&serviceproviderid=map.vectorserviceprovider&serviceid=queryfeature&featcls=225%25E8%258C%2583%25E5%259B%25B4%25E5%2588%2586%25E5%258C%25BA%25E8%25A7%2584%25E5%2588%2592.geojson&lng=" +
-                  p.lon +
-                  "&lat=" +
-                  p.lat +
-                  "&geom=true&requesttype=json"
+                p.lon +
+                "&lat=" +
+                p.lat +
+                "&geom=true&requesttype=json"
               )
               .then((response) => {
                 let center = { lon: 0, lat: 0 };
@@ -586,7 +540,7 @@
                   axios
                     .get(
                       "http://10.10.4.115:8022//poisearch/guihuacon/getInfo?ydbm=" +
-                        response.data.NO
+                      response.data.NO
                     )
                     .then(
                       (info) => {
@@ -622,10 +576,10 @@
                           }
                           try {
                             this.ydlx = data.yongdishuju["ydlxmc"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.cyfx = data.yongdishuju["cyfx"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             // this.crzt = response.data["ZT"];
                             switch (response.data["ZT"]) {
@@ -636,28 +590,28 @@
                                 this.crzt = "鏈嚭璁�";
                                 break;
                             }
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.ydmj = parseFloat(
                               "" + data.yongdishuju["ydmj"]
                             ).toFixed(0);
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.crnx = data.churangxinxi["crnx"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.crnf = data.churangxinxi["crnf"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.rjl = data.yongdishuju["rjl"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.jzxg = data.yongdishuju["jzxg"];
-                          } catch (e) {}
+                          } catch (e) { }
                           try {
                             this.jzmd = data.yongdishuju["jzmd"];
-                          } catch (e) {}
-                        } catch (e) {}
+                          } catch (e) { }
+                        } catch (e) { }
                       },
                       (info) => {
                         this.$notify.error({
@@ -741,8 +695,8 @@
     handleClick(row) {
       window.open(
         "https://qylweb.bda.gov.cn/alldetails/#/newEnterprisedetails?uscc=" +
-          row["缁熶竴绀句細淇$敤浠g爜"] +
-          "&systemName=涓皬寰�"
+        row["缁熶竴绀句細淇$敤浠g爜"] +
+        "&systemName=涓皬寰�"
       );
     },
     detectZoom() {
@@ -1260,13 +1214,13 @@
   box-shadow: 0px 1px 10px 0px rgba(3, 10, 26, 0.38);
 }
 
-.aboutDialog >>> .el-dialog__body {
+.aboutDialog>>>.el-dialog__body {
   height: 77%;
   padding: 0px !important;
   padding: 15px !important;
 }
 
-.aboutDialog >>> .el-dialog__header {
+.aboutDialog>>>.el-dialog__header {
   padding: 10px 20px;
   height: 25px;
   line-height: 25px;
@@ -1275,28 +1229,28 @@
   background: transparent;
 }
 
-.aboutDialog >>> .el-dialog__title {
+.aboutDialog>>>.el-dialog__title {
   color: #fff;
   font-size: 1.1rem;
 }
 
-.aboutDialog >>> .el-dialog__headerbtn .el-dialog__close {
+.aboutDialog>>>.el-dialog__headerbtn .el-dialog__close {
   color: #fff;
 }
 
-.aboutDialog >>> .el-dialog__headerbtn:hover .el-dialog__close {
+.aboutDialog>>>.el-dialog__headerbtn:hover .el-dialog__close {
   color: #fff;
 }
 
-.aboutDialog >>> .el-dialog__headerbtn {
+.aboutDialog>>>.el-dialog__headerbtn {
   top: 13px;
 }
 
-.aboutDialog >>> .el-form-item {
+.aboutDialog>>>.el-form-item {
   margin-bottom: 10px;
 }
 
-.el-form >>> .el-form-item__label {
+.el-form>>>.el-form-item__label {
   color: #fff;
 }
 
@@ -1313,6 +1267,7 @@
   height: 80% !important;
   overflow: auto;
 }
+
 .el-table /deep/ .el-button--text {
   /* color: #fff; */
   font-size: 14px;
@@ -1349,41 +1304,40 @@
   background-color: transparent;
 }
 
-.el-table /deep/ .el-table__body tr.current-row > td {
+.el-table /deep/ .el-table__body tr.current-row>td {
   background-color: transparent;
 }
 
-.el-table--enable-row-hover /deep/ .el-table__body tr:hover > td {
+.el-table--enable-row-hover /deep/ .el-table__body tr:hover>td {
   background-color: rgba(0, 32, 70, 0.7) !important;
 }
 
-.el-table__body /deep/ tr.current-row > td {
+.el-table__body /deep/ tr.current-row>td {
   background-color: rgba(0, 32, 70, 0.7) !important;
 }
 
-.aboutDialog .el-dialog-div .dialog-footer {
-}
+.aboutDialog .el-dialog-div .dialog-footer {}
 
 .el-pagination {
   color: #fff;
 }
 
-.el-pagination >>> .el-pagination__total,
-.el-pagination >>> .btn-next,
-.el-pagination >>> .btn-prev {
+.el-pagination>>>.el-pagination__total,
+.el-pagination>>>.btn-next,
+.el-pagination>>>.btn-prev {
   background: transparent;
   color: #fff;
   font-size: 1rem;
 }
 
-.el-pagination >>> .el-pager li {
+.el-pagination>>>.el-pager li {
   line-height: 27px;
   background-color: transparent;
   font-size: 1rem;
 }
 
-.el-pagination >>> .el-pager li.btn-quicknext,
-.el-pagination >>> .el-pager li.btn-quickprev {
+.el-pagination>>>.el-pager li.btn-quicknext,
+.el-pagination>>>.el-pager li.btn-quickprev {
   font-size: 1rem;
   line-height: 28px;
   color: #fff;
@@ -1414,6 +1368,7 @@
   .listBox li {
     font-size: 12px;
   }
+
   .el-table {
     font-size: 12px;
   }

--
Gitblit v1.9.3