2545307760@qq.com 7 ヶ月 前
コミット
341f5eb20f

+ 3 - 1
web/.env.development

@@ -3,7 +3,9 @@ VITE_CLI_PORT = 8080
 VITE_SERVER_PORT = 8888
 VITE_BASE_API = /api
 VITE_FILE_API = /api
-VITE_BASE_PATH = http://192.168.110.218
+//VITE_BASE_PATH = http://192.168.110.218
+//VITE_BASE_PATH = http://192.168.110.214
+VITE_BASE_PATH = http://127.0.0.1
 VITE_POSITION = close
 VITE_EDITOR = vscode
 // VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm

+ 1 - 1
web/index.html

@@ -8,7 +8,7 @@
     <meta content="Gin,Vue,Admin.Gin-Vue-Admin,GVA,gin-vue-admin,后台管理框架,vue后台管理框架,gin-vue-admin文档,gin-vue-admin首页,gin-vue-admin" name="keywords" />
     <link rel="icon" href="favicon.ico">
     <title></title>
-    <script src="https://map.qq.com/api/gljs?v=1.exp&key=3SVBZ-6MYYZ-Q75X5-7YN43-BMIBZ-YABND"></script>
+<!--    <script src="https://map.qq.com/api/gljs?v=1.exp&key=3SVBZ-6MYYZ-Q75X5-7YN43-BMIBZ-YABND"></script>-->
 </head>
 
 <body>

+ 2 - 0
web/package.json

@@ -38,7 +38,9 @@
         "tailwindcss": "^3.3.3",
         "three": "^0.175.0",
         "three.js": "^0.77.1",
+        "tlbs-map-vue": "^1.3.1",
         "vue": "^3.4.21",
+        "vue-demi": "^0.14.10",
         "vue-router": "^4.3.2",
         "vuedraggable": "^4.1.0"
     },

+ 2 - 1
web/src/main.js

@@ -14,6 +14,7 @@ import auth from '@/directive/auth'
 import { store } from '@/pinia'
 import App from './App.vue'
 import { initDom } from './utils/positionToCode'
