Bläddra i källkod

修复地图上电站数量重复问题

master
dong 10 månader sedan
förälder
incheckning
14fa0dfa80
3 ändrade filer med 70 tillägg och 16 borttagningar
  1. 2
    1
      src/views/layout.vue
  2. 66
    13
      src/views/nationwide.vue
  3. 2
    2
      src/views/singlestation.vue

+ 2
- 1
src/views/layout.vue Visa fil

@@ -78,4 +78,5 @@ showOverlay(true);
78 78
   background-size: 100%;
79 79
   background-repeat: no-repeat;
80 80
  }
81
-</style> 
81
+ 
82
+</style> 

+ 66
- 13
src/views/nationwide.vue Visa fil

@@ -357,7 +357,7 @@ import dian from "@/assets/svg/location.svg";
357 357
 import { imgToBase64 } from "../api/http.js";
358 358
 import hei from "@/assets/svg/name.svg";
359 359
 import { inject } from "vue";
360
-
360
+import { ElMessageBox } from 'element-plus'
361 361
 const router = useRouter();
362 362
 //   import { message } from 'ant-design-vue';
363 363
 const myChart = ref(null); //地图图表
@@ -443,16 +443,26 @@ let ymd = resdata.data.ChargeDischargeTendency.map(item => item.ymd.slice(-2));
443 443
    sysCount.value = resdata.data.sysCount
444 444
   daysandtime.value = Number(resdata.data.PowerStationIndex.safetysky)+1;
445 445
   console.log(daysandtime.value);
446
-    for (let index = 0; index < resdata.data.sysCountries.length; index++) {
447
-            let obj = {
448
-              name: resdata.data.sysCountries[index].cname,
449
-              value: resdata.data.sysCountries[index].count,
450
-              adcode:resdata.data.sysCountries[index].areaId,
451
-              provinceCode:resdata.data.sysCountries[index].provinceCode,
452
-              location:[resdata.data.sysCountries[index].longitude,resdata.data.sysCountries[index].latitude]
453
-            };
454
-            toolTipData.value.push(obj);
455
-    }
446
+   const seenNames = new Map(); // 或者用 {} 对象存储已处理的 cname
447
+
448
+for (let index = 0; index < resdata.data.sysCountries.length; index++) {
449
+  const country = resdata.data.sysCountries[index];
450
+  const cname = country.cname;
451
+
452
+  // 如果 cname 已经处理过,跳过
453
+  if (seenNames.has(cname)) continue;
454
+
455
+  // 否则,记录并添加数据
456
+  seenNames.set(cname, true);
457
+
458
+  toolTipData.value.push({
459
+    name: cname,
460
+    value: country.count,
461
+    adcode: country.areaId,
462
+    provinceCode: country.provinceCode,
463
+    location: [country.longitude, country.latitude]
464
+  });
465
+}
456 466
  
457 467
   } catch (error) {
458 468
     // convertImageToBase64();
@@ -2006,6 +2016,23 @@ const formatAmounts2 = (amount) => {
2006 2016
   }
2007 2017
 };
2008 2018
 const id = ref('')
2019
+
2020
+const handleClose = () => {
2021
+  ElMessageBox.alert('请先登录储能智慧云平台后,从平台菜单数据大屏进入当前页面', '提示', {
2022
+    // if you want to disable its autofocus
2023
+    autofocus: false,
2024
+    showClose: false, // 隐藏关闭按钮
2025
+    closeOnClickModal: false, // 禁止点击遮罩层关闭
2026
+    closeOnPressEscape: false, // 禁止按 ESC 键关闭
2027
+    confirmButtonText: '请登录',
2028
+    customClass: 'custom-message-box', // 添加自定义样式类
2029
+    callback: () => {
2030
+      window.location.href = 'https://esos-iot.bjdexn.cn/user/#/login/index';
2031
+
2032
+    },
2033
+  });
2034
+ 
2035
+}
2009 2036
 onMounted( async () => {
2010 2037
       const url = window.location.href; // 获取当前页面的 URL
2011 2038
       const match = url.match(/[?&]id=([^&#]*)/);
@@ -2023,7 +2050,10 @@ if (id.value) {
2023 2050
     document.cookie = `JSESSIONID=${id.value}; ${expires}; path=/`; // 设置 cookie
2024 2051
     console.log(`Cookie set: JSESSIONID=${id.value}`);
2025 2052
 } else {
2026
-    console.log('没有找到 ID');
2053
+  console.log('没有找到 ID');
2054
+  // window.open('https://esos-iot.bjdexn.cn/user/#/login/index', '_blank');
2055
+  handleClose()
2056
+  return
2027 2057
 }
2028 2058
   // const loading = inject('loading'); // 通过 inject 访问 layoutTitle 变量
2029 2059
   // loading.close();
@@ -2819,5 +2849,28 @@ el-table {
2819 2849
   width: 20px;
2820 2850
   border: #1fffff;
2821 2851
 }
2852
+
2822 2853
 </style>
2823
-<!--  -->
2854
+<!-- -->
2855
+<style>
2856
+/* 全局样式 */
2857
+.el-message-box {
2858
+  
2859
+  max-width: 700px; /* 最大宽度 */
2860
+  height:260px; /* 最大宽度 */
2861
+
2862
+}
2863
+.el-button{
2864
+  width: 100px;
2865
+  height: 50px;
2866
+  font-size: 18px;
2867
+  margin-right:20px;
2868
+}
2869
+ .el-message-box__content {
2870
+  font-size: 20px; /* 设置内容字体大小 */
2871
+  padding: 54px; /* 设置内容内边距 */
2872
+  
2873
+  box-sizing: border-box;
2874
+}
2875
+ 
2876
+</style>

+ 2
- 2
src/views/singlestation.vue Visa fil

@@ -24,7 +24,7 @@
24 24
        <div class="left_top2img">
25 25
         <div class="left_top21">
26 26
           <div class="left_top21img">
27
-            <div class="left_top21imgfont custom-font18">{{characteristic.dayImportKwh}}<span class="left_top21img1">kWh</span></div> </div>
27
+            <div class="left_top21imgfont custom-font18">{{formatAmount1000(characteristic.dayImportKwh)}}<span class="left_top21img1">MWh</span></div> </div>
28 28
           <div class="left_top21name TiF_font">今日总充电量</div>
29 29
         </div>
30 30
         <div class="left_top21">
@@ -32,7 +32,7 @@
32 32
           <div class="left_top21name TiF_font">累计总充电量</div>
33 33
         </div>
34 34
         <div class="left_top21">
35
-          <div class="left_top21img"> <div class="left_top21imgfont custom-font18">{{characteristic.dayExportKwh}}<span class="left_top21img1">kWh</span></div> </div>
35
+          <div class="left_top21img"> <div class="left_top21imgfont custom-font18">{{formatAmount1000(characteristic.dayExportKwh)}}<span class="left_top21img1">MWh</span></div> </div>
36 36
           <div class="left_top21name TiF_font">今日总放电量</div>
37 37
         </div>
38 38
         <div class="left_top21">

Laddar…
Avbryt
Spara