Przeglądaj źródła

原始数据导出

master
dong 1 rok temu
rodzic
commit
1fd5800c29

+ 10
- 1
.env.development Wyświetl plik

@@ -17,9 +17,18 @@ VITE_API_URL = /api
17 17
 
18 18
 # 开发环境接口地址
19 19
 # 开发环境跨域代理,支持配置多个 http://192.168.8.198:8888
20
-# VITE_PROXY = [["/api","http://192.168.8.131:8888"]]
21 20
 # VITE_PROXY = [["/api","http://zlink.bjdexn.cn:8888"]]
21
+# VITE_PROXY = [["/api","http://192.168.8.182:8888"]]
22 22
 
23 23
 VITE_PROXY = [["/api","https://esos-iot.bjdexn.cn"]]
24 24
 # VITE_API_URL ="https://mock.mengxuegu.com/mock/6614b791d985433db203d8da/example"
25 25
 # VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]
26
+# 故障列表 导出  /电站级
27
+# 邮箱分享报表 电量 收益    普通用户 / 故障信息  管理员
28
+# 0.3094     1.1344
29
+# 
30
+# 209        363
31
+# 
32
+# 
33
+# 
34
+# 

+ 1
- 0
.env.production Wyświetl plik

@@ -24,3 +24,4 @@ VITE_PWA = true
24 24
 # 线上环境接口地址
25 25
 # VITE_API_URL = "https://mock.mengxuegu.com/mock/629d727e6163854a32e8307e"
26 26
 VITE_API_URL = "https://esos-iot.bjdexn.cn"
27
+# 

+ 1
- 0
.vscode/settings.json Wyświetl plik

@@ -90,6 +90,7 @@
90 90
     "sortablejs",
91 91
     "sousuo",
92 92
     "spreadsheetml",
93
+    "Stateuser",
93 94
     "stationmanage",
94 95
     "stationstation",
95 96
     "styl",

+ 30
- 1
src/api/home/Multisite.ts Wyświetl plik

@@ -114,7 +114,7 @@ export const postemsSystemsingleStation = (params: {}, id: any) => {
114 114
 };
115 115
 // 站点系统 单站实时数据-----
116 116
 export const poststationrealtime = (params: {}, id: string, ids: string) => {
117
-  return http.post<Station.realtimeinfo>(`/station/${id}/system/${ids}/realtime/info`, qs.stringify(params));
117
+  return http.post<Station.realtimeinfo>(`/station/${id}/system/${ids}/realtime/info`, qs.stringify(params), { loading: false });
118 118
 };
119 119
 // 站点系统 功率趋势图-----