+import TlbsMap from 'tlbs-map-vue';
 
 initDom()
 /**
@@ -36,7 +37,7 @@ app
   .use(run)
   .use(store)
   .use(auth)
-  .use(router)
+  .use(router).use(TlbsMap)
   .mount('#app')
 
 export default app

+ 20 - 1
web/src/pinia/modules/screen.js

@@ -3,13 +3,32 @@ import { reactive } from 'vue'
 
 export const useScreenStore = defineStore('screen',() => {
     const controllerData = reactive({})
+    let placeList = []
+    const tunnelList = reactive([])
 
     const setController = (val) => {
         Object.assign(controllerData, val)
     }
 
+    const setTunnelList = (val) => {
+        placeList.length = 0;
+        val.forEach(item => {
+            console.log(item.latitude)
+            console.log(item.longitude)
+            placeList.push({
+                styleId: 'marker',
+                position: { lat: item.latitude, lng: item.longitude } ,
+            })
+        })
+        console.log(placeList)
+        tunnelList.length = 0
+        tunnelList.push(...val)
+    }
     return {
         controllerData,
-        setController
+        setController,
+        tunnelList,
+        setTunnelList,
+        placeList
     }
 })

+ 5 - 5
web/src/view/screen/components/chart.vue

@@ -1,7 +1,7 @@
 <template>
   <img src="@/assets/main_top_left.png" alt="" class="imgStyle"/>
   <div class="titleIcon"></div>
-  <div class="chartBox_title">数据图表</div>
+  <div class="chartBox_title">温度/湿度</div>
   <div id="environment" class="environment"></div>
 </template>
 
@@ -104,8 +104,8 @@ onMounted(() => {
 
 <style scoped lang="less">
   .imgStyle{
-    width: 450px;
-    height: 300px;
+    width: 400px;
+    height: 250px;
   }
   .titleIcon{
     width: 5px;
@@ -123,8 +123,8 @@ onMounted(() => {
     color: #0EFCFF;
   }
   .environment{
-    width: 400px;
-    height: 300px;
+    width: 360px;
+    height: 250px;
     position: absolute;
     left: 20px;
     top: 20px;

+ 6 - 6
web/src/view/screen/components/lightChart.vue

@@ -2,7 +2,7 @@
   <img src="@/assets/main_top_left.png" alt="" class="imgStyle"/>
   <div class="titleIcon"></div>
   <div class="chartBox_title">光照度</div>
-  <div id="environment" class="environment"></div>
+  <div id="light" class="environment"></div>
 </template>
 
 <script setup>
@@ -10,7 +10,7 @@ import * as echarts from 'echarts';
 import { onMounted } from 'vue'
 
 onMounted(() => {
-  let myChart = echarts.init(document.getElementById('environment'));
+  let myChart = echarts.init(document.getElementById('light'));
   myChart.setOption({
     legend:[
       {
@@ -104,8 +104,8 @@ onMounted(() => {
 
 <style scoped lang="less">
 .imgStyle{
-  width: 450px;
-  height: 300px;
+  width: 400px;
+  height: 250px;
 }
 .titleIcon{
   width: 5px;
@@ -123,8 +123,8 @@ onMounted(() => {
   color: #0EFCFF;
 }
 .environment{
-  width: 400px;
-  height: 300px;
+  width: 360px;
+  height: 250px;
   position: absolute;
   left: 20px;
   top: 20px;

+ 90 - 28
web/src/view/screen/components/map.vue

@@ -1,39 +1,101 @@
-//html
 <template>
-  <div id="container" style="overflow: hidden;"></div>
+  <tlbs-map
+      ref="mapRef"
+      api-key="3SVBZ-6MYYZ-Q75X5-7YN43-BMIBZ-YABND"
+      :center="center"
+      :zoom="zoom"
+      :control="control"
+      class="mapBox"
+      @click="onClick"
+      @map_inited="onMapInited"
+  >
+    <tlbs-multi-marker
+        ref="markerRef"
+        :geometries="geometries"
+        :styles="styles"
+        :options="options"
+    />
+    <div class="control-container">
+      <button @click.stop="getLayerInstance">
+        打印点标记实例
+      </button>
+    </div>
+  </tlbs-map>
 </template>
 
+<script>
+import { defineComponent, ref} from 'vue-demi';
+import {useScreenStore} from "@/pinia/modules/screen";
+const useScreen = useScreenStore()
 
+export default defineComponent({
+  name: 'MarkerDemo',
+  setup() {
+    const mapRef = ref(null);
+    const markerRef = ref(null);
+    const center = ref({ lat: 28.7052848, lng: 113.5759597 });
+    const zoom = ref(10);
+    const geometries = ref(useScreen.placeList)
+    const onClick = (e) => {
+      console.log(e.latLng);
+      console.log(useScreen.tunnelList)
+      // geometries.value = [
+      //   {
+      //     styleId: 'marker',
+      //     position: { lat: 28.7052848, lng: 113.5759597 } ,
+      //   },
+      //   {
+      //     styleId: 'marker',
+      //     position: { lat: e.latLng.lat, lng: e.latLng.lng } ,
+      //   },
+      // ]
+    };
 
-<script setup>
+    const onMapInited = () => {
+      // 地图加载完成后,可以获取地图实例、点标记实例,调用地图实例、点标记实例方法
+      console.log(mapRef.value.map);
+      console.log(markerRef.value.marker);
+    };
 
-import { onMounted, reactive, ref , watch } from 'vue'
-
-var center = ref(null)
-// 地图初始化
-const initMap = () => {
-  //定义地图中心点坐标
-  center.value = new TMap.LatLng(30.589184, 114.29689)
-  //定义map变量,调用 TMap.Map() 构造函数创建地图
-
-  new TMap.Map(document.getElementById('container'), {
-    center: center.value,//设置地图中心点坐标
-    zoom: 7,   //设置地图缩放级别
-    mapStyleId: 'style1', //设置地图样式
-  });
-}
-
-onMounted(()=>{
-  initMap()
-})
+    const getLayerInstance = () => {
+      // 可以获取点标记实例,调用点标记实例方法
+      console.log(markerRef.value.marker);
+    };
 
+    return {
+      center,
+      zoom,
+      onClick,
+      onMapInited,
+      getLayerInstance,
+      control: {
+        scale: {},
+        zoom: {
+          position: 'topRight',
+        },
+      },
+      mapRef,
+      markerRef,
+      geometries,
+      styles: {
+        marker: {
+          width: 20,
+          height: 30,
+          anchor: { x: 10, y: 30 },
+        },
+      },
+      options: {
+        minZoom: 5,
+        maxZoom: 15,
+      },
+    };
+  },
+});
 </script>
 
-
-<style>
-#container {
-  /*地图(容器)显示大小*/
-  width: 100%;
-  height: 100%;
+<style scoped lang="less">
+.mapBox{
+  width: 1150px;
+  height: 800px;
 }
 </style>

+ 200 - 91
web/src/view/screen/dataScreen.vue

@@ -12,39 +12,70 @@
       </div>
     </div>
     <div style="height: 10px"></div>
