Quellcode durchsuchen

底层更改,样式改写写法,UI组件升级

wandequan vor 2 Jahren
Ursprung
Commit
b207ccb0c0

+ 0 - 5
.editorconfig

@@ -1,5 +0,0 @@
-[*.{js,jsx,ts,tsx,vue}]
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
-insert_final_newline = true

+ 1 - 2
.gitignore

@@ -1,8 +1,7 @@
 .DS_Store
 node_modules
 /dist
-/public/static/data
-/public/static/plugins/Cesium1.87.1
+
 
 # local env files
 .env.local

+ 0 - 34
CHANGELOG.md

@@ -1,34 +0,0 @@
-# Changelog
-
-## [Unreleased]
-
-### Added 
-
-- 新添加的功能。
-  
-### Changed 
-
-- 对现有功能的变更。
-  
-### Deprecated 
-
-- 已经不建议使用,准备很快移除的功能。
-  
-### Removed 
-
-- 已经移除的功能。
-  
-### Fixed 
-
-- 对bug的修复
-  
-### Security 
-
-- 对安全的改进
-
-
-## [1.0.0]
-
-### Added
-
-- 初代版本发布

+ 1 - 6
README.md

@@ -1,4 +1,4 @@
-#  ojk_vue_ui
+# ojk_vue_ui
 
 ## Project setup
 ```
@@ -15,10 +15,5 @@ npm run serve
 npm run build
 ```
 
-### Lints and fixes files
-```
-npm run lint
-```
-
 ### Customize configuration
 See [Configuration Reference](https://cli.vuejs.org/config/).

+ 4 - 3
babel.config.js

@@ -1,4 +1,5 @@
 module.exports = {
-  presets: ["@vue/cli-plugin-babel/preset"],
-  plugins: ["@babel/plugin-transform-runtime"]
-};
+  presets: [
+    '@vue/cli-plugin-babel/preset'
+  ]
+}

+ 0 - 0
deployment/ojk_vue_ui.conf → deployment/web_ojk_ui.conf


+ 20 - 0
jsconfig.json

@@ -0,0 +1,20 @@
+{
+  "compilerOptions": {
+    "target": "es5",
+    "module": "esnext",
+    "baseUrl": "./",
+    "jsx": "preserve",	//在这里添加"jsx": "preserve",
+    "moduleResolution": "node",
+    "paths": {
+      "@/*": [
+        "src/*"
+      ]
+    },
+    "lib": [
+      "esnext",
+      "dom",
+      "dom.iterable",
+      "scripthost"
+    ]
+  }
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 314 - 306
package-lock.json


+ 19 - 49
package.json

@@ -4,63 +4,33 @@
   "private": true,
   "scripts": {
     "serve": "vue-cli-service serve",
-    "build": "vue-cli-service build",
-    "lint": "vue-cli-service lint"
+    "build": "vue-cli-service build"
   },
   "dependencies": {
-    "@babel/runtime": "^7.14.6",
-    "axios": "^0.21.1",
-    "cesium": "^1.92.0",
-    "core-js": "^3.6.5",
-    "echarts": "^5.1.2",
-    "element-ui": "^2.15.1",
-    "jquery": "^3.6.0",
-    "moment": "^2.29.1",
-    "proj4": "^2.7.5",
-    "vue": "^2.6.11",
-    "vue-cli-plugin-style-resources-loader": "^0.1.5",
-    "vue-ls": "^3.2.2",
-    "vue-router": "^3.2.0",
-    "vuex": "^3.4.0"
+    "axios": "^0.27.2",
+    "core-js": "^3.8.3",
+    "echarts": "^5.3.3",
+    "element-plus": "^2.2.15",
+    "moment": "^2.29.4",
+    "vue": "^3.2.13",
+    "vue-router": "^4.0.3",
+    "vuex": "^4.0.0"
   },
   "devDependencies": {
-    "@vue/cli-plugin-babel": "~4.5.0",
-    "@vue/cli-plugin-eslint": "~4.5.0",
-    "@vue/cli-plugin-router": "~4.5.0",
-    "@vue/cli-plugin-vuex": "~4.5.0",
-    "@vue/cli-service": "~4.5.0",
-    "@vue/eslint-config-prettier": "^6.0.0",
-    "babel-eslint": "^10.1.0",
-    "babel-plugin-transform-runtime": "^6.23.0",
-    "compression-webpack-plugin": "^5.0.1",
-    "eslint": "^6.7.2",
-    "eslint-plugin-prettier": "^3.3.1",
-    "eslint-plugin-vue": "^6.2.2",
-    "json-loader": "^0.5.7",
-    "less": "^3.13.1",
-    "less-loader": "^5.0.0",
-    "prettier": "^2.2.1",
+    "@vue/cli-plugin-babel": "~5.0.0",
+    "@vue/cli-plugin-router": "~5.0.0",
+    "@vue/cli-plugin-vuex": "~5.0.0",
+    "@vue/cli-service": "~5.0.0",
+    "compression-webpack-plugin": "^10.0.0",
+    "less": "^4.0.0",
+    "less-loader": "^8.0.0",
     "style-resources-loader": "^1.4.1",
-    "vue-template-compiler": "^2.6.11"
-  },
-  "eslintConfig": {
-    "root": true,
-    "env": {
-      "node": true
-    },
-    "extends": [
-      "plugin:vue/essential",
-      "eslint:recommended",
-      "@vue/prettier"
-    ],
-    "parserOptions": {
-      "parser": "babel-eslint"
-    },
-    "rules": {}
+    "vue-cli-plugin-style-resources-loader": "~0.1.5"
   },
   "browserslist": [
     "> 1%",
     "last 2 versions",
-    "not dead"
+    "not dead",
+    "not ie 11"
   ]
 }

BIN
public/favicon.ico


+ 1 - 1
public/index.html

@@ -6,7 +6,6 @@
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= htmlWebpackPlugin.options.title %></title>
-
     <script type="text/javascript" src="./static/config/config.js"></script>
     <script type="text/javascript" src="./static/config/globalVariable.js"></script>
 
@@ -17,6 +16,7 @@
     <link rel="stylesheet" href="./static/plugins/css/reset.css">
 
     <script type="text/javascript" src="./static/plugins/Cesium/Cesium.js"></script>
+    <script type="text/javascript" src="./static/plugins/Water.js"></script>
   </head>
   <body>
     <noscript>

+ 15 - 7
public/static/config/config.js

@@ -10,19 +10,26 @@ var systemConfig = {
     pitch: -30, // 倾斜角度
     roll: 0,
   },