120 120
 export const poststationsystem = (params: {}, id: string, ids: string) => {
@@ -545,3 +545,32 @@ export const editpowerURL = (id: any, params: {}) => {
545 545
 export const selectemsNameURL = (id: any, params: {}) => {
546 546
   return http.post(`/emsSystem/singleStation/selectemsName/${id}`, qs.stringify(params));
547 547
 };
548
+// 获取用户身份标识
549
+export const screenfanhuiURL = () => {
550
+  return http.post(`/screen/fanhui`);
551
+};
552
+// 修改模版信息回显
553
+export const selectscheduletariffidURL = (id: any) => {
554
+  return http.get(`/electricity/selectscheduletariffid/${id}`);
555
+};
556
+// 修改电价模版信息
557
+export const electricityupdateURL = (name: string, id: any, params: {}) => {
558
+  return http.post(`/electricity/update?name=${name}&id=${id}`, params);
559
+};
560
+// 故障告警导出
561
+export const pageInfoexcelURL = (params: {}) => {
562
+  return http.post(`/alarm/pageInfoexcel`, qs.stringify(params));
563
+};
564
+// 原始数据列表
565
+export const tdengineyuanshilURL = (params: {}) => {
566
+  return http.post(`/tdengineyuanshi/list`, qs.stringify(params));
567
+};
568
+// 原始数据导出
569
+export const listexcellURL = (params: {}) => {
570
+  return http.post(`/tdengineyuanshi/listexcel`, qs.stringify(params));
571
+};
572
+// 原始数据导出
573
+export const powerlistURL = (params: {}) => {
574
+  return http.post(`/tdengineyuanshi/powerlist`, qs.stringify(params));
575
+};
576
+//

+ 9
- 12
src/api/index.ts Wyświetl plik

@@ -89,20 +89,14 @@ class RequestHttp {
89 89
         axiosCanceler.removePending(config);
90 90
         tryHideFullScreenLoading();
91 91
         // 登录失效
92
-        if (data.code == ResultEnum.NOTLOGGEDIN) {
93
-          // userStore.setToken("");
94
-          document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
95
-          router.replace(LOGIN_URL);
96
-          ElMessage.error(data.msg);
97
-          return Promise.reject(data);
98
-        }
99
-        if (data.code == ResultEnum.OVERDUE) {
92
+        if (data.code == ResultEnum.NOTLOGGEDIN || data.code == ResultEnum.OVERDUE) {
100 93
           // userStore.setToken("");
101 94
           document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
102 95
           router.replace(LOGIN_URL);
103 96
           ElMessage.error(data.msg);
104 97
           return Promise.reject(data);
105 98
         }
99
+
106 100
         // 全局错误信息拦截(防止下载文件的时候返回数据流,没有 code 直接报错)
107 101
 
108 102
         if (data.code && data.code !== ResultEnum.SUCCESS) {
@@ -114,17 +108,20 @@ class RequestHttp {
114 108
         return data;
115 109
       },
116 110
       async (error: AxiosError) => {
117
-        // console.log(error);
111
+        console.log(error);
118 112
 
119 113
         const { response } = error;
120 114
         tryHideFullScreenLoading();
121
-        document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
122
-        router.replace(LOGIN_URL);
115
+        if (error.code == "ERR_NETWORK") {
116
+          document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
117
+          router.replace(LOGIN_URL);
118
+        }
123 119
         // 请求超时 && 网络错误单独判断,没有 response
124 120
         if (error.message.indexOf("timeout") !== -1) ElMessage.error("请求超时!请您稍后重试");
125 121
         if (error.message.indexOf("Network Error") !== -1) ElMessage.error("网络错误!请您稍后重试");
126
-        // 根据服务器响应的错误状态码,做不同的处理
122
+        // 根据服务器响应的错误状态码,做不同的处理"ERR_NETWORK"
127 123
         if (response) checkStatus(response.status);
124
+
128 125
         // 服务器结果都没有返回(可能服务器错误可能客户端断网),断网处理:可以跳转到断网页面
129 126
         if (!window.navigator.onLine) router.replace("/500");
130 127
 

+ 1
- 0
src/api/interface/index.ts Wyświetl plik

@@ -210,6 +210,7 @@ export namespace Station {
210 210
     stationName: string;
211 211
   }
212 212
   export interface summarytotal {
213
+    ymdHour: string;
213 214
     year: string;
214 215
     ym: string;
215 216
     ymd: string;

+ 1
- 1
src/enums/httpEnum.ts Wyświetl plik

@@ -6,7 +6,7 @@ export enum ResultEnum {
6 6
   NOTLOGGEDIN = 1, // 未登录
7 7
   ERROR = 500,
8 8
   OVERDUE = 401,
9
-  TIMEOUT = 30000,
9
+  TIMEOUT = 100000,
10 10
   TYPE = "success"
11 11
 }
12 12
 

+ 5
- 0
src/stores/interface/index.ts Wyświetl plik

@@ -60,3 +60,8 @@ export interface AuthState {
60 60
 export interface KeepAliveState {
61 61
   keepAliveName: string[];
62 62
 }
63
+export interface Stateuser {
64
+  username: string;
65
+  password: string;
66
+  tenantNo: string;
67
+}

+ 40
- 0
src/stores/modules/account.ts Wyświetl plik

@@ -0,0 +1,40 @@
1
+// src/stores/userStore.ts
2
+import { defineStore } from "pinia";
3
+import { Stateuser } from "@/stores/interface";
4
+
5
+const useUserStore = defineStore({
6
+  id: "user-store",
7
+
8
+  state: (): Stateuser => ({
9
+    username: "",
10
+    password: "",
11
+    tenantNo: ""
12
+  }),
13
+
14
+  actions: {
15
+    // 设置用户信息
16
+    setUser(user: Stateuser) {
17
+      this.username = user.username;
18
+      this.password = user.password; // 注意:通常不应保存密码
19
+      this.tenantNo = user.tenantNo;
20
+    },
21
+
22
+    // 获取用户信息
23
+    getUser(): Stateuser {
24
+      return {
25
+        username: this.username,
26
+        password: this.password, // 注意安全性
27
+        tenantNo: this.tenantNo
28
+      };
29
+    },
30
+
31
+    // 清空用户信息
32
+    clearUser() {
33
+      this.username = "";
34
+      this.password = "";
35
+      this.tenantNo = "";
36
+    }
37
+  }
38
+});
39
+
40
+export default useUserStore;

+ 34
- 9
src/views/Administration/addition.vue Wyświetl plik

@@ -20,7 +20,7 @@
20 20
               <div class="elform">
21 21
                 <el-form-item label="模板名称:" prop="postName" :rules="[{ required: true, message: '请输入模板名称' }]">
22 22
                   <el-input
23
-                    v-model.number="numberValidateForm.postName"
23
+                    v-model="numberValidateForm.postName"
24 24
                     style="width: 300px"
25 25
                     size="large"
26 26
                     type="text"
@@ -99,11 +99,11 @@
99 99
     </div>
100 100
   </div>
101 101
 </template>
102
-
102
+<!--    -->
103 103
 <script setup lang="ts">
104
-import { insertschedule } from "@/api/home/Multisite";
104
+import { insertschedule, selectscheduletariffidURL, electricityupdateURL } from "@/api/home/Multisite";
105 105
 import { FormInstance } from "element-plus";
106
-import { reactive, ref } from "vue";
106
+import { onMounted, reactive, ref } from "vue";
107 107
 import { useRouter, useRoute } from "vue-router";
108 108
 import { nextTick } from "vue";
109 109
 import { ElMessage } from "element-plus";
@@ -138,13 +138,18 @@ const numberValidateForm = reactive({
138 138
 const submitForm = (formEl: FormInstance | undefined) => {
139 139
   console.log(tableData);
140 140
   if (!formEl) return;
141
-
142 141
   formEl.validate(async valid => {
143 142
     if (valid) {
144 143
       if (!validateData()) return;
145
-      const { data } = await insertschedule(tableData, numberValidateForm.postName);
146
-      console.log(data);
147
-      router.push({ path: "/Administration/index", query: { id: "模板管理" } });
144
+      if (route.query.type == "模板新增") {
145
+        const { data } = await insertschedule(tableData, numberValidateForm.postName);
146
+        console.log(data);
147
+        router.push({ path: "/Administration/index", query: { id: "模板管理" } });
148
+      } else {
149
+        const { data } = await electricityupdateURL(numberValidateForm.postName, scheduleVOS.value.data[0].id, tableData);
150
+        console.log(data);
151
+        router.push({ path: "/Administration/index", query: { id: "模板管理" } });
152
+      }
148 153
     } else {
149 154
       console.log("error submit!");
150 155
       return false;
@@ -184,6 +189,7 @@ interface TableData {
184 189
   periodType: string;
185 190
   buyPrice: string;
186 191
   salePrice: string;
192
+  id: string;
187 193
 }
188 194
 const tableData = reactive<TableData[]>([]);
189 195
 // 新增行
@@ -193,7 +199,8 @@ const addNewRow = () => {
193 199
     endTime: "",
194 200
     periodType: "",
195 201
     buyPrice: "",
196
-    salePrice: ""
202
+    salePrice: "",
203
+    id: ""
197 204
   });
198 205
   tableData.push(newRow.value);
199 206
 
@@ -208,7 +215,25 @@ const handleEdit = (index: number) => {
208 215
   // 处理编辑逻辑,例如更新数据源或发送请求
209 216
   tableData.splice(index, 1);
210 217
 };
218
+// 回显电价
219
+const scheduleVOS = ref();
220
+const getghuedit = async () => {
221
+  const { data } = await selectscheduletariffidURL(route.query.id);
222
+  console.log(data);
223
+  scheduleVOS.value = data;
224
+  numberValidateForm.postName = scheduleVOS.value.data[0].name;
225
+  // tableData = scheduleVOS.value.scheduleVOS;
226
+  for (let index = 0; index < scheduleVOS.value.scheduleVOS.length; index++) {
227
+    tableData.push(scheduleVOS.value.scheduleVOS[index]);
228
+  }
229
+};
230
+onMounted(() => {
231
+  if (route.query.type == "电价编辑") {
232
+    getghuedit();
233
+  }
234
+});
211 235
 </script>
212 236
 <style scoped lang="scss">
213 237
 @import "./addition.scss";
214 238
 </style>
239
+<!-- -->

+ 48
- 12
src/views/Administration/index.vue Wyświetl plik

@@ -56,7 +56,7 @@
56 56
                         查看
57 57
                       </el-button>
58 58
                     </div>
59
-                    <div class="bodycheckbox">
59
+                    <div class="bodycheckbox" v-if="BUTTONS.Administrationbinding">
60 60
                       <el-button type="primary" v-if="item.start == 1" plain @click="onUnbind(item)" size="small">
61 61
                         解绑
62 62
                       </el-button>
@@ -70,7 +70,9 @@
70 70
           <el-tab-pane label="模板管理" name="模板管理">
71 71
             <div class="datepicker">
72 72
               <div>
73
-                <el-button type="primary" size="large" color="#0052d9" @click="newaddition">新增</el-button>
73
+                <el-button v-if="BUTTONS.Administrationadd" type="primary" size="large" color="#0052d9" @click="newaddition">
74
+                  新增
75
+                </el-button>
74 76
               </div>
75 77
               <div>
76 78
                 <el-input
@@ -96,9 +98,10 @@
96 98
                 <el-table-column prop="tags" label="标签" />
97 99
                 <el-table-column prop="createUserName" label="创建人" width="140" />
98 100
                 <el-table-column prop="createTime" label="创建时间" />
99
-                <el-table-column prop="tariffId" label="操作" width="140">
101
+                <el-table-column prop="tariffId" label="操作" width="180">
100 102
                   <template #default="scope">
101 103
                     <el-button class="bodycheck" @click="oncheck(scope.row.id)">查看</el-button>
104
+                    <el-button class="bodycheck" @click="neweditition(scope.row.id)">编辑</el-button>
102 105
                   </template>
103 106
                 </el-table-column>
104 107
               </el-table>
@@ -278,6 +281,10 @@ import {
278 281
 import { other, Station } from "@/api/interface";
279 282
 import Pagination from "@/components/ProTable/components/Pagination.vue";
280 283
 import { useRouter, useRoute } from "vue-router";
284
+import { ElNotification } from "element-plus";
285
+import { useAuthButtons } from "@/hooks/useAuthButtons";
286
+const { BUTTONS } = useAuthButtons();
287
+
281 288
 const router = useRouter();
282 289
 const route = useRoute();
283 290
 const currentDate = ref();
@@ -330,6 +337,7 @@ const formatDate = (dateString: string | number | Date) => {
330 337
   const date = new Date(dateString);
331 338
 
332 339
   // 提取年、月、日、时、分信息
340
+
333 341
   const year = date.getFullYear();
334 342
   const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
335 343
   const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
@@ -440,6 +448,16 @@ const newaddition = () => {
440 448
     }
441 449
   });
442 450
 };
451
+const neweditition = (id: any) => {
452
+  router.push({
453
+    path: "/Administration/addition",
454
+    query: {
455
+      type: "电价编辑", // 传递的参数
456
+      id: id
457
+    }
458
+  });
459
+};
460
+
443 461
 // 年份总览
444 462
 const overview = ref(false);
445 463
 const onoverview = () => {
@@ -468,6 +486,16 @@ const getselectelect = async () => {
468 486
 // 绑定确认弹窗
469 487
 const startvalue = ref();
470 488
 const onbinding = async () => {
489
+  console.log(onbindingvalue.value == " ");
490
+
491
+  if (onbindingvalue.value == " " || onbindingvalue.value == "") {
492
+    ElNotification({
493
+      title: "温馨提示",
494
+      message: "请选择模板并绑定!",
495
+      type: "warning"
496
+    });
497
+    return;
498
+  }
471 499
   let obj = {
472 500
     tmplId: onbindingvalue.value,
473 501
     start: startvalue.value,
@@ -511,6 +539,8 @@ const getselectpoweroverview = async () => {
511 539
   }
512 540
   // 处理数据
513 541
   const timeSlots = [
542
+    "23:00",
543
+    "23:30",
514 544
     "00:00",
515 545
     "00:30",
516 546
     "01:00",
@@ -556,9 +586,7 @@ const getselectpoweroverview = async () => {
556 586
     "21:00",
557 587
     "21:30",
558 588
     "22:00",
559
-    "22:30",
560
-    "23:00",
561
-    "23:30"
589
+    "22:30"
562 590
   ];
563 591
   const months = Array.from({ length: 12 }, (_, i) => i + 1);
564 592
   // 初始化表格
@@ -569,11 +597,19 @@ const getselectpoweroverview = async () => {
569 597
 
570 598
   // 填充表格
571 599
   getdata.forEach(item => {
572
-    const rowIndex = timeSlots.indexOf(item.startTime);
573
-    if (rowIndex !== -1) {
574
-      table[rowIndex][item.imonth] = item.periodType;
575
-    }
600
+    table.forEach((items, i) => {
601
+      const startTime = timeSlots.indexOf(item.startTime);
602
+      let endTime = timeSlots.indexOf(item.endTime);
603
+      if (item.startTime == getdata[getdata.length - 1].startTime) {
604
+        endTime = getdata.length - 1;
605
+      }
606
+
607
+      if (startTime <= i && i < endTime) {
608
+        table[i][item.imonth] = item.periodType;
609
+      }
610
+    });
576 611
   });
612
+  console.log(getdata);
577 613
   console.log(table);
578 614
   poweroverdata.value = table;
579 615
   // 输出结果
@@ -584,7 +620,7 @@ const getNextTime = (index: number) => {
584 620
   if (nextIndex < poweroverdata.value.length) {
585 621
     return poweroverdata.value[nextIndex].time;
586 622
   } else {
587
-    return "24:00";
623
+    return "23:00";
588 624
   }
589 625
 };
590 626
 onMounted(() => {
@@ -605,4 +641,4 @@ onMounted(() => {
605 641
 <style scoped lang="scss">
606 642
 @import "./index.scss";
607 643
 </style>
608
-<!-- 电量配置 -- 模板查看 -->
644
+<!-- -->

+ 10
- 0
src/views/Alarm/index.scss Wyświetl plik

@@ -89,9 +89,11 @@
89 89
   font-weight: 600;
90 90
 }
91 91
 .screen {
92
+  box-sizing: border-box;
92 93
   display: flex;
93 94
   justify-content: space-between;
94 95
   width: 100%;
96
+  padding: 0 40px;
95 97
   margin-top: 20px;
96 98
 }
97 99
 .screen_1 {
@@ -99,11 +101,19 @@
99 101
   align-items: center;
100 102
 }
101 103
 .screentime {
104
+  box-sizing: border-box;
102 105
   display: flex;
103 106
   justify-content: space-between;
104 107
   width: 100%;
108
+  padding: 0 40px;
105 109
   margin-top: 20px;
106 110
 }
107 111
 .eltable {
108 112
   margin-top: 30px;
109 113
 }
114
+.example_block {
115
+  display: flex;
116
+  align-items: center;
117
+  float: right;
118
+  margin: 20px 0;
119
+}

+ 123
- 82
src/views/Alarm/index.vue Wyświetl plik

@@ -16,8 +16,8 @@
16 16
           {{ (cities.find(s => s.id === Singlevalue) || {}).stationName }}
17 17
         </template>
18 18
       </el-select>
19
-      <div class="title_"></div>
20
-      <el-select
19
+      <!-- <div class="title_"></div> -->
20
+      <!-- <el-select
21 21
         v-model="emsDeviceId"
22 22
         collapse-tags
23 23
         placeholder="选择编号"
@@ -31,7 +31,7 @@
31 31
           {{ (emsDevice.find(s => s.id === emsDeviceId) || {}).id }}
32 32
         </template>
33 33
         <el-option v-for="item in emsDevice" :key="item.id" :label="item.emsDeviceId" :value="item.id" />
34
-      </el-select>
34
+      </el-select> -->
35 35
     </div>
36 36
     <div class="faultalarm">
37 37
       <el-card>
@@ -49,29 +49,35 @@
49 49
           <div class="Alarmlist_Alarm">告警列表</div>
50 50
           <div class="screen">
51 51
             <div class="screen_1">
52
+              <div>设备编号:</div>
53
+              <el-select v-model="emsDeviceId" placeholder="请选择设备类型" size="large" style="width: 240px" clearable>
54
+                <el-option v-for="item in emsDevice" :key="item.id" :label="item.emsDeviceId" :value="item.id" />
55
+              </el-select>
56
+            </div>
57
+            <div class="screen_1">
52 58
               <div>设备类型:</div>
53
-              <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px">
59
+              <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px" clearable>
54 60
                 <el-option v-for="item in quipmentlist" :key="item.daviceClass" :label="item.name" :value="item.daviceClass" />
55 61
               </el-select>
56 62
             </div>
57 63
             <div class="screen_1">
58 64
               <div>告警等级:</div>
59
-              <el-select v-model="alarm" placeholder="请选择告警等级" size="large" style="width: 240px">
65
+              <el-select v-model="alarm" placeholder="请选择告警等级" size="large" style="width: 240px" clearable>
60 66
                 <el-option v-for="item in alarmlist" :key="item.code" :label="item.name" :value="item.code" />
61 67
               </el-select>
62 68
             </div>
63 69
             <div class="screen_1">
64 70
               <div>状态:</div>
65
-              <el-select v-model="alarmstatus" placeholder="请选择状态" size="large" style="width: 240px">
71
+              <el-select v-model="alarmstatus" placeholder="请选择状态" size="large" style="width: 240px" clearable>
66 72
                 <el-option v-for="item in alarmstatuslist" :key="item.todayId" :label="item.name" :value="item.todayId" />
67 73
               </el-select>
68 74
             </div>
69
-            <div class="screen_1">
75
+            <!-- <div class="screen_1">
70 76
               <div>处理建议:</div>
71 77
               <el-select v-model="proposal" placeholder="请选择处理建议" size="large" style="width: 240px">
72 78
                 <el-option v-for="item in proposallist" :key="item.dictCode" :label="item.dictName" :value="item.dictCode" />
73 79
               </el-select>
74
-            </div>
80
+            </div> -->
75 81
           </div>
76 82
           <div class="screentime">
77 83
             <div class="screen_1">
@@ -87,29 +93,42 @@
87 93
                 value-format="YYYY-MM-DD hh:mm:ss"
88 94
               />
89 95
             </div>
90
-
91 96
             <div class="screen_1">
92
-              <el-button type="primary" size="large" @click="getpostpageInfo">查询</el-button>
93
-              <el-button size="large" @click="onreset">重置</el-button>
97
+              <el-button type="primary" @click="getpostpageInfo">查询</el-button>
98
+              <el-button @click="onexport">导出</el-button>
99
+              <el-button @click="onreset">重置</el-button>
94 100
             </div>
95 101
           </div>
96 102
           <div class="eltable">
97 103
             <el-table :data="tableData.records" style="width: 100%" border>
98
-              <el-table-column prop="deviceName" label="设备名称" width="180" />
104
+              <el-table-column prop="eid" label="设备编号" width="240" />
105
+              <el-table-column prop="deviceName" label="设备类型" width="180" />
99 106
               <el-table-column prop="alarmname" label="告警等级" width="180" />
100
-              <el-table-column prop="title" label="告警标题" />
101
-              <el-table-column prop="kehu" label="客户告警" />
102
-              <el-table-column prop="handlingdictName" label="处理建议" />
103
-              <el-table-column prop="startDate" label="告警开始时间" />
104
-              <el-table-column prop="endDate" label="告警结束时间" />
105
-              <el-table-column prop="todayname" label="状态" />
107
+              <el-table-column prop="title" label="告警内容" />
108
+              <!-- <el-table-column prop="kehu" label="客户告警" /> -->
109
+              <!-- <el-table-column prop="handlingdictName" label="处理建议" /> -->
110
+              <el-table-column prop="startDate" label="发生时间" />
111
+              <el-table-column prop="endDate" label="复位时间" />
112
+              <el-table-column prop="todayname" label="状态">
113
+                <template #default="scope">
114
+                  {{ scope.row.todayname == 1 ? "已恢复" : "未恢复" }}
115
+                </template>
116
+              </el-table-column>
106 117
             </el-table>
107 118
           </div>
119
+          <div class="example_block">
120
+            <Pagination
121
+              :pageable="pageable"
122
+              :handle-size-change="handleSizeChange"
123
+              :handle-current-change="handleCurrentChange"
124
+            />
125
+          </div>
108 126
         </div>
109 127
       </el-card>
110 128
     </div>
111 129
   </div>
112 130
 </template>
131
+<!--  == 发生 ,1&没有发生时间== 复位 |告警,事件,故障 -->
113 132
 <!--    -->
114 133
 <script setup lang="ts">
115 134
 import { onMounted, Ref, ref } from "vue";
@@ -120,8 +139,11 @@ import {
120 139
   postalarmLevel,
121 140
   postdeviceClass,
122 141
   posthandlingSugg,
123
-  postpageInfo
142
+  postpageInfo,
143
+  pageInfoexcelURL
124 144
 } from "@/api/home/Multisite";
145
+import Pagination from "@/components/ProTable/components/Pagination.vue";
146
+
125 147
 import * as echarts from "echarts";
126 148
 import { Station } from "@/api/interface";
127 149
 
@@ -139,7 +161,7 @@ const poststationstationName = async () => {
139 161
 const postemsDevice = async (value: any) => {
140 162
   emsDevice.value = [];
141 163
   const { data } = await postemsSystemsingleStation({}, value);
142
-  emsDeviceId.value = data[0].id;
164
+  // emsDeviceId.value = data[0].id;
143 165
   emsDevice.value = data;
144 166
   getstationrealtime();
145 167
 };
@@ -248,7 +270,7 @@ const baropPiechart = (list: string | any[]) => {
248 270
 
249 271
   piechart.setOption(option1);
250 272
 };
251
-// 告警等级
273
+// 告警等级-
252 274
 const getalarmLevel = async () => {
253 275
   const { data } = await postalarmLevel({ stationId: Singlevalue.value, emsId: emsDeviceId.value });
254 276
   let list = data.map(function (item) {
@@ -293,7 +315,7 @@ const gradechart = (list: string | any[]) => {
293 315
       show: true,
294 316
       orient: "vertical",
295 317
       right: "0%",
296
-      bottom: "20%",
318
+      bottom: "30%",
297 319
       icon: "circle",
298 320
       textStyle: {
299 321
         fontSize: 14,
@@ -357,6 +379,8 @@ const getpostdeviceClass = async () => {
357 379
 };
358 380
 // 设备类型
359 381
 const equipmentchart = (list: string | any[]) => {
382
+  console.log(list);
383
+
360 384
   let equipment = echarts.init(equipmenttype.value);
361 385
   window.addEventListener(
362 386
     "resize",
@@ -383,8 +407,8 @@ const equipmentchart = (list: string | any[]) => {
383 407
     legend: [
384 408
       {
385 409
         show: true,
386
-        right: "0%",
387
-        bottom: "40%",
410
+        left: "320px",
411
+        bottom: "0%",
388 412
         icon: "circle",
389 413
         orient: "vertical",
390 414
         textStyle: {
@@ -395,63 +419,16 @@ const equipmentchart = (list: string | any[]) => {
395 419
             }
396 420
           }
397 421
         },
398
-        data: [
399
-          {
400
-            value: 0, // 将 cnt 键修改为 value
401
-            code: 1,
402
-            name: "PCS"
403
-          },
404
-          {
405
-            value: 0, // 将 cnt 键修改为 value
406
-            code: 2,
407
-            name: "BMS"
408
-          }
409
-        ],
422
+        data: list,
410 423
         formatter: function (name: string) {
411
-          if (name == "PCS" || name == "BMS") {
412
-            for (let index = 0; index < list.length; index++) {
413
-              if (name == list[index].name) {
414
-                return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
415
-              }
424
+          console.log(list);
425
+
426
+          for (let index = 0; index < list.length; index++) {
427
+            if (name == list[index].name) {
428
+              return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
416 429
             }
417 430
           }
418 431
         }
419
-      },
420
-      {
421
-        show: true,
422
-        right: "24%",
423
-        bottom: "40%",
424
-        icon: "circle",
425
-        orient: "vertical",
426
-        textStyle: {
427
-          fontSize: 14,
428
-          rich: {
429
-            a: {
430
-              fontSize: 14
431
-            }
432
-          }
433
-        },
434
-        formatter: function (name: string) {
435
-          if (name == "电表" || name == "空调") {
436
-            for (let index = 0; index < list.length; index++) {
437
-              if (name == list[index].name) {
438
-                return `${name + " " + " " + "" + " "} {a|${list[index].value}} 条`;
439
-              }
440
-            }
441
-          }
442
-        },
443
-        data: [
444
-          {
445
-            value: 0, // 将 cnt 键修改为 value
446
-            code: 2,
447
-            name: "电表"
448
-          },
449
-          {
450
-            value: 0, // 将 cnt 键修改为 value
451
-            code: 2,
452
-            name: "空调"
453
-          }
454
-        ]
455 432
       }
456 433
     ],
457 434
     series: [
@@ -488,7 +465,7 @@ const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
488 465
 
489 466
 const quipment = ref();
490 467
 const alarm = ref("");
491
-const proposal = ref("");
468
+// const proposal = ref("");
492 469
 const alarmstatus = ref("");
493 470
 const timevalue: Ref<any> = ref([]);
494 471
 
@@ -501,14 +478,28 @@ const getposthandlingSugg = async () => {
501 478
 // 数据列表
502 479
 const tableData = ref();
503 480
 // 查询
481
+const pageable = ref({
482
+  ps: 10,
483
+  pn: 1,
484
+  total: 0
485
+});
486
+const handleSizeChange = async (e: any) => {
487
+  pageable.value.ps = e;
488
+  getpostpageInfo();
489
+};
490
+const handleCurrentChange = async (e: any) => {
491
+  pageable.value.pn = e;
492
+
493
+  getpostpageInfo();
494
+};
504 495
 const getpostpageInfo = async () => {
505 496
   let obj = {
506 497
     stationId: Singlevalue.value,
507 498
     emsId: emsDeviceId.value,
508
-    pn: 1,
509
-    ps: 100,
499
+    pn: pageable.value.pn,
500
+    ps: pageable.value.ps,
510 501
     alarmId: alarm.value,
511
-    handlingId: proposal.value,
502
+    // handlingId: proposal.value,
512 503
     todayId: alarmstatus.value,
513 504
     startDate: timevalue.value[0],
514 505
     endDate: timevalue.value[1],
@@ -516,15 +507,62 @@ const getpostpageInfo = async () => {
516 507
   };
517 508
   const { data } = await postpageInfo(obj);
518 509
   tableData.value = data;
510
+  pageable.value.total = tableData.value.total;
511
+};
512
+const onexport = async () => {
513
+  let obj = {
514
+    stationId: Singlevalue.value,
515
+    emsId: emsDeviceId.value,
516
+    alarmId: alarm.value,
517
+    // handlingId: proposal.value,
518
+    todayId: alarmstatus.value,
519
+    startDate: timevalue.value[0],
520
+    endDate: timevalue.value[1],
521
+    devicesId: quipment.value
522
+  };
523
+  const { data } = await pageInfoexcelURL(obj);
524
+  downloadxlsx(data);
525
+};
526
+const downloadxlsx = (data: any) => {
527
+  let fileUrl = `download/${data.msg}`;
528
+  const date = new Date();
529
+  const hours = formatTime(date.getHours());
530
+  const minutes = formatTime(date.getMinutes());
531
+  const seconds = formatTime(date.getSeconds());
532
+  let fileName = `${currentDate.value} ${hours}:${minutes}:${seconds}故障报表.xlsx`;
533
+  fetch(fileUrl)
534
+    .then(response => response.blob())
535
+    .then(blob => {
536
+      // 创建一个临时的URL对象
537
+      const url = URL.createObjectURL(blob);
538
+      // 创建一个隐藏的<a>标签,并设置其href属性为临时URL
539
+      const a = document.createElement("a");
540
+      a.href = url;
541
+      a.download = fileName; // 设置下载的文件名
542
+      a.style.display = "none";
543
+      // 将<a>标签添加到文档中,并模拟点击下载
544
+      document.body.appendChild(a);
545
+      a.click();
546
+      // 下载完成后,移除<a>标签和临时URL对象
547
+      document.body.removeChild(a);
548
+      URL.revokeObjectURL(url);
549
+    })
550
+    .catch(error => {
551
+      console.error("下载文件时出错:", error);
552
+    });
553
+};
554
+const formatTime = (time: number) => {
555
+  return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
519 556
 };
520 557
 // 重置
521 558
 const onreset = async () => {
522 559
   quipment.value = "";
523 560
   alarm.value = "";
524 561
   alarmstatus.value = "";
525
-  proposal.value = "";
562
+  // proposal.value = "";
526 563
   timevalue.value[0] = "";
527 564
   timevalue.value[1] = "";
565
+  emsDeviceId.value = "";
528 566
   getpostpageInfo();
529 567
 };
530 568
 onMounted(() => {
@@ -540,3 +578,6 @@ onMounted(() => {
540 578
 <style scoped lang="scss">
541 579
 @import "./index.scss";
542 580
 </style>
581
+<!-- -->
582
+<!--  
583
+  -->

+ 26
- 4
src/views/dataScreen/index.vue Wyświetl plik

@@ -6,11 +6,33 @@
6 6
 import { onMounted } from "vue";
7 7
 import { useRouter } from "vue-router";
8 8
 const router = useRouter();
9
-onMounted(() => {
10
-  // window.location.href = "http://zlink.bjdexn.cn/#/nationwide";
11
-  router.push("/home/index");
9
+// import useUserStore from "@/stores/modules/account"; // 确保路径正确
10
+import { screenfanhuiURL } from "@/api/home/Multisite";
12 11
 
13
-  window.open("https://esos-iot.bjdexn.cn/#/nationwide", "_blank");
12
+onMounted(async () => {
13
+  // 假设你的 userStore.getUser() 返回一个用户对象
14
+  // const userStore = useUserStore();
15
+  // const user = userStore.getUser();
16
+  // const userWithJSON = {
17
+  //   ...user
18
+  // };
19
+  // console.log(user);
20
+
21
+  // const queryString = new URLSearchParams(userWithJSON).toString();
22
+  // 假设这是你的异步函数
23
+  const { data } = await screenfanhuiURL();
24
+
25
+  // 在使用之前进行类型检查
26
+  if (typeof data === "object" && data !== null && "id" in data) {
27
+    // 类型断言
28
+    const id = (data as { id: string }).id;
29
+
30
+    // 使用 id 打开新窗口
31
+    window.open(`https://esos-iot.bjdexn.cn/#/nationwide?id=${id}`, "_blank");
32
+    router.push("/home/index");
33
+  } else {
34
+    console.error("data 不是有效的对象,或者缺少 id 属性");
35
+  }
14 36
 });
15 37
 </script>
16 38
 <!-- <style lang="scss" scoped>

+ 8
- 7
src/views/equipment/index.vue Wyświetl plik

@@ -40,14 +40,14 @@
40 40
         <el-table-column prop="eid" label="设备编号" />
41 41
         <el-table-column prop="emsDeviceId" label="设备名称" />
42 42
         <el-table-column prop="powerName" label="归属电站" />
43
-        <el-table-column prop="onlineStatus" label="绑定状态" align="center">
43
+        <el-table-column prop="binding" label="绑定状态" align="center">
44 44
           <template #default="scope">
45
-            <!-- <div v-if="scope.row.onlineStatus == 1">绑定</div>
45
+            <!-- <div v-if="scope.row.binding == 1">绑定</div>
46 46
             <div v-else>未绑定</div> -->
47 47
             <el-switch
48
-              v-model="scope.row.onlineStatus"
49
-              :active-value="1"
50
-              :inactive-value="0"
48
+              v-model="scope.row.binding"
49
+              active-value="1"
50
+              inactive-value="0"
51 51
               disabled
52 52
               @change="changeswitch"
53 53
               size="large"
@@ -57,7 +57,7 @@
57 57
         <el-table-column prop="createTime" label="创建时间" />
58 58
         <el-table-column prop="updateTime" label="修改时间" />
59 59
         <!-- <el-table-column prop="updateTime" label="创建时间" /> -->
60
-        <el-table-column prop="onlineStatus" label="设备图片" align="center" width="200">
60
+        <el-table-column prop="url" label="设备图片" align="center" width="200">
61 61
           <template #default="scope">
62 62
             <div class="elimageurl">
63 63
               <div v-for="(item, index) in scope.row.url" :key="index">
@@ -201,6 +201,7 @@ const newition = async (row: { url: never[]; emsDeviceId: any; eid: any }) => {
201 201
   powersvalue.value = selectems.value.pid; // 绑定电站
202 202
   powerswitch.value = selectems.value.onlineStatus; // 绑定状态
203 203
   dialogVisible.value = true;
204
+  console.log(powersvalue.value);
204 205
 };
205 206
 
206 207
 const changeswitch = async (e: any) => {
@@ -212,7 +213,7 @@ const changeswitch = async (e: any) => {
212 213
 // 确定
213 214
 const determine = async () => {
214 215
   if (powerswitch.value == 1) {
215
-    if (powersvalue.value == "") {
216
+    if (powersvalue.value == "" || powersvalue.value == undefined) {
216 217
       ElNotification({
217 218
         title: "温馨提示",
218 219
         message: "请选择电站并绑定!",

+ 1
- 1
src/views/home/index.scss Wyświetl plik

@@ -35,7 +35,7 @@
35 35
   border-bottom: 2px solid #e4e7ed;
36 36
 }
37 37
 #baroption {
38
-  width: 68%;
38
+  width: 50%;
39 39
   height: 400px;
40 40
   border-right: 1px solid #e8e8e8;
41 41
 

+ 96
- 41
src/views/home/index.vue Wyświetl plik

@@ -22,7 +22,7 @@
22 22
             </div>
23 23
             <el-divider />
24 24
             <div class="overview_line">
25
-              装机功率: {{ formatAmountkwh(multiStation.installedPower) }} {{ formatCompany(multiStation.installedPower) }} |
25
+              装机功率: {{ formatAmountkwh(multiStation.installedPower) }} {{ formatCompany1(multiStation.installedPower) }} |
26 26
               装机容量: {{ formatAmountkwh(multiStation.installedCap) }} {{ formatCompany(multiStation.installedCap) }}
27 27
             </div>
28 28
           </div>
@@ -43,10 +43,15 @@
43 43
                 <img src="../../assets/images/charging.png" alt="站点" />
44 44
               </div>
45 45
             </div>
46
-            <div class="overview_line">
46
+            <div class="overview_line" v-if="multiStation.importKwhDiffYDay > 0">
47
+              较昨日上升: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
48
+              {{ formatCompany_(multiStation.importKwhDiffYDay) }}
49
+            </div>
50
+            <div class="overview_line" v-else>
47 51
               较昨日下降: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
48 52
               {{ formatCompany_(multiStation.importKwhDiffYDay) }}
49 53
             </div>
54
+
50 55
             <el-divider />
51 56
             <div class="overview_line">
52 57
               本月充电: {{ formatAmountkwh(multiStation.monthImportKwh) }} {{ formatCompany(multiStation.monthImportKwh) }} |
@@ -71,14 +76,18 @@
71 76
                 <img src="../../assets/images/discharge.png" alt="站点" />
72 77
               </div>
73 78
             </div>
74
-            <div class="overview_line">
79
+            <div class="overview_line" v-if="multiStation.exportKwhDiffYDay > 0">
80
+              较昨日上升: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
81
+              {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
82
+            </div>
83
+            <div class="overview_line" v-else>
75 84
               较昨日下降: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
76 85
               {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
77 86
             </div>
78 87
             <el-divider />
79 88
             <div class="overview_line">
80
-              本月电: {{ formatAmountkwh(multiStation.monthExportKwh) }} {{ formatCompany(multiStation.monthExportKwh) }} |
81
-              累计电: {{ formatAmountkwh(multiStation.accumulativeExportKwh) }}
89
+              本月电: {{ formatAmountkwh(multiStation.monthExportKwh) }} {{ formatCompany(multiStation.monthExportKwh) }} |
90
+              累计电: {{ formatAmountkwh(multiStation.accumulativeExportKwh) }}
82 91
               {{ formatCompany(multiStation.accumulativeExportKwh) }}
83 92
             </div>
84 93
           </div>
@@ -99,7 +108,10 @@
99 108
                 <img src="../../assets/images/qian.png" alt="站点" />
100 109
               </div>
101 110
             </div>
102
-            <div class="overview_line">
111
+            <div class="overview_line" v-if="multiStation.profitDiffYDay > 0">
112
+              较昨日上升: {{ formatAmount1(multiStation.profitDiffYDay) }} {{ formatAmounts2(multiStation.profitDiffYDay) }}
113
+            </div>
114
+            <div class="overview_line" v-else>
103 115
               较昨日下降: {{ formatAmount1(multiStation.profitDiffYDay) }} {{ formatAmounts2(multiStation.profitDiffYDay) }}
104 116
             </div>
105 117
             <el-divider />
@@ -119,7 +131,7 @@
119 131
               <el-tab-pane label="收益统计" name="first"> </el-tab-pane>
120 132
               <el-tab-pane label="充放电统计" name="second"> </el-tab-pane>
121 133
               <div class="grid_div1">
122
-                <div v-if="tabpropslabel == '收益统计'" style="width: 68%" ref="baroption" id="baroption"></div>
134
+                <div v-if="tabpropslabel == '收益统计'" style="width: 60%" ref="baroption" id="baroption"></div>
123 135
                 <div v-else style="width: 100%" ref="baroption" id="baroption"></div>
124 136
                 <div id="income" v-show="tabpropslabel == '收益统计'"></div>
125 137
               </div>
@@ -173,7 +185,7 @@
173 185
       </div>
174 186
       <el-table :data="tableData.records" style="width: 100%" border>
175 187
         <el-table-column type="index" width="50" />
176
-        <el-table-column prop="stationName" label="电站名称" />
188
+        <el-table-column prop="stationName" label="电站名称" :show-overflow-tooltip="true" />
177 189
         <el-table-column prop="onlineStatus" label="在线状态">
178 190
           <template #default="scope">
179 191
             {{ scope.row.onlineStatus == 0 ? "离线" : "在线" }}
@@ -191,8 +203,18 @@
191 203
 
192 204
         <el-table-column prop="overallEfficiency" label="综合效率(%)" />
193 205
         <!-- <el-table-column prop="dischargeCompletionRate" label="放电达成率(%)" /> -->
194
-        <el-table-column prop="yesterdayProfit" label="昨日收益(元)" />
195
-        <el-table-column prop="totalProfit" label="总收益(万元)" />
206
+        <!-- <el-table-column prop="yesterdayProfit" label="昨日收益(元)" /> -->
207
+        <el-table-column prop="yesterdayProfit" label="昨日收益(元)" align="center">
208
+          <template #default="scope">
209
+            {{ scope.row.yesterdayProfit.toFixed(2) }}
210
+          </template>
211
+        </el-table-column>
212
+        <!-- <el-table-column prop="totalProfit" label="总收益(元)" /> .toFixed(2)-->
213
+        <el-table-column prop="totalProfit" label="总收益(元)" align="center">
214
+          <template #default="scope">
215
+            {{ scope.row.totalProfit.toFixed(2) }}
216
+          </template>
217
+        </el-table-column>
196 218
       </el-table>
197 219
       <div class="example_block">
198 220
         <!-- <el-pagination layout="prev, pager, next" :total="tableData.records.length" @change="changemultiStationpagebase" /> -->
@@ -201,7 +223,7 @@
201 223
     </el-card>
202 224
   </div>
203 225
 </template>
204
-<!--    -->
226
+<!--     -->
205 227
 <script setup lang="ts">
206 228
 import { onMounted, ref } from "vue";
207 229
 import type { TabsPaneContext } from "element-plus";
@@ -252,6 +274,16 @@ const formatAmountkwh = (amount: number) => {
252 274
     return (amount / 1000).toFixed(2);
253 275
   }
254 276
 };
277
+const formatCompany1 = (amount: number) => {
278
+  if (amount == undefined) {
279
+    return "kW";
280
+  }
281
+  if (amount < 1000) {
282
+    return "kW";
283
+  } else {
284
+    return "MW";
285
+  }
286
+};
255 287
 const formatCompany = (amount: number) => {
256 288
   if (amount == undefined) {
257 289
     return "kWh";
@@ -266,21 +298,27 @@ const formatAmountkwh_ = (amount: number) => {
266 298
   if (amount == undefined) {
267 299
     return "1000";
268 300
   }
269
-  if (amount > -1000) {
301
+  if (amount > 0) {
270 302
     return amount.toFixed(2);
271 303
   } else {
272
-    return (amount / 1000).toFixed(2);
304
+    return Math.abs(amount).toFixed(2);
273 305
   }
306
+  // if (amount > -1000) {
307
+  //   return amount.toFixed(2);
308
+  // } else {
309
+  //   return (amount / 1000).toFixed(2);
310
+  // }
274 311
 };
275 312
 const formatCompany_ = (amount: number) => {
276 313
   if (amount == undefined) {
277 314
     return "kWh";
278 315
   }
279
-  if (amount > -1000) {
280
-    return "kWh";
281
-  } else {
282
-    return "MWh";
283
-  }
316
+  return "kWh";
317
+  // if (amount > -1000) {
318
+  //   return "kWh";
319
+  // } else {
320
+  //   return "MWh";
321
+  // }
284 322
 };
285 323
 const formatAmount = (amount: number) => {
286 324
   if (amount == undefined) {
@@ -303,16 +341,21 @@ const formatAmounts = (amount: number) => {
303 341
   }
304 342
 };
305 343
 const formatAmount1 = (amount: number) => {
306
-  console.log(amount > -10000);
344
+  // console.log(amount > -10000);
307 345
 
308 346
   if (amount == undefined) {
309 347
     return "0";
310 348
   }
311
-  if (amount > -10000) {
349
+  if (amount > 0) {
312 350
     return amount.toFixed(2);
313 351
   } else {
314
-    return (amount / 10000).toFixed(2);
352
+    return Math.abs(amount).toFixed(2);
315 353
   }
354
+  // if (amount > -10000) {
355
+  //   return amount.toFixed(2);
356
+  // } else {
357
+  //   return (amount / 10000).toFixed(2);
358
+  // }
316 359
 };
317 360
 const formatAmounts2 = (amount: number) => {
318 361
   console.log(amount);
@@ -320,11 +363,12 @@ const formatAmounts2 = (amount: number) => {
320 363
   if (amount == undefined) {
321 364
     return "元";
322 365
   }
323
-  if (amount > -10000) {
324
-    return "元";
325
-  } else {
326
-    return "万元";
327
-  }
366
+  return "元";
367
+  // if (amount > -10000) {
368
+  //   return "元";
369
+  // } else {
370
+  //   return "万元";
371
+  // }
328 372
 };
329 373
 const pickerincome = (value: any) => {
330 374
   value2.value = [formatDate(value[0]), formatDate(value[1])];
@@ -456,7 +500,7 @@ const getmultiStation = async () => {
456 500
   }
457 501
   const profits = [{ type: "bar" }];
458 502
 
459
-  baroptionchart(dates, profits);
503
+  baroptionchart(dates, profits, "收益/元");
460 504
 };
461 505
 // 收益统计图
462 506
 const getmultiStationMonth = async () => {
@@ -475,7 +519,7 @@ const getmultiStationMonth = async () => {
475 519
 
476 520
   const profits = [{ type: "bar" }];
477 521
 
478
-  baroptionchart(dates, profits);
522
+  baroptionchart(dates, profits, "收益/元");
479 523
 };
480 524
 // 充放电统计图
481 525
 const getmultiStatiopower = async () => {
@@ -491,7 +535,7 @@ const getmultiStatiopower = async () => {
491 535
 
492 536
   const profits = [{ type: "bar" }, { type: "bar" }];
493 537
 
494
-  baroptionchart(dates, profits);
538
+  baroptionchart(dates, profits, "kWh");
495 539
 };
496 540
 // 充放电统计月份
497 541
 const getmultiStatiopowerMonth = async () => {
@@ -508,10 +552,10 @@ const getmultiStatiopowerMonth = async () => {
508 552
   }
509 553
 
510 554
   const profits = [{ type: "bar" }, { type: "bar" }];
511
-  baroptionchart(dates, profits);
555
+  baroptionchart(dates, profits, "kWh");
512 556
 };
513 557
 // 收益统计
514
-const baroptionchart = (dates: string[][], profits: { type: string }[]) => {
558
+const baroptionchart = (dates: string[][], profits: { type: string }[], subtext: string | undefined) => {
515 559
   // console.log(dates, profits);
516 560
 
517 561
   const baroptionvalue = echarts.init(baroption.value);
@@ -524,7 +568,13 @@ const baroptionchart = (dates: string[][], profits: { type: string }[]) => {
524 568
   );
525 569
   let option = {
526 570
     title: {
527
-      subtext: "收益/元"
571
+      subtext: subtext
572
+    },
573
+    tooltip: {
574
+      trigger: "axis",
575
+      axisPointer: {
576
+        type: "shadow"
577
+      }
528 578
     },
529 579
     legend: {
530 580
       right: 30
@@ -555,15 +605,20 @@ const getmultiStationtopday = async () => {
555 605
   let profitlist = [];
556 606
   let stationNames = [];
557 607
   if (data.length != 0) {
558
-    profitlist = data.map(item => item.profit).sort((a, b) => a - b);
559
-    stationNames = data.map(item => item.stationName);
608
+    const sortedData = data
609
+      .map(item => ({
610
+        profit: parseFloat(item.profit + "").toFixed(2), // 保留小数点后两位
611
+        stationName: item.stationName
612
+      }))
613
+      .sort((a, b) => parseFloat(a.profit) - parseFloat(b.profit)); // 确保排序时比较为数字
614
+
615
+    profitlist = sortedData.map(item => parseFloat(item.profit)); // 转回为数字
616
+    stationNames = sortedData.map(item => item.stationName);
560 617
   } else {
561 618
     profitlist = [60, 40, 70, 20, 80, 100, 120];
562 619
     stationNames = ["演示电站一", "演示电站二", "演示电站三", "演示电站四", "演示电站五", "演示电站六", "演示电站七"];
563 620
   }
564 621
 
565
-  // console.log(profitlist, stationNames);
566
-
567 622
   baroptionincome(profitlist, stationNames);
568 623
 };
569 624
 // 收益排名月份
@@ -574,7 +629,7 @@ const getmultiStationtopMonth = async () => {
574 629
 
575 630
   baroptionincome(profitlist, stationNames);
576 631
 };
577
-// 收益排名
632
+// 收益排名-
578 633
 const baroptionincome = (profitlist: number[], stationNames: string[]) => {
579 634
   let baroption = echarts.init(document.getElementById("income"));
580 635
   window.addEventListener(
@@ -586,7 +641,7 @@ const baroptionincome = (profitlist: number[], stationNames: string[]) => {
586 641
   );
587 642
   let option = {
588 643
     title: {
589
-      subtext: "收益排名"
644
+      subtext: "收益排名/元"
590 645
     },
591 646
     tooltip: {
592 647
       trigger: "axis",
@@ -611,10 +666,10 @@ const baroptionincome = (profitlist: number[], stationNames: string[]) => {
611 666
         }
612 667
       },
613 668
       axisLine: {
614
-        show: false // 隐藏 X 轴刻度线
669
+        show: true // 隐藏 X 轴刻度线
615 670
       },
616 671
       axisTick: {
617
-        show: false // 隐藏 X 轴刻度线
672
+        // show: true // 隐藏 X 轴刻度线
618 673
       },
619 674
       splitLine: {
620 675
         show: false // 隐藏 x 轴背景刻度线
@@ -625,7 +680,7 @@ const baroptionincome = (profitlist: number[], stationNames: string[]) => {
625 680
       position: "right",
626 681
       data: profitlist,
627 682
       axisLine: {
628
-        show: false // 隐藏 y 轴刻度线
683
+        show: true // 隐藏 y 轴刻度线
629 684
       },
630 685
       axisTick: {
631 686
         show: false // 隐藏 y 轴刻度线

+ 31
- 18
src/views/incomeforms/index.vue Wyświetl plik

@@ -251,7 +251,7 @@ console.log(BUTTONS);
251 251
 // 表头
252 252
 const columnList = ref([
253 253
   {
254
-    prop: "stationName",
254
+    prop: "ymdHour",
255 255
     label: "日期",
256 256
     ifcolumn: true,
257 257
     children: null
@@ -322,7 +322,7 @@ const columnList = ref([
322 322
   },
323 323
   {
324 324
     prop: "overallEfficiency",
325
-    label: "综合效率(%)",
325
+    label: "总(元)",
326 326
     ifcolumn: true,
327 327
     children: null
328 328
   }
@@ -337,7 +337,7 @@ const singlecolumnList = ref([
337 337
   },
338 338
   {
339 339
     prop: "",
340
-    label: "充电量(kWh)",
340
+    label: "充电量(kWh)",
341 341
     ifcolumn: true,
342 342
     children: [
343 343
       {
@@ -394,26 +394,29 @@ const singlecolumnList = ref([
394 394
       },
395 395
       {
396 396
         prop: "dischargeTotal",
397
-        label: "总",
397
+        label: "总(元)",
398 398
         ifcolumn: true
399 399
       }
400 400
     ]
401
-  },
402
-  {
403
-    prop: "overallEfficiency",
404
-    label: "综合效率(%)",
405
-    ifcolumn: true,
406
-    children: null
407 401
   }
402
+  // ,
403
+  // {
404
+  //   prop: "overallEfficiency",
405
+  //   label: "综合效率(%)",
406
+  //   ifcolumn: true,
407
+  //   children: null
408
+  // }
408 409
 ]);
409 410
 const currentDate = ref();
410 411
 const activeName = ref("站点汇总");
411
-const handleClick = (val: any) => {
412
+const handleClick = async (val: any) => {
412 413
   // activeName.value
413 414
   activeName.value = val.props.name;
414 415
   if (val.props.name == "站点汇总") {
415 416
   } else {
416
-    poststationstationName();
417
+    reportformsindex.value = 2;
418
+    await poststationstationName();
419
+    await onreportforms(reportformsindex.value);
417 420
   }
418 421
 };
419 422
 const timepicker: Ref<any> = ref([]);
@@ -489,7 +492,7 @@ const getdaymonthyear = async (value: any) => {
489 492
 };
490 493
 // 查询
491 494
 const gatSummary = () => {
492
-  getreportpowerday();
495
+  getdaymonthyear(daymonthyearvalue.value);
493 496
 };
494 497
 // 重置
495 498
 const onreset = () => {
@@ -666,6 +669,8 @@ const onexport = async () => {
666 669
   }
667 670
 };
668 671
 const downloadxlsx = (item: string, data: other.Data) => {
672
+  console.log(item, data);
673
+
669 674
   let fileUrl = `download/${data.msg}`;
670 675
   const date = new Date();
671 676
   const hours = formatTime(date.getHours());
@@ -720,7 +725,7 @@ const getreportpowerday = async () => {
720 725
     endDate: timepicker.value[1]
721 726
   };
722 727
   const { data } = await incomeday(obj);
723
-  data.total.stationName = "总计";
728
+  data.total.ymdHour = "总计";
724 729
   data.list.push(data.total);
725 730
   tableData.value = data;
726 731
 };
@@ -731,7 +736,7 @@ const getreportpoweryearMonth = async () => {
731 736
     endYearMonth: timepicker.value[1]
732 737
   };
733 738
   const { data } = await incomeyearMonth(obj);
734
-  data.total.stationName = "总计";
739
+  data.total.ymdHour = "总计";
735 740
   data.list.push(data.total);
736 741
   tableData.value = data;
737 742
 };
@@ -743,7 +748,7 @@ const getreportpoweryear = async () => {
743 748
     endYear: timepicker.value[1]
744 749
   };
745 750
   const { data } = await incomeyear(obj);
746
-  data.total.stationName = "总计";
751
+  data.total.ymdHour = "总计";
747 752
   data.list.push(data.total);
748 753
   tableData.value = data;
749 754
 };
@@ -788,7 +793,7 @@ const poststationstationName = async () => {
788 793
   const { data } = await stationstationName({});
789 794
   Singlevalue.value = data[0].id;
790 795
   cities.value = data;
791
-  getsingleincomeday();
796
+  // getsingleincomeday();
792 797
 };
793 798
 const postemsDevice = async (value: any) => {
794 799
   console.log(value);
@@ -813,7 +818,14 @@ const yearstarttime = async (val: any) => {
813 818
 
814 819
 // 查询
815 820
 const onselectsite = async () => {
816
-  onreportforms(reportformsindex.value);
821
+  if (reportformsindex.value == 2) {
822
+    getsingleincomeday();
823
+  } else if (reportformsindex.value == 3) {
824
+    getsingleincomeyearMonth();
825
+  } else if (reportformsindex.value == 4) {
826
+    getsingleincomeyear();
827
+  }
828
+  // onreportforms(reportformsindex.value);
817 829
 };
818 830
 // 重置
819 831
 const onselectreset = async () => {
@@ -917,3 +929,4 @@ onMounted(() => {
917 929
 <style scoped lang="scss">
918 930
 @import "./index.scss";
919 931
 </style>
932
+<!-- -->

+ 17
- 17
src/views/monitor/index.vue Wyświetl plik

@@ -572,39 +572,39 @@
572 572
           <div class="equipmentdata_equipment">
573 573
             <div class="equipmentdata_div">
574 574
               <div class="equipment_title">总电压</div>
575
-              <div>{{ BMSlist.tv ?? "-" }} V</div>
575
+              <div>{{ (BMSlist.tv * 1).toFixed(1) ?? "-" }} V</div>
576 576
             </div>
577 577
             <div class="equipmentdata_div">
578 578
               <div class="equipment_title">总电流</div>
579
-              <div>{{ BMSlist.tc ?? "-" }} A</div>
579
+              <div>{{ (BMSlist.tc * 1).toFixed(1) ?? "-" }} A</div>
580 580
             </div>
581 581
             <div class="equipmentdata_div">
582 582
               <div class="equipment_title">SOC</div>
583
-              <div>{{ BMSlist.soc ?? "-" }} %</div>
583
+              <div>{{ (BMSlist.soc * 1).toFixed(1) ?? "-" }} %</div>
584 584
             </div>
585 585
             <div class="equipmentdata_div4">
586 586
               <div class="equipment_title">SOH</div>
587
-              <div>{{ BMSlist.soh ?? "-" }} %</div>
587
+              <div>{{ (BMSlist.soh * 1).toFixed(1) ?? "-" }} %</div>
588 588
             </div>
589 589
           </div>
590 590
           <!-- 2 -->
591 591
           <div class="equipmentdata_equipment">
592 592
             <div class="equipmentdata_div">
593 593
               <div class="equipment_title">充电限制功率</div>
594
-              <div>{{ BMSlist.rechargeablePower ?? "-" }} kW</div>
594
+              <div>{{ (BMSlist.rechargeablePower * 1).toFixed(1) ?? "-" }} kW</div>
595 595
             </div>
596 596
             <div class="equipmentdata_div">
597 597
               <div class="equipment_title">放电限制功率</div>
598
-              <div>{{ BMSlist.dischargeablePower ?? "-" }} kW</div>
598
+              <div>{{ (BMSlist.dischargeablePower * 1).toFixed(1) ?? "-" }} kW</div>
599 599
             </div>
600 600
 
601 601
             <div class="equipmentdata_div">
602 602
               <div class="equipment_title">平均单体温度</div>
603
-              <div>{{ BMSlist.avgCellTempr ?? "-" }} ℃</div>
603
+              <div>{{ (BMSlist.avgCellTempr * 1).toFixed(1) ?? "-" }} ℃</div>
604 604
             </div>
605 605
             <div class="equipmentdata_div">
606 606
               <div class="equipment_title">平均单体电压</div>
607
-              <div>{{ BMSlist.avgCellVoltage ?? "-" }} V</div>
607
+              <div>{{ (BMSlist.avgCellVoltage * 1).toFixed(1) ?? "-" }} V</div>
608 608
             </div>
609 609
           </div>
610 610
           <!-- 3 -->
@@ -634,19 +634,19 @@
634 634
             </div> -->
635 635
             <div class="equipmentdata_div">
636 636
               <div class="equipment_title">最高单体温度</div>
637
-              <div>{{ BMSlist.maxCellTempr ?? "-" }} ℃</div>
637
+              <div>{{ (BMSlist.maxCellTempr * 1).toFixed(3) ?? "-" }} ℃</div>
638 638
             </div>
639 639
             <div class="equipmentdata_div">
640 640
               <div class="equipment_title">最低单体温度</div>
641
-              <div>{{ BMSlist.minCellTempr ?? "-" }} ℃</div>
641
+              <div>{{ (BMSlist.minCellTempr * 1).toFixed(3) ?? "-" }} ℃</div>
642 642
             </div>
643 643
             <div class="equipmentdata_div4">
644 644
               <div class="equipment_title">最高单体电压</div>
645
-              <div>{{ BMSlist.maxCellVoltage ?? "-" }} V</div>
645
+              <div>{{ (BMSlist.maxCellVoltage * 1).toFixed(3) ?? "-" }} V</div>
646 646
             </div>
647 647
             <div class="equipmentdata_div">
648 648
               <div class="equipment_title">最低单体电压</div>
649
-              <div>{{ BMSlist.minCellVoltage ?? "-" }} V</div>
649
+              <div>{{ (BMSlist.minCellVoltage * 1).toFixed(3) ?? "-" }} V</div>
650 650
             </div>
651 651
           </div>
652 652
           <!--  -->
@@ -777,7 +777,7 @@
777 777
             </el-card> -->
778 778
             <el-card>
779 779
               <div class="equipmentdevice1">
780
-                <div class="equipmentname" v-if="Conditionerdata.alarmStatus == 1">
780
+                <div class="equipmentname" v-if="Conditionerdata.alarmStatus == 0">
781 781
                   <div class="equipmentborder"></div>
782 782
                   <div class="equipment1">正常</div>
783 783
                 </div>
@@ -833,19 +833,19 @@
833 833
           <div class="equipmentdata_equipment">
834 834
             <div class="equipmentdata_div">
835 835
               <div class="equipment_title">出水温度</div>
836
-              <div>{{ Conditionerdata.condensingTempr ?? "-" }} ℃</div>
836
+              <div>{{ (Conditionerdata.condensingTempr * 1).toFixed(3) ?? "-" }} ℃</div>
837 837
             </div>
838 838
             <div class="equipmentdata_div">
839 839
               <div class="equipment_title">回水温度</div>
840
-              <div>{{ Conditionerdata.defrostTempr ?? "-" }} ℃</div>
840
+              <div>{{ (Conditionerdata.defrostTempr * 1).toFixed(3) ?? "-" }} ℃</div>
841 841
             </div>
842 842
             <div class="equipmentdata_div">
843 843
               <div class="equipment_title">出水压力</div>
844
-              <div>{{ Conditionerdata.outdoorTempr ?? "-" }} Bar</div>
844
+              <div>{{ (Conditionerdata.outdoorTempr * 1).toFixed(1) ?? "-" }} Bar</div>
845 845
             </div>
846 846
             <div class="equipmentdata_div4">
847 847
               <div class="equipment_title">回水压力</div>
848
-              <div>{{ Conditionerdata.cabinetTempr ?? "-" }} Bar</div>
848
+              <div>{{ (Conditionerdata.cabinetTempr * 1).toFixed(1) ?? "-" }} Bar</div>
849 849
             </div>
850 850
           </div>
851 851
           <!--  -->

+ 4
- 0
src/views/overview/index.scss Wyświetl plik

@@ -216,6 +216,10 @@
216 216
   width: 100%;
217 217
   height: 280px;
218 218
   margin-top: 30px;
219
+  overflow: hidden;
220
+}
221
+.gridpiechartimg {
222
+  width: 100%;
219 223
 }
220 224
 .gridpiechartname {
221 225
   margin-top: 20px;

+ 88
- 23
src/views/overview/index.vue Wyświetl plik

@@ -38,7 +38,11 @@
38 38
                 <img src="../../assets/images/charging.png" alt="站点" />
39 39
               </div>
40 40
             </div>
41
-            <div class="overview_line">
41
+            <div class="overview_line" v-if="multiStation.importKwhDiffYDay > 0">
42
+              较昨日上升: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
43
+              {{ formatCompany_(multiStation.importKwhDiffYDay) }}
44
+            </div>
45
+            <div class="overview_line" v-else>
42 46
               较昨日下降: {{ formatAmountkwh_(multiStation.importKwhDiffYDay) }}
43 47
               {{ formatCompany_(multiStation.importKwhDiffYDay) }}
44 48
             </div>
@@ -67,14 +71,18 @@
67 71
                 <img src="../../assets/images/discharge.png" alt="站点" />
68 72
               </div>
69 73
             </div>
70
-            <div class="overview_line">
74
+            <div class="overview_line" v-if="multiStation.exportKwhDiffYDay > 0">
75
+              较昨日上升: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
76
+              {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
77
+            </div>
78
+            <div class="overview_line" v-else>
71 79
               较昨日下降: {{ formatAmountkwh_(multiStation.exportKwhDiffYDay) }}
72 80
               {{ formatCompany_(multiStation.exportKwhDiffYDay) }}
73 81
             </div>
74 82
             <el-divider />
75 83
             <div class="overview_line">
76
-              本月电: {{ formatAmountkwh(multiStation.monthExportKwh) }} {{ formatCompany(multiStation.monthExportKwh) }} |
77
-              累计电:
84
+              本月电: {{ formatAmountkwh(multiStation.monthExportKwh) }} {{ formatCompany(multiStation.monthExportKwh) }} |
85
+              累计电:
78 86
               {{ formatAmountkwh(multiStation.accumulativeExportKwh) }}
79 87
               {{ formatCompany(multiStation.accumulativeExportKwh) }}
80 88
             </div>
@@ -96,7 +104,11 @@
96 104
                 <img src="../../assets/images/qian.png" alt="站点" />
97 105
               </div>
98 106
             </div>
99
-            <div class="overview_line">
107
+            <div class="overview_line" v-if="multiStation.profitDiffYDay > 0">
108
+              较昨日上升: {{ formatAmount1(multiStation.profitDiffYDay) }}
109
+              {{ formatAmounts2(multiStation.profitDiffYDay) }}
110
+            </div>
111
+            <div class="overview_line" v-else>
100 112
               较昨日下降: {{ formatAmount1(multiStation.profitDiffYDay) }}
101 113
               {{ formatAmounts2(multiStation.profitDiffYDay) }}
102 114
             </div>
@@ -126,7 +138,7 @@
126 138
             </div>
127 139
             <el-divider />
128 140
             <div class="overview_line">
129
-              装机功率: {{ formatAmountkwh(multiStation.installedPower) }} {{ formatCompany(multiStation.installedPower) }} |
141
+              装机功率: {{ formatAmountkwh(multiStation.installedPower) }} {{ formatCompany1(multiStation.installedPower) }} |
130 142
               装机容量:
131 143
               {{ formatAmountkwh(multiStation.installedCap) }}
132 144
               {{ formatCompany(multiStation.installedCap) }}
@@ -159,6 +171,7 @@
159 171
                 :disabled-date="pickerOptions"
160 172
                 value-format="YYYY-MM-DD hh:mm:ss"
161 173
                 @change="onhandleClick"
174
+                :default-time="defaultTime2"
162 175
               />
163 176
             </div>
164 177
           </div>
@@ -171,8 +184,10 @@
171 184
               <div>站点信息</div>
172 185
               <div class="grid_right1" @click="details()">查看详细</div>
173 186
             </div>
174
-            <!-- <div id="gridpiechart"></div> -->
175
-            <img class="gridpiechart" :src="stationinfodata.absoluteStationPicUrl" alt="" />
187
+            <!-- <div id="gridpiechart">-||-</div> -->
188
+            <div class="gridpiechart">
189
+              <img class="gridpiechartimg" :src="stationinfodata.absoluteStationPicUrl" alt="" />
190
+            </div>
176 191
             <div class="gridpiechartname">{{ stationinfodata.stationName }}</div>
177 192
 
178 193
             <div class="gridpiechartdiv">
@@ -244,8 +259,8 @@
244 259
       </div>
245 260
       <el-table :data="tableData.records" style="width: 100%" border :scrollbar-always-on="true">
246 261
         <el-table-column type="index" label="序号" width="60" />
247
-        <el-table-column prop="emsDeviceId" label="设备编号" width="160" />
248
-        <el-table-column prop="name" label="设备名称" width="160" />
262
+        <el-table-column prop="eid" label="设备编号" width="160" :show-overflow-tooltip="true" />
263
+        <el-table-column prop="emsDeviceId" label="设备名称" width="160" :show-overflow-tooltip="true" />
249 264
         <el-table-column prop="onlineStatus" label="在线状态" width="160">
250 265
           <template #default="scope">
251 266
             {{ scope.row.onlineStatus == 0 ? "离线" : "在线" }}
@@ -374,6 +389,7 @@ const pageable = ref({
374 389
 const Singlevalue = ref("");
375 390
 const Singledata = ref([]);
376 391
 const onselect = (val: any) => {
392
+  activeName.value = "first";
377 393
   Singledata.value = val.id;
378 394
   getStationinfo();
379 395
   gatsinglestationday();
@@ -426,6 +442,7 @@ const getStationinfo = async () => {
426 442
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
427 443
   return time.getTime(new Date()) > Date.now();
428 444
 };
445
+const defaultTime2: [Date, Date] = [new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 1, 1, 23, 56, 56)]; // '00:00:00', '23:56:56'
429 446
 // 查询最近数据
430 447
 const recently = (val: any) => {
431 448
   // 获取当前日期
@@ -500,7 +517,7 @@ const gatsinglestationday = async () => {
500 517
 
501 518
   const profits = [{ type: "bar" }];
502 519
 
503
-  baroptionchart(dates, profits);
520
+  baroptionchart(dates, profits, "收益/元");
504 521
 };
505 522
 // 收益统计------月份
506 523
 const gatsinglestationyearMonth = async () => {
@@ -515,7 +532,7 @@ const gatsinglestationyearMonth = async () => {
515 532
   }
516 533
   const profits = [{ type: "bar" }];
517 534
 
518
-  baroptionchart(dates, profits);
535
+  baroptionchart(dates, profits, "收益/元");
519 536
 };
520 537
 // 充放电统计图
521 538
 const getmultiStatiopower = async () => {
@@ -527,7 +544,7 @@ const getmultiStatiopower = async () => {
527 544
   }
528 545
   const profits = [{ type: "bar" }, { type: "bar" }];
529 546
 
530
-  baroptionchart(dates, profits);
547
+  baroptionchart(dates, profits, "kWh");
531 548
 };
532 549
 // 充放电统计图
533 550
 const getsinglestationchargingMonth = async () => {
@@ -538,10 +555,10 @@ const getsinglestationchargingMonth = async () => {
538 555
   }
539 556
   const profits = [{ type: "bar" }, { type: "bar" }];
540 557
 
541
-  baroptionchart(dates, profits);
558
+  baroptionchart(dates, profits, "kWh");
542 559
 };
543 560
 // 收益统计
544
-const baroptionchart = (dates: string[][], profits: { type: string }[]) => {
561
+const baroptionchart = (dates: string[][], profits: { type: string }[], subtext: string | undefined) => {
545 562
   const baroptionvalue = echarts.init(baroption.value);
546 563
   window.addEventListener(
547 564
     "resize",
@@ -552,11 +569,17 @@ const baroptionchart = (dates: string[][], profits: { type: string }[]) => {
552 569
   );
553 570
   let option = {
554 571
     title: {
555
-      subtext: "收益/元"
572
+      subtext: subtext
556 573
     },
557 574
     legend: {
558 575
       right: 30
559 576
     },
577
+    tooltip: {
578
+      trigger: "axis",
579
+      axisPointer: {
580
+        type: "shadow"
581
+      }
582
+    },
560 583
     grid: {
561 584
       left: "1%",
562 585
       right: "4%",
@@ -679,7 +702,12 @@ const getcomprehensiveefficiency = async () => {
679 702
   for (let index = 0; index < data.list.length; index++) {
680 703
     dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
681 704
   }
682
-  const profits = [{ type: "line" }];
705
+  const profits = [
706
+    {
707
+      type: "line",
708
+      showSymbol: false
709
+    }
710
+  ];
683 711
 
684 712
   getiveefficiency(data.avgEfficiency, dates, profits);
685 713
 };
@@ -695,7 +723,12 @@ const getoverallEfficiencyyearMonth = async () => {
695 723
   for (let index = 0; index < data.list.length; index++) {
696 724
     dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
697 725
   }
698
-  const profits = [{ type: "line" }];
726
+  const profits = [
727
+    {
728
+      type: "line",
729
+      showSymbol: false
730
+    }
731
+  ];
699 732
 
700 733
   getiveefficiency(data.avgEfficiency, dates, profits);
701 734
 };
@@ -713,13 +746,19 @@ const getiveefficiency = (num: any, dates: string[][], profits: { type: string }
713 746
       text: `综合效率${num}%`,
714 747
       subtext: "效率/%"
715 748
     },
749
+    tooltip: {
750
+      trigger: "axis",
751
+      axisPointer: {
752
+        type: "shadow"
753
+      }
754
+    },
716 755
     legend: {
717 756
       right: 30
718 757
     },
719 758
     grid: {
720 759
       left: "2%",
721 760
       right: "4%",
722
-      bottom: "6%",
761
+      bottom: "10%",
723 762
       containLabel: true
724 763
     },
725 764
     xAxis: {
@@ -728,6 +767,22 @@ const getiveefficiency = (num: any, dates: string[][], profits: { type: string }
728 767
     yAxis: {
729 768
       type: "value"
730 769
     },
770
+    dataZoom: [
771
+      {
772
+        type: "inside",
773
+        xAxisIndex: [0, 1],
774
+        start: 0,
775
+        end: 100
776
+      },
777
+      {
778
+        show: true,
779
+        xAxisIndex: [0, 1],
780
+        type: "slider",
781
+        bottom: 10,
782
+        start: 0,
783
+        end: 100
784
+      }
785
+    ],
731 786
     dataset: {
732 787
       source: dates
733 788
     },
@@ -749,6 +804,16 @@ const formatAmountkwh = (amount: number) => {
749 804
     return (amount / 1000).toFixed(2);
750 805
   }
751 806
 };
807
+const formatCompany1 = (amount: number) => {
808
+  if (amount == undefined) {
809
+    return "kW";
810
+  }
811
+  if (amount < 1000) {
812
+    return "kW";
813
+  } else {
814
+    return "MW";
815
+  }
816
+};
752 817
 const formatCompany = (amount: number) => {
753 818
   if (amount == undefined) {
754 819
     return "kWh";
@@ -763,20 +828,20 @@ const formatAmountkwh_ = (amount: number) => {
763 828
   if (amount == undefined) {
764 829
     return "1000";
765 830
   }
766
-  if (amount > -1000) {
831
+  if (amount > 0) {
767 832
     return amount.toFixed(2);
768 833
   } else {
769
-    return (amount / 1000).toFixed(2);
834
+    return Math.abs(amount).toFixed(2);
770 835
   }
771 836
 };
772 837
 const formatCompany_ = (amount: number) => {
773 838
   if (amount == undefined) {
774 839
     return "kWh";
775 840
   }
776
-  if (amount > -1000) {
841
+  if (amount > 0) {
777 842
     return "kWh";
778 843
   } else {
779
-    return "MWh";
844
+    return "kWh";
780 845
   }
781 846
 };
782 847
 const formatAmount = (amount: number) => {

+ 25
- 13
src/views/powerStation/addition.vue Wyświetl plik

@@ -66,10 +66,10 @@
66 66
                   autocomplete="off"
67 67
                 />
68 68
               </el-form-item> -->
69
-              <el-form-item label="电站地址" prop="keywordcategory" :rules="[{ required: true, message: '请输入电站地址' }]">
69
+              <el-form-item label="电站地址">
70 70
                 <el-cascader
71 71
                   :props="props"
72
-                  v-model="numberValidateForm.keywordcategory"
72
+                  v-model="selectedValue"
73 73
                   clearable
74 74
                   size="large"
75 75
                   placeholder="请选择服务地区"
@@ -229,10 +229,10 @@ const numberValidateForm = reactive({
229 229
   // transformer: "",
230 230
   // transformercapacity: "",
231 231
   operationDate: "", // 投运时间
232
-  keywordcategory: selectedValue.value[0], // 国家id
233
-  provinceCode: selectedValue.value[1], // 省id
234
-  cityCode: selectedValue.value[2], // 市id
235
-  countyCode: selectedValue.value[3] //区id
232
+  keywordcategory: 0, // 国家id
233
+  provinceCode: 0, // 省id
234
+  cityCode: 0, // 市id
235
+  countyCode: 0 //区id
236 236
 });
237 237
 const timedate = ref();
238 238
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
@@ -240,7 +240,11 @@ const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
240 240
 };
241 241
 
242 242
 const submitForm = (formEl: FormInstance | undefined) => {
243
-  console.log(numberValidateForm.emsId);
243
+  numberValidateForm.keywordcategory = selectedValue.value[0] ?? 0;
244
+  numberValidateForm.provinceCode = selectedValue.value[1] ?? 0;
245
+  numberValidateForm.cityCode = selectedValue.value[2] ?? 0;
246
+  numberValidateForm.countyCode = selectedValue.value[3] ?? 0;
247
+  console.log(numberValidateForm);
244 248
 
245 249
   if (!formEl) return;
246 250
   formEl.validate(async valid => {
@@ -267,6 +271,8 @@ const submitForm = (formEl: FormInstance | undefined) => {
267 271
 };
268 272
 const selectemsId = ref();
269 273
 const onselect = () => {
274
+  console.log(selectemsId.value);
275
+
270 276
   numberValidateForm.emsId = selectemsId.value.join();
271 277
 };
272 278
 const resetForm = (formEl: FormInstance | undefined) => {
@@ -289,7 +295,7 @@ const getghuedit = async () => {
289 295
     let a = yonghueditdata.value[0].emsid[index].eid;
290 296
     selectemsId.value.push(a);
291 297
   }
292
-  numberValidateForm.emsId = yonghueditdata.value[0].emsid;
298
+  numberValidateForm.emsId = selectemsId.value.join();
293 299
   // numberValidateForm.address = yonghueditdata.value[0].address;
294 300
   numberValidateForm.contactPhone = yonghueditdata.value[0].contactPhone;
295 301
   numberValidateForm.installedPower = yonghueditdata.value[0].installedPower;
@@ -309,16 +315,21 @@ const getghuedit = async () => {
309 315
   }
310 316
   grtselectemssytem();
311 317
 };
312
-// 选择设备编码
318
+// 选择设备编码 ----
313 319
 const equipmentdata = ref();
314 320
 const grtselectemssytem = async () => {
315 321
   const { data } = await selectemssytemALLURL({});
316 322
   let arr = data;
317 323
   console.log(arr);
318
-  const emsidArray = yonghueditdata.value[0].emsid as any[];
319
-  const arrArray = arr as any[];
324
+  if (route.query.type == "电站编辑") {
325
+    const emsidArray = yonghueditdata.value[0].emsid as any[];
326
+    const arrArray = arr as any[];
327
+    equipmentdata.value = [...emsidArray, ...arrArray];
328
+  } else {
329
+    const arrArray = arr as any[];
330
+    equipmentdata.value = [...arrArray];
331
+  }
320 332
 
321
-  equipmentdata.value = [...emsidArray, ...arrArray];
322 333
   console.log(equipmentdata.value);
323 334
 };
324 335
 // 地区
@@ -432,6 +443,7 @@ const props: CascaderProps = {
432 443
 const oncascader = async (selectedValues: any) => {
433 444
   console.log(selectedValues);
434 445
   selectedValue.value = selectedValues;
446
+  console.log(selectedValue.value);
435 447
 };
436 448
 onMounted(() => {
437 449
   if (route.query.type == "电站编辑") {
@@ -441,7 +453,7 @@ onMounted(() => {
441 453
   }
442 454
 });
443 455
 </script>
444
-<!-- 电站 -->
456
+<!--  -->
445 457
 <style scoped lang="scss">
446 458
 @import "./addition.scss";
447 459
 </style>

+ 0
- 2
src/views/powerStation/index.scss Wyświetl plik

@@ -17,8 +17,6 @@
17 17
   justify-content: space-between;
18 18
   margin-bottom: 20px;
19 19
 }
20
-.selectsiteadd {
21
-}
22 20
 .selectsite_right {
23 21
   display: flex;
24 22
 }

+ 1
- 1
src/views/powerStation/index.vue Wyświetl plik

@@ -26,7 +26,7 @@
26 26
       <el-table :data="tableData.records" style="width: 100%" border>
27 27
         <el-table-column type="index" prop="date" label="序号" width="60" />
28 28
         <el-table-column prop="powerName" label="电站名称" width="180" />
29
-        <el-table-column prop="stationName" label="安装人" />
29
+        <el-table-column prop="stationName" label="安装人" :show-overflow-tooltip="true" />
30 30
         <el-table-column prop="contactPhone" label="安装人电话">
31 31
           <!-- <template #default="scope">
32 32
             {{ scope.row.pcsStatus == "" ? "-" : scope.row.pcsStatus }}

+ 28
- 0
src/views/rawdata/index.scss Wyświetl plik

@@ -0,0 +1,28 @@
1
+.screen {
2
+  display: flex;
3
+  width: 100%;
4
+  margin-bottom: 20px;
5
+}
6
+.screen1 {
7
+  display: flex;
8
+  justify-content: space-between;
9
+  width: 100%;
10
+}
11
+.cardbottom {
12
+  margin-top: 20px;
13
+}
14
+.title {
15
+  display: flex;
16
+  align-items: center;
17
+  margin-bottom: 20px;
18
+  font-size: 18px;
19
+  .title_time {
20
+    margin-left: 10px;
21
+    font-size: 16px;
22
+  }
23
+}
24
+.pagination {
25
+  display: flex;
26
+  justify-content: space-between;
27
+  margin-top: 20px;
28
+}

+ 225
- 0
src/views/rawdata/index.vue Wyświetl plik

@@ -0,0 +1,225 @@
1
+<template>
2
+  <div>
3
+    <div class="title">
4
+      原始数据
5
+      <div class="title_time">{{ currentDate }}</div>
6
+    </div>
7
+    <div class="card">
8
+      <div class="screen">
9
+        <div>
10
+          电站&ensp;&ensp;
11
+          <el-select v-model="status" placeholder="选择电站" size="large" style="width: 240px" @change="postemsDevice">
12
+            <el-option v-for="item in cities" :key="item.id" :label="item.stationName" :value="item.id" />
13
+          </el-select>
14
+        </div>
15
+        <div>
16
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;所属设备&ensp;&ensp;
17
+          <el-select
18
+            v-model="emsDeviceId"
19
+            placeholder="请先选择电站在选择所属设备"
20
+            size="large"
21
+            style="width: 240px"
22
+            clearable
23
+            @change="getpostdeviceClass"
24
+          >
25
+            <el-option v-for="item in emsDevice" :key="item.id" :label="item.emsDeviceId" :value="item.id" />
26
+          </el-select>
27
+        </div>
28
+        <div>
29
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;设备类型&ensp;&ensp;
30
+          <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px" clearable>
31
+            <el-option v-for="item in quipmentlist" :key="item.peek" :label="item.peek" :value="item.peek" />
32
+          </el-select>
33
+        </div>
34
+      </div>
35
+      <div class="screen1">
36
+        <div>
37
+          时间范围&ensp;&ensp;
38
+          <el-date-picker
39
+            size="large"
40
+            v-model="timevalue"
41
+            type="daterange"
42
+            start-placeholder="开始时间"
43
+            end-placeholder="结束时间"
44
+            :default-value="timevalue"
45
+            :disabled-date="pickerOptions"
46
+            value-format="YYYY-MM-DD"
47
+          />
48
+        </div>
49
+        &ensp;&ensp; &ensp;&ensp;
50
+        <div>
51
+          <el-button type="primary" size="large" color="#0052d9" @click="query(0)">查询</el-button>
52
+          <el-button type="primary" size="large" color="#0052d9" @click="newaddition">导出</el-button>
53
+          <el-button size="large" @click="query(1)">重置</el-button>&ensp;&ensp;
54
+        </div>
55
+      </div>
56
+    </div>
57
+    <div class="card cardbottom">
58
+      <div>&ensp;</div>
59
+      <el-table :data="tableData.list" style="width: 100%" border>
60
+        <el-table-column width="250" :show-overflow-tooltip="true" v-for="item in head" :key="item" :prop="item" :label="item" />
61
+      </el-table>
62
+      <!-- 分页组件 -->
63
+      <div class="pagination">
64
+        <div></div>
65
+        <slot name="pagination">
66
+          <Pagination :pageable="pageable" :handle-size-change="handleSizeChange" :handle-current-change="handleCurrentChange" />
67
+        </slot>
68
+      </div>
69
+    </div>
70
+  </div>
71
+</template>
72
+
73
+<!-- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
74
+                                                                                                                                                                                                                          
75
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
76
+
77
+<script setup lang="ts">
78
+import {
79
+  tdengineyuanshilURL,
80
+  stationstationName,
81
+  postemsSystemsingleStation,
82
+  listexcellURL,
83
+  powerlistURL
84
+} from "@/api/home/Multisite";
85
+import { onMounted, Ref, ref } from "vue";
86
+// import { useAuthButtons } from "@/hooks/useAuthButtons";
87
+// const { BUTTONS } = useAuthButtons();
88
+import { Station } from "@/api/interface";
89
+import Pagination from "@/components/ProTable/components/Pagination.vue";
90
+
91
+// import { useRouter } from "vue-router";
92
+// const router = useRouter();
93
+const emsDeviceId = ref("");
94
+const quipment = ref("");
95
+const quipmentlist = ref();
96
+
97
+const emsDevice: Ref<any[]> = ref([]);
98
+
99
+const cities: Ref<Station.todo[]> = ref([]);
100
+const timevalue: Ref<any> = ref([]);
101
+
102
+const poststationstationName = async () => {
103
+  const { data } = await stationstationName({});
104
+  cities.value = data;
105
+};
106
+const postemsDevice = async (value: any) => {
107
+  console.log(value);
108
+
109
+  emsDevice.value = [];
110
+  emsDeviceId.value = "";
111
+  const { data } = await postemsSystemsingleStation({}, value);
112
+  // emsDeviceId.value = data[0].id;
113
+  emsDevice.value = data;
114
+};
115
+const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
116
+  return time.getTime(new Date()) > Date.now();
117
+};
118
+// 设备类型
119
+const getpostdeviceClass = async () => {
120
+  const { data } = await powerlistURL({ eId: emsDeviceId.value });
121
+
122
+  quipmentlist.value = data;
123
+};
124
+const query = (val: any) => {
125
+  if (val == 0) {
126
+    getplatformuserlist();
127
+  } else {
128
+    (quipment.value = ""), (status.value = "");
129
+    (emsDeviceId.value = ""), getplatformuserlist();
130
+  }
131
+};
132
+
133
+const newaddition = async () => {
134
+  console.log(1);
135
+  let obj = {
136
+    powerId: status.value,
137
+    eId: emsDeviceId.value,
138
+    peek: quipment.value,
139
+    startTime: timevalue.value[0],
140
+    endTime: timevalue.value[1]
141
+  };
142
+  const { data } = await listexcellURL(obj);
143
+
144
+  downloadxlsx(data);
145
+};
146
+const downloadxlsx = (data: any) => {
147
+  let fileUrl = `download/${data.msg}`;
148
+  const date = new Date();
149
+  const hours = formatTime(date.getHours());
150
+  const minutes = formatTime(date.getMinutes());
151
+  const seconds = formatTime(date.getSeconds());
152
+  let fileName = `${currentDate.value} ${hours}:${minutes}:${seconds}故障报表.xlsx`;
153
+  fetch(fileUrl)
154
+    .then(response => response.blob())
155
+    .then(blob => {
156
+      // 创建一个临时的URL对象
157
+      const url = URL.createObjectURL(blob);
158
+      // 创建一个隐藏的<a>标签,并设置其href属性为临时URL
159
+      const a = document.createElement("a");
160
+      a.href = url;
161
+      a.download = fileName; // 设置下载的文件名
162
+      a.style.display = "none";
163
+      // 将<a>标签添加到文档中,并模拟点击下载
164
+      document.body.appendChild(a);
165
+      a.click();
166
+      // 下载完成后,移除<a>标签和临时URL对象
167
+      document.body.removeChild(a);
168
+      URL.revokeObjectURL(url);
169
+    })
170
+    .catch(error => {
171
+      console.error("下载文件时出错:", error);
172
+    });
173
+};
174
+const formatTime = (time: number) => {
175
+  return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
176
+};
177
+const tableData = ref();
178
+
179
+const status = ref("");
180
+const head = ref();
181
+const pageable = ref({
182
+  pn: 1,
183
+  ps: 10,
184
+  total: 0
185
+});
186
+// 表格操作 Hooks
187
+const handleSizeChange = async (e: any) => {
188
+  pageable.value.ps = e;
189
+  getplatformuserlist();
190
+};
191
+const handleCurrentChange = async (e: any) => {
192
+  pageable.value.pn = e;
193
+
194
+  getplatformuserlist();
195
+};
196
+const getplatformuserlist = async () => {
197
+  let obj = {
198
+    powerId: status.value,
199
+    eId: emsDeviceId.value,
200
+    startTime: timevalue.value[0],
201
+    endTime: timevalue.value[1],
202
+    peek: quipment.value,
203
+    pageNum: pageable.value.pn,
204
+    pageSize: pageable.value.ps
205
+  };
206
+  const { data } = await tdengineyuanshilURL(obj);
207
+  tableData.value = data;
208
+
209
+  head.value = Object.keys(tableData.value.list[0]);
210
+  pageable.value.total = tableData.value.page.totald;
211
+};
212
+const currentDate = ref();
213
+onMounted(() => {
214
+  const current = localStorage.getItem("currentDate");
215
+  if (current) {
216
+    currentDate.value = current;
217
+  }
218
+  getplatformuserlist();
219
+  poststationstationName();
220
+});
221
+</script>
222
+<style scoped lang="scss">
223
+@import "./index.scss";
224
+</style>
225
+<!-- -->

+ 52
- 36
src/views/reportforms/index.vue Wyświetl plik

@@ -110,7 +110,7 @@
110 110
         <el-tab-pane label="单站报表" name="单站报表">
111 111
           <div class="tabpane">
112 112
             <div class="tabpane_1">报表类型:</div>
113
-            <div :class="reportformsindex == 1 ? 'tabpane_2' : 'tabpane_1'" @click="onreportforms(1)">时段报表</div>
113
+            <!-- <div :class="reportformsindex == 1 ? 'tabpane_2' : 'tabpane_1'" @click="onreportforms(1)">时段报表</div> -->
114 114
             <div :class="reportformsindex == 2 ? 'tabpane_2' : 'tabpane_1'" @click="onreportforms(2)">日报表</div>
115 115
             <div :class="reportformsindex == 3 ? 'tabpane_2' : 'tabpane_1'" @click="onreportforms(3)">月报表</div>
116 116
             <div :class="reportformsindex == 4 ? 'tabpane_2' : 'tabpane_1'" @click="onreportforms(4)">年报表</div>
@@ -176,7 +176,9 @@
176 176
               </el-dropdown>
177 177
             </div>
178 178
           </div>
179
-          <div v-if="reportformsindex == 1">
179
+          <!-- <div v-if="reportformsindex == 1"> -->
180
+          <!-- 目前没有时段数据 -->
181
+          <div v-if="false">
180 182
             <div class="tabpane_data">时段数据</div>
181 183
             <div class="tabpanechart">
182 184
               <div :class="chartindex == 1 ? 'tabpane_22' : 'tabpane_11'" @click="onchart(1)">
@@ -305,7 +307,9 @@
305 307
     </el-card>
306 308
   </div>
307 309
 </template>
308
-<!--    -->
310
+<!--    
311
+  
312
+-->
309 313
 <script setup lang="ts">
310 314
 import { onMounted, Ref, ref } from "vue";
311 315
 import {
@@ -403,13 +407,14 @@ const columnList = ref([
403 407
         ifcolumn: true
404 408
       }
405 409
     ]
406
-  },
407
-  {
408
-    prop: "overallEfficiency",
409
-    label: "综合效率(%)",
410
-    ifcolumn: true,
411
-    children: null
412 410
   }
411
+  // ,
412
+  // {
413
+  //   prop: "overallEfficiency",
414
+  //   label: "综合效率(%)",
415
+  //   ifcolumn: true,
416
+  //   children: null
417
+  // }
413 418
 ]);
414 419
 // 单站报表表头
415 420
 const singlecolumnList = ref([
@@ -482,28 +487,30 @@ const singlecolumnList = ref([
482 487
         ifcolumn: true
483 488
       }
484 489
     ]
485
-  },
486
-  {
487
-    prop: "overallEfficiency",
488
-    label: "综合效率(%)",
489
-    ifcolumn: true,
490
-    children: null
491 490
   }
491
+  // ,
492
+  // {
493
+  //   prop: "overallEfficiency",
494
+  //   label: "综合效率(%)",
495
+  //   ifcolumn: true,
496
+  //   children: null
497
+  // }
492 498
 ]);
493 499
 const currentDate = ref();
494 500
 const activeName = ref("站点汇总");
495 501
 const timepicker: Ref<any> = ref([]);
496 502
 //year daterange
497 503
 const timetype: Ref<any> = ref("daterange");
498
-const handleClick = (val: any) => {
504
+const handleClick = async (val: any) => {
499 505
   if (val.props.name == "站点汇总") {
500 506
     const today = new Date();
501
-    const currentDate = today.toLocaleDateString();
507
+    const currentDate = today.toISOString().split("T")[0];
502 508
     timepicker.value = [currentDate, currentDate];
503 509
     getreportpowerday();
504 510
   } else {
505 511
     chartindex.value = 1;
506
-    poststationstationName();
512
+    await poststationstationName();
513
+    await onreportforms(2);
507 514
   }
508 515
 };
509 516
 //可选择区间,initYear传参,不传则所有年份有效,小于0判断一下?
@@ -548,14 +555,14 @@ const getdaymonthyear = async (value: any) => {
548 555
   if (value == 1) {
549 556
     timetype.value = "daterange";
550 557
     const today = new Date();
551
-    const currentDate = today.toLocaleDateString();
558
+    const currentDate = today.toISOString().split("T")[0];
552 559
     timepicker.value = [currentDate, currentDate];
553 560
     getreportpowerday();
554 561
   } else if (value == 2) {
555 562
     timetype.value = "monthrange";
556 563
 
557 564
     const today = new Date();
558
-    const currentDate = today.toLocaleDateString();
565
+    const currentDate = today.toISOString().split("T")[0];
559 566
     // 获取过去 31 天的日期
560 567
     const thirtyOneDaysAgoDate = new Date(today);
561 568
     thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
@@ -564,7 +571,7 @@ const getdaymonthyear = async (value: any) => {
564 571
     getreportpoweryearMonth();
565 572
   } else {
566 573
     const today = new Date();
567
-    const currentDate = today.toLocaleDateString();
574
+    const currentDate = today.toISOString().split("T")[0];
568 575
     // 获取去年同月的日期
569 576
     const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
570 577
     const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
@@ -834,7 +841,7 @@ const getreportpoweryear = async () => {
834 841
   data.list.push(data.total);
835 842
   tableData.value = data;
836 843
 };
837
-const reportformsindex = ref(1);
844
+const reportformsindex = ref(2);
838 845
 const pickertype: Ref<any> = ref("date");
839 846
 
840 847
 // <!-- /--/ -->
@@ -842,41 +849,48 @@ const pickertype: Ref<any> = ref("date");
842 849
 
843 850
 //             <!-- monthrange/月 -->
844 851
 //             <!-- year/年 -->
852
+
845 853
 const onreportforms = (val: any) => {
846
-  // starttime.value = "";
847
-  reportformsindex.value = val;
848 854
   if (val == 1) {
849 855
     pickertype.value = "date";
850 856
     starttime.value = currentDate.value;
851
-    poststationstationName();
852 857
   } else if (val == 2) {
853 858
     pickertype.value = "daterange";
854 859
     const today = new Date();
855
-    const currentDate = today.toLocaleDateString();
860
+    const currentDate = today.toISOString().split("T")[0];
856 861
     starttime.value = [currentDate, currentDate];
857
-    getsingleStationyear();
858 862
   } else if (val == 3) {
859 863
     pickertype.value = "monthrange";
860 864
     const today = new Date();
861
-    const currentDate = today.toLocaleDateString();
862
-    // 获取过去 31 天的日期
865
+    const currentDate = today.toISOString().split("T")[0];
863 866
     const thirtyOneDaysAgoDate = new Date(today);
864 867
     thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
865 868
     const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
866 869
     starttime.value = [thirtyOneDaysAgo, currentDate];
867
-    getelectricitylevelyearMonth();
868 870
   } else if (val == 4) {
869 871
     pickertype.value = "year";
870 872
     const today = new Date();
871
-    const currentDate = today.toLocaleDateString();
873
+    const currentDate = today.toISOString().split("T")[0];
872 874
     // 获取去年同月的日期
873 875
     const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
874 876
     const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
875 877
     starttime.value = [lastYearSameMonth.substring(0, 4), currentDate.substring(0, 4)];
876 878
     getelectricitylevelyear();
877 879
   }
880
+  reportformsindex.value = val;
881
+  onreportformsid(reportformsindex.value);
882
+};
883
+const onreportformsid = (val: any) => {
884
+  if (val == 1) {
885
+    poststationstationName();
886
+  } else if (val == 2) {
887
+    getsingleStationyear();
888
+  } else if (val == 3) {
889
+    getelectricitylevelyearMonth();
890
+  } else if (val == 4) {
891
+    getelectricitylevelyear();
892
+  }
878 893
 };
879
-
880 894
 const chartindex = ref(1);
881 895
 
882 896
 const onchart = (val: any) => {
@@ -898,6 +912,7 @@ const poststationstationName = async () => {
898 912
   const { data } = await stationstationName({});
899 913
   Singlevalue.value = data[0].id;
900 914
   cities.value = data;
915
+  return;
901 916
   getemsSystemsingleStation();
902 917
   getstationsystem();
903 918
 };
@@ -909,6 +924,8 @@ const postemsDevice = async (value: any) => {
909 924
 const starttime: Ref<any> = ref("");
910 925
 // 开始时间
911 926
 const yearstarttime = async (val: any) => {
927
+  console.log(val);
928
+
912 929
   if (reportformsindex.value == 1) {
913 930
     starttime.value = formatDate(val);
914 931
   } else if (reportformsindex.value == 2) {
@@ -922,14 +939,13 @@ const yearstarttime = async (val: any) => {
922 939
     starttime.value = val;
923 940
   }
924 941
 };
925
-
926
-// 查询
942
+// 查询-文件夹
927 943
 const onselectsite = async () => {
928
-  getstationsystem();
944
+  onreportformsid(reportformsindex.value);
929 945
 };
930 946
 // 重置
931 947
 const onselectreset = async () => {
932
-  onreportforms(1);
948
+  onreportformsid(1);
933 949
 };
934 950
 
935 951
 const singleexport = async () => {

+ 8
- 1
src/views/station/index.scss Wyświetl plik

@@ -108,7 +108,7 @@
108 108
   height: 40px;
109 109
 
110 110
   // background-color: hsl(0deg 0% 100% / 70%);
111
-  border: 1px solid rgb(0 0 0 / 5%);
111
+  border: 1px solid rgb(0 0 0 / 30%);
112 112
   border-radius: 10px;
113 113
 }
114 114
 .topcard_online1 {
@@ -118,6 +118,13 @@
118 118
   background: #40dc1d;
119 119
   border-radius: 100px;
120 120
 }
121
+.topcard_online2 {
122
+  width: 8px;
123
+  height: 8px;
124
+  margin-right: 8px;
125
+  background: red;
126
+  border-radius: 100px;
127
+}
121 128
 .topcard_bottom {
122 129
   position: absolute;
123 130
   bottom: 0;

+ 10
- 4
src/views/station/index.vue Wyświetl plik

@@ -27,7 +27,7 @@
27 27
             </div>
28 28
           </div>
29 29
         </div>
30
-        <div class="search_bottom" v-if="foldtype">
30
+        <div class="search_bottom" v-show="foldtype">
31 31
           <div>
32 32
             <el-cascader
33 33
               :props="props"
@@ -81,10 +81,14 @@
81 81
               @mouseleave.stop="handleMouseLeave"
82 82
             />
83 83
 
84
-            <div class="topcard_online">
84
+            <div v-if="item.onlineStatus == 1" class="topcard_online">
85 85
               <div class="topcard_online1"></div>
86 86
               在线
87 87
             </div>
88
+            <div v-else class="topcard_online">
89
+              <div class="topcard_online2"></div>
90
+              离线
91
+            </div>
88 92
             <div class="topcard_zhong">
89 93
               <el-card>
90 94
                 <div class="el_card">
@@ -97,7 +101,7 @@
97 101
                     <div class="topcard_title">装机设备</div>
98 102
                   </div> -->
99 103
                   <div>
100
-                    <div class="el_cardname">{{ item.installedPower }} <span class="el_cardunit">MW</span></div>
104
+                    <div class="el_cardname">{{ item.installedPower }} <span class="el_cardunit">kW</span></div>
101 105
                     <div class="topcard_title">装机功率</div>
102 106
                   </div>
103 107
                 </div>
@@ -196,7 +200,9 @@
196 200
     </div>
197 201
   </div>
198 202
 </template>
199
-<!--    -->
203
+<!--  
204
+
205
+-->
200 206
 <script setup lang="ts">
201 207
 import { multiStationpageinfo, getlistcountry, getliststate, getlistcity, getlistcounty } from "@/api/home/Multisite";
202 208
 import { CascaderOption, ElCascader, CascaderProps } from "element-plus";

+ 62
- 0
src/views/system/index.scss Wyświetl plik

@@ -444,3 +444,65 @@
444 444
 
445 445
   // background: #f3f6fd !important;
446 446
 }
447
+.Equipmentright {
448
+  display: flex;
449
+  flex: 1;
450
+  align-items: center;
451
+
452
+  // justify-content: space-around;
453
+  justify-content: space-between;
454
+  margin-right: 300px;
455
+
456
+  // position: relative;
457
+  // left: 720px;
458
+}
459
+.Equipmenttpye {
460
+  box-sizing: border-box;
461
+  display: flex;
462
+  align-items: center;
463
+  width: 100px;
464
+  padding: 4px;
465
+  font-size: 22px;
466
+  color: #40dc1d;
467
+}
468
+.Equipmenttpyes {
469
+  box-sizing: border-box;
470
+  display: flex;
471
+  align-items: center;
472
+  width: 100px;
473
+  padding: 4px;
474
+  font-size: 22px;
475
+  color: red;
476
+}
477
+.equipmentborder {
478
+  width: 10px;
479
+  height: 10px;
480
+  margin-right: 8px;
481
+  background: #40dc1d;
482
+  border-radius: 100px;
483
+  animation: twinkle 2s ease-in-out infinite; /* 光点闪烁动画 */
484
+}
485
+.equipmentborderif {
486
+  width: 10px;
487
+  height: 10px;
488
+  margin-right: 8px;
489
+  background: red;
490
+  border-radius: 100px;
491
+  animation: twinkle 2s ease-in-out infinite; /* 光点闪烁动画 */
492
+}
493
+
494
+@keyframes twinkle {
495
+  0%,
496
+  100% {
497
+    opacity: 0; /* 初始和结束时完全可见 */
498
+    transform: scale(1); /* 初始和结束时的大小 */
499
+  }
500
+  50% {
501
+    opacity: 1; /* 中间状态时不可见 */
502
+    transform: scale(1); /* 中间状态时扩散的大小 */
503
+  }
504
+}
505
+.equipment {
506
+  display: flex;
507
+  align-items: center;
508
+}

+ 122
- 52
src/views/system/index.vue Wyświetl plik

@@ -32,6 +32,17 @@
32 32
         </template>
33 33
         <el-option v-for="item in emsDevice" :key="item.id" :label="item.emsDeviceId" :value="item.id" />
34 34
       </el-select>
35
+      <div class="Equipmentright">
36
+        <div></div>
37
+        <div class="Equipmenttpye" v-if="realtime.onlineStatus == 1">
38
+          <div class="equipmentborder"></div>
39
+          在线
40
+        </div>
41
+        <div class="Equipmenttpyes" v-else>
42
+          <div class="equipmentborderif"></div>
43
+          离线
44
+        </div>
45
+      </div>
35 46
     </div>
36 47
     <div class="realtime">
37 48
       <el-row :gutter="20">
@@ -46,7 +57,7 @@
46 57
               <div class="real_timediv">
47 58
                 <el-card>
48 59
                   <div class="real_timename">今日充电量</div>
49
-                  <div class="real_timeunit">{{ realtime.dayImportKwh }}<span class="real_timeunitcss">kWh</span></div>
60
+                  <div class="real_timeunit">{{ realtime.dayImportKwh }}<span class="real_timeunitcss"> kWh</span></div>
50 61
                 </el-card>
51 62
               </div>
52 63
               <div class="real_timediv">
@@ -125,9 +136,14 @@
125 136
                 </div>
126 137
                 <div class="Boxdiv_right">
127 138
                   <div class="Boxdiv_bottom">
128
-                    <div class="Boxdivradius"></div>
129
-                    <div v-if="item.emsCommStatus == 1">正常</div>
130
-                    <div v-else>正常</div>
139
+                    <div v-if="item.emsCommStatus == 0" class="equipment">
140
+                      <!-- <div class="equipmentborderif"></div> -->
141
+                      停机
142
+                    </div>
143
+                    <div v-else class="equipment">
144
+                      <!-- <div class="equipmentborder"></div> -->
145
+                      运行
146
+                    </div>
131 147
                   </div>
132 148
                 </div>
133 149
               </div>
@@ -136,6 +152,9 @@
136 152
         </el-col>
137 153
       </el-row>
138 154
     </div>
155
+    <!--  
156
+      
157
+    -->
139 158
     <div class="realoperation">
140 159
       <el-card>
141 160
         <template #header>
@@ -279,45 +298,45 @@
279 298
             <div class="income_ul_left">{{ item.ymdHour }}</div>
280 299
             <div class="income_li1">
281 300
               <div class="income_title2_1">
282
-                <div class="income_title2_11">{{ item.chargeSharpKwh }}</div>
283
-                <div class="income_title2_11">{{ item.chargePeakKwh }}</div>
284
-                <div class="income_title2_11">{{ item.chargeShoulderKwh }}</div>
285
-                <div class="income_title2_11">{{ item.chargeValleyKwh }}</div>
286
-                <div class="income_title2_11">{{ item.chargeKwh }}</div>
301
+                <div class="income_title2_11">{{ item.chargeSharpKwh.toFixed(2) }}</div>
302
+                <div class="income_title2_11">{{ item.chargePeakKwh.toFixed(2) }}</div>
303
+                <div class="income_title2_11">{{ item.chargeShoulderKwh.toFixed(2) }}</div>
304
+                <div class="income_title2_11">{{ item.chargeValleyKwh.toFixed(2) }}</div>
305
+                <div class="income_title2_11">{{ item.chargeKwh.toFixed(2) }}</div>
287 306
               </div>
288 307
             </div>
289 308
             <div class="income_li2">
290 309
               <div class="income_title2_1">
291
-                <div class="income_title2_11">{{ item.dischargeSharpKwh }}</div>
292
-                <div class="income_title2_11">{{ item.dischargePeakKwh }}</div>
293
-                <div class="income_title2_11">{{ item.dischargeShoulderKwh }}</div>
294
-                <div class="income_title2_11">{{ item.dischargeValleyKwh }}</div>
295
-                <div class="income_title2_11">{{ item.dischargeKwh }}</div>
310
+                <div class="income_title2_11">{{ item.dischargeSharpKwh.toFixed(2) }}</div>
311
+                <div class="income_title2_11">{{ item.dischargePeakKwh.toFixed(2) }}</div>
312
+                <div class="income_title2_11">{{ item.dischargeShoulderKwh.toFixed(2) }}</div>
313
+                <div class="income_title2_11">{{ item.dischargeValleyKwh.toFixed(2) }}</div>
314
+                <div class="income_title2_11">{{ item.dischargeKwh.toFixed(2) }}</div>
296 315
               </div>
297 316
             </div>
298
-            <div class="income_ul_right">{{ item.profit }}</div>
317
+            <div class="income_ul_right">{{ item.profit.toFixed(2) }}</div>
299 318
           </div>
300 319
           <div class="income_ul">
301 320
             <div class="income_ul_left">总计</div>
302 321
             <div class="income_li1">
303 322
               <div class="income_title2_1">
304
-                <div class="income_title2_11">{{ incomedata.total.chargeSharpKwh }}</div>
305
-                <div class="income_title2_11">{{ incomedata.total.chargePeakKwh }}</div>
306
-                <div class="income_title2_11">{{ incomedata.total.chargeShoulderKwh }}</div>
307
-                <div class="income_title2_11">{{ incomedata.total.chargeValleyKwh }}</div>
308
-                <div class="income_title2_11">{{ incomedata.total.chargeKwh }}</div>
323
+                <div class="income_title2_11">{{ incomedata.total.chargeSharpKwh.toFixed(2) }}</div>
324
+                <div class="income_title2_11">{{ incomedata.total.chargePeakKwh.toFixed(2) }}</div>
325
+                <div class="income_title2_11">{{ incomedata.total.chargeShoulderKwh.toFixed(2) }}</div>
326
+                <div class="income_title2_11">{{ incomedata.total.chargeValleyKwh.toFixed(2) }}</div>
327
+                <div class="income_title2_11">{{ incomedata.total.chargeKwh.toFixed(2) }}</div>
309 328
               </div>
310 329
             </div>
311 330
             <div class="income_li2">
312 331
               <div class="income_title2_1">
313
-                <div class="income_title2_11">{{ incomedata.total.dischargeSharpKwh }}</div>
314
-                <div class="income_title2_11">{{ incomedata.total.dischargePeakKwh }}</div>
315
-                <div class="income_title2_11">{{ incomedata.total.dischargeShoulderKwh }}</div>
316
-                <div class="income_title2_11">{{ incomedata.total.dischargeValleyKwh }}</div>
317
-                <div class="income_title2_11">{{ incomedata.total.dischargeKwh }}</div>
332
+                <div class="income_title2_11">{{ incomedata.total.dischargeSharpKwh.toFixed(2) }}</div>
333
+                <div class="income_title2_11">{{ incomedata.total.dischargePeakKwh.toFixed(2) }}</div>
334
+                <div class="income_title2_11">{{ incomedata.total.dischargeShoulderKwh.toFixed(2) }}</div>
335
+                <div class="income_title2_11">{{ incomedata.total.dischargeValleyKwh.toFixed(2) }}</div>
336
+                <div class="income_title2_11">{{ incomedata.total.dischargeKwh.toFixed(2) }}</div>
318 337
               </div>
319 338
             </div>
320
-            <div class="income_ul_right">{{ incomedata.total.profit }}</div>
339
+            <div class="income_ul_right">{{ incomedata.total.profit.toFixed(2) }}</div>
321 340
           </div>
322 341
         </div>
323 342
       </el-card>
@@ -326,7 +345,7 @@
326 345
 </template>
327 346
 <!--    -->
328 347
 <script setup lang="ts">
329
-import { onMounted, Ref, ref } from "vue";
348
+import { onMounted, onUnmounted, Ref, ref } from "vue";
330 349
 import {
331 350
   stationstationName,
332 351
   postemsSystemsingleStation,
@@ -340,6 +359,7 @@ import {
340 359
 } from "@/api/home/Multisite";
341 360
 import * as echarts from "echarts";
342 361
 import { Station } from "@/api/interface";
362
+const intervalID = ref();
343 363
 
344 364
 const Singlevalue = ref("");
345 365
 const cities: Ref<Station.todo[]> = ref([]);
@@ -349,7 +369,12 @@ const emsDevice: Ref<any[]> = ref([]);
349 369
 const emsDeviceId = ref("");
350 370
 const poststationstationName = async () => {
351 371
   const { data } = await stationstationName({});
352
-  Singlevalue.value = data[0].id ?? "";
372
+  if (data.length == 0) {
373
+    Singlevalue.value = "";
374
+    return;
375
+  } else {
376
+    Singlevalue.value = data[0].id;
377
+  }
353 378
   cities.value = data;
354 379
   postemsDevice();
355 380
 };
@@ -358,13 +383,19 @@ const postemsDevice = async () => {
358 383
   const { data } = await postemsSystemsingleStation({}, Singlevalue.value);
359 384
   if (data.length == 0) {
360 385
     emsDeviceId.value = "";
386
+    clearInterval(intervalID.value);
361 387
     return;
362 388
   } else {
363 389
     emsDeviceId.value = data[0].id;
364 390
   }
365 391
 
366 392
   emsDevice.value = data;
393
+  // 清除定时器的示例
394
+  clearInterval(intervalID.value);
367 395
   getstationrealtime();
396
+  intervalID.value = setInterval(function () {
397
+    getstationrealtime();
398
+  }, 10000);
368 399
 };
369 400
 const realtime: Ref<Station.realtimeinfo> = ref({
370 401
   accumulativeExportKwh: 0,
@@ -375,16 +406,16 @@ const realtime: Ref<Station.realtimeinfo> = ref({
375 406
   onlineStatus: 0,
376 407
   soc: 0
377 408
 });
409
+
378 410
 const getstationrealtime = async () => {
379 411
   const { data } = await poststationrealtime({}, Singlevalue.value, emsDeviceId.value);
380 412
   realtime.value = data;
381
-  console.log(data);
382
-
383 413
   await getpoststationdevice();
384 414
   await getstationsystem();
385 415
   await getstationdevice();
386 416
   await gatrevenue();
387 417
 };
418
+
388 419
 // 功率趋势图
389 420
 const trendchart = ref();
390 421
 
@@ -449,14 +480,44 @@ const powertrend = (chartDataList: any[], storedPower: any[]) => {
449 480
       {
450 481
         type: "line",
451 482
         stack: "Total",
483
+        showSymbol: false,
452 484
         data: secondList
453 485
       }
454 486
     ]
455 487
   };
488
+  console.log(valueList.length);
489
+  console.log(secondList.length);
456 490
 
457
-  trendchartvalue.setOption(option, true);
491
+  if (valueList.length === 0 && secondList.length === 0) {
492
+    trendchartvalue.setOption(
493
+      {
494
+        title: {
495
+          text: "暂无数据",
496
+          left: "center",
497
+          top: "center",
498
+          textStyle: {
499
+            fontSize: 20,
500
+            color: "#999"
501
+          }
502
+        },
503
+        tooltip: {
504
+          trigger: "item",
505
+          formatter: "暂无数据"
506
+        },
507
+        legend: {
508
+          // 清空图例
509
+          data: [] // 清空图例内容
510
+        },
511
+        series: [] // 清空系列
512
+      },
513
+      true
514
+    );
515
+  } else {
516
+    trendchartvalue.setOption(option, true);
517
+  }
518
+  // trendchartvalue.setOption(option, true);
458 519
 };
459
-// 告警状态
520
+
460 521
 const device: Ref<Station.systemdevice[]> = ref([]);
461 522
 const getstationdevice = async () => {
462 523
   const { data } = await poststationdevice({}, Singlevalue.value, emsDeviceId.value);
@@ -557,19 +618,22 @@ const getpoststationdevice = async () => {
557 618
     }
558 619
   }
559 620
   if (Battery.value) {
560
-    for (let a = 0; a < data.batteryCluster.length; a++) {
561
-      let text = "";
562
-      if (socvalue.value) {
563
-        text = "soc";
564
-      } else if (maxvoltage.value) {
565
-        text = "maxCellVoltage";
566
-      } else if (minvoltage.value) {
567
-        text = "minCellVoltage";
568
-      } else if (socvalue.value && minvoltage.value && minvoltage.value) {
569
-        text = "soc,maxCellVoltage,minCellVoltage";
570
-      }
571
-      Cluster = await getstationrecord(data.batteryCluster[a].deviceId, text);
572
-    }
621
+    // for (let a = 0; a < data.batteryCluster.length; a++) {
622
+    //   let text = "";
623
+    //   if (socvalue.value) {
624
+    //     text = "soc";
625
+    //   } else if (maxvoltage.value) {
626
+    //     text = "maxCellVoltage";
627
+    //   } else if (minvoltage.value) {
628
+    //     text = "minCellVoltage";
629
+    //   } else if (socvalue.value && minvoltage.value && minvoltage.value) {
630
+    //     text = "soc,maxCellVoltage,minCellVoltage";
631
+    //   }
632
+    Cluster = await getstationrecord(data.batteryCluster[0].deviceId, "soc");
633
+    Cluster = await getstationrecord(data.batteryCluster[0].deviceId, "maxCellVoltage");
634
+    Cluster = await getstationrecord(data.batteryCluster[0].deviceId, "minCellVoltage");
635
+    Cluster = await getstationrecord(data.batteryCluster[0].deviceId, "soc,maxCellVoltage,minCellVoltage");
636
+    // }
573 637
   }
574 638
   if (metertype.value) {
575 639
     for (let i = 0; i < data.electricMeter.length; i++) {
@@ -735,6 +799,7 @@ const getoperatingcurve = (pcsdata: any, Cluster: any, Meter: any, gridmeter: an
735 799
         showSymbol: false,
736 800
         smooth: true,
737 801
         data: pcsdata.totalActivePower,
802
+
738 803
         // color: "rgba(190,233,197, 0.2)"
739 804
         markArea: {
740 805
           itemStyle: {
@@ -751,27 +816,31 @@ const getoperatingcurve = (pcsdata: any, Cluster: any, Meter: any, gridmeter: an
751 816
       {
752 817
         name: Meter.deviceName + "_有功功率",
753 818
         type: "line",
819
+        showSymbol: false,
754 820
         data: Meter.totalActivePower
755 821
       },
756
-      {
757
-        name: gridmeter.deviceName + "_有功功率",
758
-        type: "line",
759
-        data: gridmeter.totalActivePower
760
-      },
822
+      // {
823
+      //   name: gridmeter.deviceName + "_有功功率",
824
+      //   type: "line",
825
+      //   data: gridmeter.totalActivePower
826
+      // },
761 827
 
762 828
       {
763 829
         name: Cluster.deviceName + "_SOC",
764 830
         type: "line",
831
+        showSymbol: false,
765 832
         data: Cluster.soc
766 833
       },
767 834
       {
768 835
         name: Cluster.deviceName + "_单体最高电压",
769 836
         type: "line",
837
+        showSymbol: false,
770 838
         data: Cluster.maxCellVoltage
771 839
       },
772 840
       {
773 841
         name: Cluster.deviceName + "_单体最低电压",
774 842
         type: "line",
843
+        showSymbol: false,
775 844
         // stack: "Total",
776 845
         data: Cluster.minCellVoltage
777 846
       }
@@ -800,11 +869,12 @@ const gatrevenue = async () => {
800 869
     date: pickervalue.value
801 870
   };
802 871
   const { data } = await postelectricityrevenue(obj, Singlevalue.value, emsDeviceId.value);
803
-  console.log(data);
804 872
 
805 873
   incomedata.value = data;
806 874
 };
807
-
875
+onUnmounted(() => {
876
+  clearInterval(intervalID.value);
877
+});
808 878
 onMounted(() => {
809 879
   const current = localStorage.getItem("currentDate");
810 880
   if (current) {

+ 131
- 57
src/views/user/addition.vue Wyświetl plik

@@ -13,7 +13,7 @@
13 13
                   {
14 14
                     required: true,
15 15
                     type: 'array',
16
-                    validator: (rule, value, callback) => {
16
+                    validator: (rule: any, value: any, callback: any) => {
17 17
                       if (value.length == 0) {
18 18
                         callback(new Error('请分配电站!'));
19 19
                       } else {
@@ -90,18 +90,18 @@
90 90
                       size="large"
91 91
                       type="text"
92 92
                       placeholder="手机号码"
93
-                      autocomplete="off"
94 93
                     />
95 94
                   </el-form-item>
96
-                  <el-form-item label="邮箱:" prop="email">
97
-                    <el-input
98
-                      v-model.number="numberValidateForm.email"
99
-                      style="width: 300px"
95
+                  <el-form-item label="岗位:" prop="postIds">
96
+                    <el-select
97
+                      v-model="numberValidateForm.postIds"
98
+                      placeholder="请选择部门"
100 99
                       size="large"
101
-                      type="text"
102
-                      placeholder="邮箱"
103
-                      autocomplete="off"
104
-                    />
100
+                      style="width: 300px"
101
+                      multiple
102
+                    >
103
+                      <el-option v-for="item in platformData.post" :key="item.id" :label="item.postName" :value="item.id" />
104
+                    </el-select>
105 105
                   </el-form-item>
106 106
                 </div>
107 107
                 <div class="elform">
@@ -126,50 +126,72 @@
126 126
                     />
127 127
                   </el-form-item>
128 128
                 </div>
129
+
129 130
                 <div class="elform">
130
-                  <el-form-item label="用户性别:">
131
-                    <el-radio-group v-model="numberValidateForm.sex">
132
-                      <el-radio value="0">男</el-radio>
133
-                      <el-radio value="1">女</el-radio>
134
-                    </el-radio-group>
135
-                  </el-form-item>
136
-                  <div style="width: 400px">
137
-                    <el-form-item label="用户状态:" prop="status">
138
-                      <el-switch v-model="numberValidateForm.status" />
139
-                    </el-form-item>
140
-                  </div>
141
-                </div>
142
-                <div class="elform">
143
-                  <el-form-item label="岗位:" prop="postIds">
144
-                    <!-- <el-input
145
-                      v-model.number="numberValidateForm.postIds"
131
+                  <el-form-item
132
+                    label="邮箱:"
133
+                    prop="email"
134
+                    :rules="[
135
+                      { required: true, message: '请输入邮箱', trigger: 'blur' },
136
+                      {
137
+                        pattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,4})$/,
138
+                        message: '邮箱格式不正确',
139
+                        trigger: 'blur'
140
+                      }
141
+                    ]"
142
+                  >
143
+                    <el-input
144
+                      v-model="numberValidateForm.email"
146 145
                       style="width: 300px"
147 146
                       size="large"
148 147
                       type="text"
149
-                      placeholder="岗位"
150
-                      autocomplete="off"
151
-                    /> -->
148
+                      placeholder="邮箱"
149
+                    />
150
+                  </el-form-item>
151
+
152
+                  <el-form-item label="推送类型:" prop="postIds">
152 153
                     <el-select
153
-                      v-model="numberValidateForm.postIds"
154
-                      placeholder="请选择部门"
155
-                      size="large"
154
+                      v-model="numberValidateForm.emailType"
155
+                      placeholder="选择推送模式"
156 156
                       style="width: 300px"
157
-                      multiple
157
+                      size="large"
158 158
                     >
159
-                      <el-option v-for="item in platformData.post" :key="item.id" :label="item.postName" :value="item.id" />
159
+                      <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
160 160
                     </el-select>
161 161
                   </el-form-item>
162 162
                 </div>
163 163
                 <div class="elform">
164
+                  <el-form-item label="推送时间:">
165
+                    <el-time-select
166
+                      v-model="numberValidateForm.emailTypetime"
167
+                      style="width: 300px"
168
+                      start="00:00"
169
+                      step="00:30"
170
+                      end="24:00"
171
+                      placeholder="推送时间"
172
+                    />
173
+                  </el-form-item>
174
+
164 175
                   <el-form-item label="角色:">
165
-                    <el-checkbox-group v-model="numberValidateForm.roleIds">
166
-                      <el-checkbox v-for="item in platformData.role" :key="item.id" :value="item.id">{{
167
-                        item.roleName
168
-                      }}</el-checkbox>
169
-                    </el-checkbox-group>
176
+                    <el-radio-group style="width: 300px" v-model="numberValidateForm.roleIds[0]">
177
+                      <el-radio v-for="item in platformData.role" :key="item.id" :value="item.id">{{ item.roleName }}</el-radio>
178
+                    </el-radio-group>
170 179
                   </el-form-item>
171 180
                 </div>
172 181
                 <div class="elform">
182
+                  <el-form-item label="用户性别:">
183
+                    <el-radio-group v-model="numberValidateForm.sex">
184
+                      <el-radio value="0">男</el-radio>
185
+                      <el-radio value="1">女</el-radio>
186
+                    </el-radio-group>
187
+                  </el-form-item>
188
+                  <div style="width: 400px">
189
+                    <el-form-item label="用户状态:" prop="status">
190
+                      <el-switch v-model="numberValidateForm.status" />
191
+                    </el-form-item>
192
+                  </div>
193
+                </div>
194
+                <div class="elform">
173 195
                   <el-form-item label="备注:">
174 196
                     <el-input
175 197
                       v-model="numberValidateForm.remark"
@@ -202,8 +224,8 @@ import {
202 224
   yonghuedit,
203 225
   getresetPwd,
204 226
   platformedit,
205
-  selectTenantPower,
206
-  selectPowerstation
227
+  selectTenantPower
228
+  // selectPowerstation
207 229
 } from "@/api/home/Multisite.js";
208 230
 import { onMounted, reactive, ref } from "vue";
209 231
 import { useRouter, useRoute } from "vue-router";
@@ -228,6 +250,8 @@ interface FormData {
228 250
   roleIds: string[]; // 假设 roleIds 也是 string[]
229 251
   remark: string;
230 252
   departmentId: string[];
253
+  emailTypetime: string;
254
+  emailType: string;
231 255
 }
232 256
 
233 257
 const numberValidateForm = reactive<FormData>({
@@ -242,9 +266,10 @@ const numberValidateForm = reactive<FormData>({
242 266
   postIds: [],
243 267
   roleIds: [],
244 268
   remark: "",
245
-  departmentId: []
269
+  departmentId: [],
270
+  emailTypetime: "",
271
+  emailType: ""
246 272
 });
247
-
248 273
 const submitForm = (formEl: FormInstance | undefined) => {
249 274
   console.log(formEl);
250 275
   if (!formEl) return;
@@ -263,7 +288,9 @@ const submitForm = (formEl: FormInstance | undefined) => {
263 288
           postIds: numberValidateForm.postIds.toString(),
264 289
           roleIds: numberValidateForm.roleIds.toString(),
265 290
           remark: numberValidateForm.remark,
266
-          powerId: numberValidateForm.departmentId.toString()
291
+          powerId: numberValidateForm.departmentId.toString(),
292
+          sendTime: numberValidateForm.emailTypetime,
293
+          emailType: numberValidateForm.emailType
267 294
         };
268 295
 
269 296
         const { data } = await platformadd(obj);
@@ -288,7 +315,9 @@ const submitForm = (formEl: FormInstance | undefined) => {
288 315
           roleIds: numberValidateForm.roleIds.toString(),
289 316
           remark: numberValidateForm.remark,
290 317
           id: route.query.id,
291
-          powerId: numberValidateForm.departmentId.toString()
318
+          powerId: numberValidateForm.departmentId.toString(),
319
+          sendTime: numberValidateForm.emailTypetime,
320
+          emailType: numberValidateForm.emailType
292 321
         };
293 322
 
294 323
         const { data } = await platformedit(obj);
@@ -337,6 +366,7 @@ const buildTree = (data: other.tableData1[]) => {
337 366
 
338 367
   return tree;
339 368
 };
369
+
340 370
 const platformData = ref();
341 371
 const getplatformlist = async () => {
342 372
   const { data } = await platformlist({});
@@ -344,6 +374,9 @@ const getplatformlist = async () => {
344 374
   console.log(data);
345 375
 };
346 376
 const yonghueditdata = ref();
377
+
378
+const options = ref();
379
+
347 380
 const getghuedit = async () => {
348 381
   const { data } = await yonghuedit(route.query.id);
349 382
   yonghueditdata.value = data;
@@ -357,23 +390,58 @@ const getghuedit = async () => {
357 390
   numberValidateForm.sex = yonghueditdata.value.user.sex;
358 391
   numberValidateForm.status = yonghueditdata.value.user.status == 0 ? true : false;
359 392
   numberValidateForm.remark = yonghueditdata.value.user.remark;
393
+  yonghueditdata.value.powerId.forEach((item: { powerId: string }) => {
394
+    numberValidateForm.departmentId.push(item.powerId);
395
+  });
396
+
360 397
   yonghueditdata.value.posts.forEach((role: { flag: any; id: string }) => {
361 398
     if (role.flag) {
362 399
       numberValidateForm.postIds.push(role.id);
363 400
     }
364 401
   });
402
+
365 403
   yonghueditdata.value.roles.forEach((role: { flag: any; id: string }) => {
366 404
     if (role.flag) {
367 405
       numberValidateForm.roleIds.push(role.id);
368 406
     }
369 407
   });
408
+  if (yonghueditdata.value.user.roles[0].roleKey == 1) {
409
+    options.value = [
410
+      {
411
+        value: "0",
412
+        label: "暂不发送邮件"
413
+      },
414
+      {
415
+        value: "1",
416
+        label: "发送邮件"
417
+      }
418
+    ];
419
+  } else {
420
+    options.value = [
421
+      {
422
+        value: "0",
423
+        label: "暂不发送邮件"
424
+      },
425
+      {
426
+        value: "1",
427
+        label: "详细邮件"
428
+      },
429
+      {
430
+        value: "2",
431
+        label: "简易邮件"
432
+      }
433
+    ];
434
+  }
435
+  numberValidateForm.emailTypetime = yonghueditdata.value.user.sendTime;
436
+  numberValidateForm.emailType = yonghueditdata.value.user.emailType;
437
+  getTreeDatalist();
370 438
 };
371 439
 const resetPwddata = ref();
372 440
 const onresetPwd = async () => {
373 441
   const { data } = await getresetPwd(route.query.id);
374 442
   resetPwddata.value = data;
375 443
 };
376
-// 电站权限
444
+// 电站权限列表
377 445
 const TreeDatalist = ref();
378 446
 const getTreeDatalist = async () => {
379 447
   const { data } = await selectTenantPower({});
@@ -382,15 +450,15 @@ const getTreeDatalist = async () => {
382 450
   TreeDatalist.value = data;
383 451
 };
384 452
 // 回显电站权限
385
-const TreeDatalists = ref();
453
+// const TreeDatalists = ref();
386 454
 
387
-const ongetTreeDatalist = async () => {
388
-  const { data } = await selectPowerstation(route.query.id);
389
-  TreeDatalists.value = data;
390
-  TreeDatalists.value.forEach((item: { powerId: string }) => {
391
-    numberValidateForm.departmentId.push(item.powerId);
392
-  });
393
-};
455
+// const ongetTreeDatalist = async () => {
456
+//   const { data } = await selectPowerstation(route.query.id);
457
+//   TreeDatalists.value = data;
458
+//   TreeDatalists.value.forEach((item: { powerId: string }) => {
459
+//     numberValidateForm.departmentId.push(item.powerId);
460
+//   });
461
+// };
394 462
 const changeTreeFilter = (val: string[]) => {
395 463
   numberValidateForm.departmentId = val;
396 464
 };
@@ -399,17 +467,23 @@ const handleChange = async (val: any) => {
399 467
   console.log(val);
400 468
   numberValidateForm.deptId = val[numberValidateForm.deptId.length - 1].toString();
401 469
 };
470
+
402 471
 onMounted(() => {
403 472
   if (route.query.type == "用户编辑") {
404
-    ongetTreeDatalist();
405
-    onresetPwd();
473
+    // ongetTreeDatalist();
406 474
     getghuedit();
475
+    onresetPwd();
476
+  } else {
477
+    getTreeDatalist();
407 478
   }
408 479
   department();
409 480
   getplatformlist();
410
-  getTreeDatalist();
411 481
 });
412 482
 </script>
413 483
 <style scoped lang="scss">
414 484
 @import "./addition.scss";
415 485
 </style>
486
+<!-- 
487
+0.3225  918    296
488
+0.7371  459   338
489
+-->

+ 36
- 5
src/views/user/index.vue Wyświetl plik

@@ -56,16 +56,25 @@
56 56
         <el-table-column prop="id" label="用户ID" show-overflow-tooltip />
57 57
         <el-table-column prop="userName" label="用户名称" />
58 58
         <el-table-column prop="loginName" label="登录账号" />
59
-        <el-table-column prop="dept.deptName" label="部门" />
59
+        <el-table-column prop="dept.deptName" label="部门" :show-overflow-tooltip="true" />
60 60
         <el-table-column prop="phonenumber" label="手机" />
61 61
         <el-table-column prop="createBy" label="创建人" />
62
-        <el-table-column prop="status" label="用户状态" align="center" width="140">
62
+        <el-table-column prop="status" label="用户状态" width="120">
63 63
           <template #default="scope">
64 64
             <div v-if="scope.row.status == 0">正常</div>
65 65
             <div v-else>错误</div>
66 66
           </template>
67 67
         </el-table-column>
68
-        <el-table-column prop="createTime" label="创建时间" />
68
+        <el-table-column prop="email" label="邮箱" show-overflow-tooltip />
69
+
70
+        <!-- <el-table-column prop="status" label="推送" align="center">
71
+          <template #default="scope">
72
+            <el-select :model-value="scope.row.status" placeholder="选择推送模式" size="large" @change="postersDevice">
73
+              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
74
+            </el-select>
75
+          </template>
76
+        </el-table-column> -->
77
+        <el-table-column prop="createTime" label="创建时间" :show-overflow-tooltip="true" />
69 78
         <el-table-column label="操作" align="center" width="260">
70 79
           <template #default="scope">
71 80
             <el-button v-if="BUTTONS.useredit" color="#0052d9" type="primary" @click="newition(scope.row)">编辑</el-button>
@@ -124,6 +133,7 @@ import { platformuserlist, userremove } from "../../api/home/Multisite.js";
124 133
 import Pagination from "@/components/ProTable/components/Pagination.vue";
125 134
 import { useAuthButtons } from "@/hooks/useAuthButtons";
126 135
 import { Login } from "@/api/interface/index.js";
136
+// import { ElForm, ElMessage, ElMessageBox, ElNotification } from "element-plus";
127 137
 import { ElForm, ElNotification } from "element-plus";
128 138
 import { newloginApi } from "@/api/modules/login.js";
129 139
 const { BUTTONS } = useAuthButtons();
@@ -213,8 +223,29 @@ const handleCurrentChange = async (e: any) => {
213 223
 
214 224
   getplatformuserlist();
215 225
 };
226
+// 用户推送
227
+// const postersDevice = async (value: any) => {
228
+//   console.log(value);
216 229
 
217
-// 删除
230
+//   ElMessageBox.confirm("确定推送模式吗?", "提示", {
231
+//     confirmButtonText: "确定",
232
+//     cancelButtonText: "取消",
233
+//     type: "warning"
234
+//   })
235
+//     .then(() => {
236
+//       ElMessage({
237
+//         type: "success",
238
+//         message: "确定"
239
+//       });
240
+//     })
241
+//     .catch(() => {
242
+//       ElMessage({
243
+//         type: "info",
244
+//         message: "取消"
245
+//       });
246
+//     });
247
+// };
248
+//
218 249
 const onremove = async (row: any) => {
219 250
   await useHandleData(userremove, { ids: row.id }, "删除");
220 251
   await getplatformuserlist();
@@ -228,7 +259,7 @@ const Newpassword = (e: any) => {
228 259
   userid.value = e.id;
229 260
   loginForm.username = e.loginName;
230 261
 };
231
-// 修改密码
262
+//constant
232 263
 type FormInstance = InstanceType<typeof ElForm>;
233 264
 const loginFormRef = ref<FormInstance>();
234 265
 const dialogVisible = ref(false);

+ 6
- 2
src/views/userinformation/index.scss Wyświetl plik

@@ -38,9 +38,13 @@
38 38
 .bottom {
39 39
   position: fixed;
40 40
   bottom: 80px;
41
-  left: 80px;
41
+  left: 50%;
42 42
   display: flex;
43 43
   justify-content: center;
44
-  width: 100%;
44
+  width: 200px;
45 45
   margin-top: 40px;
46 46
 }
47
+.dialogitem {
48
+  margin: 20px 0;
49
+  color: red;
50
+}

+ 132
- 9
src/views/userinformation/index.vue Wyświetl plik

@@ -30,11 +30,27 @@
30 30
         电话:<span class="user_div">{{ userdata.user.phonenumber }}</span>
31 31
       </div>
32 32
       <div class="user">
33
+        推送类型:<span class="user_div">
34
+          <div v-if="userdata.user.emailType == 0">暂不发送</div>
35
+          <div v-if="userdata.user.emailType == 1">详细邮件</div>
36
+          <div v-if="userdata.user.emailType == 2">简约邮件</div>
37
+        </span>
38
+        &nbsp; &nbsp; &nbsp; &nbsp;
39
+        <el-button :icon="Share" @click="dialogemailType = true">修改</el-button>
40
+      </div>
41
+      <div class="user">
33 42
         邮箱:<span class="user_div">{{ userdata.user.email }}</span>
43
+        &nbsp; &nbsp; &nbsp; &nbsp;
44
+        <el-button :icon="Edit" @click="postersDeviceEdit">修改</el-button>
34 45
       </div>
35 46
       <div class="user">
36
-        创建时间:<span class="user_div">{{ userdata.user.createTime }}</span>
47
+        推送时间:<span class="user_div">{{ userdata.user.sendTime }}</span>
48
+        &nbsp; &nbsp; &nbsp; &nbsp;
49
+        <el-button :icon="Edit" @click="dialogVisible = true">修改</el-button>
37 50
       </div>
51
+      <!-- <div class="user">
52
+        创建时间:<span class="user_div">{{ userdata.user.createTime }}</span>  
53
+      </div> -->
38 54
       <div class="user">
39 55
         备注:<span class="user_div">{{ userdata.user.remark }}</span>
40 56
       </div>
@@ -42,6 +58,27 @@
42 58
     <div class="bottom">
43 59
       <el-button @click="resetForm()" type="primary" size="large">返回</el-button>
44 60
     </div>
61
+    <el-dialog v-model="dialogVisible" title="提示" width="500" :before-close="handleClose">
62
+      <div class="dialogitem">选择报表推送时间,设置18:00之前的时间发送前一天的报表,18:00之后发送当日报表!</div>
63
+      <el-time-select v-model="value1" style="width: 240px" start="00:00" step="00:30" end="24:00" placeholder="推送时间" />
64
+      <template #footer>
65
+        <div class="dialog-footer">
66
+          <el-button @click="handleClose">取消</el-button>
67
+          <el-button type="primary" @click="postersDeviceShare"> 确定 </el-button>
68
+        </div>
69
+      </template>
70
+    </el-dialog>
71
+    <el-dialog v-model="dialogemailType" title="提示" width="500" :before-close="handleClosemailType">
72
+      <el-select v-model="emailType" placeholder="选择推送模式" size="large">
73
+        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
74
+      </el-select>
75
+      <template #footer>
76
+        <div class="dialog-footer">
77
+          <el-button @click="handleClosemailType">取消</el-button>
78
+          <el-button type="primary" @click="postersmailType"> 确定 </el-button>
79
+        </div>
80
+      </template>
81
+    </el-dialog>
45 82
   </div>
46 83
 </template>
47 84
 <!--    -->
@@ -49,43 +86,129 @@
49 86
 import { selectaccountNumber, updateURL } from "@/api/home/Multisite";
50 87
 import { onMounted, ref, watch } from "vue";
51 88
 import UploadImg from "@/components/Upload/Img.vue";
52
-
89
+import { Share, Edit } from "@element-plus/icons-vue";
53 90
 import { useRouter } from "vue-router";
91
+import { ElMessageBox } from "element-plus";
54 92
 const router = useRouter();
55 93
 const userdata = ref();
56
-
94
+const dialogVisible = ref(false);
95
+const dialogemailType = ref(false);
96
+const emailType = ref(0);
97
+const options = ref();
57 98
 const absoluteStationPicUr1 = ref("");
58 99
 watch(absoluteStationPicUr1, (newVal, oldVal) => {
59 100
   console.log("absoluteStationPicUr1 has changed:", newVal);
60 101
   console.log(oldVal);
61
-
62 102
   // 你可以在这里处理变化后的逻辑
63
-  getupdate();
103
+  if (absoluteStationPicUr1.value != userdata.value.user.avatar) {
104
+    getupdate();
105
+  }
64 106
 });
65 107
 // 修改个人信息
66 108
 const getupdate = async () => {
67
-  console.log(absoluteStationPicUr1.value);
68 109
   let obj = {
69 110
     avatar: absoluteStationPicUr1.value
70 111
   };
71
-  const { data } = await updateURL(obj);
72
-  console.log(data);
73
-  getplatformuserlist();
112
+  await updateURL(obj);
74 113
 };
75 114
 const getplatformuserlist = async () => {
76 115
   const { data } = await selectaccountNumber({});
77 116
   userdata.value = data;
117
+  if (userdata.value.user.roles[0].roleKey == 1) {
118
+    options.value = [
119
+      {
120
+        value: "0",
121
+        label: "暂不发送邮件"
122
+      },
123
+      {
124
+        value: "1",
125
+        label: "发送邮件"
126
+      }
127
+    ];
128
+  } else {
129
+    options.value = [
130
+      {
131
+        value: "0",
132
+        label: "暂不发送邮件"
133
+      },
134
+      {
135
+        value: "1",
136
+        label: "简易邮件"
137
+      },
138
+      {
139
+        value: "2",
140
+        label: "详细邮件"
141
+      }
142
+    ];
143
+  }
78 144
   absoluteStationPicUr1.value = userdata.value.user.avatar;
145
+  value1.value = userdata.value.user.sendTime;
146
+  emailType.value = userdata.value.user.emailType;
79 147
 };
80 148
 const currentDate = ref();
81 149
 const resetForm = async () => {
82 150
   router.back();
83 151
 };
152
+// 邮箱编辑
153
+const postersDeviceEdit = async () => {
154
+  ElMessageBox.prompt("请先填写邮箱", {
155
+    confirmButtonText: "确定",
156
+    cancelButtonText: "取消",
157
+    inputValue: userdata.value.user.email,
158
+    inputPattern: /^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+\.([A-Za-z]{2,4})$/,
159
+    inputErrorMessage: "请输入正确格式邮箱"
160
+  }).then(async ({ value }) => {
161
+    let obj = {
162
+      email: value
163
+    };
164
+    await updateURL(obj);
165
+    getplatformuserlist();
166
+  });
167
+};
168
+const handleClose = async () => {
169
+  dialogVisible.value = false;
170
+};
171
+
172
+const value1 = ref();
173
+// 用户推送
174
+const postersDeviceShare = async () => {
175
+  console.log(value1.value);
176
+  let obj = {
177
+    sendTime: value1.value
178
+  };
179
+  await updateURL(obj);
180
+  dialogVisible.value = false;
181
+  getplatformuserlist();
182
+};
183
+// 取消推送时间弹窗
184
+const handleClosemailType = async () => {
185
+  dialogemailType.value = false;
186
+};
187
+
188
+// 用户推送
189
+const postersmailType = async () => {
190
+  console.log(dialogemailType.value);
191
+
192
+  ElMessageBox.confirm("确认推送模式", "提示", {
193
+    confirmButtonText: "确定",
194
+    cancelButtonText: "取消",
195
+    type: "warning"
196
+  }).then(async () => {
197
+    let obj = {
198
+      emailType: emailType.value
199
+    };
200
+    await updateURL(obj);
201
+    dialogemailType.value = false;
202
+    getplatformuserlist();
203
+  });
204
+};
205
+//
84 206
 onMounted(() => {
85 207
   const current = localStorage.getItem("currentDate");
86 208
   if (current) {
87 209
     currentDate.value = current;
88 210
   }
211
+
89 212
   getplatformuserlist();
90 213
 });
91 214
 </script>

Ładowanie…
Anuluj
Zapisz