-    <div class="substrate">
-      <Map/>
-    </div>
-    <div class="upperLevel">
-      <el-row>
-        <el-col :span="6" style="height: 900px;background-color: rgba(45,64,125,0.5);">
-          <div class="deviceBox">
-            <img src="@/assets/main_top_left.png" alt=""/>
-            <div class="titleIcon"></div>
-            <div class="deviceBox_title">设备汇总</div>
-            <div class="deviceOptionBox">
-              <div class="deviceOption" v-for="item in deviceList">
-                <img :src="item.url" style="width: 40px;height: 40px"  alt=""/>
-                <el-text style="padding-top: 8px;color: #ffffff">{{item.label + item.value}}</el-text>
-              </div>
+    <el-row>
+      <el-col :span="5" style="height: 900px;">
+        <div class="deviceBox">
+          <img src="@/assets/main_top_left.png" alt=""/>
+          <div class="titleIcon"></div>
+          <div class="deviceBox_title">设备汇总</div>
+          <div class="deviceOptionBox">
+            <div class="deviceOption" v-for="item in deviceList">
+              <img :src="item.url" style="width: 35px;height: 35px"  alt=""/>
+              <el-text style="padding-top: 8px;color: #ffffff" size="small">{{item.label + item.value}}</el-text>
             </div>
           </div>
-          <div class="chartBox">
-            <Chart/>
-          </div>
-        </el-col>
-        <el-col :span="6" :offset="12" class="rightBox">
-          <div class="chartBox">
-            <lightChart/>
+        </div>
+        <div class="chartBox">
+          <Chart/>
+        </div>
+        <div class="chartBox">
+          <lightChart/>
+        </div>
+      </el-col>
+      <el-col :span="14" style="display: flex;justify-content: center">
+        <div class="centerBox">
+          <Map/>
+        </div>
+      </el-col>
+      <el-col :span="5" class="rightBox">
+        <div style="height: 20px"></div>
+        <div class="panel">
+          <span class="panel-title">亮度调整</span>
+<!--          <el-slider-->
+<!--              v-model="transparency"-->
+<!--              :step="50"-->
+<!--              show-stops-->
+<!--              :show-tooltip="false"-->
+<!--              class="panel-slider"-->
+<!--              @change="changeTransparency"-->
+<!--          />-->
+          <div class="brightness" style="margin: 90px 0 0 50px;">
+            <span>低</span>
+            <span>中</span>
+            <span>高</span>
           </div>
-          <div class="warnBox">
-            <img :src="warn" alt="" class="warnBoxExternal" />
-            <img :src="warnTitle" alt="" class="warnBoxTitle"/>
-            <span>警告列表</span>
+<!--          <el-slider-->
+<!--              v-model="transparencyTwo"-->
+<!--              :step="50"-->
+<!--              show-stops-->
+<!--              :show-tooltip="false"-->
+<!--              class="panel-slider2"-->
+<!--              @change="changeTransparencyTwo"-->
+<!--          />-->
+          <div class="brightness" style="margin: 50px 0 0 50px;">
+            <span>低</span>
+            <span>中</span>
+            <span>高</span>
           </div>
-        </el-col>
-      </el-row>
-    </div>
+          <div class="panel-bottom"></div>
+        </div>
+        <div class="warnBox">
+          <img :src="warn" alt="" class="warnBoxExternal" />
+          <img :src="warnTitle" alt="" class="warnBoxTitle"/>
+          <span>警告列表</span>
+        </div>
+      </el-col>
+    </el-row>
   </div>
 </template>
 
@@ -60,7 +91,10 @@ import warn from '@/assets/main_bottopm_top2.png'
 import Map from './components/map.vue'
 import warnTitle from '@/assets/warnTitle.png'
 import lightChart from './components/lightChart.vue'