-  dataProxy: "/ojk_data",
-  modelTilesObj: {
-    build: "./static/data/build",
-    other_build: "./static/data/other_build",
-    plan: "./static/data/plan",
-    pipe: "./static/data/pipe"
+  dataProxy: "/ojk_data", 
+  modelTilesObj: { 
+    build: "http://122.228.13.28:1009/3DTiles/oujiangkou/revise/build",
+    // other_build: "http://122.228.13.28:1009/3DTiles/oujiangkou/revise/other_build",
+    // plan: "http://122.228.13.28:1009/3DTiles/oujiangkou/revise/plan",
+    plan_nowater: "http://122.228.13.28:1009/3DTiles/oujiangkou/revise/plan_nowater",
+    pipe: "http://122.228.13.28:1009/3DTiles/oujiangkou/revise/pipe",
+
+    // ojk_shuiba_dm: "http://122.228.13.28:1009/3DTiles/oujiangkou/shuiba/dm",
+    // ojk_shuiba_snjz: "http://122.228.13.28:1009/3DTiles/oujiangkou/shuiba/snjz",
+    // ojk_shuiba_swjz: "http://122.228.13.28:1009/3DTiles/oujiangkou/shuiba/swjz",
+    // ojk_shuiba_xp: "http://122.228.13.28:1009/3DTiles/oujiangkou/shuiba/xp",
+    // ojk_shuiba_zm: "http://122.228.13.28:1009/3DTiles/oujiangkou/shuiba/zm",
   },
   modelTilesMatrixObj: {
     build: {
       scale: 1.0,
       longitude: 120.94053,
       latitude: 27.94213,
-      height: 4, //修改高度
+      height: 4, // 修改高度
       rx: 0,
       ry: 0,
       rz: 0, //修改旋转
@@ -48,6 +55,7 @@ var systemConfig = {
       rz: 0, //修改旋转
       alpha: 0,
     },
+    plan_nowater: {},
     pipe: {
       scale: 1.0,
       longitude: 120.93406,

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
public/static/data/ojk_water_v3.json


+ 16 - 0
public/static/data/ojksb.json

@@ -0,0 +1,16 @@
+{
+	"water": {
+		"name": "water",
+		"content": "水坝模型水面",
+		"positions": [
+			2.1100088731238316,
+			0.48772191231863493,
+			2.110040476653327,
+			0.48770207361274925,
+			2.1100037612120524,
+			0.48765620295134576,
+			2.109973211975746,
+			0.4876767993852706
+		]
+	}
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 59 - 0
public/static/plugins/Water.js


Datei-Diff unterdrückt, da er zu groß ist
+ 40 - 0
public/static/plugins/Waterdb.js


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
public/static/plugins/waterAUpraise.js


+ 4 - 3
src/App.vue

@@ -1,13 +1,14 @@
 <template>
-  <div id="app">
+  <div id="main">
     <Home></Home>
   </div>
 </template>
 
 <script>
+import { defineAsyncComponent } from "vue";
 export default {
   components: {
-    Home: () => import("@/views/Home.vue")
+    Home: defineAsyncComponent(() => import("@/views/Home.vue")),
   },
 };
 </script>
@@ -26,7 +27,7 @@ body {
   // overflow-x: auto;
   // overflow-y: auto;
 }
-#app {
+#main {
   height: 100%;
   width: 100%;
 }

+ 0 - 0
src/assets/common/less/variable.less → src/assets/less/variable.less


+ 2 - 2
src/components/Header.vue

@@ -125,7 +125,7 @@ export default {
   .bgimg {
     width: 100%;
     height: 100%;
-    background: url(../assets/Images/top_bg.png) center 2px no-repeat;
+    background: url(~@/assets/Images/top_bg.png) center 2px no-repeat;
     > div {
       height: @height;
       color: #ffffff;
@@ -178,7 +178,7 @@ export default {
         line-height: 30px;
         font-size: 26px;
         letter-spacing: 2px;
-        background: url(../assets/Images/wz.png) -9px center no-repeat;
+        background: url(~@/assets/Images/wz.png) -9px center no-repeat;
         padding-left: 40px;
         margin-right: 20px;
         color: #e9effe;

+ 71 - 37
src/components/LeftPanel.vue

@@ -10,7 +10,9 @@
             <div class="detail">
               <div class="title">平均流量</div>
               <div class="value">
-                <marquee class="number" direction="left" behavior="scroll">{{ pjll }}</marquee>
+                <div class="marquee number">
+                  <div class="scrolling">{{ pjll }}</div>
+                </div>
                 <span class="unit">
                   m
                   <sup>3</sup>
@@ -59,27 +61,33 @@
       <div class="panel panel3">
         <div class="title">- 漏失仪实时列表 -</div>
         <div class="content">
-          <Table1 v-bind="{
-            tableData: tableData1,
-            tableLabel: tabelLabel1,
-            rowClick: locationEquipment
-          }"></Table1>
+          <Table1
+            v-bind="{
+              tableData: tableData1,
+              tableLabel: tabelLabel1,
+              rowClick: locationEquipment,
+            }"
+          ></Table1>
         </div>
       </div>
       <div class="panel panel4">
         <div class="title">- 消防栓实时列表 -</div>
         <div class="content">
-          <Table2 v-bind="{
-            tableData: tableData2,
-            tableLabel: tabelLabel2,
-            rowClick: locationEquipment
-          }"></Table2>
+          <Table2
+            v-bind="{
+              tableData: tableData2,
+              tableLabel: tabelLabel2,
+              rowClick: locationEquipment,
+            }"
+          ></Table2>
         </div>
       </div>
-    </div>  </div>
+    </div>
+  </div>
 </template>
 
 <script>
+import { defineAsyncComponent } from "vue";
 import api from "@/api/data";
 import * as echarts from "echarts";
 export default {
@@ -95,7 +103,12 @@ export default {
       tabelLabel1: [
         { label: "设备Id", width: "", minWidth: "30%", prop: "equipmentId" },
         { label: "更新时间", width: "", minWidth: "45%", prop: "time" },
-        { label: "漏失状态", width: "", minWidth: "25%", prop: "leakageStatus" }, // 0正常,1异常
+        {
+          label: "漏失状态",
+          width: "",
+          minWidth: "25%",
+          prop: "leakageStatus",
+        }, // 0正常,1异常
       ],
       tableData2: [],
       tabelLabel2: [
@@ -107,14 +120,14 @@ export default {
     };
   },
   components: {
-    Table1: () => import("@/components/Table.vue"),
-    Table2: () => import("@/components/Table.vue"),
-    Tools: () => import("@/components/Tools.vue"),
+    Table1: defineAsyncComponent(() => import("@/components/Table.vue")),
+    Table2: defineAsyncComponent(() => import("@/components/Table.vue")),
+    Tools: defineAsyncComponent(() => import("@/components/Tools.vue")),
   },
   created() {
     this.getAndUpdateData();
   },
-  mounted() { },
+  mounted() {},
   methods: {
     getAndUpdateData() {
       let that = this;
@@ -149,7 +162,7 @@ export default {
             that.jrzxsb = data.onLineDeviceCount;
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
     // 左二数据
     getFlowChangeData() {
@@ -166,7 +179,7 @@ export default {
             that.drawEchartsLine(chartsData);
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
     // 左二绘制echart
     drawEchartsLine(echartData) {
@@ -185,6 +198,9 @@ export default {
           left: 70,
           right: 20,
         },
+        axisLabel: {
+          color: "#ffffff"
+        },
         xAxis: {
           type: "category",
           boundaryGap: false,
@@ -207,16 +223,14 @@ export default {
             let data = result.data;
             if (data.length > 0) {
               that.tableData1 = data.map(function (item) {
-                item.time = item.time
-                  .replace("T", " ")
-                  .split(".")[0];
+                item.time = item.time.replace("T", " ").split(".")[0];
                 item.leakageStatus = item.leakageStatus == 0 ? "正常" : "异常";
                 return item;
               });
             }
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
     // 左四数据
     getTableData2() {
@@ -235,11 +249,11 @@ export default {
             }
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
-    // 定位 
+    // 定位
     locationEquipment(data) {
-      let arr = proj4("EPSG:0986", "EPSG:4326", [data.x, data.y])
+      let arr = proj4("EPSG:0986", "EPSG:4326", [data.x, data.y]);
       globalVariable.viewer.camera.flyTo({
         // fromDegrees()将经纬度和高程转换为世界坐标
         destination: Cesium.Cartesian3.fromDegrees(arr[0], arr[1], 200),
@@ -247,11 +261,11 @@ export default {
           // 指向
           heading: Cesium.Math.toRadians(0),
           // 视角
-          pitch: Cesium.Math.toRadians(-90.0),// 倾斜角度,
-          roll: 0
-        }
+          pitch: Cesium.Math.toRadians(-90.0), // 倾斜角度,
+          roll: 0,
+        },
       });
-    }
+    },
   },
 };
 </script>
@@ -289,7 +303,7 @@ export default {
         margin-bottom: 0px;
       }
 
-      >.title {
+      > .title {
         width: 100%;
         height: @panel_title_height;
         background: #1153b785;
@@ -310,14 +324,14 @@ export default {
       top: 0px;
 
       .content {
-        >div {
+        > div {
           float: left;
           width: 50%;
           height: 50%;
         }
 
         .jcsj {
-          >div {
+          > div {
             height: 100%;
             float: left;
 
@@ -364,25 +378,25 @@ export default {
 
         .pjll {
           .img {
-            background: url(../assets/Images/1.png) center center no-repeat;
+            background: url(~@/assets/Images/1.png) center center no-repeat;
           }
         }
 
         .pjyl {
           .img {
-            background: url(../assets/Images/2.png) center center no-repeat;
+            background: url(~@/assets/Images/2.png) center center no-repeat;
           }
         }
 
         .jrbj {
           .img {
-            background: url(../assets/Images/3.png) center center no-repeat;
+            background: url(~@/assets/Images/3.png) center center no-repeat;
           }
         }
 
         .jrzxsb {
           .img {
-            background: url(../assets/Images/4.png) center center no-repeat;
+            background: url(~@/assets/Images/4.png) center center no-repeat;
           }
         }
       }
@@ -418,4 +432,24 @@ export default {
     }
   }
 }
+
+.marquee {
+  overflow: hidden;
+  white-space: nowrap;
+}
+
+.scrolling {
+  animation: marquee 5s linear infinite;
+  display: inline-block;
+  padding-right: 10px;
+}
+
+@keyframes marquee {
+  from {
+    transform: translateX(0);
+  }
+  to {
+    transform: translateX(-100%);
+  }
+}
 </style>

+ 315 - 211
src/components/MainMap.vue

@@ -12,190 +12,142 @@ import WaterQuality from "@/assets/Images/MapSymbol/WaterQuality.png";
 
 export default {
   data() {
-    return {};
+    return {
+      waterClass: null,
+    };
   },
   created() {
-    proj4.defs("EPSG:0986", "+proj=tmerc +lat_0=0 +lon_0=120.666666666667 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs +type=crs")
+    proj4.defs(
+      "EPSG:0986",
+      "+proj=tmerc +lat_0=0 +lon_0=120.666666666667 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs +type=crs"
+    );
     // $.getJSON("./static/data/guanxian.json", function (result) {
     //   globalVariable.guanxianGeojson = result
     // });
   },
   mounted() {
-    let that = this;
-    // // 默认中国区域
-    // Cesium.Camera.DEFAULT_VIEW_RECTANGLE = Cesium.Rectangle.fromDegrees(
-    //   90,
-    //   -20,
-    //   110,
-    //   90
-    // );
-    let viewer = new Cesium.Viewer("cesiumContainer", {
-      // useDefaultRenderLoop: false,  //关闭自动渲染
-      animation: false, //动画控制不显示
-      timeline: false, //时间线不显示
-      fullscreenButton: false, //全屏按钮不显示
-      infoBox: false,
-      baseLayerPicker: false, //地图切换不显示
-      // terrainProvider: Cesium.createWorldTerrain(), // 地形
-      imageryProvider: new Cesium.SingleTileImageryProvider({
-        url: (function createColorCanvas(color) {
-          var width = 1,
-            height = 1;
-          var canvas = document.createElement("canvas");
-          canvas.width = width;
-          canvas.height = height;
-          var ctx = canvas.getContext("2d");
-          ctx.fillStyle = color;
-          ctx.fillRect(0, 0, width, height);
-          return canvas.toDataURL();
-        })("#ffffff00"),
-        rectangle: Cesium.Rectangle.fromDegrees(-180.0, -90.0, 180.0, 90.0),
-      }),
-      geocoder: false,
-      homeButton: false,
-      selectionIndicator: false, // 去除绿色选择框
-      sceneModePicker: false,
-      navigationHelpButton: false,
-      scene3DOnly: true, // 仅以3D渲染以节省GPU内存
-      useBrowserRecommendedResolution: true, // 以浏览器建议的分辨率渲染
+    this.waterClass = new Cesium.Water();
+    this.initViewer().then(() => {
+      this.setViewDefaultlocation().then(() => {
+        this.mainFunc();
+      });
     });
-
-    //去除版权标记
-    viewer._cesiumWidget._creditContainer.style.display = "none";
-
-    globalVariable.viewer = viewer;
-
-    this.mainFunc(viewer);
-
-    // setTimeout(() => {
-    //   
-    // }, 999);
-
-    //  this.cesium.viewer.render();
-    return;
   },
   methods: {
-    mainFunc(viewer) {
-      let that = this;
-      this.mapConfig(viewer);
-
-      // // 加载天地图影像
-      // viewer.imageryLayers.addImageryProvider(
-      //   new Cesium.WebMapTileServiceImageryProvider({
-      //     url: "http://t{s}.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" + systemConfig.tdt_tk,
-      //     // url: "/proxy_tdt/proxy{s}/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk="+systemConfig.tdt_tk,
-      //     layer: "img",
-      //     style: "default",
-      //     tileMatrixSetID: "w",
-      //     format: "image/jpeg",
-      //     subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
-      //     tileMatrixSetID: "GoogleMapsCompatible",
-      //     show: true,
-      //     minimumLevel: 1,
-      //     maximumLevel: 18,
-      //     // rectangle: Cesium.Rectangle.fromDegrees(90, -90, 180, -180),
-      //   })
-      // );
-      // //加载影像注记
-      // viewer.imageryLayers.addImageryProvider(
-      //   new Cesium.WebMapTileServiceImageryProvider({
-      //     url: "http://t{s}.tianditu.gov.cn/cia_w/wmts?tk=" + systemConfig.tdt_tk,
-      //     layer: "cia",
-      //     style: "default",
-      //     tileMatrixSetID: "w",
-      //     format: "tiles",
-      //     subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
-      //     maximumLevel: 20,
-      //   })
-      // );
-
-      viewer.imageryLayers.addImageryProvider(
-        new Cesium.UrlTemplateImageryProvider({
-          url: 'http://202.107.245.52:12017/v1.0/gr?l={z}&x={x}&y={y}',
-          minimumLevel: 1,
-          maximumLevel: 19,
-          format: "png"
-        }),
-      );
+    initViewer() {
+      return new Promise((resolve, reject) => {
+        globalVariable.viewer = new Cesium.Viewer("cesiumContainer", {
+          // useDefaultRenderLoop: false,  //关闭自动渲染
+          animation: false, //动画控制不显示
+          timeline: false, //时间线不显示
+          fullscreenButton: false, //全屏按钮不显示
+          infoBox: false,
+          baseLayerPicker: false, //地图切换不显示
+          // terrainProvider: Cesium.createWorldTerrain(), // 地形
+          imageryProvider: new Cesium.SingleTileImageryProvider({
+            url: (function createColorCanvas(color) {
+              var width = 1,
+                height = 1;
+              var canvas = document.createElement("canvas");
+              canvas.width = width;
+              canvas.height = height;
+              var ctx = canvas.getContext("2d");
+              ctx.fillStyle = color;
+              ctx.fillRect(0, 0, width, height);
+              return canvas.toDataURL();
+            })("#ffffff00"),
+            rectangle: Cesium.Rectangle.fromDegrees(-180.0, -90.0, 180.0, 90.0),
+          }),
+          geocoder: false,
+          homeButton: false,
+          selectionIndicator: false, // 去除绿色选择框
+          sceneModePicker: false,
+          navigationHelpButton: false,
+          scene3DOnly: true, // 仅以3D渲染以节省GPU内存
+          useBrowserRecommendedResolution: true, // 以浏览器建议的分辨率渲染
+        });
+        //去除版权标记
+        globalVariable.viewer._cesiumWidget._creditContainer.style.display =
+          "none";
+        resolve();
+      });
+    },
 
-      // 定位
-      viewer.camera.flyTo({
-        destination: Cesium.Cartesian3.fromDegrees(
-          systemConfig.mapDefault.center.lon,
-          systemConfig.mapDefault.center.lat,
-          systemConfig.mapDefault.height,
-        ),
-        orientation: {
-          heading: Cesium.Math.toRadians(systemConfig.mapDefault.heading), // 方向
-          pitch: Cesium.Math.toRadians(systemConfig.mapDefault.pitch), // 倾斜角度
-          roll: Cesium.Math.toRadians(systemConfig.mapDefault.roll),
-        },
+    // 默认定位
+    setViewDefaultlocation(time) {
+      return new Promise((resolve, reject) => {
+        globalVariable.viewer.camera.flyTo({
+          destination: Cesium.Cartesian3.fromDegrees(
+            systemConfig.mapDefault.center.lon,
+            systemConfig.mapDefault.center.lat,
+            systemConfig.mapDefault.height
+          ),
+          orientation: {
+            heading: Cesium.Math.toRadians(systemConfig.mapDefault.heading), // 方向
+            pitch: Cesium.Math.toRadians(systemConfig.mapDefault.pitch), // 倾斜角度
+            roll: Cesium.Math.toRadians(systemConfig.mapDefault.roll),
+          },
+          duration: isNaN(time) ? 3 : time,
+          pitchAdjustHeight: 1000,
+          complete: function () {
+            resolve();
+          },
+        });
       });
+    },
+
+    mainFunc() {
+      this.mapConfig();
 
-      this.getPointPosition().then((result) => {
-        that.bindPopup();
-      }).catch((err) => {
+      // 加载地图瓦片
+      this.addMapTiles("arcgis");
 
+      // this.getPointPosition()
+      //   .then((result) => {
+      //     that.bindPopup();
+      //   })
+      //   .catch((err) => {});
+
+      this.tilesetAdd();
+
+      this.addWater("./static/data/ojk_water_v3.json", {
+        // this.addWater("./static/data/ojksb.json", {
+        // normalMap: "img/textures/waterNormals.jpg", // 水正常扰动的法线图
+        frequency: 8000.0, // 控制波数的数字。
+        animationSpeed: 0.02, // 控制水的动画速度的数字。
+        amplitude: 5.0, // 控制水波振幅的数字。
+        specularIntensity: 0.8, // 控制镜面反射强度的数字。
+        baseWaterColor: "#006ab4", // rgba颜色对象基础颜色的水。#00ffff,#00baff,#006ab4
+        blendColor: "#006ab4", // 从水中混合到非水域时使用的rgba颜色对象。
+        height: -1, //水面高度
+        clampToGround: true, //是否贴地
+        opacity: 0.8, //透明度
       });
 
-      // this.singleClick(viewer);
+      // this.singleClick();
 
       // this.addGWDataPrimitive();
 
-      // // 模型加载;
-      // 建筑
-      if (systemConfig.modelTilesObj.build && systemConfig.modelTilesMatrixObj.build) {
-        let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.build);
-        globalVariable.build = this.add3DTilesData(systemConfig.modelTilesObj.build, pianyi, true);
-      }
-      // 其他建筑(厂房)
-      if (systemConfig.modelTilesObj.other_build && systemConfig.modelTilesMatrixObj.other_build) {
-        let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.other_build);
-        globalVariable.other_build = this.add3DTilesData(systemConfig.modelTilesObj.other_build, pianyi, true);
-      }
-      if (systemConfig.modelTilesObj.plan && systemConfig.modelTilesMatrixObj.plan) {
-        // 地面
-        let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.plan);
-        globalVariable.plan = this.add3DTilesData(systemConfig.modelTilesObj.plan, pianyi, true);
-      }
-      // globalVariable.plan.style = new Cesium.Cesium3DTileStyle({
-      //   // //写法一
-      //   color: "color('rgba(255,255,255,0.5)')",
-      //   //写法2
-      //   // color: {
-      //   //     evaluateColor: function (feature, result) {
-      //   //         let color = new Cesium.Color(1, 1, 1, param);
-      //   //         return color;                            
-      //   //     }
-      //   // },
-      //   // show: true,
-      // });
-      if (systemConfig.modelTilesObj.pipe && systemConfig.modelTilesMatrixObj.pipe) {
-        // 管网
-        let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.pipe);
-        globalVariable.pipe = this.add3DTilesData(systemConfig.modelTilesObj.pipe, pianyi, false);
-      }
-      // globalVariable.tileset = [globalVariable.plan, globalVariable.build]
-      // this.loop();
+      // this.loadBigDataGltf();
     },
+
     // cesium 球体配置
-    mapConfig(viewer) {
-      let globe = viewer.scene.globe;
+    mapConfig() {
       // 基础球体颜色
-      globe.baseColor = Cesium.Color.BLUE;
+      globalVariable.viewer.scene.globe.baseColor = Cesium.Color.BLUE;
       // 取消大气效果(发光)
-      globe.showGroundAtmosphere = true;
+      globalVariable.viewer.scene.globe.showGroundAtmosphere = true;
 
-      globe.translucency.enabled = true;
+      globalVariable.viewer.scene.globe.translucency.enabled = true;
 
       // // 地底颜色
-      // globe.undergroundColor = undefined;
+      // globalVariable.viewer.scene.globe.undergroundColor = undefined;
 
       // 地形遮盖
-      globe.depthTestAgainstTerrain = false;
+      globalVariable.viewer.scene.globe.depthTestAgainstTerrain = false;
 
-      // globe.translucency.frontFaceAlpha = 1.0;
-      // globe.translucency.rectangle = Cesium.Rectangle.fromDegrees(
+      // globalVariable.viewer.scene.globe.translucency.frontFaceAlpha = 1.0;
+      // globalVariable.viewer.scene.globe.translucency.rectangle = Cesium.Rectangle.fromDegrees(
       //   120.87373270003363,
       //   27.913116219448348,
       //   120.98856425530658,
@@ -203,36 +155,36 @@ export default {
       // );
 
       // // 地下模式
-      // viewer.scene.screenSpaceCameraController.enableCollisionDetection = true ;
-      // viewer.scene.undergroundMode = true;
+      // globalVariable.viewer.scene.screenSpaceCameraController.enableCollisionDetection = true ;
+      // globalVariable.viewer.scene.undergroundMode = true;
       // // 设置地表透明度
-      // viewer.scene.globe.translucency.frontFaceAlpha=0
+      // globalVariable.viewer.scene.globe.translucency.frontFaceAlpha=0
 
       // // 天空盒隐藏
-      // viewer.scene.skyBox.show = false;
+      // globalVariable.viewer.scene.skyBox.show = false;
       // // 解决抗锯齿问题
       // if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
       //   //判断是否支持图像渲染像素化处理
-      //   viewer.resolutionScale = window.devicePixelRatio;
+      //   globalVariable.viewer.resolutionScale = window.devicePixelRatio;
       // }
       // // //是否开启抗锯齿
-      // viewer.scene.fxaa = true;
-      // viewer.scene.postProcessStages.fxaa.enabled = true;
-      // viewer.scene.globe.depthTestAgainstTerrain = true;
-      // viewer.scene.debugShowFramesPerSecond = true;
-      // viewer.scene.globe.enableLighting = true;
-      // viewer.shadows = true;
-      // //viewer.shadowMap.softShadows  = true
-      // viewer.shadowMap.darkness = 0.7; //阴影透明度--越大越透明
+      // globalVariable.viewer.scene.fxaa = true;
+      // globalVariable.viewer.scene.postProcessStages.fxaa.enabled = true;
+      // globalVariable.viewer.scene.globe.depthTestAgainstTerrain = true;
+      // globalVariable.viewer.scene.debugShowFramesPerSecond = true;
+      // globalVariable.viewer.scene.globe.enableLighting = true;
+      // globalVariable.viewer.shadows = true;
+      // //globalVariable.viewer.shadowMap.softShadows  = true
+      // globalVariable.viewer.shadowMap.darkness = 0.7; //阴影透明度--越大越透明
       // // 改变时间设置光照效果
       // var utc = Cesium.JulianDate.fromDate(new Date("2021/07/04 08:00:00"));
       // //北京时间=UTC+8=GMT+8
-      // viewer.clockViewModel.currentTime = Cesium.JulianDate.addHours(
+      // globalVariable.viewer.clockViewModel.currentTime = Cesium.JulianDate.addHours(
       //   utc,
       //   8,
       //   new Cesium.JulianDate()
       // );
-      // viewer.scene.light = new Cesium.DirectionalLight({
+      // globalVariable.viewer.scene.light = new Cesium.DirectionalLight({
       //   //去除时间原因影响模型颜色
       //   direction: new Cesium.Cartesian3(
       //     0.35492591601301104,
@@ -241,23 +193,177 @@ export default {
       //   ),
       // });
     },
-    loop() {
-      requestAnimationFrame(this.loop);
-      // this.$options.methods.renderCesium();
-      globalVariable.viewer.render();
+
+    // 添加地图底图瓦片
+    addMapTiles(key) {
+      switch (key) {
+        case "tdt":
+          // 加载天地图影像
+          globalVariable.viewer.imageryLayers.addImageryProvider(
+            new Cesium.WebMapTileServiceImageryProvider({
+              url:
+                "http://t{s}.tianditu.gov.cn/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" +
+                systemConfig.tdt_tk,
+              // url: "/proxy_tdt/proxy{s}/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk="+systemConfig.tdt_tk,
+              layer: "img",
+              style: "default",
+              tileMatrixSetID: "w",
+              format: "image/jpeg",
+              subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
+              tileMatrixSetID: "GoogleMapsCompatible",
+              show: true,
+              minimumLevel: 1,
+              maximumLevel: 18,
+              // rectangle: Cesium.Rectangle.fromDegrees(90, -90, 180, -180),
+            })
+          );
+          // 加载影像注记
+          globalVariable.viewer.imageryLayers.addImageryProvider(
+            new Cesium.WebMapTileServiceImageryProvider({
+              url:
+                "http://t{s}.tianditu.gov.cn/cia_w/wmts?tk=" +
+                systemConfig.tdt_tk,
+              layer: "cia",
+              style: "default",
+              tileMatrixSetID: "w",
+              format: "tiles",
+              subdomains: ["0", "1", "2", "3", "4", "5", "6", "7"],
+              maximumLevel: 20,
+            })
+          );
+          break;
+        case "xq":
+          viewer.imageryLayers.addImageryProvider(
+            new Cesium.UrlTemplateImageryProvider({
+              url: "http://119.3.233.75/tile/v1.0/gr?l={z}&x={x}&y={y}",
+              minimumLevel: 1,
+              maximumLevel: 19,
+              format: "png",
+            })
+          );
+
+          break;
+        case "arcgis":
+          // 加载ArcGIS在线地图
+          globalVariable.viewer.imageryLayers.addImageryProvider(
+            new Cesium.ArcGisMapServerImageryProvider({
+              url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer",
+            })
+          );
+          break;
+
+        default:
+          break;
+      }
     },
 
+    // 模型加载
+    tilesetAdd() {
+      // 水坝
+      // this.add3DTilesData(
+      //   systemConfig.modelTilesObj.ojk_shuiba_dm,
+      //   undefined,
+      //   true
+      // );
+      // this.add3DTilesData(
+      //   systemConfig.modelTilesObj.ojk_shuiba_snjz,
+      //   undefined,
+      //   true
+      // );
+      // this.add3DTilesData(
+      //   systemConfig.modelTilesObj.ojk_shuiba_swjz,
+      //   undefined,
+      //   true
+      // );
+      // this.add3DTilesData(
+      //   systemConfig.modelTilesObj.ojk_shuiba_xp,
+      //   undefined,
+      //   true
+      // );
+      // globalVariable.ojk_shuiba_zm = this.add3DTilesData(
+      //   systemConfig.modelTilesObj.ojk_shuiba_zm,
+      //   undefined,
+      //   true
+      // );
+
+      // 模型加载;
+      if (systemConfig.modelTilesObj.plan) {
+        // 地面
+        // let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.plan);
+        globalVariable.plan = this.add3DTilesData(
+          systemConfig.modelTilesObj.plan,
+          undefined,
+          true
+        );
+      }
+      if (systemConfig.modelTilesObj.plan_nowater) {
+        // 无水地面
+        // let pianyi = this.createMatrix4(systemConfig.modelTilesMatrixObj.plan);
+        globalVariable.plan = this.add3DTilesData(
+          systemConfig.modelTilesObj.plan_nowater,
+          undefined,
+          true
+        );
+      }
+      // 建筑
+      if (systemConfig.modelTilesObj.build) {
+        globalVariable.build = this.add3DTilesData(
+          systemConfig.modelTilesObj.build,
+          undefined,
+          true
+        );
+      }
+      // 其他建筑(厂房)
+      if (systemConfig.modelTilesObj.other_build) {
+        globalVariable.other_build = this.add3DTilesData(
+          systemConfig.modelTilesObj.other_build,
+          undefined,
+          true
+        );
+      }
+      // 管网
+      if (systemConfig.modelTilesObj.pipe) {
+        globalVariable.pipe = this.add3DTilesData(
+          systemConfig.modelTilesObj.pipe,
+          undefined,
+          false
+        );
+      }
+      // globalVariable.tileset = [globalVariable.plan, globalVariable.build]
+    },
 
+    addWater(url, style) {
+      this.waterClass.create(url, style).then((waterPrimitiveArr) => {
+        this.waterPrimitiveArr = waterPrimitiveArr;
+        window.waterPrimitiveArr = this.waterPrimitiveArr;
+        waterPrimitiveArr.map(function (waterPrimitive) {
+          return globalVariable.viewer.scene.primitives.add(waterPrimitive);
+        });
+      });
+      // setTimeout(() => {
+      // Cesium.upraiseModel(waterPrimitiveArr, {
+      //   time: 3,
+      //   height: 2,
+      //   defaultHeight: 2,
+      // });
+      // Cesium.upraiseModel([globalVariable.ojk_shuiba_zm], {
+      //   time: 3,
+      //   height: 2,
+      //   defaultHeight: 0,
+      // });
+    },
 
     // 点位数据
-    // 1 流量计  2 消火栓  3 漏失监测仪  4 水质检测设备 
+    // 1 流量计  2 消火栓  3 漏失监测仪  4 水质检测设备
     getPointPosition() {
       let that = this;
       return new Promise((resolve, reject) => {
         if (Object.keys(globalVariable.point_positions).length != 0) {
           Object.keys(globalVariable.point_positions).map(function (key) {
-            globalVariable.viewer.entities.remove(globalVariable.point_positions[key]);
-          })
+            globalVariable.viewer.entities.remove(
+              globalVariable.point_positions[key]
+            );
+          });
           globalVariable.point_positions = {};
         }
         api
@@ -270,20 +376,20 @@ export default {
               //   new Cesium.BillboardCollection()
               // );
               data.map(function (item, index) {
-                let arr = that.wenzhou2000ToWGS84([item.x, item.y])
+                let arr = that.wenzhou2000ToWGS84([item.x, item.y]);
                 let img = null;
                 switch (item.equipmentType) {
                   case 1:
-                    img = Flowmeter
+                    img = Flowmeter;
                     break;
                   case 2:
-                    img = FireHydrant
+                    img = FireHydrant;
                     break;
                   case 3:
-                    img = LeakageTester
+                    img = LeakageTester;
                     break;
                   case 4:
-                    img = WaterQuality
+                    img = WaterQuality;
                     break;
                 }
                 let entity = globalVariable.viewer.entities.add({
@@ -300,12 +406,12 @@ export default {
                   },
                   // description: '<table><tr><td>事件描述:</td><td>' + item.id + '</td></tr>'+'<tr><td>中心点坐标:'+item.palce+'',
                 });
-                item.lon = arr[0]
-                item.lat = arr[1]
+                item.lon = arr[0];
+                item.lat = arr[1];
                 entity.info = item;
                 entity.callback = that.searchPointInfo;
-                globalVariable.point_positions[item.equipmentId] = entity
-                return
+                globalVariable.point_positions[item.equipmentId] = entity;
+                return;
                 // billboards.add({
                 //   image: img, // 图片地址
                 //   width: 138,
@@ -322,21 +428,21 @@ export default {
               });
               resolve();
             }
-
           })
           .catch((err) => {
             reject();
           });
       });
-
     },
     // 点位popup窗口事件
     bindPopup() {
       let that = this;
-      var handler = new Cesium.ScreenSpaceEventHandler(globalVariable.viewer.scene.canvas);
+      var handler = new Cesium.ScreenSpaceEventHandler(
+        globalVariable.viewer.scene.canvas
+      );
       handler.setInputAction(function (event) {
         popup({
-          type: 'LEFT_CLICK',
+          type: "LEFT_CLICK",
           infos: event,
         });
       }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
@@ -353,7 +459,7 @@ export default {
             if (globalVariable.point_positions[clickMarkerId]) {
               var data = globalVariable.point_positions[clickMarkerId];
               if (data.callback) {
-                data.callback(data.info)
+                data.callback(data.info);
               }
             }
           } else {
@@ -361,7 +467,6 @@ export default {
           }
         }
       }
-
     },
 
     // 查询点位坐标
@@ -410,45 +515,42 @@ export default {
 
     // 加载3DTiles数据
     add3DTilesData(url, matrix, show) {
-      let that = this;
       let tileset = new Cesium.Cesium3DTileset({
         url: url + "/tileset.json",
         skipLevelOfDetail: true, //开启跳级加载
         // preferLeaves: true,
         maximumScreenSpaceError: 16,
         maximumNumberOfLoadedTiles: 2000,
-        maximumMemoryUsage: 512,//tileset可以使用的最大内存
+        maximumMemoryUsage: 512, //tileset可以使用的最大内存
         show: show,
         immediatelyLoadDesiredLevelOfDetail: true,
       });
       globalVariable.viewer.scene.primitives.add(tileset);
       tileset.readyPromise.then(function () {
-        if (matrix)
-          tileset.root.transform = matrix;
+        if (matrix) tileset.root.transform = matrix;
       });
       return tileset;
     },
 
     // 创建偏移矩阵
     createMatrix4(matrixParam) {
-      let tileModelTool = matrixParam;
       var mx = Cesium.Matrix3.fromRotationX(
-        Cesium.Math.toRadians(tileModelTool.rx)
+        Cesium.Math.toRadians(matrixParam.rx)
       );
       var my = Cesium.Matrix3.fromRotationY(
-        Cesium.Math.toRadians(tileModelTool.ry)
+        Cesium.Math.toRadians(matrixParam.ry)
       );
       var mz = Cesium.Matrix3.fromRotationZ(
-        Cesium.Math.toRadians(tileModelTool.rz)
+        Cesium.Math.toRadians(matrixParam.rz)
       );
       var rotationX = Cesium.Matrix4.fromRotationTranslation(mx);
       var rotationY = Cesium.Matrix4.fromRotationTranslation(my);
       var rotationZ = Cesium.Matrix4.fromRotationTranslation(mz);
       //平移 修改经纬度
       var position = Cesium.Cartesian3.fromDegrees(
-        tileModelTool.longitude,
-        tileModelTool.latitude,
-        tileModelTool.height
+        matrixParam.longitude,
+        matrixParam.latitude,
+        matrixParam.height
       );
       var m = Cesium.Transforms.eastNorthUpToFixedFrame(position);
       //旋转、平移矩阵相乘
@@ -456,7 +558,7 @@ export default {
       Cesium.Matrix4.multiply(m, rotationY, m);
       Cesium.Matrix4.multiply(m, rotationZ, m);
       //缩放 修改缩放比例
-      var scale = Cesium.Matrix4.fromUniformScale(tileModelTool.scale);
+      var scale = Cesium.Matrix4.fromUniformScale(matrixParam.scale);
       Cesium.Matrix4.multiply(m, scale, m);
       return m;
     },
@@ -468,17 +570,19 @@ export default {
       return new Promise((resolve, reject) => {
         $.getJSON("./static/data/GLTF/tree_path.json", function (array) {
           //array.length
-
           let instances = [];
-          for (let i = 0; i < array.length; i += 10) {
+          for (let i = 0; i < array.length; i += 2) {
             const item = array[i];
-            let lonlat = that.webMercator2lonlat(item.x, item.y);
+            let lonlat = that.wenzhou2000ToWGS84([
+              Number(item.x),
+              Number(item.y),
+            ]);
             globalVariable.treeArr.push(lonlat);
             let modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
               new Cesium.Cartesian3.fromDegrees(
-                lonlat[0] + 116.2026998939312,
-                lonlat[1] + 1.1932712598797461,
-                10
+                lonlat[0] + 0.0007,
+                lonlat[1] - 0.0004,
+                5
               ),
               new Cesium.HeadingPitchRoll(0, 0, 0)
             );
@@ -574,7 +678,7 @@ export default {
     },
 
     wenzhou2000ToWGS84(coordinate) {
-      return proj4("EPSG:0986", "EPSG:4326", coordinate)
+      return proj4("EPSG:0986", "EPSG:4326", coordinate);
     },
 
     // 经纬度转墨卡托

+ 50 - 37
src/components/RightPanel.vue

@@ -2,44 +2,56 @@
   <div class="rightPanel">
     <div class="container">
       <div class="panel panel1">
-        <Popup v-if="type == 'popup'" v-bind="{
-          popupData: popupData,
-          close: closePopup
-        }"></Popup>
+        <Popup
+          v-if="type == 'popup'"
+          v-bind="{
+            popupData: popupData,
+            close: closePopup,
+          }"
+        ></Popup>
         <div class="title">- 各点位实时流量 -</div>
         <div class="content">
-          <Table3 v-bind="{
-            tableData: tableData3,
-            tableLabel: tabelLabel3,
-            rowClick: locationEquipment
-          }"></Table3>
+          <Table3
+            v-bind="{
+              tableData: tableData3,
+              tableLabel: tabelLabel3,
+              rowClick: locationEquipment,
+            }"
+          ></Table3>
         </div>
       </div>
       <div class="panel panel2">
         <div class="title">- 各点位实时压力 -</div>
         <div class="content">
-          <Table4 v-bind="{
-            tableData: tableData4,
-            tableLabel: tabelLabel4,
-            rowClick: locationEquipment
-          }"></Table4>
+          <Table4
+            v-bind="{
+              tableData: tableData4,
+              tableLabel: tabelLabel4,
+              rowClick: locationEquipment,
+            }"
+          ></Table4>
         </div>
       </div>
       <div class="panel panel3">
         <div class="title">- 实时报警列表 -</div>
         <div class="content">
-          <Table5 v-bind="{
-            tableData: tableData5,
-            tableLabel: tabelLabel5,
-            rowClick: openAlertDetailInfo,
-          }"></Table5>
+          <Table5
+            v-bind="{
+              tableData: tableData5,
+              tableLabel: tabelLabel5,
+              rowClick: openAlertDetailInfo,
+            }"
+          ></Table5>
         </div>
       </div>
       <div class="panel panel4">
         <div class="title">- 应急预案 -</div>
         <div class="content">
-          <el-image style="width: 62.5%; height: 100%; margin: 0 auto; display: block" :src="yjya_img"
-            :preview-src-list="srcList"></el-image>
+          <el-image
+            style="width: 62.5%; height: 100%; margin: 0 auto; display: block"
+            :src="yjya_img"
+            :preview-src-list="srcList"
+          ></el-image>
         </div>
       </div>
     </div>
@@ -47,6 +59,7 @@
 </template>
 
 <script>
+import { defineAsyncComponent } from "vue";
 import api from "@/api/data";
 import yjya_img from "@/assets/Images/yjya.png";
 export default {
@@ -78,17 +91,17 @@ export default {
     };
   },
   components: {
-    Table3: () => import("@/components/Table.vue"),
-    Table4: () => import("@/components/Table.vue"),
-    Table5: () => import("@/components/Table.vue"),
+    Table3: defineAsyncComponent(() => import("@/components/Table.vue")),
+    Table4: defineAsyncComponent(() => import("@/components/Table.vue")),
+    Table5: defineAsyncComponent(() => import("@/components/Table.vue")),
 
-    Popup: () => import("@/components/Popup.vue"),
+    Popup: defineAsyncComponent(() => import("@/components/Popup.vue")),
   },
   created() {
     this.getAndUpdateData();
   },
   mounted() {
-    window.jumpPopup = this.jump
+    window.jumpPopup = this.jump;
   },
   methods: {
     jump(type, param) {
@@ -96,7 +109,7 @@ export default {
       this.popupData = param;
     },
     closePopup() {
-      this.type = ""
+      this.type = "";
     },
 
     getAndUpdateData() {
@@ -130,7 +143,7 @@ export default {
             }
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
     // 右 三 数据
     getTableDataR3() {
@@ -161,7 +174,7 @@ export default {
                 return item;
               });
             }
-            return
+            return;
             data = [
               {
                 equipmentId: "001211100140", //设备id
@@ -173,7 +186,7 @@ export default {
                 position: "",
                 x: "",
                 y: "",
-                z: ""
+                z: "",
               },
             ];
             that.tableData5 = data.map(function (item) {
@@ -197,16 +210,16 @@ export default {
             });
           }
         })
-        .catch((err) => { });
+        .catch((err) => {});
     },
     // 用于报警设备发送短信
     openAlertDetailInfo(item) {
       // item.id
       // this.locationEquipment
     },
-    // 定位 
+    // 定位
     locationEquipment(data) {
-      let arr = proj4("EPSG:0986", "EPSG:4326", [data.x, data.y])
+      let arr = proj4("EPSG:0986", "EPSG:4326", [data.x, data.y]);
       globalVariable.viewer.camera.flyTo({
         // fromDegrees()将经纬度和高程转换为世界坐标
         destination: Cesium.Cartesian3.fromDegrees(arr[0], arr[1], 200),
@@ -214,11 +227,11 @@ export default {
           // 指向
           heading: Cesium.Math.toRadians(0),
           // 视角
-          pitch: Cesium.Math.toRadians(-90.0),// 倾斜角度,
-          roll: 0
-        }
+          pitch: Cesium.Math.toRadians(-90.0), // 倾斜角度,
+          roll: 0,
+        },
       });
-    }
+    },
   },
 };
 </script>

+ 17 - 17
src/components/Table.vue

@@ -168,44 +168,44 @@ export default {
 .tbDynam {
   width: 100%;
   height: 100%;
-  /deep/ .el-table {
+  :deep(.el-table) {
     background: transparent;
     color: #ffffff;
+    border-bottom: 1px solid transparent;
   }
-  /deep/ .el-table tr {
+  :deep(.el-table tr) {
     background: transparent;
     cursor: pointer;
   }
-  /deep/ .el-table .el-table__body tr:nth-child(2n + 1) {
+  :deep(.el-table .el-table__body tr:nth-child(2n + 1)) {
     background: #2e445bb3;
   }
-  /deep/
-    .el-table--enable-row-hover
-    .el-table__body
-    tr:hover
-    > td.el-table__cell {
+  :deep(.el-table--enable-row-hover
+      .el-table__body
+      tr:hover
+      > td.el-table__cell) {
     background: transparent;
   }
-  /deep/ .el-table__empty-text {
+  :deep(.el-table__empty-text) {
     color: #ffffff;
   }
-  /deep/ .el-table__body tr.current-row > td.el-table__cell {
+  :deep(.el-table__body tr.current-row > td.el-table__cell) {
     background: transparent;
   }
-  /deep/ .el-table th.el-table__cell {
+  :deep(.el-table th.el-table__cell) {
     background: transparent;
     color: #ffffff;
   }
-  /deep/ .el-table td.el-table__cell,
-  /deep/ .el-table th.el-table__cell.is-leaf {
+  :deep(.el-table td.el-table__cell),
+  :deep(.el-table th.el-table__cell.is-leaf) {
     border-bottom: 1px solid transparent;
   }
-  /deep/ .el-table--border::after,
-  /deep/ .el-table--group::after,
-  /deep/ .el-table::before {
+  :deep(.el-table--border::after),
+  :deep(.el-table--group::after),
+  :deep(.el-table::before) {
     background-color: transparent;
   }
-  // /deep/ .el-table .cell{
+  // ::v-deep .el-table .cell{
   //   white-space: nowrap;
   //   overflow: hidden;
   //   text

+ 171 - 160
src/components/Tools.vue

@@ -1,183 +1,194 @@
 <template>
-    <div class="tools">
-        <div class="changeModel">
-            <el-switch
-                style="display: block"
-                v-model="value"
-                active-color="#13ce66"
-                inactive-color="#409eff"
-                active-text="管网数据"
-                inactive-text="地面建筑"
-                @change="changeModel"
-            ></el-switch>
-        </div>
-
-        <ul>
-            <li
-                :class="['measureDistance', { active: nowTool == 'measureDistance' }]"
-                @click="controlMeasureLength"
-                title="测距"
-            ></li>
-            <li
-                :class="['measureArea', { active: nowTool == 'measureArea' }]"
-                @click="controlMeasureArea"
-                title="测面"
-            ></li>
-            <li class="clearMeasure" @click="clearMeasure" title="清空"></li>
-            <li class="home" @click="flyHome" title="回退至全景"></li>
-        </ul>
+  <div class="tools">
+    <div class="changeModel">
+      <el-switch
+        style="display: block"
+        v-model="value"
+        active-color="#13ce66"
+        inactive-color="#409eff"
+        active-text="管网数据"
+        inactive-text="地面建筑"
+        @change="changeModel"
+      ></el-switch>
     </div>
+
+    <ul>
+      <li
+        :class="['measureDistance', { active: nowTool == 'measureDistance' }]"
+        @click="controlMeasureLength"
+        title="测距"
+      ></li>
+      <li
+        :class="['measureArea', { active: nowTool == 'measureArea' }]"
+        @click="controlMeasureArea"
+        title="测面"
+      ></li>
+      <li class="clearMeasure" @click="clearMeasure" title="清空"></li>
+      <li class="home" @click="flyHome" title="回退至全景"></li>
+    </ul>
+  </div>
 </template>
 
 <script>
-import MeasureTool from '@/utils/MeasureTool'
+import MeasureTool from "@/utils/MeasureTool";
 export default {
-    data() {
-        return {
-            value: false,
-            nowTool: ""
-        }
+  data() {
+    return {
+      value: false,
+      nowTool: "",
+    };
+  },
+  created() {
+    // this.measureLength = measureLengthTool({
+    //     action: "add",
+    //     callback: function () { }
+    // }, globalVariable.viewer)
+    // this.measureArea = measureAreaTool({
+    //     action: "add",
+    //     callback: function () { }
+    // }, globalVariable.viewer)
+  },
+  methods: {
+    controlMeasureLength() {
+      let that = this;
+      if (this.nowTool == "measureDistance") {
+        this.nowTool = "";
+        MeasureTool.clearMeasure(globalVariable.viewer);
+      } else {
+        this.nowTool = "measureDistance";
+        MeasureTool.measureLineSpace(globalVariable.viewer, null, function () {
+          that.nowTool = "";
+        });
+      }
     },
-    created() {
-        // this.measureLength = measureLengthTool({
-        //     action: "add",
-        //     callback: function () { }
-        // }, globalVariable.viewer)
-        // this.measureArea = measureAreaTool({
-        //     action: "add",
-        //     callback: function () { }
-        // }, globalVariable.viewer)
+    controlMeasureArea() {
+      let that = this;
+      if (this.nowTool == "measureArea") {
+        this.nowTool = "";
+        MeasureTool.clearMeasure(globalVariable.viewer);
+      } else {
+        this.nowTool = "measureArea";
+        MeasureTool.measureAreaSpace(globalVariable.viewer, null, function () {
+          that.nowTool = "";
+        });
+      }
     },
-    methods: {
-        controlMeasureLength() {
-            let that = this;
-            this.nowTool = 'measureDistance'
-            MeasureTool.measureLineSpace(globalVariable.viewer, null, function () {
-                that.nowTool = ""
-            });
-        },
-        controlMeasureArea() {
-            let that = this;
-            this.nowTool = 'measureArea'
-            MeasureTool.measureAreaSpace(globalVariable.viewer, null, function () {
-                that.nowTool = ""
-            });
-        },
-        clearMeasure(){
-            MeasureTool.clearMeasure(globalVariable.viewer);
-        },
-        flyHome() {
-            // 定位
-            globalVariable.viewer.camera.flyTo({
-                destination: Cesium.Cartesian3.fromDegrees(
-                    systemConfig.mapDefault.center.lon,
-                    systemConfig.mapDefault.center.lat,
-                    systemConfig.mapDefault.height,
-                ),
-                orientation: {
-                    heading: Cesium.Math.toRadians(systemConfig.mapDefault.heading), // 方向
-                    pitch: Cesium.Math.toRadians(systemConfig.mapDefault.pitch), // 倾斜角度
-                    roll: Cesium.Math.toRadians(systemConfig.mapDefault.roll),
-                },
-            });
-        },
-        changeModel(judge) {
-            if (judge) {
-                // 管网数据
-                globalVariable.build.show = false;
-                globalVariable.other_build.show = false;
-                globalVariable.pipe.show = true;
-            } else {
-                // 地面建筑
-                globalVariable.build.show = true;
-                globalVariable.other_build.show = true;
-                globalVariable.pipe.show = false;
-            }
+    clearMeasure() {
+      MeasureTool.clearMeasure(globalVariable.viewer);
+    },
+    flyHome() {
+      // 定位
+      globalVariable.viewer.camera.flyTo({
+        destination: Cesium.Cartesian3.fromDegrees(
+          systemConfig.mapDefault.center.lon,
+          systemConfig.mapDefault.center.lat,
+          systemConfig.mapDefault.height
+        ),
+        orientation: {
+          heading: Cesium.Math.toRadians(systemConfig.mapDefault.heading), // 方向
+          pitch: Cesium.Math.toRadians(systemConfig.mapDefault.pitch), // 倾斜角度
+          roll: Cesium.Math.toRadians(systemConfig.mapDefault.roll),
         },
-    }
-}
+      });
+    },
+    changeModel(judge) {
+      if (judge) {
+        // 管网数据
+        globalVariable.build.show = false;
+        globalVariable.other_build.show = false;
+        globalVariable.pipe.show = true;
+      } else {
+        // 地面建筑
+        globalVariable.build.show = true;
+        globalVariable.other_build.show = true;
+        globalVariable.pipe.show = false;
+      }
+    },
+  },
+};
 </script>
 
 <style lang="less" scoped>
 .tools {
+  position: absolute;
+  z-index: 1;
+  color: #ffffff;
+  background: #1153b733;
+  border: 2px solid #1153b7;
+  padding: 5px;
+  border-radius: 5px;
+  top: 0px;
+  right: -60px;
+
+  .changeModel {
     position: absolute;
-    z-index: 1;
-    // top: 140px;
-    right: -60px;
-    color: #ffffff;
+    width: 180px;
+    padding: 5px;
     background: #1153b733;
     border: 2px solid #1153b7;
-    padding: 5px;
     border-radius: 5px;
-    .changeModel {
-        position: absolute;
-        width: 180px;
-        padding: 5px;
-        background: #1153b733;
-        border: 2px solid #1153b7;
-        border-radius: 5px;
-        left: 60px;
-        top: 0px;
+    left: 60px;
+    top: 0px;
+  }
+  li {
+    width: 32px;
+    height: 32px;
+    cursor: pointer;
+    margin-bottom: 10px;
+    &:last-child {
+      margin-bottom: 0px;
     }
-    li {
-        width: 32px;
-        height: 32px;
-        cursor: pointer;
-        margin-bottom: 10px;
-        &:last-child {
-            margin-bottom: 0px;
-        }
 
-        &.measureDistance {
-            background: url(../assets/img/tools/measureDistance.png) center
-                center no-repeat;
-            &:hover {
-                background: url(../assets/img/tools/measureDistance_active.png)
-                    center center no-repeat;
-            }
-            &.active {
-                background: url(../assets/img/tools/measureDistance_active.png)
-                    center center no-repeat;
-            }
-        }
-        &.measureArea {
-            background: url(../assets/img/tools/measureArea.png) center center
-                no-repeat;
-            &:hover {
-                background: url(../assets/img/tools/measureArea_active.png)
-                    center center no-repeat;
-            }
-            &.active {
-                background: url(../assets/img/tools/measureArea_active.png)
-                    center center no-repeat;
-            }
-        }
-        &.clearMeasure {
-            background: url(../assets/img/tools/clearMeasure.png) center center
-                no-repeat;
-            &:hover {
-                background: url(../assets/img/tools/clearMeasure_active.png)
-                    center center no-repeat;
-            }
-            &.active {
-                background: url(../assets/img/tools/clearMeasure_active.png)
-                    center center no-repeat;
-            }
-        }
-        &.home {
-            background: url(../assets/img/tools/home.png) center center
-                no-repeat;
-            &:hover {
-                background: url(../assets/img/tools/home_active.png) center
-                    center no-repeat;
-            }
-        }
+    &.measureDistance {
+      background: url(~@/assets/img/tools/measureDistance.png) center center
+        no-repeat;
+      &:hover {
+        background: url(~@/assets/img/tools/measureDistance_active.png) center
+          center no-repeat;
+      }
+      &.active {
+        background: url(~@/assets/img/tools/measureDistance_active.png) center
+          center no-repeat;
+      }
     }
-    /deep/ .el-switch__label {
-        color: #ffffff;
-        &.is-active {
-            color: #409eff;
-        }
+    &.measureArea {
+      background: url(~@/assets/img/tools/measureArea.png) center center
+        no-repeat;
+      &:hover {
+        background: url(~@/assets/img/tools/measureArea_active.png) center
+          center no-repeat;
+      }
+      &.active {
+        background: url(~@/assets/img/tools/measureArea_active.png) center
+          center no-repeat;
+      }
+    }
+    &.clearMeasure {
+      background: url(~@/assets/img/tools/clearMeasure.png) center center
+        no-repeat;
+      &:hover {
+        background: url(~@/assets/img/tools/clearMeasure_active.png) center
+          center no-repeat;
+      }
+      &.active {
+        background: url(~@/assets/img/tools/clearMeasure_active.png) center
+          center no-repeat;
+      }
+    }
+    &.home {
+      background: url(~@/assets/img/tools/home.png) center center no-repeat;
+      &:hover {
+        background: url(~@/assets/img/tools/home_active.png) center center
+          no-repeat;
+      }
+    }
+  }
+
+  :deep(.el-switch__label) {
+    color: #ffffff;
+    &.is-active {
+      color: #409eff;
     }
+  }
 }
 </style>

+ 11 - 25
src/main.js

@@ -1,28 +1,14 @@
-import Vue from "vue";
+import { createApp } from 'vue'
+import App from './App.vue'
+let initApp = createApp(App);
 
-// import reset_css from './assets/common/css/reset.css';
-// import function_css from './assets/common/css/function.css';
-// import element_reset from './assets/common/css/element-reset.css';
-// Vue.use(reset_css);
-// Vue.use(function_css);
-// Vue.use(element_reset);
+// import router from './router'
+// import store from './store'
+// initApp.use(store);
+// initApp.use(router);
 
-import ElementUI from 'element-ui';
-import 'element-ui/lib/theme-chalk/index.css';
-Vue.use(ElementUI);
+import ElementPlus from 'element-plus'
+import 'element-plus/dist/index.css'
+initApp.use(ElementPlus)
 
-import App from "./App.vue";
-// import router from "./router";
-// import store from "./store";
-
-// import VueStorage from 'vue-ls'
-// Vue.use(VueStorage)
-
-Vue.config.productionTip = false;
-
-new Vue({
-  data() { return {} },
-  // router,
-  // store,
-  render: (h) => h(App),
-}).$mount("#app");
+initApp.mount('#app');

+ 22 - 23
src/router/index.js

@@ -1,26 +1,25 @@
-import Vue from "vue";
-import VueRouter from "vue-router";
+import { createRouter, createWebHashHistory } from 'vue-router'
+import HomeView from '../views/HomeView.vue'
 
-// 处理统一路由跳转的问题
-const originalPush = VueRouter.prototype.push
-VueRouter.prototype.push = function push(location) {
-  return originalPush.call(this, location).catch(err => err)
-}
-// const VueRouterReplace = VueRouter.prototype.replace
-// VueRouter.prototype.replace = function replace(to) {
-//   return VueRouterReplace.call(this, to).catch(err => err)
-// }
+const routes = [
+  {
+    path: '/',
+    name: 'home',
+    component: HomeView
+  },
+  {
+    path: '/about',
+    name: 'about',
+    // route level code-splitting
+    // this generates a separate chunk (about.[hash].js) for this route
+    // which is lazy-loaded when the route is visited.
+    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
+  }
+]
 
-Vue.use(VueRouter);
+const router = createRouter({
+  history: createWebHashHistory(),
+  routes
+})
 
-const routes = [{
-  path: "/",
-  component: () => import( /* webpackChunkName: "home" */ "../views/Home.vue"),
-}];
-
-const router = new VueRouter({
-  // mode: 'history',
-  routes,
-});
-
-export default router;
+export default router

+ 4 - 9
src/store/index.js

@@ -1,19 +1,14 @@
-import Vue from 'vue'
-import Vuex from 'vuex'
+import { createStore } from 'vuex'
 
-Vue.use(Vuex)
-
-export default new Vuex.Store({
+export default createStore({
   state: {
-
   },
   getters: {
-
   },
   mutations: {
-
   },
   actions: {
   },
-  modules: {},
+  modules: {
+  }
 })

+ 10 - 3
src/utils/MeasureTool.js

@@ -1,5 +1,5 @@
 export default {
-
+    handler: null,
     line: {
         points: [],
         lines: [],
@@ -251,7 +251,7 @@ export default {
 
         //计算多边形面积
         function getArea(points) {
-
+            console.log(JSON.stringify(points));
             var res = 0;
             //拆分三角曲面
 
@@ -352,7 +352,6 @@ export default {
             }
         }
         this.line.lines = []
-
     },
     clearArea(viewer) {
         if (this.area.points.length != 0) {
@@ -368,8 +367,16 @@ export default {
         }
         this.area.areas = []
     },
+
     clearMeasure(viewer) {
         this.clearLine(viewer)
         this.clearArea(viewer)
+
+        if (this.handler) {
+            this.handler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)
+            this.handler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK)
+            this.handler.removeInputAction(Cesium.ScreenSpaceEventType.RIGHT_CLICK)
+            this.handler = null;
+        }
     }
 }

+ 0 - 34
src/utils/axios.js

@@ -1,34 +0,0 @@
-const VueAxios = {
-  vm: {},
-  // eslint-disable-next-line no-unused-vars
-  install (Vue, instance) {
-    if (this.installed) {
-      return
-    }
-    this.installed = true
-
-    if (!instance) {
-      // eslint-disable-next-line no-console
-      console.error('You have to install axios')
-      return
-    }
-    Vue.axios = instance
-
-    Object.defineProperties(Vue.prototype, {
-      axios: {
-        get: function get () {
-          return instance
-        }
-      },
-      $http: {
-        get: function get () {
-          return instance
-        }
-      }
-    })
-  }
-}
-
-export {
-  VueAxios
-}

+ 8 - 13
src/utils/request.js

@@ -1,10 +1,5 @@
-import Vue from 'vue'
 import axios from 'axios'
 import qs from 'qs'
-import {
-  VueAxios
-} from './axios'
-// import { notification } from 'ant-design-vue'
 
 // 创建 axios 实例
 const service = axios.create({
@@ -39,12 +34,12 @@ const err = (error) => {
 // response interceptor
 service.interceptors.response.use(response => response.data, err)
 
-const installer = {
-  vm: {},
-  install(Vue) {
-    Vue.use(VueAxios, service)
-  }
-}
+// const installer = {
+//   vm: {},
+//   install(Vue) {
+//     Vue.use(VueAxios, service)
+//   }
+// }
 
 /**
  * 整合url中拼接的参数
@@ -198,8 +193,8 @@ function postFile(url, data) {
 }
 
 export {
-  installer as VueAxios,
-  service as axios,
+  // installer as VueAxios,
+  // service as axios,
   splicingParam,
   get,
   post,

+ 13 - 7
src/views/Home.vue

@@ -3,6 +3,7 @@
     <MainMap></MainMap>
     <!-- <MainMap2></MainMap2> -->
     <Header></Header>
+    <!-- <Tools></Tools> -->
     <LeftPanel></LeftPanel>
     <RightPanel></RightPanel>
     <!-- <TreeModelList></TreeModelList> -->
@@ -11,20 +12,25 @@
   </div>
 </template>
 <script>
+import { defineAsyncComponent } from "vue";
 export default {
   name: "Home",
   components: {
-    MainMap: () => import("@/components/MainMap.vue"),
-    Header: () => import("@/components/Header.vue"),
-    LeftPanel: () => import("@/components/LeftPanel.vue"),
-    RightPanel: () => import("@/components/RightPanel.vue"),
+    MainMap: defineAsyncComponent(() => import("@/components/MainMap.vue")),
+    Header: defineAsyncComponent(() => import("@/components/Header.vue")),
+    LeftPanel: defineAsyncComponent(() => import("@/components/LeftPanel.vue")),
+    RightPanel: defineAsyncComponent(() =>
+      import("@/components/RightPanel.vue")
+    ),
+
+    // Tools: () => import("@/components/Tools.vue"),
 
     // TreeModelList: () => import("@/components/TreeModelList.vue"),
     // TilesControl: () => import("@/components/TilesControl.vue"),
     // ModelControl: () => import("@/components/ModelControl.vue"),
   },
   data() {
-    return {}
+    return {};
   },
   mounted() {
     // this.initLoading(4500, 15000);
@@ -46,8 +52,8 @@ export default {
       setTimeout(() => {
         loading.close();
       }, endTime);
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 9 - 14
vue.config.js

@@ -1,3 +1,5 @@
+const { defineConfig } = require('@vue/cli-service')
+
 const path = require('path')
 const webpack = require('webpack')
 const CompressionWebpackPlugin = require("compression-webpack-plugin");
@@ -5,8 +7,9 @@ const CompressionWebpackPlugin = require("compression-webpack-plugin");
 function resolve(dir) {
   return path.join(__dirname, dir)
 }
-// vue.config.js
-module.exports = {
+
+module.exports = defineConfig({
+  transpileDependencies: true,
   pages: {
     index: {
       // page 的入口
@@ -55,6 +58,7 @@ module.exports = {
       ...config.plugins,
       ...plugins
     ]
+    // 增加加载 .geojson 文件的规则
     let rules = [{
       test: /\.geojson$/,
       loader: 'json-loader'
@@ -71,19 +75,11 @@ module.exports = {
       .set('@$', resolve('src'))
       .set('@static', resolve('public/static'))
   },
-  css: {
-    loaderOptions: {
-      less: {
-        modifyVars: {},
-        javascriptEnabled: true
-      },
-    }
-  },
   pluginOptions: {
     "style-resources-loader": {
       preProcessor: "less",
       patterns: [
-        path.resolve(__dirname, 'src/assets/common/less/variable.less')
+        path.resolve(__dirname, 'src/assets/less/variable.less')
       ]
     }
   },
@@ -91,7 +87,7 @@ module.exports = {
     port: 2002,
     proxy: {
       '/ojk_data': {
-        target: 'http://122.228.13.28:5000',
+        target: 'http://122.228.13.28:1006',
         changeOrigin: true,
         pathRewrite: {
           '^/ojk_data': ''
@@ -106,5 +102,4 @@ module.exports = {
       }
     },
   }
-}
-
+})

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.