-import { reactive } from 'vue'
+import { queryAllTunnels } from '@/api/tunnel'
+import { reactive, onMounted } from 'vue'
+import {useScreenStore} from "@/pinia/modules/screen";
+const useScreen = useScreenStore()
 
 const deviceList = reactive([
   {url: environments, label: '环境:', value: '2/1'},
@@ -71,8 +105,13 @@ const deviceList = reactive([
 const jumpScreen = (type) => {
   console.log(type)
 }
-
-
+onMounted(() => {
+  queryAllTunnels().then(res => {
+    if (res.code === 0) {
+      useScreen.setTunnelList(res.data)
+    }
+  })
+})
 </script>
 
 <style scoped lang="less">
@@ -117,30 +156,15 @@ const jumpScreen = (type) => {
       font-size: 16px;
     }
   }
-  // 地图层
-  .substrate{
-    width: 100%;
-    height: 900px;
-    position: absolute;
-    z-index: 0;
-  }
-  // 数据层
-  .upperLevel{
-    width: 100%;
-    height: 820px;
-    position: absolute;
-    z-index: 1;
-    pointer-events: none;
-    background-color: transparent;
-    .deviceBox{
-      width: 450px;
-      height: 200px;
+  .deviceBox {
+      width: 400px;
+      height: 180px;
       margin: 20px;
       position: relative;
       pointer-events: auto;
       img {
-        width: 450px;
-        height: 200px;
+        width: 400px;
+        height: 180px;
       }
       .deviceBox_title {
         position: absolute;
@@ -149,15 +173,16 @@ const jumpScreen = (type) => {
         font-size: 20px;
         color: #0EFCFF;
       }
-      .deviceOptionBox{
+      .deviceOptionBox {
         position: absolute;
         top: 70px;
-        width: 450px;
+        width: 400px;
         height: 60px;
         display: flex;
         justify-content: space-around;
         align-items: center;
-        .deviceOption{
+
+        .deviceOption {
           width: 90px;
           height: 60px;
           display: flex;
@@ -166,50 +191,127 @@ const jumpScreen = (type) => {
           color: #ffffff;
         }
       }
-      .titleIcon{
-        width: 5px;
-        height: 20px;
-        background-color: #0EFCFF;
+    }
+  .titleIcon{
+    width: 5px;
+    height: 20px;
+    background-color: #0EFCFF;
+    position: absolute;
+    left: 20px;
+    top: 16px;
+  }
+  .chartBox{
+    width: 400px;
+    height: 250px;
+    margin: 20px;
+    position: relative;
+    pointer-events: auto;
+  }
+  .rightBox{
+    height: 900px;
+    .warnBox{
+      position: relative;
+      width: 400px;
+      height: 300px;
+      margin: 20px 0 0 20px;
+      .warnBoxExternal{
+        width: 400px;
+        height: 270px;
+      }
+      .warnBoxTitle{
+        width: 200px;
+        height: 35px;
         position: absolute;
         left: 20px;
-        top: 16px;
+        top: 30px;
+      }
+      span{
+        color:#ffffff;
+        font-size: 18px;
+        position: absolute;
+        left: 70px;
+        top: 37px;
       }
     }
-    .chartBox{
-      width: 450px;
-      height: 300px;
-      margin: 20px;
+    .panel{
       position: relative;
-      pointer-events: auto;
-    }
-    .rightBox{
-      height: 900px;
-      background-color: rgba(45,64,125,0.5);
-      .warnBox{
-        position: relative;
-        width: 90%;
-        height: 300px;
-        margin-top: 20px;
-        .warnBoxExternal{
-          width: 100%;
-          height: 300px;
-          padding-left: 5%
-        }
-        .warnBoxTitle{
-          width: 200px;
-          height: 35px;
-          position: absolute;
-          left: 40px;
-          top: 30px;
+      width: 400px;
+      height: 200px;
+      margin-left: 20px;
+      border: 1px solid rgba(25,186,139,0.17);
+      padding: 0 0.1875rem 0.5rem;
+      margin-bottom: 0.1875rem;
+      background: url(@/assets/line.png) rgba(255,255,255,0.04);
+      &::before{
+        .horn;
+        top: 0;
+        left: 0;
+        border-left: 2px solid #02a6b5;
+        border-top: 2px solid #02a6b5;
+      }
+      &::after{
+        .horn;
+        top: 0;
+        right: 0;
+        border-right: 2px solid #02a6b5;
+        border-top: 2px solid #02a6b5;
+      }
+      .panel-bottom{
+        &::before{
+          .horn;
+          bottom: 0;
+          left: 0;
+          border-left: 2px solid #02a6b5;
+          border-bottom: 2px solid #02a6b5;
         }
-        span{
-          color:#ffffff;
-          font-size: 18px;
-          position: absolute;
-          left: 70px;
-          top: 37px;
+        &::after{
+          .horn;
+          bottom: 0;
+          right: 0;
+          border-right: 2px solid #02a6b5;
+          border-bottom: 2px solid #02a6b5;
         }
       }
+      .panel-title{
+        position: absolute;
+        left: 160px;
+        top: 10px;
+        font-size: 20px;
+        font-weight: bold;
+        color: #0EFCFF;
+      }
+      .panelSwitchTitle{
+        color: #ffffff;
+        font-size: 16px;
+        position: absolute;
+        bottom: 30px;
+        font-weight: bold;
+        left:25px;
+      }
+      .panelSwitch{
+        position: absolute;
+        right: 25px;
+        bottom: 20px;
+      }
+      .panel-slider{
+        width: 300px;
+        position: absolute;
+        top: 60px;
+        left: 50px;
+      }
+      .panel-slider2{
+        width: 300px;
+        position: absolute;
+        top: 120px;
+        left: 50px;
+      }
+      .brightness{
+        width: 300px;
+        display: flex;
+        justify-content: space-between;
+        color: #909399;
+        font-size: 14px;
+      }
     }
   }
 }
@@ -220,5 +322,12 @@ const jumpScreen = (type) => {
   background-color: #283a72;
 }
 
+.centerBox{
+  width: 1150px;
+  height: 700px;
+  border-radius: 10px;
+  margin-top: 20px;
+}
+
 </style>