Browse Source

年后第一次提交

master
dong 1 year ago
parent
commit
24e71ecfeb

+ 20
- 0
.env.development View File

29
 # 
29
 # 
30
 # 209        363
30
 # 209        363
31
 # 
31
 # 
32
+#                                             
32
 # 
33
 # 
33
 # 
34
 # 
35
+#                                                                                                          
34
 # 
36
 # 
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+

+ 1
- 0
.vscode/settings.json View File

68
     "informationtype",
68
     "informationtype",
69
     "insertschedule",
69
     "insertschedule",
70
     "juejin",
70
     "juejin",
71
+    "keywordcategory",
71
     "liquidfill",
72
     "liquidfill",
72
     "longpress",
73
     "longpress",
73
     "mockjs",
74
     "mockjs",

+ 29
- 16
package-lock.json View File

14
         "@vueuse/integrations": "^10.9.0",
14
         "@vueuse/integrations": "^10.9.0",
15
         "@wangeditor/editor": "^5.1.23",
15
         "@wangeditor/editor": "^5.1.23",
16
         "@wangeditor/editor-for-vue": "^5.1.12",
16
         "@wangeditor/editor-for-vue": "^5.1.12",
17
-        "axios": "^1.6.2",
17
+        "axios": "^1.7.9",
18
         "dayjs": "^1.11.10",
18
         "dayjs": "^1.11.10",
19
         "driver.js": "^1.3.1",
19
         "driver.js": "^1.3.1",
20
         "echarts": "^5.4.3",
20
         "echarts": "^5.4.3",
21
         "echarts-liquidfill": "^3.1.0",
21
         "echarts-liquidfill": "^3.1.0",
22
-        "element-plus": "^2.4.3",
22
+        "element-plus": "^2.9.1",
23
+        "file-saver": "^2.0.5",
23
         "js-cookie": "^3.0.5",
24
         "js-cookie": "^3.0.5",
24
         "md5": "^2.3.0",
25
         "md5": "^2.3.0",
25
         "mitt": "^3.0.1",
26
         "mitt": "^3.0.1",
40
       "devDependencies": {
41
       "devDependencies": {
41
         "@commitlint/cli": "^18.4.3",
42
         "@commitlint/cli": "^18.4.3",
42
         "@commitlint/config-conventional": "^18.4.3",
43
         "@commitlint/config-conventional": "^18.4.3",
44
+        "@types/file-saver": "^2.0.7",
43
         "@types/js-cookie": "^3.0.6",
45
         "@types/js-cookie": "^3.0.6",
44
         "@types/md5": "^2.3.5",
46
         "@types/md5": "^2.3.5",
45
         "@types/nprogress": "^0.2.3",
47
         "@types/nprogress": "^0.2.3",
3361
       "resolved": "https://registry.npmjs.org/@types/event-emitter/-/event-emitter-0.3.5.tgz",
3363
       "resolved": "https://registry.npmjs.org/@types/event-emitter/-/event-emitter-0.3.5.tgz",
3362
       "integrity": "sha512-zx2/Gg0Eg7gwEiOIIh5w9TrhKKTeQh7CPCOPNc0el4pLSwzebA8SmnHwZs2dWlLONvyulykSwGSQxQHLhjGLvQ=="
3364
       "integrity": "sha512-zx2/Gg0Eg7gwEiOIIh5w9TrhKKTeQh7CPCOPNc0el4pLSwzebA8SmnHwZs2dWlLONvyulykSwGSQxQHLhjGLvQ=="
3363
     },
3365
     },
3366
+    "node_modules/@types/file-saver": {
3367
+      "version": "2.0.7",
3368
+      "resolved": "https://registry.npmjs.org/@types/file-saver/-/file-saver-2.0.7.tgz",
3369
+      "integrity": "sha512-dNKVfHd/jk0SkR/exKGj2ggkB45MAkzvWCaqLUUgkyjITkGNzH8H+yUwr+BLJUBjZOe9w8X3wgmXhZDRg1ED6A==",
3370
+      "dev": true
3371
+    },
3364
     "node_modules/@types/js-cookie": {
3372
     "node_modules/@types/js-cookie": {
3365
       "version": "3.0.6",
3373
       "version": "3.0.6",
3366
       "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
3374
       "resolved": "https://registry.npmjs.org/@types/js-cookie/-/js-cookie-3.0.6.tgz",
4570
       }
4578
       }
4571
     },
4579
     },
4572
     "node_modules/axios": {
4580
     "node_modules/axios": {
4573
-      "version": "1.6.7",
4574
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
4575
-      "integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
4581
+      "version": "1.7.9",
4582
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz",
4583
+      "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==",
4576
       "dependencies": {
4584
       "dependencies": {
4577
-        "follow-redirects": "^1.15.4",
4585
+        "follow-redirects": "^1.15.6",
4578
         "form-data": "^4.0.0",
4586
         "form-data": "^4.0.0",
4579
         "proxy-from-env": "^1.1.0"
4587
         "proxy-from-env": "^1.1.0"
4580
       }
4588
       }
6487
       }
6495
       }
6488
     },
6496
     },
6489
     "node_modules/dayjs": {
6497
     "node_modules/dayjs": {
6490
-      "version": "1.11.10",
6491
-      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz",
6492
-      "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ=="
6498
+      "version": "1.11.13",
6499
+      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz",
6500
+      "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
6493
     },
6501
     },
6494
     "node_modules/de-indent": {
6502
     "node_modules/de-indent": {
6495
       "version": "1.0.2",
6503
       "version": "1.0.2",
6901
       "dev": true
6909
       "dev": true
6902
     },
6910
     },
6903
     "node_modules/element-plus": {
6911
     "node_modules/element-plus": {
6904
-      "version": "2.6.0",
6905
-      "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.6.0.tgz",
6906
-      "integrity": "sha512-MP+N48P+diyndR+GjY+0VOrUmFnajD4U0CkrXIMzmeRmq4+dwi0bdzVo587v4wDo9Hs+ggviyacqm3NS8JYVqw==",
6912
+      "version": "2.9.1",
6913
+      "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-2.9.1.tgz",
6914
+      "integrity": "sha512-9Agqf/jt4Ugk7EZ6C5LME71sgkvauPCsnvJN12Xid2XVobjufxMGpRE4L7pS4luJMOmFAH3J0NgYEGZT5r+NDg==",
6907
       "dependencies": {
6915
       "dependencies": {
6908
         "@ctrl/tinycolor": "^3.4.1",
6916
         "@ctrl/tinycolor": "^3.4.1",
6909
         "@element-plus/icons-vue": "^2.3.1",
6917
         "@element-plus/icons-vue": "^2.3.1",
6913
         "@types/lodash-es": "^4.17.6",
6921
         "@types/lodash-es": "^4.17.6",
6914
         "@vueuse/core": "^9.1.0",
6922
         "@vueuse/core": "^9.1.0",
6915
         "async-validator": "^4.2.5",
6923
         "async-validator": "^4.2.5",
6916
-        "dayjs": "^1.11.3",
6924
+        "dayjs": "^1.11.13",
6917
         "escape-html": "^1.0.3",
6925
         "escape-html": "^1.0.3",
6918
         "lodash": "^4.17.21",
6926
         "lodash": "^4.17.21",
6919
         "lodash-es": "^4.17.21",
6927
         "lodash-es": "^4.17.21",
7799
         "node": "^10.12.0 || >=12.0.0"
7807
         "node": "^10.12.0 || >=12.0.0"
7800
       }
7808
       }
7801
     },
7809
     },
7810
+    "node_modules/file-saver": {
7811
+      "version": "2.0.5",
7812
+      "resolved": "https://registry.npmjs.org/file-saver/-/file-saver-2.0.5.tgz",
7813
+      "integrity": "sha512-P9bmyZ3h/PRG+Nzga+rbdI4OEpNDzAVyy74uVO9ATgzLK6VtAsYybF/+TOCvrc0MO793d6+42lLyZTw7/ArVzA=="
7814
+    },
7802
     "node_modules/filelist": {
7815
     "node_modules/filelist": {
7803
       "version": "1.0.4",
7816
       "version": "1.0.4",
7804
       "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
7817
       "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.4.tgz",
7869
       "dev": true
7882
       "dev": true
7870
     },
7883
     },
7871
     "node_modules/follow-redirects": {
7884
     "node_modules/follow-redirects": {
7872
-      "version": "1.15.5",
7873
-      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz",
7874
-      "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==",
7885
+      "version": "1.15.9",
7886
+      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
7887
+      "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
7875
       "funding": [
7888
       "funding": [
7876
         {
7889
         {
7877
           "type": "individual",
7890
           "type": "individual",

+ 4
- 2
package.json View File

40
     "@vueuse/integrations": "^10.9.0",
40
     "@vueuse/integrations": "^10.9.0",
41
     "@wangeditor/editor": "^5.1.23",
41
     "@wangeditor/editor": "^5.1.23",
42
     "@wangeditor/editor-for-vue": "^5.1.12",
42
     "@wangeditor/editor-for-vue": "^5.1.12",
43
-    "axios": "^1.6.2",
43
+    "axios": "^1.7.9",
44
     "dayjs": "^1.11.10",
44
     "dayjs": "^1.11.10",
45
     "driver.js": "^1.3.1",
45
     "driver.js": "^1.3.1",
46
     "echarts": "^5.4.3",
46
     "echarts": "^5.4.3",
47
     "echarts-liquidfill": "^3.1.0",
47
     "echarts-liquidfill": "^3.1.0",
48
-    "element-plus": "^2.4.3",
48
+    "element-plus": "^2.9.1",
49
+    "file-saver": "^2.0.5",
49
     "js-cookie": "^3.0.5",
50
     "js-cookie": "^3.0.5",
50
     "md5": "^2.3.0",
51
     "md5": "^2.3.0",
51
     "mitt": "^3.0.1",
52
     "mitt": "^3.0.1",
66
   "devDependencies": {
67
   "devDependencies": {
67
     "@commitlint/cli": "^18.4.3",
68
     "@commitlint/cli": "^18.4.3",
68
     "@commitlint/config-conventional": "^18.4.3",
69
     "@commitlint/config-conventional": "^18.4.3",
70
+    "@types/file-saver": "^2.0.7",
69
     "@types/js-cookie": "^3.0.6",
71
     "@types/js-cookie": "^3.0.6",
70
     "@types/md5": "^2.3.5",
72
     "@types/md5": "^2.3.5",
71
     "@types/nprogress": "^0.2.3",
73
     "@types/nprogress": "^0.2.3",

+ 49
- 5
src/api/home/Multisite.ts View File

21
   return http.post<Station.between[]>(`/stats/multStation/profit/between/day`, qs.stringify(params));
21
   return http.post<Station.between[]>(`/stats/multStation/profit/between/day`, qs.stringify(params));
22
 };
22
 };
23
 // 收益统计------------月份
23
 // 收益统计------------月份
24
+export const multiStationMonthMonth = (params: {}) => {
25
+  return http.post<Station.between[]>(`/stats/multStation/profit/between/Month`, qs.stringify(params));
26
+};
27
+// 收益统计------------年份
24
 export const multiStationdayMonth = (params: {}) => {
28
 export const multiStationdayMonth = (params: {}) => {
25
   return http.post<Station.between[]>(`/stats/multStation/profit/between/yearMonth`, qs.stringify(params));
29
   return http.post<Station.between[]>(`/stats/multStation/profit/between/yearMonth`, qs.stringify(params));
26
 };
30
 };
29
   return http.post<Station.power[]>(`/stats/multStation/power/between/day`, qs.stringify(params));
33
   return http.post<Station.power[]>(`/stats/multStation/power/between/day`, qs.stringify(params));
30
 };
34
 };
31
 // 充放电统计-----------月份
35
 // 充放电统计-----------月份
36
+export const multiStatiopowerMonth = (params: {}) => {
37
+  return http.post<Station.power[]>(`/stats/multStation/power/between/Month`, qs.stringify(params));
38
+};
39
+// 充放电统计-----------年份
32
 export const multiStatyearMonth = (params: {}) => {
40
 export const multiStatyearMonth = (params: {}) => {
33
   return http.post<Station.power[]>(`/stats/multStation/power/between/yearMonth`, qs.stringify(params));
41
   return http.post<Station.power[]>(`/stats/multStation/power/between/yearMonth`, qs.stringify(params));
34
 };
42
 };
37
   return http.post<Station.profitday[]>(`/stats/multStation/profit/top/between/day`, qs.stringify(params));
45
   return http.post<Station.profitday[]>(`/stats/multStation/profit/top/between/day`, qs.stringify(params));
38
 };
46
 };
39
 // 收益排名--------------月份
47
 // 收益排名--------------月份
48
+export const multiStationtopdayMonth = (params: {}) => {
49
+  return http.post<Station.profitday[]>(`/stats/multStation/profit/top/between/Month`, qs.stringify(params));
50
+};
51
+// 收益排名--------------年份
40
 export const multiStationtopyearMonth = (params: {}) => {
52
 export const multiStationtopyearMonth = (params: {}) => {
41
   return http.post<Station.profitday[]>(`/stats/multStation/profit/top/between/yearMonth`, qs.stringify(params));
53
   return http.post<Station.profitday[]>(`/stats/multStation/profit/top/between/yearMonth`, qs.stringify(params));
42
 };
54
 };
85
   return http.post<Station.profitbetween>(`/stats/singleStation/${id}/profit/between/day`, qs.stringify(params));
97
   return http.post<Station.profitbetween>(`/stats/singleStation/${id}/profit/between/day`, qs.stringify(params));
86
 };
98
 };
87
 // 单站橄榄收益统计------------月份
99
 // 单站橄榄收益统计------------月份
100
+export const singlestationdayMonth = (params: {}, id: any) => {
101
+  return http.post<Station.profitbetween>(`/stats/singleStation/${id}/profit/between/Month`, qs.stringify(params));
102
+};
103
+// 单站橄榄收益统计------------年份
88
 export const singlestationyearMonth = (params: {}, id: any) => {
104
 export const singlestationyearMonth = (params: {}, id: any) => {
89
   return http.post<Station.profitbetween>(`/stats/singleStation/${id}/profit/between/yearMonth`, qs.stringify(params));
105
   return http.post<Station.profitbetween>(`/stats/singleStation/${id}/profit/between/yearMonth`, qs.stringify(params));
90
 };
106
 };
92
 export const postsexportKwh = (params: {}, id: any) => {
108
 export const postsexportKwh = (params: {}, id: any) => {
93
   return http.post<Station.power[]>(`/stats/singleStation/${id}/singleStation/between/day`, qs.stringify(params));
109
   return http.post<Station.power[]>(`/stats/singleStation/${id}/singleStation/between/day`, qs.stringify(params));
94
 };
110
 };
95
-// 单站橄榄放电统计----------月份
111
+// 单站橄榄放电统计---------月
112
+export const postsexportKwhMonth = (params: {}, id: any) => {
113
+  return http.post<Station.power[]>(`/stats/singleStation/${id}/singleStation/between/Month`, qs.stringify(params));
114
+};
115
+// 单站橄榄放电统计----------年份
96
 export const singlestationchargingMonth = (params: {}, id: any) => {
116
 export const singlestationchargingMonth = (params: {}, id: any) => {
97
   return http.post<Station.power[]>(`/stats/singleStation/${id}/between/yuerMonth`, qs.stringify(params));
117
   return http.post<Station.power[]>(`/stats/singleStation/${id}/between/yuerMonth`, qs.stringify(params));
98
 };
118
 };
177
   return http.post(`device/station/${id}/${ids}/airConditionerInfo`, qs.stringify(params), { loading: false });
197
   return http.post(`device/station/${id}/${ids}/airConditionerInfo`, qs.stringify(params), { loading: false });
178
 };
198
 };
179
 // 电价管理
199
 // 电价管理
180
-export const electricitylist = (params: {}, id: string) => {
181
-  return http.post<Station.electricity[]>(`/electricity/${id}/tariff/2024/list`, qs.stringify(params));
200
+export const electricitylist = (params: {}, time: any, id: string) => {
201
+  return http.post<Station.electricity[]>(`/electricity/${id}/tariff/${time}/list`, qs.stringify(params));
182
 };
202
 };
183
 // 电价新增
203
 // 电价新增
184
 export const insertschedule = (params: {}, name: string) => {
204
 export const insertschedule = (params: {}, name: string) => {
569
 export const listexcellURL = (params: {}) => {
589
 export const listexcellURL = (params: {}) => {
570
   return http.post(`/tdengineyuanshi/listexcel`, qs.stringify(params));
590
   return http.post(`/tdengineyuanshi/listexcel`, qs.stringify(params));
571
 };
591
 };
572
-// 原始数据导出
592
+
593
+// 点位名称查询
594
+export const selectpeekURL = (params: {}) => {
595
+  return http.post(`/tdengineyuanshi/selectpeek`, qs.stringify(params));
596
+};
597
+// 点位名称修改
598
+export const updatepeekURL = (params: {}) => {
599
+  return http.post(`/tdengineyuanshi/updatepeek`, qs.stringify(params));
600
+};
601
+// 一键同步所有列
602
+export const insertpeekURL = (params: {}) => {
603
+  return http.post(`/tdengineyuanshi/insertpeek`, qs.stringify(params));
604
+};
605
+// 原始数据
573
 export const powerlistURL = (params: {}) => {
606
 export const powerlistURL = (params: {}) => {
574
   return http.post(`/tdengineyuanshi/powerlist`, qs.stringify(params));
607
   return http.post(`/tdengineyuanshi/powerlist`, qs.stringify(params));
575
 };
608
 };
576
-//
609
+// 原始数据导出状态并下载
610
+export const listexcelURL = () => {
611
+  return http.get(`/tdengineyuanshi/progress`, {}, { loading: false });
612
+};
613
+// 本地原始数据列表
614
+export const directorylURL = () => {
615
+  return http.get(`/tdengineyuanshi/directory`, {}, { loading: false });
616
+};
617
+// 本地原始数据列表
618
+export const directorylURL1 = () => {
619
+  return http.get(`/Thisitem_20241029.tar.gz`, {}, { loading: false });
620
+};

+ 2
- 0
src/api/index.ts View File

71
           //   "SECKEY_ABVK=yzv+fRRRekBvVNrnVlQZv0los5i9tWT7/GYgPAgu884%3D; BMAP_SECKEY=yzv-fRRRekBvVNrnVlQZv2Guui2pW9C79nYaUUFkI6HcEGOO1i70kkCS7E4MlMHKL_cRl3cFeNBvx5NWIX7dDXYkhI77iZtdc5SYW-OwC5dUHv-nMCrN1CjB_61m-b-ZQhKFDokV8rhJZR9Pxhea7EahAHKq5bXPwLaKaPVAkkSluICvD9iloe2h7po2dYwnzuDCbfgG42YScxs_6kx_Jg"
71
           //   "SECKEY_ABVK=yzv+fRRRekBvVNrnVlQZv0los5i9tWT7/GYgPAgu884%3D; BMAP_SECKEY=yzv-fRRRekBvVNrnVlQZv2Guui2pW9C79nYaUUFkI6HcEGOO1i70kkCS7E4MlMHKL_cRl3cFeNBvx5NWIX7dDXYkhI77iZtdc5SYW-OwC5dUHv-nMCrN1CjB_61m-b-ZQhKFDokV8rhJZR9Pxhea7EahAHKq5bXPwLaKaPVAkkSluICvD9iloe2h7po2dYwnzuDCbfgG42YScxs_6kx_Jg"
72
           // );
72
           // );
73
         }
73
         }
74
+        console.log(config);
75
+
74
         return config;
76
         return config;
75
       },
77
       },
76
       (error: AxiosError) => {
78
       (error: AxiosError) => {

+ 1
- 1
src/components/SelectIcon/index.vue View File

27
     </el-dialog>
27
     </el-dialog>
28
   </div>
28
   </div>
29
 </template>
29
 </template>
30
-
30
+<!--    -->
31
 <script setup lang="ts" name="SelectIcon">
31
 <script setup lang="ts" name="SelectIcon">
32
 import { ref, computed } from "vue";
32
 import { ref, computed } from "vue";
33
 import * as Icons from "@element-plus/icons-vue";
33
 import * as Icons from "@element-plus/icons-vue";

+ 2
- 1
src/layouts/components/Header/components/Avatar.vue View File

59
     // cookies.remove("rememberMe");
59
     // cookies.remove("rememberMe");
60
     // console.log(cookies.get("rememberMe"));
60
     // console.log(cookies.get("rememberMe"));
61
 
61
 
62
-    document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
62
+    // document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
63
     // 3.重定向到登陆页
63
     // 3.重定向到登陆页
64
     router.replace(LOGIN_URL);
64
     router.replace(LOGIN_URL);
65
     ElMessage.success("退出登录成功!");
65
     ElMessage.success("退出登录成功!");
88
   }
88
   }
89
 }
89
 }
90
 </style>
90
 </style>
91
+<!-- http://localhost:8848/user/#/home/index -->

+ 1
- 1
src/layouts/components/Header/components/PasswordDialog.vue View File

94
         type: "success",
94
         type: "success",
95
         duration: 3000
95
         duration: 3000
96
       });
96
       });
97
-      document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
97
+      // document.cookie = "rememberMe=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/user/;";
98
       // 3.重定向到登陆页
98
       // 3.重定向到登陆页
99
       router.replace(LOGIN_URL);
99
       router.replace(LOGIN_URL);
100
     } finally {
100
     } finally {

+ 4
- 4
src/routers/index.ts View File

11
   hash: () => createWebHashHistory(),
11
   hash: () => createWebHashHistory(),
12
   history: () => createWebHistory()
12
   history: () => createWebHistory()
13
 };
13
 };
14
-import { useCookies } from "@vueuse/integrations/useCookies";
14
+// import { useCookies } from "@vueuse/integrations/useCookies";
15
 
15
 
16
 /**
16
 /**
17
  * @description 📚 路由参数配置简介
17
  * @description 📚 路由参数配置简介
55
   // 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
55
   // 3.判断是访问登陆页,有 Token 就在当前页面,没有 Token 重置路由到登陆页
56
   // 读取cookie
56
   // 读取cookie
57
 
57
 
58
-  const cookies = useCookies();
58
+  // const cookies = useCookies();
59
 
59
 
60
   if (to.path.toLocaleLowerCase() === LOGIN_URL) {
60
   if (to.path.toLocaleLowerCase() === LOGIN_URL) {
61
-    if (cookies.get("rememberMe")) return next(from.fullPath);
61
+    // if (cookies.get("rememberMe")) return next(from.fullPath);
62
     resetRouter();
62
     resetRouter();
63
     return next();
63
     return next();
64
   }
64
   }
67
   if (ROUTER_WHITE_LIST.includes(to.path)) return next();
67
   if (ROUTER_WHITE_LIST.includes(to.path)) return next();
68
 
68
 
69
   // 5.判断是否有 Token,没有重定向到 login 页面
69
   // 5.判断是否有 Token,没有重定向到 login 页面
70
-  if (!cookies.get("rememberMe")) return next({ path: LOGIN_URL, replace: true });
70
+  // if (!cookies.get("rememberMe")) return next({ path: LOGIN_URL, replace: true });
71
 
71
 
72
   // 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
72
   // 6.如果没有菜单列表,就重新请求菜单列表并添加动态路由
73
   if (!authStore.authMenuListGet.length) {
73
   if (!authStore.authMenuListGet.length) {

+ 35
- 10
src/views/Administration/addition.vue View File

138
 const submitForm = (formEl: FormInstance | undefined) => {
138
 const submitForm = (formEl: FormInstance | undefined) => {
139
   console.log(tableData);
139
   console.log(tableData);
140
   if (!formEl) return;
140
   if (!formEl) return;
141
+  // formEl.validate(async valid => {
142
+  //   if (valid) {
143
+  //     if (!validateData()) return;
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
+  //     }
153
+  //   } else {
154
+  //     console.log("error submit!");
155
+  //     return false;
156
+  //   }
157
+  // });
141
   formEl.validate(async valid => {
158
   formEl.validate(async valid => {
142
     if (valid) {
159
     if (valid) {
143
       if (!validateData()) return;
160
       if (!validateData()) return;
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: "模板管理" } });
161
+
162
+      try {
163
+        let responseData;
164
+
165
+        if (route.query.type === "模板新增") {
166
+          responseData = await insertschedule(tableData, numberValidateForm.postName);
167
+        } else {
168
+          responseData = await electricityupdateURL(numberValidateForm.postName, scheduleVOS.value.data[0].id, tableData);
169
+        }
170
+
171
+        console.log(responseData.data);
172
+        ElMessage.success("操作成功"); // User feedback for success
173
+        router.push({ path: "/Administration/index", query: { id: "模板管理" } }); // Consolidated navigation
174
+      } catch (error) {
175
+        console.error("Submission error:", error);
176
+        ElMessage.error("提交失败,请重试!"); // Inform the user about submission failure
152
       }
177
       }
153
     } else {
178
     } else {
154
-      console.log("error submit!");
155
-      return false;
179
+      console.log("Validation failed!");
180
+      ElMessage.warning("请检查表单填写是否正确!"); // Inform the user about validation failure
156
     }
181
     }
157
   });
182
   });
158
 };
183
 };

+ 13
- 28
src/views/Administration/index.vue View File

39
                   placeholder="选择时间"
39
                   placeholder="选择时间"
40
                   size="large"
40
                   size="large"
41
                   clearable
41
                   clearable
42
-                  :disabled-date="pickerOptions"
42
+                  format="YYYY"
43
+                  value-format="YYYY"
43
                   @change="pickerincome"
44
                   @change="pickerincome"
44
                 />
45
                 />
45
               </div>
46
               </div>
265
     </el-dialog>
266
     </el-dialog>
266
   </div>
267
   </div>
267
 </template>
268
 </template>
268
-<!--    -->
269
+<!--   
270
+      
271
+-->
269
 <script setup lang="ts">
272
 <script setup lang="ts">
270
 import { onMounted, Ref, ref } from "vue";
273
 import { onMounted, Ref, ref } from "vue";
271
 import {
274
 import {
321
 
324
 
322
 const pickervalue = ref();
325
 const pickervalue = ref();
323
 pickervalue.value = currentYear + "";
326
 pickervalue.value = currentYear + "";
324
-const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
325
-  return time.getTime(new Date()) > Date.now();
326
-};
327
+// const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
328
+//   return time.getTime(new Date()) > Date.now();
329
+// };
327
 // 选择日期
330
 // 选择日期
328
-const pickerincome = async (val: any) => {
329
-  if (val == null) {
330
-    pickervalue.value = currentYear;
331
-  } else {
332
-    pickervalue.value = formatDate(val);
333
-  }
331
+const pickerincome = async () => {
334
   getelectricitylist();
332
   getelectricitylist();
335
 };
333
 };
336
-const formatDate = (dateString: string | number | Date) => {
337
-  const date = new Date(dateString);
338
-
339
-  // 提取年、月、日、时、分信息
340
 
334
 
341
-  const year = date.getFullYear();
342
-  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
343
-  const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
344
-  const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
345
-  const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
346
-
347
-  // 拼接成 "YYYY-MM-DD HH:MM" 格式
348
-  const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
349
-
350
-  return formattedDate;
351
-};
352
 // 电价配置
335
 // 电价配置
353
 const tricitylist: Ref<Station.electricity[]> = ref([]);
336
 const tricitylist: Ref<Station.electricity[]> = ref([]);
354
 
337
 
355
 const getelectricitylist = async () => {
338
 const getelectricitylist = async () => {
356
-  const { data } = await electricitylist({}, Singlevalue.value);
339
+  const { data } = await electricitylist({}, pickervalue.value, Singlevalue.value);
357
   tricitylist.value = data;
340
   tricitylist.value = data;
358
   getselectpoweroverview();
341
   getselectpoweroverview();
359
 };
342
 };
641
 <style scoped lang="scss">
624
 <style scoped lang="scss">
642
 @import "./index.scss";
625
 @import "./index.scss";
643
 </style>
626
 </style>
644
-<!-- -->
627
+<!--
628
+    
629
+ -->

+ 32
- 3
src/views/Alarm/index.vue View File

86
                 size="large"
86
                 size="large"
87
                 v-model="timevalue"
87
                 v-model="timevalue"
88
                 type="daterange"
88
                 type="daterange"
89
+                :shortcuts="shortcuts"
89
                 start-placeholder="开始时间"
90
                 start-placeholder="开始时间"
90
                 end-placeholder="结束时间"
91
                 end-placeholder="结束时间"
91
                 :default-value="timevalue"
92
                 :default-value="timevalue"
92
-                :disabled-date="pickerOptions"
93
                 value-format="YYYY-MM-DD hh:mm:ss"
93
                 value-format="YYYY-MM-DD hh:mm:ss"
94
+                :disabled-date="pickerOptions"
94
               />
95
               />
95
             </div>
96
             </div>
96
             <div class="screen_1">
97
             <div class="screen_1">
128
     </div>
129
     </div>
129
   </div>
130
   </div>
130
 </template>
131
 </template>
131
-<!--  == 发生 ,1&没有发生时间== 复位 |告警,事件,故障 -->
132
+<!--    -->
132
 <!--    -->
133
 <!--    -->
133
 <script setup lang="ts">
134
 <script setup lang="ts">
134
 import { onMounted, Ref, ref } from "vue";
135
 import { onMounted, Ref, ref } from "vue";
468
 // const proposal = ref("");
469
 // const proposal = ref("");
469
 const alarmstatus = ref("");
470
 const alarmstatus = ref("");
470
 const timevalue: Ref<any> = ref([]);
471
 const timevalue: Ref<any> = ref([]);
471
-
472
+const shortcuts = ref([
473
+  {
474
+    text: "过去7天",
475
+    value: () => {
476
+      const end = new Date();
477
+      const start = new Date();
478
+      start.setDate(start.getDate() - 7);
479
+      return [start, end];
480
+    }
481
+  },
482
+  {
483
+    text: "过去1个月",
484
+    value: () => {
485
+      const end = new Date();
486
+      const start = new Date();
487
+      start.setMonth(start.getMonth() - 1);
488
+      return [start, end];
489
+    }
490
+  },
491
+  {
492
+    text: "过去3个月",
493
+    value: () => {
494
+      const end = new Date();
495
+      const start = new Date();
496
+      start.setMonth(start.getMonth() - 3);
497
+      return [start, end];
498
+    }
499
+  }
500
+]);
472
 // 处理建议
501
 // 处理建议
473
 
502
 
474
 const getposthandlingSugg = async () => {
503
 const getposthandlingSugg = async () => {

+ 20
- 22
src/views/department/addition.vue View File

126
   status: "0"
126
   status: "0"
127
 });
127
 });
128
 
128
 
129
-const submitForm = (formEl: FormInstance | undefined) => {
130
-  if (numberValidateForm.parentId == "") {
129
+const submitForm = async (formEl: FormInstance | undefined) => {
130
+  if (!formEl) return;
131
+
132
+  if (numberValidateForm.parentId === "") {
131
     numberValidateForm.parentId = tableData.value[0].id;
133
     numberValidateForm.parentId = tableData.value[0].id;
132
   }
134
   }
133
-  if (!formEl) return;
134
-  formEl.validate(async valid => {
135
+
136
+  try {
137
+    const valid = await formEl.validate();
138
+
135
     if (valid) {
139
     if (valid) {
136
-      if (route.query.type == "部门新增") {
137
-        // let obj = {
138
-        //   parentId: numberValidateForm.parentId,
139
-        //   deptName: numberValidateForm.deptName,
140
-        //   orderNum: numberValidateForm.orderNum,
141
-        //   leader: numberValidateForm.leader,
142
-        //   phone: numberValidateForm.phone,
143
-        //   email: numberValidateForm.email,
144
-        //   status: numberValidateForm.status ? 0 : 1
145
-        // };
146
-        const { data } = await platformdeptadd(numberValidateForm);
147
-        console.log(data);
140
+      let responseData;
141
+
142
+      if (route.query.type === "部门新增") {
143
+        responseData = await platformdeptadd(numberValidateForm);
148
       } else {
144
       } else {
149
-        const { data } = await platformdeptedit(numberValidateForm);
150
-        console.log(data);
145
+        responseData = await platformdeptedit(numberValidateForm);
151
       }
146
       }
152
-      router.back();
147
+
148
+      console.log(responseData.data);
149
+      router.back(); // Navigate back after success
153
     } else {
150
     } else {
154
-      console.log("error submit!");
155
-      return false;
151
+      console.error("Validation failed!");
156
     }
152
     }
157
-  });
153
+  } catch (error) {
154
+    console.error("Submission error:", error);
155
+  }
158
 };
156
 };
159
 
157
 
160
 const resetForm = (formEl: FormInstance | undefined) => {
158
 const resetForm = (formEl: FormInstance | undefined) => {

+ 1
- 1
src/views/department/index.vue View File

13
         <div>
13
         <div>
14
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;部门状态&ensp;&ensp;<el-select
14
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;部门状态&ensp;&ensp;<el-select
15
             v-model="status"
15
             v-model="status"
16
-            placeholder="Select"
16
+            placeholder="请选择"
17
             size="large"
17
             size="large"
18
             style="width: 240px"
18
             style="width: 240px"
19
           >
19
           >

+ 2
- 3
src/views/home/index.scss View File

26
 }
26
 }
27
 .grid_divright {
27
 .grid_divright {
28
   position: absolute;
28
   position: absolute;
29
-  right: 20px;
29
+  top: -10px;
30
+  right: 0;
30
   display: flex;
31
   display: flex;
31
   align-items: center;
32
   align-items: center;
32
   height: 38px;
33
   height: 38px;
33
-
34
-  // padding-top: 10px;
35
   border-bottom: 2px solid #e4e7ed;
34
   border-bottom: 2px solid #e4e7ed;
36
 }
35
 }
37
 #baroption {
36
 #baroption {

+ 339
- 68
src/views/home/index.vue View File

137
               </div>
137
               </div>
138
             </el-tabs>
138
             </el-tabs>
139
             <div class="grid_divright">
139
             <div class="grid_divright">
140
-              <div :class="recentlytype == 7 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(7)">近7日</div>
141
-              <div :class="recentlytype == 31 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(31)">近31日</div>
142
-              <div :class="recentlytype == 360 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(360)">近12月</div>
140
+              <!-- <div :class="recentlytype == 7 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(7)">日</div>
141
+              <div :class="recentlytype == 31 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(31)"></div>
142
+              <div :class="recentlytype == 360 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(360)">年</div> -->
143
               <el-date-picker
143
               <el-date-picker
144
                 v-model="value2"
144
                 v-model="value2"
145
-                type="daterange"
145
+                :type="timetype"
146
+                :shortcuts="shortcuts"
146
                 start-placeholder="开始时间"
147
                 start-placeholder="开始时间"
147
                 end-placeholder="结束时间"
148
                 end-placeholder="结束时间"
148
                 :default-value="value2"
149
                 :default-value="value2"
150
+                :format="format"
151
+                :value-format="format"
152
+                unlink-panels
153
+                size="large"
149
                 :disabled-date="pickerOptions"
154
                 :disabled-date="pickerOptions"
150
                 @change="pickerincome"
155
                 @change="pickerincome"
151
               />
156
               />
157
+              <el-select
158
+                v-model="daymonthyearvalue"
159
+                placeholder="选择日期"
160
+                size="large"
161
+                style="width: 80px"
162
+                @change="getdaymonthyear"
163
+              >
164
+                <el-option v-for="item in daymonthyear" :key="item.value" :label="item.label" :value="item.value" />
165
+              </el-select>
152
             </div>
166
             </div>
153
           </div>
167
           </div>
154
         </el-card>
168
         </el-card>
174
       <div class="cardtable">
188
       <div class="cardtable">
175
         <div>通讯状态:</div>
189
         <div>通讯状态:</div>
176
         &emsp;
190
         &emsp;
177
-        <el-select v-model="onlineStatus" placeholder="Select" size="large" style="width: 240px">
191
+        <el-select v-model="onlineStatus" placeholder="请选择" size="large" style="width: 240px">
178
           <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
192
           <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
179
         </el-select>
193
         </el-select>
180
         &emsp;
194
         &emsp;
223
     </el-card>
237
     </el-card>
224
   </div>
238
   </div>
225
 </template>
239
 </template>
226
-<!--     -->
240
+<!--  ECharte  -->
227
 <script setup lang="ts">
241
 <script setup lang="ts">
228
-import { onMounted, ref } from "vue";
242
+import { onMounted, Ref, ref } from "vue";
229
 import type { TabsPaneContext } from "element-plus";
243
 import type { TabsPaneContext } from "element-plus";
230
 import * as echarts from "echarts";
244
 import * as echarts from "echarts";
231
 import Pagination from "@/components/ProTable/components/Pagination.vue";
245
 import Pagination from "@/components/ProTable/components/Pagination.vue";
238
   multiStationpagebaseInfo,
252
   multiStationpagebaseInfo,
239
   multiStationdayMonth,
253
   multiStationdayMonth,
240
   multiStationtopyearMonth,
254
   multiStationtopyearMonth,
241
-  multiStatyearMonth
255
+  multiStatyearMonth,
256
+  multiStatiopowerMonth,
257
+  multiStationtopdayMonth,
258
+  multiStationMonthMonth
242
 } from "@/api/home/Multisite";
259
 } from "@/api/home/Multisite";
243
 const multiStation = ref();
260
 const multiStation = ref();
244
 const activeName = ref("first");
261
 const activeName = ref("first");
249
 const onlineStatus = ref("");
266
 const onlineStatus = ref("");
250
 const modelinput = ref();
267
 const modelinput = ref();
251
 const tabpropslabel = ref("收益统计");
268
 const tabpropslabel = ref("收益统计");
252
-const recentlytype = ref(7);
269
+// const recentlytype = ref(7);
253
 const options = ref([
270
 const options = ref([
254
   {
271
   {
255
     value: "",
272
     value: "",
370
   //   return "万元";
387
   //   return "万元";
371
   // }
388
   // }
372
 };
389
 };
373
-const pickerincome = (value: any) => {
374
-  value2.value = [formatDate(value[0]), formatDate(value[1])];
375
-  if (tabpropslabel.value == "收益统计") {
376
-    getmultiStation(); // 收益统计图
377
-    getmultiStationtopday(); // 收益排名图
390
+const pickerincome = () => {
391
+  // value2.value = [formatDate(value[0]), formatDate(value[1])];
378
 
392
 
379
-    getmultiStationMonth(); // 收益统计图
380
-    getmultiStationtopMonth(); // 收益排名图
393
+  if (tabpropslabel.value == "收益统计") {
394
+    if (daymonthyearvalue.value == 1) {
395
+      getmultiStation(); // 收益统计图
396
+      getmultiStationtopday(); // 收益排名图
397
+    } else if (daymonthyearvalue.value == 2) {
398
+      // getmultiStation(); // 收益统计图
399
+      // getmultiStationtopday(); // 收益排名图
400
+      getmultiStationMonthMonth();
401
+      getmultiStationtopdayMonth();
402
+    } else {
403
+      getmultiStationMonth(); // 收益统计图
404
+      getmultiStationtopMonth(); // 收益排名图
405
+    }
381
   } else {
406
   } else {
382
-    getmultiStatiopower(); // 充放电统计图
383
-    getmultiStatiopowerMonth();
407
+    if (daymonthyearvalue.value == 1) {
408
+      getmultiStatiopower(); // 充放电统计图
409
+    } else if (daymonthyearvalue.value == 2) {
410
+      // getmultiStatiopower(); // 充放电统计图
411
+      getmultisMonth();
412
+    } else {
413
+      getmultiStatiopowerMonth();
414
+    }
384
   }
415
   }
385
 };
416
 };
386
-const formatDate = (dateString: string | number | Date) => {
387
-  const date = new Date(dateString);
417
+// const formatDate = (dateString: string | number | Date) => {
418
+//   const date = new Date(dateString);
388
 
419
 
389
-  // 提取年、月、日、时、分信息
390
-  const year = date.getFullYear();
391
-  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
392
-  const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
393
-  const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
394
-  const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
420
+//   // 提取年、月、日、时、分信息
421
+//   const year = date.getFullYear();
422
+//   const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
423
+//   const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
424
+//   const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
425
+//   const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
395
 
426
 
396
-  // 拼接成 "YYYY-MM-DD HH:MM" 格式
397
-  const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
427
+//   // 拼接成 "YYYY-MM-DD HH:MM" 格式
428
+//   const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
398
 
429
 
399
-  return formattedDate;
400
-};
430
+//   return formattedDate;
431
+// };
401
 const handleClick = (tab: TabsPaneContext) => {
432
 const handleClick = (tab: TabsPaneContext) => {
402
   // if (baroption.value) {
433
   // if (baroption.value) {
403
   //   baroption.value.dispose(); //地图图表
434
   //   baroption.value.dispose(); //地图图表
404
   // }
435
   // }
405
-
406
   tabpropslabel.value = tab.props.label;
436
   tabpropslabel.value = tab.props.label;
407
-  if (tab.props.label == "收益统计") {
408
-    getmultiStationtopday(); // 收益排名图
409
-    getmultiStation();
410
-  } else {
411
-    getmultiStatiopower();
412
-  }
437
+  pickerincome();
438
+  // if (tab.props.label == "收益统计") {
439
+  //   getmultiStationtopday(); // 收益排名图
440
+  //   getmultiStation();
441
+  // } else {
442
+  //   getmultiStatiopower();
443
+  // }
413
 };
444
 };
414
 //
445
 //
415
-const recently = (val: any) => {
416
-  // 获取当前日期
417
-  recentlytype.value = val;
418
-  const today = new Date();
419
-  const currentDate = today.toLocaleDateString();
446
+const daymonthyearvalue = ref(1);
420
 
447
 
421
-  // 获取过去 7 天的日期
422
-  const sevenDaysAgoDate = new Date(today);
423
-  sevenDaysAgoDate.setDate(today.getDate() - 7);
424
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
448
+const daymonthyear = ref([
449
+  {
450
+    value: 1,
451
+    label: "日"
452
+  },
453
+  {
454
+    value: 2,
455
+    label: "月"
456
+  },
457
+  {
458
+    value: 3,
459
+    label: "年"
460
+  }
461
+]);
462
+const shortcuts = ref([
463
+  {
464
+    text: "过去7天",
465
+    value: () => {
466
+      const end = new Date();
467
+      const start = new Date();
468
+      start.setDate(start.getDate() - 7);
469
+      return [start, end];
470
+    }
471
+  },
472
+  {
473
+    text: "过去1个月",
474
+    value: () => {
475
+      const end = new Date();
476
+      const start = new Date();
477
+      start.setMonth(start.getMonth() - 1);
478
+      return [start, end];
479
+    }
480
+  },
481
+  {
482
+    text: "过去3个月",
483
+    value: () => {
484
+      const end = new Date();
485
+      const start = new Date();
486
+      start.setMonth(start.getMonth() - 3);
487
+      return [start, end];
488
+    }
489
+  }
490
+]);
491
+const timetype: Ref<any> = ref("daterange");
492
+const format = ref("YYYY-MM-DD");
493
+
494
+const getdaymonthyear = async (value: any) => {
495
+  daymonthyearvalue.value = value;
496
+  if (value == 1) {
497
+    timetype.value = "daterange";
498
+    format.value = "YYYY-MM-DD";
499
+    shortcuts.value = [
500
+      {
501
+        text: "过去7天",
502
+        value: () => {
503
+          const end = new Date();
504
+          const start = new Date();
505
+          start.setDate(start.getDate() - 7);
506
+          return [start, end];
507
+        }
508
+      },
509
+      {
510
+        text: "过去1个月",
511
+        value: () => {
512
+          const end = new Date();
513
+          const start = new Date();
514
+          start.setMonth(start.getMonth() - 1);
515
+          return [start, end];
516
+        }
517
+      },
518
+      {
519
+        text: "过去3个月",
520
+        value: () => {
521
+          const end = new Date();
522
+          const start = new Date();
523
+          start.setMonth(start.getMonth() - 3);
524
+          return [start, end];
525
+        }
526
+      }
527
+    ];
528
+    const today = new Date();
529
+    const currentDate = today.toISOString().split("T")[0];
530
+    const sevenDaysAgoDate = new Date(today);
531
+    sevenDaysAgoDate.setDate(today.getDate() - 6);
532
+    const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
533
+    value2.value = [sevenDaysAgo, currentDate];
534
+    // getreportpowerday();
535
+  } else if (value == 2) {
536
+    const today = new Date();
537
+    const currentDate = today.toISOString().split("T")[0];
538
+    const currentYearMonth = currentDate.slice(0, 7);
425
 
539
 
426
-  // 获取过去 31 天的日期
427
-  const thirtyOneDaysAgoDate = new Date(today);
428
-  thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
429
-  const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
540
+    value2.value = [currentYearMonth, currentYearMonth];
541
+    // getreportpoweryearMonth();
542
+    timetype.value = "monthrange";
543
+    format.value = "YYYY-MM";
430
 
544
 
431
-  // 获取去年同月的日期
432
-  const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
433
-  const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
545
+    shortcuts.value = [
546
+      {
547
+        text: "本月",
548
+        value: () => {
549
+          return [new Date(), new Date()];
550
+        }
551
+      },
552
+      {
553
+        text: "过去6个月",
554
+        value: () => {
555
+          const end = new Date();
556
+          const start = new Date();
557
+          start.setMonth(start.getMonth() - 6);
558
+          return [start, end];
559
+        }
560
+      },
561
+      {
562
+        text: "今年",
563
+        value: () => {
564
+          const end = new Date();
565
+          const start = new Date(new Date().getFullYear(), 0);
566
+          return [start, end];
567
+        }
568
+      }
569
+    ];
570
+  } else {
571
+    const today = new Date();
572
+    const currentDate = today.toISOString().split("T")[0];
573
+    // 获取去年同月的日期
574
+    value2.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
575
+    console.log(value2.value);
576
+    timetype.value = "yearrange";
577
+    format.value = "YYYY";
434
 
578
 
579
+    shortcuts.value = [
580
+      {
581
+        text: "今年",
582
+        value: () => {
583
+          return [new Date(), new Date()];
584
+        }
585
+      },
586
+      {
587
+        text: "过去1年",
588
+        value: () => {
589
+          const end = new Date();
590
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
591
+          return [start, end];
592
+        }
593
+      },
594
+      {
595
+        text: "过去2年",
596
+        value: () => {
597
+          const start = new Date();
598
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
599
+          return [start, end];
600
+        }
601
+      }
602
+    ];
603
+    // getreportpoweryear();
604
+  }
435
   if (tabpropslabel.value == "收益统计") {
605
   if (tabpropslabel.value == "收益统计") {
436
-    if (val == 7) {
437
-      value2.value = [sevenDaysAgo, currentDate];
438
-      getmultiStation(); // 收益统计图
439
-      getmultiStationtopday(); // 收益排名图
440
-    } else if (val == 31) {
441
-      value2.value = [thirtyOneDaysAgo, currentDate];
606
+    if (daymonthyearvalue.value == 1) {
442
       getmultiStation(); // 收益统计图
607
       getmultiStation(); // 收益统计图
443
       getmultiStationtopday(); // 收益排名图
608
       getmultiStationtopday(); // 收益排名图
609
+    } else if (daymonthyearvalue.value == 2) {
610
+      // getmultiStation(); // 收益统计图
611
+      // getmultiStationtopday(); // 收益排名图
612
+      getmultiStationMonthMonth();
613
+      getmultiStationtopdayMonth();
444
     } else {
614
     } else {
445
-      value2.value = [lastYearSameMonth, currentDate];
446
-
447
       getmultiStationMonth(); // 收益统计图
615
       getmultiStationMonth(); // 收益统计图
448
       getmultiStationtopMonth(); // 收益排名图
616
       getmultiStationtopMonth(); // 收益排名图
449
     }
617
     }
450
   } else {
618
   } else {
451
-    if (val == 7) {
452
-      value2.value = [sevenDaysAgo, currentDate];
453
-      getmultiStatiopower(); // 充放电统计图
454
-    } else if (val == 31) {
455
-      value2.value = [thirtyOneDaysAgo, currentDate];
619
+    if (daymonthyearvalue.value == 1) {
456
       getmultiStatiopower(); // 充放电统计图
620
       getmultiStatiopower(); // 充放电统计图
621
+    } else if (daymonthyearvalue.value == 2) {
622
+      // getmultiStatiopower(); // 充放电统计图
623
+      getmultisMonth();
457
     } else {
624
     } else {
458
-      value2.value = [lastYearSameMonth, currentDate];
459
       getmultiStatiopowerMonth();
625
       getmultiStatiopowerMonth();
460
     }
626
     }
461
   }
627
   }
462
 };
628
 };
629
+// const recently = (val: any) => {
630
+//   // 获取当前日期
631
+//   recentlytype.value = val;
632
+//   const today = new Date();
633
+//   const currentDate = today.toLocaleDateString();
634
+
635
+//   // 获取过去 7 天的日期
636
+//   const sevenDaysAgoDate = new Date(today);
637
+//   sevenDaysAgoDate.setDate(today.getDate() - 7);
638
+//   const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
639
+
640
+//   // 获取过去 31 天的日期
641
+//   const thirtyOneDaysAgoDate = new Date(today);
642
+//   thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
643
+//   const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
644
+
645
+//   // 获取去年同月的日期
646
+//   const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
647
+//   const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
648
+
649
+//   if (tabpropslabel.value == "收益统计") {
650
+//     if (val == 7) {
651
+//       value2.value = [sevenDaysAgo, currentDate];
652
+//       getmultiStation(); // 收益统计图
653
+//       getmultiStationtopday(); // 收益排名图
654
+//     } else if (val == 31) {
655
+//       value2.value = [thirtyOneDaysAgo, currentDate];
656
+//       getmultiStation(); // 收益统计图
657
+//       getmultiStationtopday(); // 收益排名图
658
+//     } else {
659
+//       value2.value = [lastYearSameMonth, currentDate];
660
+
661
+//       getmultiStationMonth(); // 收益统计图
662
+//       getmultiStationtopMonth(); // 收益排名图
663
+//     }
664
+//   } else {
665
+//     if (val == 7) {
666
+//       value2.value = [sevenDaysAgo, currentDate];
667
+//       getmultiStatiopower(); // 充放电统计图
668
+//     } else if (val == 31) {
669
+//       value2.value = [thirtyOneDaysAgo, currentDate];
670
+//       getmultiStatiopower(); // 充放电统计图
671
+//     } else {
672
+//       value2.value = [lastYearSameMonth, currentDate];
673
+//       getmultiStatiopowerMonth();
674
+//     }
675
+//   }
676
+// };
463
 
677
 
464
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
678
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
465
   return time.getTime(new Date()) > Date.now();
679
   return time.getTime(new Date()) > Date.now();
503
   baroptionchart(dates, profits, "收益/元");
717
   baroptionchart(dates, profits, "收益/元");
504
 };
718
 };
505
 // 收益统计图
719
 // 收益统计图
720
+const getmultiStationMonthMonth = async () => {
721
+  const { data } = await multiStationMonthMonth({ startDate: value2.value[0], endDate: value2.value[1] });
722
+  // const profits = data.map(item => item.profit);
723
+  // const dates = data.map(item => item.ymd);
724
+  const dates = [["product", "收益"]];
725
+  // console.log(data.length);
726
+
727
+  if (data.length != 0) {
728
+    for (let index = 0; index < data.length; index++) {
729
+      dates.push([data[index].ymd, data[index].profit]);
730
+    }
731
+  } else {
732
+    dates.push([value2.value[0], "50"], [value2.value[1], "120"]);
733
+  }
734
+  const profits = [{ type: "bar" }];
735
+
736
+  baroptionchart(dates, profits, "收益/元");
737
+};
738
+// 收益统计图
506
 const getmultiStationMonth = async () => {
739
 const getmultiStationMonth = async () => {
507
   const { data } = await multiStationdayMonth({ startDate: value2.value[0], endDate: value2.value[1] });
740
   const { data } = await multiStationdayMonth({ startDate: value2.value[0], endDate: value2.value[1] });
508
   // const profits = data.map(item => item.profit);
741
   // const profits = data.map(item => item.profit);
537
 
770
 
538
   baroptionchart(dates, profits, "kWh");
771
   baroptionchart(dates, profits, "kWh");
539
 };
772
 };
773
+// 充放电统计图
774
+const getmultisMonth = async () => {
775
+  const { data } = await multiStatiopowerMonth({ startDate: value2.value[0], endDate: value2.value[1] });
776
+  const dates = [["product", "充电", "放电"]];
777
+  if (data.length != 0) {
778
+    for (let index = 0; index < data.length; index++) {
779
+      dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
780
+    }
781
+  } else {
782
+    dates.push([value2.value[1], "0", "0"]);
783
+  }
784
+
785
+  const profits = [{ type: "bar" }, { type: "bar" }];
786
+
787
+  baroptionchart(dates, profits, "kWh");
788
+};
540
 // 充放电统计月份
789
 // 充放电统计月份
541
 const getmultiStatiopowerMonth = async () => {
790
 const getmultiStatiopowerMonth = async () => {
542
   const { data } = await multiStatyearMonth({ startYearMonth: value2.value[0], endYearMonth: value2.value[1] });
791
   const { data } = await multiStatyearMonth({ startYearMonth: value2.value[0], endYearMonth: value2.value[1] });
621
 
870
 
622
   baroptionincome(profitlist, stationNames);
871
   baroptionincome(profitlist, stationNames);
623
 };
872
 };
873
+// 收益排名
874
+const getmultiStationtopdayMonth = async () => {
875
+  const { data } = await multiStationtopdayMonth({ startDate: value2.value[0], endDate: value2.value[1] });
876
+  let profitlist = [];
877
+  let stationNames = [];
878
+  if (data.length != 0) {
879
+    const sortedData = data
880
+      .map(item => ({
881
+        profit: parseFloat(item.profit + "").toFixed(2), // 保留小数点后两位
882
+        stationName: item.stationName
883
+      }))
884
+      .sort((a, b) => parseFloat(a.profit) - parseFloat(b.profit)); // 确保排序时比较为数字
885
+
886
+    profitlist = sortedData.map(item => parseFloat(item.profit)); // 转回为数字
887
+    stationNames = sortedData.map(item => item.stationName);
888
+  } else {
889
+    profitlist = [60, 40, 70, 20, 80, 100, 120];
890
+    stationNames = ["演示电站一", "演示电站二", "演示电站三", "演示电站四", "演示电站五", "演示电站六", "演示电站七"];
891
+  }
892
+
893
+  baroptionincome(profitlist, stationNames);
894
+};
624
 // 收益排名月份
895
 // 收益排名月份
625
 const getmultiStationtopMonth = async () => {
896
 const getmultiStationtopMonth = async () => {
626
   const { data } = await multiStationtopyearMonth({ startDate: value2.value[0], endDate: value2.value[1] });
897
   const { data } = await multiStationtopyearMonth({ startDate: value2.value[0], endDate: value2.value[1] });
641
   );
912
   );
642
   let option = {
913
   let option = {
643
     title: {
914
     title: {
644
-      subtext: "收益排名/元"
915
+      subtext: `收益排名/元`
645
     },
916
     },
646
     tooltip: {
917
     tooltip: {
647
       trigger: "axis",
918
       trigger: "axis",

+ 313
- 94
src/views/incomeforms/index.vue View File

22
                     v-if="timetype != 'year'"
22
                     v-if="timetype != 'year'"
23
                     v-model="timepicker"
23
                     v-model="timepicker"
24
                     :type="timetype"
24
                     :type="timetype"
25
+                    :shortcuts="shortcuts"
26
+                    :format="format"
27
+                    :value-format="format"
25
                     start-placeholder="开始时间"
28
                     start-placeholder="开始时间"
26
                     end-placeholder="结束时间"
29
                     end-placeholder="结束时间"
27
-                    :default-value="timepicker"
30
+                    size="large"
28
                     :disabled-date="pickerOptions"
31
                     :disabled-date="pickerOptions"
29
-                    @change="datepicker"
32
+                  />
33
+                  <el-date-picker
34
+                    v-if="timetype == 'year'"
35
+                    v-model="timepicker"
36
+                    type="yearrange"
37
+                    :format="format"
38
+                    :value-format="format"
39
+                    :shortcuts="shortcuts"
40
+                    start-placeholder="开始时间"
41
+                    end-placeholder="结束时间"
30
                     size="large"
42
                     size="large"
43
+                    :disabled-date="pickerOptions"
31
                   />
44
                   />
32
-                  <YearPicker
45
+                  <!-- <YearPicker
33
                     v-if="timetype == 'year'"
46
                     v-if="timetype == 'year'"
34
                     style="width: 300px"
47
                     style="width: 300px"
35
                     ref="statisticPicker"
48
                     ref="statisticPicker"
38
                     :start-year1="timepicker[0]"
51
                     :start-year1="timepicker[0]"
39
                     :end-year2="timepicker[1]"
52
                     :end-year2="timepicker[1]"
40
                     @update-time-range="updateStatisticYear"
53
                     @update-time-range="updateStatisticYear"
41
-                  />
54
+                  /> -->
42
                   <el-select
55
                   <el-select
43
                     v-model="daymonthyearvalue"
56
                     v-model="daymonthyearvalue"
44
                     placeholder="选择日期"
57
                     placeholder="选择日期"
134
                     v-if="pickertype != 'year'"
147
                     v-if="pickertype != 'year'"
135
                     v-model="starttime"
148
                     v-model="starttime"
136
                     :type="pickertype"
149
                     :type="pickertype"
137
-                    placeholder="选择时间"
150
+                    :shortcuts="shortcuts"
151
+                    :format="format"
152
+                    :value-format="format"
153
+                    start-placeholder="开始时间"
154
+                    end-placeholder="结束时间"
138
                     size="large"
155
                     size="large"
139
                     clearable
156
                     clearable
140
                     :disabled-date="pickerOptions"
157
                     :disabled-date="pickerOptions"
141
-                    @change="yearstarttime"
142
                   />
158
                   />
143
-                  <YearPicker
159
+                  <el-date-picker
160
+                    v-if="pickertype == 'year'"
161
+                    v-model="starttime"
162
+                    type="yearrange"
163
+                    :format="format"
164
+                    :value-format="format"
165
+                    :shortcuts="shortcuts"
166
+                    start-placeholder="开始时间"
167
+                    end-placeholder="结束时间"
168
+                    size="large"
169
+                    :disabled-date="pickerOptions"
170
+                  />
171
+                  <!-- <YearPicker
144
                     v-if="pickertype == 'year'"
172
                     v-if="pickertype == 'year'"
145
                     style="width: 300px"
173
                     style="width: 300px"
146
                     ref="statisticPicker"
174
                     ref="statisticPicker"
149
                     :start-year1="starttime[0]"
177
                     :start-year1="starttime[0]"
150
                     :end-year2="starttime[1]"
178
                     :end-year2="starttime[1]"
151
                     @update-time-range="updateStatisticYear1"
179
                     @update-time-range="updateStatisticYear1"
152
-                  />
180
+                  /> -->
153
                 </div>
181
                 </div>
154
                 &ensp;&ensp;
182
                 &ensp;&ensp;
155
 
183
 
242
   singlemonthExcel,
270
   singlemonthExcel,
243
   singleyeaeExcel
271
   singleyeaeExcel
244
 } from "@/api/home/Multisite";
272
 } from "@/api/home/Multisite";
245
-import YearPicker from "@/components/year/index.vue";
246
-// import { YearPicker } from "../../components/year/index.vue";
247
 import { other, Station } from "@/api/interface";
273
 import { other, Station } from "@/api/interface";
248
 import { useAuthButtons } from "@/hooks/useAuthButtons";
274
 import { useAuthButtons } from "@/hooks/useAuthButtons";
249
 const { BUTTONS } = useAuthButtons();
275
 const { BUTTONS } = useAuthButtons();
322
   },
348
   },
323
   {
349
   {
324
     prop: "overallEfficiency",
350
     prop: "overallEfficiency",
325
-    label: "(元)",
351
+    label: "应收益(元)",
326
     ifcolumn: true,
352
     ifcolumn: true,
327
     children: null
353
     children: null
328
   }
354
   }
398
         ifcolumn: true
424
         ifcolumn: true
399
       }
425
       }
400
     ]
426
     ]
401
-  }
427
+  },
402
   // ,
428
   // ,
403
   // {
429
   // {
404
   //   prop: "overallEfficiency",
430
   //   prop: "overallEfficiency",
406
   //   ifcolumn: true,
432
   //   ifcolumn: true,
407
   //   children: null
433
   //   children: null
408
   // }
434
   // }
435
+  {
436
+    prop: "overallEfficiency",
437
+    label: "应收益(元)",
438
+    ifcolumn: true,
439
+    children: null
440
+  }
409
 ]);
441
 ]);
442
+//
410
 const currentDate = ref();
443
 const currentDate = ref();
411
 const activeName = ref("站点汇总");
444
 const activeName = ref("站点汇总");
445
+
412
 const handleClick = async (val: any) => {
446
 const handleClick = async (val: any) => {
413
-  // activeName.value
414
   activeName.value = val.props.name;
447
   activeName.value = val.props.name;
415
   if (val.props.name == "站点汇总") {
448
   if (val.props.name == "站点汇总") {
449
+    getdaymonthyear(1);
450
+    gatSummary();
416
   } else {
451
   } else {
417
-    reportformsindex.value = 2;
418
     await poststationstationName();
452
     await poststationstationName();
419
-    await onreportforms(reportformsindex.value);
453
+    await onreportforms(2);
420
   }
454
   }
421
 };
455
 };
422
 const timepicker: Ref<any> = ref([]);
456
 const timepicker: Ref<any> = ref([]);
423
-//可选择区间,initYear传参,不传则所有年份有效,小于0判断一下?
424
-const dateValue = ref<any>({ startYear: 2000, endYear: new Date().getFullYear() });
425
-//选完/输入完成的回调
426
-const updateStatisticYear: any = (startYear: number, endYear: number) => {
427
-  timepicker.value = [startYear + "", endYear + ""];
428
-  getreportpoweryear();
429
-};
430
-//选完/输入完成的回调
431
-const updateStatisticYear1: any = (startYear: number, endYear: number) => {
432
-  starttime.value = [startYear + "", endYear + ""];
433
-  getsingleincomeyear();
434
-};
435
-// 格式化时间
457
+
458
+// 禁用日期
436
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
459
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
437
   return time.getTime(new Date()) > Date.now();
460
   return time.getTime(new Date()) > Date.now();
438
 };
461
 };
439
 // 选择时间
462
 // 选择时间
440
-const datepicker = (val: any) => {
441
-  timepicker.value = [formatDate(val[0]), formatDate(val[1])];
442
-};
463
+// const datepicker = (val: any) => {
464
+//   timepicker.value = [formatDate(val[0]), formatDate(val[1])];
465
+// };
443
 // 选择日期
466
 // 选择日期
444
 const daymonthyearvalue = ref(1);
467
 const daymonthyearvalue = ref(1);
468
+
469
+const shortcuts = ref([
470
+  {
471
+    text: "过去7天",
472
+    value: () => {
473
+      const end = new Date();
474
+      const start = new Date();
475
+      start.setDate(start.getDate() - 7);
476
+      return [start, end];
477
+    }
478
+  },
479
+  {
480
+    text: "过去1个月",
481
+    value: () => {
482
+      const end = new Date();
483
+      const start = new Date();
484
+      start.setMonth(start.getMonth() - 1);
485
+      return [start, end];
486
+    }
487
+  },
488
+  {
489
+    text: "过去3个月",
490
+    value: () => {
491
+      const end = new Date();
492
+      const start = new Date();
493
+      start.setMonth(start.getMonth() - 3);
494
+      return [start, end];
495
+    }
496
+  }
497
+]);
445
 const daymonthyear = ref([
498
 const daymonthyear = ref([
446
   {
499
   {
447
     value: 1,
500
     value: 1,
457
   }
510
   }
458
 ]);
511
 ]);
459
 const timetype: Ref<any> = ref("daterange");
512
 const timetype: Ref<any> = ref("daterange");
513
+const format = ref("YYYY-MM-DD");
460
 
514
 
461
 const getdaymonthyear = async (value: any) => {
515
 const getdaymonthyear = async (value: any) => {
462
   daymonthyearvalue.value = value;
516
   daymonthyearvalue.value = value;
463
   if (value == 1) {
517
   if (value == 1) {
464
     timetype.value = "daterange";
518
     timetype.value = "daterange";
465
-
519
+    format.value = "YYYY-MM-DD";
520
+    shortcuts.value = [
521
+      {
522
+        text: "过去7天",
523
+        value: () => {
524
+          const end = new Date();
525
+          const start = new Date();
526
+          start.setDate(start.getDate() - 7);
527
+          return [start, end];
528
+        }
529
+      },
530
+      {
531
+        text: "过去1个月",
532
+        value: () => {
533
+          const end = new Date();
534
+          const start = new Date();
535
+          start.setMonth(start.getMonth() - 1);
536
+          return [start, end];
537
+        }
538
+      },
539
+      {
540
+        text: "过去3个月",
541
+        value: () => {
542
+          const end = new Date();
543
+          const start = new Date();
544
+          start.setMonth(start.getMonth() - 3);
545
+          return [start, end];
546
+        }
547
+      }
548
+    ];
466
     const today = new Date();
549
     const today = new Date();
467
-    const currentDate = today.toLocaleDateString();
550
+    const currentDate = today.toISOString().split("T")[0];
468
     timepicker.value = [currentDate, currentDate];
551
     timepicker.value = [currentDate, currentDate];
469
-    getreportpowerday();
552
+    // getreportpowerday();
470
   } else if (value == 2) {
553
   } else if (value == 2) {
554
+    const today = new Date();
555
+    const currentDate = today.toISOString().split("T")[0];
556
+    const currentYearMonth = currentDate.slice(0, 7);
557
+
558
+    timepicker.value = [currentYearMonth, currentYearMonth];
559
+    // getreportpoweryearMonth();
471
     timetype.value = "monthrange";
560
     timetype.value = "monthrange";
561
+    format.value = "YYYY-MM";
472
 
562
 
473
-    const today = new Date();
474
-    const currentDate = today.toLocaleDateString();
475
-    // 获取过去 31 天的日期
476
-    const thirtyOneDaysAgoDate = new Date(today);
477
-    thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
478
-    const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
479
-    timepicker.value = [thirtyOneDaysAgo, currentDate];
480
-    getreportpoweryearMonth();
563
+    shortcuts.value = [
564
+      {
565
+        text: "本月",
566
+        value: () => {
567
+          return [new Date(), new Date()];
568
+        }
569
+      },
570
+      {
571
+        text: "过去6个月",
572
+        value: () => {
573
+          const end = new Date();
574
+          const start = new Date();
575
+          start.setMonth(start.getMonth() - 6);
576
+          return [start, end];
577
+        }
578
+      },
579
+      {
580
+        text: "今年",
581
+        value: () => {
582
+          const end = new Date();
583
+          const start = new Date(new Date().getFullYear(), 0);
584
+          return [start, end];
585
+        }
586
+      }
587
+    ];
481
   } else {
588
   } else {
482
-    timetype.value = "year";
483
-
484
     const today = new Date();
589
     const today = new Date();
485
-    const currentDate = today.toLocaleDateString();
590
+    const currentDate = today.toISOString().split("T")[0];
486
     // 获取去年同月的日期
591
     // 获取去年同月的日期
487
-    const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
488
-    const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
489
-    timepicker.value = [lastYearSameMonth.substring(0, 4), currentDate.substring(0, 4)];
490
-    getreportpoweryear();
592
+    timepicker.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
593
+    console.log(timepicker.value);
594
+    timetype.value = "yearrange";
595
+    format.value = "YYYY";
596
+
597
+    shortcuts.value = [
598
+      {
599
+        text: "今年",
600
+        value: () => {
601
+          return [new Date(), new Date()];
602
+        }
603
+      },
604
+      {
605
+        text: "过去1年",
606
+        value: () => {
607
+          const end = new Date();
608
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
609
+          return [start, end];
610
+        }
611
+      },
612
+      {
613
+        text: "过去2年",
614
+        value: () => {
615
+          const start = new Date();
616
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
617
+          return [start, end];
618
+        }
619
+      }
620
+    ];
621
+    // getreportpoweryear();
491
   }
622
   }
492
 };
623
 };
624
+
493
 // 查询
625
 // 查询
494
 const gatSummary = () => {
626
 const gatSummary = () => {
495
-  getdaymonthyear(daymonthyearvalue.value);
627
+  if (daymonthyearvalue.value == 1) {
628
+    getreportpowerday();
629
+  } else if (daymonthyearvalue.value == 2) {
630
+    getreportpoweryearMonth();
631
+  } else if (daymonthyearvalue.value == 3) {
632
+    getreportpoweryear();
633
+  }
496
 };
634
 };
497
 // 重置
635
 // 重置
498
 const onreset = () => {
636
 const onreset = () => {
701
 const formatTime = (time: number) => {
839
 const formatTime = (time: number) => {
702
   return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
840
   return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
703
 };
841
 };
704
-const formatDate = (dateString: string | number | Date) => {
705
-  const date = new Date(dateString);
842
+// const formatDate = (dateString: string | number | Date) => {
843
+//   const date = new Date(dateString);
706
 
844
 
707
-  // 提取年、月、日、时、分信息
708
-  const year = date.getFullYear();
709
-  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
710
-  const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
711
-  const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
712
-  const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
845
+//   // 提取年、月、日、时、分信息
846
+//   const year = date.getFullYear();
847
+//   const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
848
+//   const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
849
+//   const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
850
+//   const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
713
 
851
 
714
-  // 拼接成 "YYYY-MM-DD HH:MM" 格式
715
-  const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
852
+//   // 拼接成 "YYYY-MM-DD HH:MM" 格式
853
+//   const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
716
 
854
 
717
-  return formattedDate;
718
-};
855
+//   return formattedDate;
856
+// };
719
 const tableData = ref();
857
 const tableData = ref();
720
 
858
 
721
 // 日
859
 // 日
755
 
893
 
756
 const reportformsindex = ref(2);
894
 const reportformsindex = ref(2);
757
 const pickertype: Ref<any> = ref("daterange");
895
 const pickertype: Ref<any> = ref("daterange");
758
-
759
 const onreportforms = (val: any) => {
896
 const onreportforms = (val: any) => {
760
   reportformsindex.value = val;
897
   reportformsindex.value = val;
761
-  if (val == 2) {
898
+
899
+  if (val == 1) {
900
+    pickertype.value = "date";
901
+    starttime.value = currentDate.value;
902
+  } else if (val == 2) {
903
+    shortcuts.value = [
904
+      {
905
+        text: "过去7天",
906
+        value: () => {
907
+          const end = new Date();
908
+          const start = new Date();
909
+          start.setDate(start.getDate() - 7);
910
+          return [start, end];
911
+        }
912
+      },
913
+      {
914
+        text: "过去1个月",
915
+        value: () => {
916
+          const end = new Date();
917
+          const start = new Date();
918
+          start.setMonth(start.getMonth() - 1);
919
+          return [start, end];
920
+        }
921
+      },
922
+      {
923
+        text: "过去3个月",
924
+        value: () => {
925
+          const end = new Date();
926
+          const start = new Date();
927
+          start.setMonth(start.getMonth() - 3);
928
+          return [start, end];
929
+        }
930
+      }
931
+    ];
762
     pickertype.value = "daterange";
932
     pickertype.value = "daterange";
933
+    format.value = "YYYY-MM-DD";
763
     const today = new Date();
934
     const today = new Date();
764
-    const currentDate = today.toLocaleDateString();
935
+    const currentDate = today.toISOString().split("T")[0];
765
     starttime.value = [currentDate, currentDate];
936
     starttime.value = [currentDate, currentDate];
766
-    getsingleincomeday();
767
   } else if (val == 3) {
937
   } else if (val == 3) {
768
-    pickertype.value = "monthrange";
769
     const today = new Date();
938
     const today = new Date();
770
-    const currentDate = today.toLocaleDateString();
771
-    // 获取过去 31 天的日期
772
-    const thirtyOneDaysAgoDate = new Date(today);
773
-    thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
774
-    const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
775
-    starttime.value = [thirtyOneDaysAgo, currentDate];
776
-    getsingleincomeyearMonth();
939
+    const currentDate = today.toISOString().split("T")[0];
940
+    const currentYearMonth = currentDate.slice(0, 7);
941
+    starttime.value = [currentYearMonth, currentYearMonth];
942
+    format.value = "YYYY-MM";
943
+    pickertype.value = "monthrange";
944
+
945
+    shortcuts.value = [
946
+      {
947
+        text: "本月",
948
+        value: () => {
949
+          return [new Date(), new Date()];
950
+        }
951
+      },
952
+      {
953
+        text: "过去6个月",
954
+        value: () => {
955
+          const end = new Date();
956
+          const start = new Date();
957
+          start.setMonth(start.getMonth() - 6);
958
+          return [start, end];
959
+        }
960
+      },
961
+      {
962
+        text: "今年",
963
+        value: () => {
964
+          const end = new Date();
965
+          const start = new Date(new Date().getFullYear(), 0);
966
+          return [start, end];
967
+        }
968
+      }
969
+    ];
777
   } else if (val == 4) {
970
   } else if (val == 4) {
778
-    pickertype.value = "year";
779
     const today = new Date();
971
     const today = new Date();
780
-    const currentDate = today.toLocaleDateString();
972
+    const currentDate = today.toISOString().split("T")[0];
781
     // 获取去年同月的日期
973
     // 获取去年同月的日期
782
-    const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
783
-    const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
784
-    starttime.value = [lastYearSameMonth.substring(0, 4), currentDate.substring(0, 4)];
785
-    getsingleincomeyear();
974
+    starttime.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
975
+    pickertype.value = "yearrange";
976
+    format.value = "YYYY";
977
+
978
+    shortcuts.value = [
979
+      {
980
+        text: "今年",
981
+        value: () => {
982
+          return [new Date(), new Date()];
983
+        }
984
+      },
985
+      {
986
+        text: "过去1年",
987
+        value: () => {
988
+          const end = new Date();
989
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
990
+          return [start, end];
991
+        }
992
+      },
993
+      {
994
+        text: "过去2年",
995
+        value: () => {
996
+          const start = new Date();
997
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
998
+          return [start, end];
999
+        }
1000
+      }
1001
+    ];
786
   }
1002
   }
1003
+  onselectsite();
787
 };
1004
 };
788
 
1005
 
789
 // 选择站点
1006
 // 选择站点
802
 // 选择日期
1019
 // 选择日期
803
 const starttime: Ref<any> = ref("");
1020
 const starttime: Ref<any> = ref("");
804
 // 开始时间
1021
 // 开始时间
805
-const yearstarttime = async (val: any) => {
806
-  if (reportformsindex.value == 1) {
807
-  } else if (reportformsindex.value == 2) {
808
-    starttime.value = [formatDate(val[0]), formatDate(val[1])];
809
-  } else if (reportformsindex.value == 3) {
810
-    starttime.value = [formatDate(val[0]), formatDate(val[1])];
811
-  } else if (reportformsindex.value == 4) {
812
-    for (let index = 0; index < val.length; index++) {
813
-      val[index] = formatDate(val[index]);
814
-    }
815
-    starttime.value = val;
816
-  }
817
-};
1022
+// const yearstarttime = async (val: any) => {
1023
+//   if (reportformsindex.value == 1) {
1024
+//   } else if (reportformsindex.value == 2) {
1025
+//     starttime.value = [formatDate(val[0]), formatDate(val[1])];
1026
+//   } else if (reportformsindex.value == 3) {
1027
+//     starttime.value = [formatDate(val[0]), formatDate(val[1])];
1028
+//   } else if (reportformsindex.value == 4) {
1029
+//     for (let index = 0; index < val.length; index++) {
1030
+//       val[index] = formatDate(val[index]);
1031
+//     }
1032
+//     starttime.value = val;
1033
+//   }
1034
+// };
818
 
1035
 
819
 // 查询
1036
 // 查询
820
 const onselectsite = async () => {
1037
 const onselectsite = async () => {
929
 <style scoped lang="scss">
1146
 <style scoped lang="scss">
930
 @import "./index.scss";
1147
 @import "./index.scss";
931
 </style>
1148
 </style>
932
-<!-- -->
1149
+<!--
1150
+
1151
+-->

+ 32
- 0
src/views/localdata/index.scss View File

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
+}
29
+.lexce {
30
+  margin-top: 20px;
31
+  font-size: 16px;
32
+}

+ 300
- 0
src/views/localdata/index.vue View File

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
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;标题翻译&ensp;&ensp;
36
+          <el-select
37
+            v-model="translate.user.peekType"
38
+            placeholder="请选择设备类型"
39
+            size="large"
40
+            style="width: 240px"
41
+            clearable
42
+            @change="ontranslate"
43
+          >
44
+            <el-option v-for="item in translatelist" :key="item.id" :label="item.value" :value="item.id" />
45
+          </el-select>
46
+        </div>
47
+      </div>
48
+      <div class="screen1">
49
+        <div>
50
+          时间范围&ensp;&ensp;
51
+          <el-date-picker
52
+            size="large"
53
+            v-model="timevalue"
54
+            :shortcuts="shortcuts"
55
+            type="daterange"
56
+            start-placeholder="开始时间"
57
+            end-placeholder="结束时间"
58
+            :default-value="timevalue"
59
+            :disabled-date="pickerOptions"
60
+            value-format="YYYY-MM-DD"
61
+            format="YYYY-MM-DD"
62
+          />
63
+        </div>
64
+        &ensp;&ensp; &ensp;&ensp;
65
+        <div>
66
+          <el-button type="primary" size="large" color="#0052d9" @click="query(0)">查询</el-button>
67
+          <el-button type="primary" size="large" color="#0052d9" @click="newaddition">导出</el-button>
68
+          <el-button size="large" @click="query(1)">重置</el-button>&ensp;&ensp;
69
+        </div>
70
+      </div>
71
+    </div> -->
72
+    <div class="card cardbottom">
73
+      <div>&ensp;</div>
74
+      <el-table
75
+        :data="tableData.children"
76
+        row-key="name"
77
+        :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
78
+        style="width: 100%"
79
+        border
80
+        @row-click="handleRowClick"
81
+      >
82
+        <!-- <el-table-column/> -->
83
+        <!-- <el-table-column width="250" :show-overflow-tooltip="true" v-for="item in head" :key="item" :prop="item" :label="item" /> -->
84
+        <!-- <el-table-column type="selection" width="55" :selectable="selectable" /> -->
85
+        <el-table-column prop="name" label="文件名称" />
86
+        <el-table-column prop="size" label="文件大小" />
87
+        <el-table-column prop="type" label="文件类型" />
88
+        <el-table-column label="操作" align="center" width="180">
89
+          <template #default="scope">
90
+            <el-button v-if="scope.row.type == 'file'" @click="downloadxlsx(row.name)">下载</el-button>
91
+          </template>
92
+        </el-table-column>
93
+      </el-table>
94
+      <!-- 分页 组件 -->
95
+      <!-- <div class="pagination">
96
+        <div></div>
97
+        <slot name="pagination">
98
+          <Pagination :pageable="pageable" :handle-size-change="handleSizeChange" :handle-current-change="handleCurrentChange" />
99
+        </slot>
100
+      </div> -->
101
+    </div>
102
+    <el-dialog v-model="dialogVisible" title="导出中" top="300px" width="40%" @close="handleClose">
103
+      <div class="lexce">{{ message }}</div>
104
+      <template #footer>
105
+        <div class="dialog-footer" v-if="excelexport">
106
+          <el-button v-if="excelexport.progress == 0" @click="handleClose">取消导出</el-button>
107
+          <el-button v-if="excelexport.progress == 3" type="primary" @click="handleClose"> 确定 </el-button>
108
+        </div>
109
+      </template>
110
+    </el-dialog>
111
+  </div>
112
+</template>
113
+<!--    -->
114
+<script setup lang="ts">
115
+import { directorylURL, stationstationName, selectaccountNumber } from "@/api/home/Multisite";
116
+import { onMounted, Ref, ref } from "vue";
117
+// import { useAuthButtons } from "@/hooks/useAuthButtons";
118
+// const { BUTTONS } = useAuthButtons();
119
+import { Station } from "@/api/interface";
120
+// import Pagination from "@/components/ProTable/components/Pagination.vue";
121
+import { TreeNode } from "element-plus";
122
+// import { saveAs } from "file-saver";
123
+// import axios from "axios";
124
+
125
+// import { useRouter } from "vue-router";
126
+// const router = useRouter();
127
+const translate = ref();
128
+
129
+const cities: Ref<Station.todo[]> = ref([]);
130
+
131
+const timevalue: Ref<any> = ref([]);
132
+
133
+const poststationstationName = async () => {
134
+  const { data } = await stationstationName({});
135
+  cities.value = data;
136
+};
137
+
138
+const dialogVisible = ref(false);
139
+const message = ref("");
140
+
141
+const timerId = ref();
142
+
143
+const excelexport = ref();
144
+const handleClose = async () => {
145
+  if (timerId.value) {
146
+    clearTimeout(timerId.value);
147
+    timerId.value = ""; // 清除引用
148
+    dialogVisible.value = false;
149
+  }
150
+};
151
+
152
+const tableData = ref();
153
+
154
+const head = ref();
155
+const pageable = ref({
156
+  pn: 1,
157
+  ps: 10,
158
+  total: 0
159
+});
160
+// 表格操作 Hooks
161
+// const handleSizeChange = async (e: any) => {
162
+//   pageable.value.ps = e;
163
+//   getplatformuserlist();
164
+// };
165
+// const handleCurrentChange = async (e: any) => {
166
+//   pageable.value.pn = e;
167
+
168
+//   getplatformuserlist();
169
+// };
170
+// 文件 编辑 选择
171
+// interface User {
172
+//   size: number;
173
+//   name: string;
174
+//   type: string;
175
+//   children?: User[];
176
+// }
177
+// const treeProps = reactive({
178
+//   checkStrictly: false
179
+// });
180
+// const selectable = (row: any) => {
181
+//   console.log(row);
182
+// };
183
+const currentPath = ref();
184
+const handleRowClick = (node: TreeNode) => {
185
+  // 获取当前点击行的所有父级名称
186
+  const parentNames = getParentNames(tableData.value, node, []);
187
+  console.log("点击的节点: ", node); // 输出当前点击节点
188
+  // 拼接成字符串
189
+  currentPath.value = parentNames?.join("/"); // 不反转顺序,确保路径是从根节点到目标节点的顺序
190
+  console.log("父级路径: ", currentPath.value); // 输出拼接后的父级路径
191
+};
192
+
193
+// 明确指定参数类型和返回类型
194
+const getParentNames = (currentNode: any, targetNode: any, parentNames: string[]): string[] | null => {
195
+  // 如果找到了目标节点
196
+  if (currentNode.name === targetNode.name) {
197
+    parentNames.push(currentNode.name); // 添加当前节点的名称到父级路径
198
+    return parentNames;
199
+  }
200
+
201
+  // 如果当前节点有子节点,递归查找
202
+  if (currentNode.children && currentNode.children.length) {
203
+    const newParentNames = [...parentNames, currentNode.name]; // 创建新的父级名称数组
204
+    for (let child of currentNode.children) {
205
+      const result = getParentNames(child, targetNode, newParentNames);
206
+      if (result) return result;
207
+    }
208
+  }
209
+
210
+  // 如果没有找到,返回 null
211
+  return null;
212
+};
213
+
214
+// const downloadFile = async () => {
215
+// setTimeout(async () => {
216
+//   try {
217
+//     const fileUrl = `https://esos-iot.bjdexn.cn/Thisitem_20241029.tar.gz`;
218
+//     const response = await axios.get(fileUrl, { responseType: "blob" });
219
+//     const fileName = "Thisitem_20241029.tar.gz".split("/").pop();
220
+//     saveAs(response.data, fileName);
221
+//   } catch (error) {
222
+//     console.error("下载失败:", error);
223
+//   }
224
+// }, 2000);
225
+// };
226
+// https://esos-iot.bjdexn.cn/myDeviceData/Thisitem_20241029.tar.gz
227
+const downloadxlsx = (name: any) => {
228
+  let fileUrl = `myDeviceData/${name}`;
229
+  let fileName = name;
230
+  fetch(fileUrl)
231
+    .then(response => response.blob())
232
+    .then(blob => {
233
+      // 创建一个临时的URL对象
234
+      const url = URL.createObjectURL(blob);
235
+      // 创建一个隐藏的<a>标签,并设置其href属性为临时URL
236
+      const a = document.createElement("a");
237
+      a.href = url;
238
+      a.download = fileName; // 设置下载的文件名
239
+      a.style.display = "none";
240
+      // 将<a>标签添加到文档中,并模拟点击下载
241
+      document.body.appendChild(a);
242
+      a.click();
243
+      // 下载完成后,移除<a>标签和临时URL对象
244
+      document.body.removeChild(a);
245
+      URL.revokeObjectURL(url);
246
+    })
247
+    .catch(error => {
248
+      console.error("下载文件时出错:", error);
249
+    });
250
+};
251
+
252
+const getplatformuserlist = async () => {
253
+  // let obj = {
254
+  //   powerId: status.value,
255
+  //   eId: emsDeviceId.value,
256
+  //   startTime: timevalue.value[0],
257
+  //   endTime: timevalue.value[1],
258
+  //   peek: quipment.value,
259
+  //   pageNum: pageable.value.pn,
260
+  //   pageSize: pageable.value.ps
261
+  // };
262
+  const { data } = await directorylURL();
263
+
264
+  tableData.value = data;
265
+
266
+  head.value = Object.keys(tableData.value.list[0]);
267
+  pageable.value.total = tableData.value.page.totald;
268
+};
269
+const currentDate = ref();
270
+
271
+const selectaccountNumberlist = async () => {
272
+  const { data } = await selectaccountNumber({});
273
+  console.log(data);
274
+  translate.value = data;
275
+};
276
+
277
+onMounted(() => {
278
+  const current = localStorage.getItem("currentDate");
279
+  if (current) {
280
+    currentDate.value = current;
281
+  }
282
+  const today = new Date();
283
+  const sevenDaysAgo = new Date(today);
284
+  sevenDaysAgo.setDate(today.getDate() - 7);
285
+  const sevenDaysAgoDate = sevenDaysAgo.toISOString().split("T")[0];
286
+
287
+  timevalue.value = [currentDate.value, sevenDaysAgoDate];
288
+  console.log(timevalue.value);
289
+
290
+  getplatformuserlist();
291
+  poststationstationName();
292
+  selectaccountNumberlist();
293
+});
294
+</script>
295
+<style scoped lang="scss">
296
+@import "./index.scss";
297
+</style>
298
+<!--
299
+
300
+-->

+ 1
- 1
src/views/login/components/LoginForm.vue View File

105
         // 用户
105
         // 用户
106
         const { data } = await loginApi({
106
         const { data } = await loginApi({
107
           ...loginForm,
107
           ...loginForm,
108
-          rememberMe: true
108
+          rememberMe: false
109
         });
109
         });
110
         console.log(data);
110
         console.log(data);
111
 
111
 

+ 1
- 1
src/views/menu/index.vue View File

13
         <div>
13
         <div>
14
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;菜单状态&ensp;&ensp;<el-select
14
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;菜单状态&ensp;&ensp;<el-select
15
             v-model="visible"
15
             v-model="visible"
16
-            placeholder="Select"
16
+            placeholder="请选择"
17
             size="large"
17
             size="large"
18
             style="width: 240px"
18
             style="width: 240px"
19
           >
19
           >

+ 20
- 11
src/views/monitor/add.vue View File

137
     label: "系统"
137
     label: "系统"
138
   }
138
   }
139
 ]);
139
 ]);
140
-const submitForm = (formEl: FormInstance | undefined) => {
140
+const submitForm = async (formEl: FormInstance | undefined) => {
141
   if (!formEl) return;
141
   if (!formEl) return;
142
-  formEl.validate(async valid => {
142
+
143
+  try {
144
+    const valid = await formEl.validate();
145
+
143
     if (valid) {
146
     if (valid) {
144
       if (!ExpressionIsValid.value) {
147
       if (!ExpressionIsValid.value) {
145
         ElMessage.error("表达式不正确");
148
         ElMessage.error("表达式不正确");
146
         return false;
149
         return false;
147
       }
150
       }
148
-      if (route.query.type == "任务新增") {
149
-        const { data } = await monitorjobadd(numberValidateForm);
150
-        console.log(data);
151
+
152
+      let responseData;
153
+
154
+      if (route.query.type === "任务新增") {
155
+        responseData = await monitorjobadd(numberValidateForm);
151
       } else {
156
       } else {
152
-        const { data } = await monitorjobedit(numberValidateForm);
153
-        console.log(data);
157
+        responseData = await monitorjobedit(numberValidateForm);
154
       }
158
       }
155
-      router.back();
159
+
160
+      console.log(responseData.data);
161
+      ElMessage.success("操作成功"); // Provide success feedback
162
+      router.back(); // Navigate back after success
156
     } else {
163
     } else {
157
-      console.log("error submit!");
158
-      return false;
164
+      console.log("Validation failed!");
159
     }
165
     }
160
-  });
166
+  } catch (error) {
167
+    console.error("Submission error:", error);
168
+    ElMessage.error("提交失败,请重试!"); // Optional error feedback
169
+  }
161
 };
170
 };
162
 const ExpressionIsValid = ref();
171
 const ExpressionIsValid = ref();
163
 
172
 

+ 5
- 2
src/views/overview/index.scss View File

1
-/* 去除边框 */
1
+// /*  */
2
 .title {
2
 .title {
3
   margin-bottom: 20px;
3
   margin-bottom: 20px;
4
   :deep(.el-select__wrapper) {
4
   :deep(.el-select__wrapper) {
79
 }
79
 }
80
 .grid_divright {
80
 .grid_divright {
81
   position: absolute;
81
   position: absolute;
82
+  top: 0;
82
   right: 20px;
83
   right: 20px;
83
   display: flex;
84
   display: flex;
84
   align-items: center;
85
   align-items: center;
311
   justify-content: space-between;
312
   justify-content: space-between;
312
   width: 100%;
313
   width: 100%;
313
   height: 65px;
314
   height: 65px;
314
-  padding: 0 20px;
315
+  padding: 0;
315
   border-bottom: 1px solid #e8e8e8;
316
   border-bottom: 1px solid #e8e8e8;
316
 }
317
 }
317
 .middleleftchart {
318
 .middleleftchart {
389
 .dialog_name {
390
 .dialog_name {
390
   border-right: 1px solid rgb(0 0 0 / 5%);
391
   border-right: 1px solid rgb(0 0 0 / 5%);
391
 }
392
 }
393
+
394
+// 日期 尖 峰 平 股

+ 398
- 98
src/views/overview/index.vue View File

159
               </div>
159
               </div>
160
             </el-tabs>
160
             </el-tabs>
161
             <div class="grid_divright">
161
             <div class="grid_divright">
162
-              <div :class="recentlytype == 7 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(7)">近7日</div>
162
+              <!-- <div :class="recentlytype == 7 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(7)">近7日</div>
163
               <div :class="recentlytype == 31 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(31)">近31日</div>
163
               <div :class="recentlytype == 31 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(31)">近31日</div>
164
-              <div :class="recentlytype == 360 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(360)">近12月</div>
164
+              <div :class="recentlytype == 360 ? 'grid_divright_1' : 'grid_divright_2'" @click="recently(360)">近12月</div> -->
165
               <el-date-picker
165
               <el-date-picker
166
                 v-model="value2"
166
                 v-model="value2"
167
-                type="daterange"
167
+                :type="timetype1"
168
+                :shortcuts="shortcuts1"
169
+                :format="format1"
170
+                :value-format="format1"
168
                 start-placeholder="开始时间"
171
                 start-placeholder="开始时间"
169
                 end-placeholder="结束时间"
172
                 end-placeholder="结束时间"
170
                 :default-value="value2"
173
                 :default-value="value2"
171
                 :disabled-date="pickerOptions"
174
                 :disabled-date="pickerOptions"
172
-                value-format="YYYY-MM-DD hh:mm:ss"
175
+                size="large"
173
                 @change="onhandleClick"
176
                 @change="onhandleClick"
174
                 :default-time="defaultTime2"
177
                 :default-time="defaultTime2"
175
               />
178
               />
179
+              <el-select
180
+                v-model="daymonthyearvalue1"
181
+                placeholder="选择日期"
182
+                size="large"
183
+                style="width: 80px"
184
+                @change="getdaymonthyear1"
185
+              >
186
+                <el-option v-for="item in daymonthyear1" :key="item.value" :label="item.label" :value="item.value" />
187
+              </el-select>
176
             </div>
188
             </div>
177
           </div>
189
           </div>
178
         </el-card>
190
         </el-card>
220
             <div>综合功率</div>
232
             <div>综合功率</div>
221
 
233
 
222
             <div class="middle_divright">
234
             <div class="middle_divright">
223
-              <div :class="timedays == 7 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(7)">近7日</div>
235
+              <!-- <div :class="timedays == 7 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(7)">近7日</div>
224
               <div :class="timedays == 31 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(31)">近31日</div>
236
               <div :class="timedays == 31 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(31)">近31日</div>
225
-              <div :class="timedays == 360 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(360)">近12月</div>
237
+              <div :class="timedays == 360 ? 'middle_divright_1' : 'middle_divright_2'" @click="oncomprehen(360)">近12月</div> -->
226
               <el-date-picker
238
               <el-date-picker
227
                 v-model="timedayslist"
239
                 v-model="timedayslist"
228
-                type="daterange"
240
+                :type="pickertype"
241
+                :shortcuts="shortcuts"
242
+                :format="format"
243
+                :value-format="format"
244
+                unlink-panels
245
+                size="large"
229
                 start-placeholder="开始时间"
246
                 start-placeholder="开始时间"
230
                 end-placeholder="结束时间"
247
                 end-placeholder="结束时间"
231
                 :default-value="timedayslist"
248
                 :default-value="timedayslist"
232
                 :disabled-date="pickerOptions"
249
                 :disabled-date="pickerOptions"
233
-                value-format="YYYY-MM-DD hh:mm:ss"
234
                 @change="onpowerblur"
250
                 @change="onpowerblur"
235
               />
251
               />
252
+              <!-- <el-select
253
+                v-model="daymonthyearvalue"
254
+                placeholder="选择日期"
255
+                size="large"
256
+                style="width: 80px"
257
+                @change="getdaymonthyear"
258
+              >
259
+                <el-option v-for="item in daymonthyear" :key="item.value" :label="item.label" :value="item.value" />
260
+              </el-select> -->
236
             </div>
261
             </div>
237
           </div>
262
           </div>
238
           <div class="middleleftchart" ref="comprehensive"></div>
263
           <div class="middleleftchart" ref="comprehensive"></div>
248
       <div class="cardtable">
273
       <div class="cardtable">
249
         <div>通讯状态:</div>
274
         <div>通讯状态:</div>
250
         &emsp;
275
         &emsp;
251
-        <el-select v-model="onlineStatus" placeholder="Select" size="large" style="width: 240px">
276
+        <el-select v-model="onlineStatus" placeholder="请选择" size="large" style="width: 240px">
252
           <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
277
           <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
253
         </el-select>
278
         </el-select>
254
         &emsp;
279
         &emsp;
369
   singlestationyearMonth,
394
   singlestationyearMonth,
370
   singlestationchargingMonth,
395
   singlestationchargingMonth,
371
   overallEfficiencyday,
396
   overallEfficiencyday,
372
-  overallEfficiencyyearMonth,
373
-  Stationinfo
397
+  // overallEfficiencyyearMonth,
398
+  Stationinfo,
399
+  singlestationdayMonth,
400
+  postsexportKwhMonth
374
 } from "@/api/home/Multisite";
401
 } from "@/api/home/Multisite";
375
 import { Station } from "@/api/interface";
402
 import { Station } from "@/api/interface";
376
 const multiStation = ref();
403
 const multiStation = ref();
392
   activeName.value = "first";
419
   activeName.value = "first";
393
   Singledata.value = val.id;
420
   Singledata.value = val.id;
394
   getStationinfo();
421
   getStationinfo();
395
-  gatsinglestationday();
422
+  // gatsinglestationday();
396
   postmultiStationpagebaseInfo();
423
   postmultiStationpagebaseInfo();
397
-  oncomprehen(7);
424
+  onhandleClick();
398
   getsite();
425
   getsite();
399
 };
426
 };
427
+
400
 const cities: Ref<Station.todo[]> = ref([]);
428
 const cities: Ref<Station.todo[]> = ref([]);
401
 
429
 
402
 const onlineStatus = ref("");
430
 const onlineStatus = ref("");
403
-const recentlytype = ref(7);
431
+// const recentlytype = ref(7);
404
 const tabpropslabel = ref("收益统计");
432
 const tabpropslabel = ref("收益统计");
405
 
433
 
406
 const options = ref([
434
 const options = ref([
417
     label: "离线"
445
     label: "离线"
418
   }
446
   }
419
 ]);
447
 ]);
448
+
420
 const poststationstationName = async () => {
449
 const poststationstationName = async () => {
421
   const { data } = await stationstationName({});
450
   const { data } = await stationstationName({});
422
   Singlevalue.value = data[0].id;
451
   Singlevalue.value = data[0].id;
425
   getStationinfo();
454
   getStationinfo();
426
   gatsinglestationday();
455
   gatsinglestationday();
427
   postmultiStationpagebaseInfo();
456
   postmultiStationpagebaseInfo();
428
-  oncomprehen(7);
457
+  onpowerblur();
458
+
459
+  // oncomprehen(7);
429
 };
460
 };
430
 // 选择站点
461
 // 选择站点
431
 const getsite = async () => {
462
 const getsite = async () => {
444
 };
475
 };
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'
476
 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'
446
 // 查询最近数据
477
 // 查询最近数据
447
-const recently = (val: any) => {
448
-  // 获取当前日期
449
-  recentlytype.value = val;
450
 
478
 
451
-  const today = new Date();
452
-  const currentDate = today.toLocaleDateString();
479
+const getdaymonthyear1 = async (value: any) => {
480
+  daymonthyearvalue.value = value;
481
+  if (value == 1) {
482
+    timetype1.value = "daterange";
483
+    format1.value = "YYYY-MM-DD";
484
+    shortcuts1.value = [
485
+      {
486
+        text: "过去7天",
487
+        value: () => {
488
+          const end = new Date();
489
+          const start = new Date();
490
+          start.setDate(start.getDate() - 7);
491
+          return [start, end];
492
+        }
493
+      },
494
+      {
495
+        text: "过去1个月",
496
+        value: () => {
497
+          const end = new Date();
498
+          const start = new Date();
499
+          start.setMonth(start.getMonth() - 1);
500
+          return [start, end];
501
+        }
502
+      },
503
+      {
504
+        text: "过去3个月",
505
+        value: () => {
506
+          const end = new Date();
507
+          const start = new Date();
508
+          start.setMonth(start.getMonth() - 3);
509
+          return [start, end];
510
+        }
511
+      }
512
+    ];
453
 
513
 
454
-  // 获取过去 7 天的日期
455
-  const sevenDaysAgoDate = new Date(today);
456
-  sevenDaysAgoDate.setDate(today.getDate() - 7);
457
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
514
+    const today = new Date();
515
+    const currentDate = today.toISOString().split("T")[0];
516
+    const sevenDaysAgoDate = new Date(today);
517
+    sevenDaysAgoDate.setDate(today.getDate() - 7);
518
+    const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
519
+    value2.value = [sevenDaysAgo, currentDate];
520
+
521
+    // getreportpowerday();
522
+  } else if (value == 2) {
523
+    const today = new Date();
524
+    const currentDate = today.toISOString().split("T")[0];
525
+    const currentYearMonth = currentDate.slice(0, 7);
458
 
526
 
459
-  // 获取过去 31 天的日期
460
-  const thirtyOneDaysAgoDate = new Date(today);
461
-  thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
462
-  const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
527
+    value2.value = [currentYearMonth, currentYearMonth];
528
+    // getreportpoweryearMonth();
463
 
529
 
464
-  // 获取去年同月的日期
465
-  const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
466
-  const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
530
+    timetype1.value = "monthrange";
531
+    format1.value = "YYYY-MM";
467
 
532
 
533
+    shortcuts1.value = [
534
+      {
535
+        text: "本月",
536
+        value: () => {
537
+          return [new Date(), new Date()];
538
+        }
539
+      },
540
+      {
541
+        text: "过去6个月",
542
+        value: () => {
543
+          const end = new Date();
544
+          const start = new Date();
545
+          start.setMonth(start.getMonth() - 6);
546
+          return [start, end];
547
+        }
548
+      },
549
+      {
550
+        text: "今年",
551
+        value: () => {
552
+          const end = new Date();
553
+          const start = new Date(new Date().getFullYear(), 0);
554
+          return [start, end];
555
+        }
556
+      }
557
+    ];
558
+  } else {
559
+    const today = new Date();
560
+    const currentDate = today.toISOString().split("T")[0];
561
+    // 获取去年同月的日期
562
+    value2.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
563
+    console.log(value2.value);
564
+    timetype1.value = "yearrange";
565
+    format1.value = "YYYY";
566
+
567
+    shortcuts1.value = [
568
+      {
569
+        text: "今年",
570
+        value: () => {
571
+          return [new Date(), new Date()];
572
+        }
573
+      },
574
+      {
575
+        text: "过去1年",
576
+        value: () => {
577
+          const end = new Date();
578
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
579
+          return [start, end];
580
+        }
581
+      },
582
+      {
583
+        text: "过去2年",
584
+        value: () => {
585
+          const start = new Date();
586
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
587
+          return [start, end];
588
+        }
589
+      }
590
+    ];
591
+  }
468
   if (tabpropslabel.value == "收益统计") {
592
   if (tabpropslabel.value == "收益统计") {
469
-    if (val == 7) {
470
-      value2.value = [sevenDaysAgo, currentDate];
471
-      gatsinglestationday();
472
-    } else if (val == 31) {
473
-      value2.value = [thirtyOneDaysAgo, currentDate];
593
+    if (daymonthyearvalue.value == 1) {
474
       gatsinglestationday();
594
       gatsinglestationday();
595
+    } else if (daymonthyearvalue.value == 2) {
596
+      getsinglestationdayMonth();
475
     } else {
597
     } else {
476
-      value2.value = [lastYearSameMonth, currentDate];
477
       gatsinglestationyearMonth();
598
       gatsinglestationyearMonth();
478
     }
599
     }
479
   } else {
600
   } else {
480
-    if (val == 7) {
481
-      value2.value = [sevenDaysAgo, currentDate];
482
-      getmultiStatiopower();
483
-    } else if (val == 31) {
484
-      value2.value = [thirtyOneDaysAgo, currentDate];
601
+    if (daymonthyearvalue.value == 1) {
485
       getmultiStatiopower();
602
       getmultiStatiopower();
603
+    } else if (daymonthyearvalue.value == 2) {
604
+      getpostsexportKwhMonth();
486
     } else {
605
     } else {
487
-      value2.value = [lastYearSameMonth, currentDate];
488
       getsinglestationchargingMonth();
606
       getsinglestationchargingMonth();
489
     }
607
     }
490
   }
608
   }
491
 };
609
 };
610
+// const recently = (val: any) => {
611
+//   // 获取当前日期
612
+//   recentlytype.value = val;
613
+
614
+//   const today = new Date();
615
+//   const currentDate = today.toLocaleDateString();
616
+
617
+//   // 获取过去 7 天的日期
618
+//   const sevenDaysAgoDate = new Date(today);
619
+//   sevenDaysAgoDate.setDate(today.getDate() - 7);
620
+//   const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
621
+
622
+//   // 获取过去 31 天的日期
623
+//   const thirtyOneDaysAgoDate = new Date(today);
624
+//   thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
625
+//   const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
626
+
627
+//   // 获取去年同月的日期
628
+//   const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
629
+//   const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
630
+
631
+//   if (tabpropslabel.value == "收益统计") {
632
+//     if (val == 7) {
633
+//       value2.value = [sevenDaysAgo, currentDate];
634
+//       gatsinglestationday();
635
+//     } else if (val == 31) {
636
+//       value2.value = [thirtyOneDaysAgo, currentDate];
637
+//       gatsinglestationday();
638
+//     } else {
639
+//       value2.value = [lastYearSameMonth, currentDate];
640
+//       gatsinglestationyearMonth();
641
+//     }
642
+//   } else {
643
+//     if (val == 7) {
644
+//       value2.value = [sevenDaysAgo, currentDate];
645
+//       getmultiStatiopower();
646
+//     } else if (val == 31) {
647
+//       value2.value = [thirtyOneDaysAgo, currentDate];
648
+//       getmultiStatiopower();
649
+//     } else {
650
+//       value2.value = [lastYearSameMonth, currentDate];
651
+//       getsinglestationchargingMonth();
652
+//     }
653
+//   }
654
+// };
492
 
655
 
493
 // 切换收益统计与充放电统计
656
 // 切换收益统计与充放电统计
494
 const handleClick = (tab: TabsPaneContext) => {
657
 const handleClick = (tab: TabsPaneContext) => {
495
   tabpropslabel.value = tab.props.label;
658
   tabpropslabel.value = tab.props.label;
496
 
659
 
497
-  if (tab.props.label == "收益统计") {
498
-    gatsinglestationday();
660
+  if (tabpropslabel.value == "收益统计") {
661
+    if (daymonthyearvalue.value == 1) {
662
+      gatsinglestationday();
663
+    } else if (daymonthyearvalue.value == 2) {
664
+      getsinglestationdayMonth();
665
+    } else {
666
+      gatsinglestationyearMonth();
667
+    }
499
   } else {
668
   } else {
500
-    getmultiStatiopower();
669
+    if (daymonthyearvalue.value == 1) {
670
+      getmultiStatiopower();
671
+    } else if (daymonthyearvalue.value == 2) {
672
+      getpostsexportKwhMonth();
673
+    } else {
674
+      getsinglestationchargingMonth();
675
+    }
501
   }
676
   }
502
 };
677
 };
503
 const onhandleClick = () => {
678
 const onhandleClick = () => {
504
   if (tabpropslabel.value == "收益统计") {
679
   if (tabpropslabel.value == "收益统计") {
505
-    gatsinglestationday();
680
+    if (daymonthyearvalue.value == 1) {
681
+      gatsinglestationday();
682
+    } else if (daymonthyearvalue.value == 2) {
683
+      getsinglestationdayMonth();
684
+    } else {
685
+      gatsinglestationyearMonth();
686
+    }
506
   } else {
687
   } else {
507
-    getmultiStatiopower();
688
+    if (daymonthyearvalue.value == 1) {
689
+      getmultiStatiopower();
690
+    } else if (daymonthyearvalue.value == 2) {
691
+      getpostsexportKwhMonth();
692
+    } else {
693
+      getsinglestationchargingMonth();
694
+    }
508
   }
695
   }
509
 };
696
 };
510
 // 收益统计----日
697
 // 收益统计----日
519
 
706
 
520
   baroptionchart(dates, profits, "收益/元");
707
   baroptionchart(dates, profits, "收益/元");
521
 };
708
 };
522
-// 收益统计------月份
709
+// 收益统计----月
710
+const getsinglestationdayMonth = async () => {
711
+  const { data } = await singlestationdayMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
712
+  const dates = [["product", "收益"]];
713
+  for (let index = 0; index < data.list.length; index++) {
714
+    dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
715
+  }
716
+
717
+  const profits = [{ type: "bar" }];
718
+
719
+  baroptionchart(dates, profits, "收益/元");
720
+};
721
+// 收益统计------年份
523
 const gatsinglestationyearMonth = async () => {
722
 const gatsinglestationyearMonth = async () => {
524
   const { data } = await singlestationyearMonth(
723
   const { data } = await singlestationyearMonth(
525
     { startYearMonth: value2.value[0], endYearMonth: value2.value[1] },
724
     { startYearMonth: value2.value[0], endYearMonth: value2.value[1] },
547
   baroptionchart(dates, profits, "kWh");
746
   baroptionchart(dates, profits, "kWh");
548
 };
747
 };
549
 // 充放电统计图
748
 // 充放电统计图
749
+const getpostsexportKwhMonth = async () => {
750
+  const { data } = await postsexportKwhMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
751
+  const dates = [["product", "充电", "放电"]];
752
+
753
+  for (let index = 0; index < data.length; index++) {
754
+    dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
755
+  }
756
+  const profits = [{ type: "bar" }, { type: "bar" }];
757
+
758
+  baroptionchart(dates, profits, "kWh");
759
+};
760
+// 充放电统计图
550
 const getsinglestationchargingMonth = async () => {
761
 const getsinglestationchargingMonth = async () => {
551
   const { data } = await singlestationchargingMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
762
   const { data } = await singlestationchargingMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
552
   const dates = [["product", "充电", "放电"]];
763
   const dates = [["product", "充电", "放电"]];
655
 };
866
 };
656
 // 综合效率---------------------------------------------------------------
867
 // 综合效率---------------------------------------------------------------
657
 const comprehensive = ref();
868
 const comprehensive = ref();
658
-const timedays = ref(7);
869
+// const timedays = ref(7);
659
 const timedayslist = ref();
870
 const timedayslist = ref();
871
+const pickertype: Ref<any> = ref("daterange");
872
+const daymonthyearvalue = ref(1);
873
+const daymonthyearvalue1 = ref(1);
874
+const timetype1: Ref<any> = ref("daterange");
875
+const format = ref("YYYY-MM-DD");
876
+const format1 = ref("YYYY-MM-DD");
877
+
878
+const daymonthyear1 = ref([
879
+  {
880
+    value: 1,
881
+    label: "按日"
882
+  },
883
+  {
884
+    value: 2,
885
+    label: "按月"
886
+  },
887
+  {
888
+    value: 3,
889
+    label: "按年"
890
+  }
891
+]);
892
+const shortcuts = ref([
893
+  {
894
+    text: "过去7天",
895
+    value: () => {
896
+      const end = new Date();
897
+      const start = new Date();
898
+      start.setDate(start.getDate() - 7);
899
+      return [start, end];
900
+    }
901
+  },
902
+  {
903
+    text: "过去1个月",
904
+    value: () => {
905
+      const end = new Date();
906
+      const start = new Date();
907
+      start.setMonth(start.getMonth() - 1);
908
+      return [start, end];
909
+    }
910
+  },
911
+  {
912
+    text: "过去3个月",
913
+    value: () => {
914
+      const end = new Date();
915
+      const start = new Date();
916
+      start.setMonth(start.getMonth() - 3);
917
+      return [start, end];
918
+    }
919
+  }
920
+]);
921
+const shortcuts1 = ref([
922
+  {
923
+    text: "过去7天",
924
+    value: () => {
925
+      const end = new Date();
926
+      const start = new Date();
927
+      start.setDate(start.getDate() - 7);
928
+      return [start, end];
929
+    }
930
+  },
931
+  {
932
+    text: "过去1个月",
933
+    value: () => {
934
+      const end = new Date();
935
+      const start = new Date();
936
+      start.setMonth(start.getMonth() - 1);
937
+      return [start, end];
938
+    }
939
+  },
940
+  {
941
+    text: "过去3个月",
942
+    value: () => {
943
+      const end = new Date();
944
+      const start = new Date();
945
+      start.setMonth(start.getMonth() - 3);
946
+      return [start, end];
947
+    }
948
+  }
949
+]);
660
 const onpowerblur = () => {
950
 const onpowerblur = () => {
951
+  getdaymonthyear();
952
+};
953
+const getdaymonthyear = async () => {
954
+  // daymonthyearvalue.value = value;
661
   getcomprehensiveefficiency();
955
   getcomprehensiveefficiency();
956
+
957
+  // if (daymonthyearvalue.value == 1) {
958
+  //   getcomprehensiveefficiency();
959
+  // } else if (daymonthyearvalue.value == 2) {
960
+  // } else {
961
+  //   getoverallEfficiencyyearMonth();
962
+  // }
662
 };
963
 };
964
+// const oncomprehen = (val: number) => {
965
+//   // 获取当前日期
966
+//   timedays.value = val;
663
 
967
 
664
-const oncomprehen = (val: number) => {
665
-  // 获取当前日期
666
-  timedays.value = val;
968
+//   const today = new Date();
969
+//   const currentDate = today.toLocaleDateString();
667
 
970
 
668
-  const today = new Date();
669
-  const currentDate = today.toLocaleDateString();
971
+//   // 获取过去 7 天的日期
972
+//   const sevenDaysAgoDate = new Date(today);
973
+//   sevenDaysAgoDate.setDate(today.getDate() - 7);
974
+//   const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
670
 
975
 
671
-  // 获取过去 7 天的日期
672
-  const sevenDaysAgoDate = new Date(today);
673
-  sevenDaysAgoDate.setDate(today.getDate() - 7);
674
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
976
+//   // 获取过去 31 天的日期
977
+//   const thirtyOneDaysAgoDate = new Date(today);
978
+//   thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
979
+//   const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
675
 
980
 
676
-  // 获取过去 31 天的日期
677
-  const thirtyOneDaysAgoDate = new Date(today);
678
-  thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
679
-  const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
680
-
681
-  // 获取去年同月的日期
682
-  const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
683
-  const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
684
-  if (val == 7) {
685
-    timedayslist.value = [sevenDaysAgo, currentDate];
686
-    getcomprehensiveefficiency();
687
-  } else if (val == 31) {
688
-    timedayslist.value = [thirtyOneDaysAgo, currentDate];
689
-    getcomprehensiveefficiency();
690
-  } else {
691
-    timedayslist.value = [lastYearSameMonth, currentDate];
692
-    getoverallEfficiencyyearMonth();
693
-  }
694
-};
981
+//   // 获取去年同月的日期
982
+//   const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
983
+//   const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
984
+//   if (val == 7) {
985
+//     timedayslist.value = [sevenDaysAgo, currentDate];
986
+//     getcomprehensiveefficiency();
987
+//   } else if (val == 31) {
988
+//     timedayslist.value = [thirtyOneDaysAgo, currentDate];
989
+//     getcomprehensiveefficiency();
990
+//   } else {
991
+//     timedayslist.value = [lastYearSameMonth, currentDate];
992
+//     getoverallEfficiencyyearMonth();
993
+//   }
994
+// };
695
 const getcomprehensiveefficiency = async () => {
995
 const getcomprehensiveefficiency = async () => {
696
   const { data } = await overallEfficiencyday(
996
   const { data } = await overallEfficiencyday(
697
     { startDate: timedayslist.value[0], endDate: timedayslist.value[1] },
997
     { startDate: timedayslist.value[0], endDate: timedayslist.value[1] },
711
 
1011
 
712
   getiveefficiency(data.avgEfficiency, dates, profits);
1012
   getiveefficiency(data.avgEfficiency, dates, profits);
713
 };
1013
 };
714
-const getoverallEfficiencyyearMonth = async () => {
715
-  const { data } = await overallEfficiencyyearMonth(
716
-    {
717
-      startYearMonth: timedayslist.value[0],
718
-      endYearMonth: timedayslist.value[1]
719
-    },
720
-    Singlevalue.value
721
-  );
722
-  const dates = [["profit", "综合效率"]];
723
-  for (let index = 0; index < data.list.length; index++) {
724
-    dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
725
-  }
726
-  const profits = [
727
-    {
728
-      type: "line",
729
-      showSymbol: false
730
-    }
731
-  ];
1014
+// const getoverallEfficiencyyearMonth = async () => {
1015
+//   const { data } = await overallEfficiencyyearMonth(
1016
+//     {
1017
+//       startYearMonth: timedayslist.value[0],
1018
+//       endYearMonth: timedayslist.value[1]
1019
+//     },
1020
+//     Singlevalue.value
1021
+//   );
1022
+//   const dates = [["profit", "综合效率"]];
1023
+//   for (let index = 0; index < data.list.length; index++) {
1024
+//     dates.push([data.list[index].ymd, data.list[index].overallEfficiency.toString()]);
1025
+//   }
1026
+//   const profits = [
1027
+//     {
1028
+//       type: "line",
1029
+//       showSymbol: false
1030
+//     }
1031
+//   ];
732
 
1032
 
733
-  getiveefficiency(data.avgEfficiency, dates, profits);
734
-};
1033
+//   getiveefficiency(data.avgEfficiency, dates, profits);
1034
+// };
735
 const getiveefficiency = (num: any, dates: string[][], profits: { type: string }[]) => {
1035
 const getiveefficiency = (num: any, dates: string[][], profits: { type: string }[]) => {
736
   const comprehensivevalue = echarts.init(comprehensive.value);
1036
   const comprehensivevalue = echarts.init(comprehensive.value);
737
   window.addEventListener(
1037
   window.addEventListener(

+ 36
- 11
src/views/post/addition.vue View File

92
   status: "0"
92
   status: "0"
93
 });
93
 });
94
 
94
 
95
-const submitForm = (formEl: FormInstance | undefined) => {
95
+// const submitForm = (formEl: FormInstance | undefined) => {
96
+//   if (!formEl) return;
97
+//   formEl.validate(async valid => {
98
+//     if (valid) {
99
+//       if (route.query.type == "岗位新增") {
100
+//         const { data } = await platformpostadd(numberValidateForm);
101
+//         console.log(data);
102
+//       } else {
103
+//         const { data } = await platformpostedit(numberValidateForm);
104
+//         console.log(data);
105
+//       }
106
+//       router.back();
107
+//     } else {
108
+//       console.log("error submit!");
109
+//       return false;
110
+//     }
111
+//   });
112
+// };
113
+
114
+const submitForm = async (formEl: FormInstance | undefined) => {
96
   if (!formEl) return;
115
   if (!formEl) return;
97
-  formEl.validate(async valid => {
116
+
117
+  try {
118
+    const valid = await formEl.validate();
119
+
98
     if (valid) {
120
     if (valid) {
99
-      if (route.query.type == "岗位新增") {
100
-        const { data } = await platformpostadd(numberValidateForm);
101
-        console.log(data);
121
+      let responseData;
122
+
123
+      if (route.query.type === "岗位新增") {
124
+        responseData = await platformpostadd(numberValidateForm);
102
       } else {
125
       } else {
103
-        const { data } = await platformpostedit(numberValidateForm);
104
-        console.log(data);
126
+        responseData = await platformpostedit(numberValidateForm);
105
       }
127
       }
106
-      router.back();
128
+
129
+      console.log(responseData.data);
130
+      router.back(); // Navigate back after success
107
     } else {
131
     } else {
108
-      console.log("error submit!");
109
-      return false;
132
+      console.log("Validation failed!");
110
     }
133
     }
111
-  });
134
+  } catch (error) {
135
+    console.error("Submission error:", error);
136
+  }
112
 };
137
 };
113
 
138
 
114
 const resetForm = (formEl: FormInstance | undefined) => {
139
 const resetForm = (formEl: FormInstance | undefined) => {

+ 1
- 1
src/views/post/index.vue View File

20
         <div>
20
         <div>
21
           &ensp;&ensp;&ensp;&ensp;岗位状态&ensp;&ensp;<el-select
21
           &ensp;&ensp;&ensp;&ensp;岗位状态&ensp;&ensp;<el-select
22
             v-model="status"
22
             v-model="status"
23
-            placeholder="Select"
23
+            placeholder="请选择"
24
             size="large"
24
             size="large"
25
             style="width: 240px"
25
             style="width: 240px"
26
           >
26
           >

+ 139
- 24
src/views/powerStation/addition.vue View File

72
                   v-model="selectedValue"
72
                   v-model="selectedValue"
73
                   clearable
73
                   clearable
74
                   size="large"
74
                   size="large"
75
-                  placeholder="请选择服务地区"
75
+                  :placeholder="selectedValuename"
76
                   @change="oncascader"
76
                   @change="oncascader"
77
+                  @visible-change="handleVisibleChange"
77
                   style="width: 300px; margin-right: 20px"
78
                   style="width: 300px; margin-right: 20px"
78
                 />
79
                 />
79
               </el-form-item>
80
               </el-form-item>
93
                 </el-form-item>
94
                 </el-form-item>
94
               </div>
95
               </div>
95
             </div>
96
             </div>
96
-
97
             <div class="elform">
97
             <div class="elform">
98
-              <el-form-item label="装机功率" prop="installedPower" :rules="[{ required: true, message: '请输入装机功率' }]">
98
+              <el-form-item label="详细地址" prop="detailedaddress" :rules="[{ required: true, message: '请输入装机功率' }]">
99
                 <el-input
99
                 <el-input
100
-                  v-model="numberValidateForm.installedPower"
100
+                  v-model="numberValidateForm.detailedaddress"
101
                   style="width: 300px"
101
                   style="width: 300px"
102
                   size="large"
102
                   size="large"
103
                   type="text"
103
                   type="text"
116
                 />
116
                 />
117
               </el-form-item>
117
               </el-form-item>
118
             </div>
118
             </div>
119
+            <div class="elform">
120
+              <el-form-item label="经度" prop="longitude" :rules="[{ required: true, message: '请输入装机功率' }]">
121
+                <el-input
122
+                  v-model="numberValidateForm.longitude"
123
+                  style="width: 300px"
124
+                  size="large"
125
+                  type="text"
126
+                  placeholder="请输入装机功率"
127
+                  autocomplete="off"
128
+                />
129
+              </el-form-item>
130
+
131
+              <el-form-item label="经度" prop="latitude" :rules="[{ required: true, message: '请输入装机功率' }]">
132
+                <el-input
133
+                  v-model="numberValidateForm.latitude"
134
+                  style="width: 300px"
135
+                  size="large"
136
+                  type="text"
137
+                  placeholder="请输入装机容量"
138
+                  autocomplete="off"
139
+                />
140
+              </el-form-item>
141
+            </div>
142
+            <div class="elform">
143
+              <el-form-item label="装机功率" prop="installedPower" :rules="[{ required: true, message: '请输入装机功率' }]">
144
+                <el-input
145
+                  v-model="numberValidateForm.installedPower"
146
+                  style="width: 300px"
147
+                  size="large"
148
+                  type="text"
149
+                  placeholder="请输入装机功率"
150
+                  autocomplete="off"
151
+                />
152
+              </el-form-item>
153
+            </div>
119
             <!-- <div class="elform">
154
             <!-- <div class="elform">
120
               <el-form-item label="并网点信息">
155
               <el-form-item label="并网点信息">
121
                 <el-input
156
                 <el-input
211
 const formRef = ref<FormInstance>();
246
 const formRef = ref<FormInstance>();
212
 const supertype = ref(route.query.type);
247
 const supertype = ref(route.query.type);
213
 const selectedValue = ref([44]);
248
 const selectedValue = ref([44]);
249
+const selectedValuename = ref("请选择地区");
214
 const absoluteStationPicUr1 = ref();
250
 const absoluteStationPicUr1 = ref();
215
 const layoutPicUr1 = ref();
251
 const layoutPicUr1 = ref();
216
 const numberValidateForm = reactive({
252
 const numberValidateForm = reactive({
229
   // transformer: "",
265
   // transformer: "",
230
   // transformercapacity: "",
266
   // transformercapacity: "",
231
   operationDate: "", // 投运时间
267
   operationDate: "", // 投运时间
232
-  keywordcategory: 0, // 国家id
268
+  Category: 0, // 国家id
233
   provinceCode: 0, // 省id
269
   provinceCode: 0, // 省id
234
   cityCode: 0, // 市id
270
   cityCode: 0, // 市id
235
-  countyCode: 0 //区id
271
+  countyCode: 0, //区id
272
+  longitude: 0, // 经度
273
+  latitude: 0, //维度
274
+  detailedaddress: "" //详细地址
236
 });
275
 });
237
 const timedate = ref();
276
 const timedate = ref();
238
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
277
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
240
 };
279
 };
241
 
280
 
242
 const submitForm = (formEl: FormInstance | undefined) => {
281
 const submitForm = (formEl: FormInstance | undefined) => {
243
-  numberValidateForm.keywordcategory = selectedValue.value[0] ?? 0;
282
+  numberValidateForm.Category = selectedValue.value[0] ?? 0;
244
   numberValidateForm.provinceCode = selectedValue.value[1] ?? 0;
283
   numberValidateForm.provinceCode = selectedValue.value[1] ?? 0;
245
   numberValidateForm.cityCode = selectedValue.value[2] ?? 0;
284
   numberValidateForm.cityCode = selectedValue.value[2] ?? 0;
246
   numberValidateForm.countyCode = selectedValue.value[3] ?? 0;
285
   numberValidateForm.countyCode = selectedValue.value[3] ?? 0;
247
-  console.log(numberValidateForm);
248
 
286
 
249
   if (!formEl) return;
287
   if (!formEl) return;
288
+  // formEl.validate(async valid => {
289
+  //   if (valid) {
290
+  //     if (route.query.type == "电站新增") {
291
+  //       // numberValidateForm.emsId;
292
+
293
+  //       numberValidateForm.url = absoluteStationPicUr1.value.map((item: { url: any }) => item.url).join(", ");
294
+  //       numberValidateForm.arrangementplan = layoutPicUr1.value.map((item: { url: any }) => item.url).join(", ");
295
+  //       const { data } = await insertpowerURL(numberValidateForm);
296
+  //       console.log(data);
297
+  //     } else {
298
+  //       numberValidateForm.url = absoluteStationPicUr1.value.map((item: { url: any }) => item.url).join(", ");
299
+  //       numberValidateForm.arrangementplan = layoutPicUr1.value.map((item: { url: any }) => item.url).join(", ");
300
+  //       const { data } = await updatesingleeditURL(numberValidateForm);
301
+  //       console.log(data);
302
+  //     }
303
+  //     router.back();
304
+  //   } else {
305
+  //     console.log("error submit!");
306
+  //     return false;
307
+  //   }
308
+  // });
250
   formEl.validate(async valid => {
309
   formEl.validate(async valid => {
251
     if (valid) {
310
     if (valid) {
252
-      if (route.query.type == "电站新增") {
253
-        // numberValidateForm.emsId;
311
+      // Prepare URL fields only once
312
+      const urls = absoluteStationPicUr1.value.map((item: { url: any }) => item.url).join(", ");
313
+      const arrangements = layoutPicUr1.value.map((item: { url: any }) => item.url).join(", ");
254
 
314
 
255
-        numberValidateForm.url = absoluteStationPicUr1.value.map((item: { url: any }) => item.url).join(", ");
256
-        numberValidateForm.arrangementplan = layoutPicUr1.value.map((item: { url: any }) => item.url).join(", ");
257
-        const { data } = await insertpowerURL(numberValidateForm);
258
-        console.log(data);
259
-      } else {
260
-        numberValidateForm.url = absoluteStationPicUr1.value.map((item: { url: any }) => item.url).join(", ");
261
-        numberValidateForm.arrangementplan = layoutPicUr1.value.map((item: { url: any }) => item.url).join(", ");
262
-        const { data } = await updatesingleeditURL(numberValidateForm);
263
-        console.log(data);
315
+      numberValidateForm.url = urls;
316
+      numberValidateForm.arrangementplan = arrangements;
317
+
318
+      try {
319
+        let responseData;
320
+
321
+        if (route.query.type === "电站新增") {
322
+          // Add a new power station
323
+          responseData = await insertpowerURL(numberValidateForm);
324
+        } else {
325
+          // Update an existing power station
326
+          responseData = await updatesingleeditURL(numberValidateForm);
327
+        }
328
+
329
+        console.log(responseData.data);
330
+        router.back(); // Navigate back after success
331
+      } catch (error) {
332
+        console.error("Submission error:", error);
264
       }
333
       }
265
-      router.back();
266
     } else {
334
     } else {
267
-      console.log("error submit!");
268
-      return false;
335
+      console.log("Validation failed!");
269
     }
336
     }
270
   });
337
   });
271
 };
338
 };
301
   numberValidateForm.installedPower = yonghueditdata.value[0].installedPower;
368
   numberValidateForm.installedPower = yonghueditdata.value[0].installedPower;
302
   numberValidateForm.installedCap = yonghueditdata.value[0].installedCap;
369
   numberValidateForm.installedCap = yonghueditdata.value[0].installedCap;
303
   numberValidateForm.operationDate = yonghueditdata.value[0].operationDate;
370
   numberValidateForm.operationDate = yonghueditdata.value[0].operationDate;
371
+  numberValidateForm.longitude = yonghueditdata.value[0].longitude;
372
+  numberValidateForm.latitude = yonghueditdata.value[0].latitude;
373
+  numberValidateForm.detailedaddress = yonghueditdata.value[0].detailedaddress;
304
   absoluteStationPicUr1.value = [];
374
   absoluteStationPicUr1.value = [];
305
   for (let index = 0; index < yonghueditdata.value[0].url.length; index++) {
375
   for (let index = 0; index < yonghueditdata.value[0].url.length; index++) {
306
     absoluteStationPicUr1.value.push({
376
     absoluteStationPicUr1.value.push({
307
       url: yonghueditdata.value[0].url[index]
377
       url: yonghueditdata.value[0].url[index]
308
     });
378
     });
309
   }
379
   }
380
+
310
   layoutPicUr1.value = [];
381
   layoutPicUr1.value = [];
311
   for (let index = 0; index < yonghueditdata.value[0].arrangementurl.length; index++) {
382
   for (let index = 0; index < yonghueditdata.value[0].arrangementurl.length; index++) {
312
     layoutPicUr1.value.push({
383
     layoutPicUr1.value.push({
313
       url: yonghueditdata.value[0].arrangementurl[index]
384
       url: yonghueditdata.value[0].arrangementurl[index]
314
     });
385
     });
315
   }
386
   }
387
+
388
+  selectedValue.value = [];
389
+  if (yonghueditdata.value[0].citiesname) {
390
+    selectedValuename.value =
391
+      yonghueditdata.value[0].countriesname +
392
+      "/" +
393
+      yonghueditdata.value[0].statesname +
394
+      "/" +
395
+      yonghueditdata.value[0].citiesname +
396
+      "/" +
397
+      yonghueditdata.value[0].regionsname;
398
+  } else {
399
+    selectedValuename.value = "请选择地址";
400
+  }
401
+
402
+  // console.log(selectedValue.value);
316
   grtselectemssytem();
403
   grtselectemssytem();
317
 };
404
 };
318
 // 选择设备编码 ----
405
 // 选择设备编码 ----
341
 const props: CascaderProps = {
428
 const props: CascaderProps = {
342
   lazy: true,
429
   lazy: true,
343
   checkStrictly: true,
430
   checkStrictly: true,
344
-
345
   async lazyLoad(node, resolve) {
431
   async lazyLoad(node, resolve) {
432
+    console.log(node);
433
+    console.log(selectedValue.value);
346
     if (node.level == 0) {
434
     if (node.level == 0) {
347
       // node为当前点击的节点,resolve为数据加载完成的回调(必须调用)
435
       // node为当前点击的节点,resolve为数据加载完成的回调(必须调用)
348
       let nodes: CascaderOption[] | undefined = [];
436
       let nodes: CascaderOption[] | undefined = [];
445
   selectedValue.value = selectedValues;
533
   selectedValue.value = selectedValues;
446
   console.log(selectedValue.value);
534
   console.log(selectedValue.value);
447
 };
535
 };
536
+const handleVisibleChange = async (visible: any) => {
537
+  if (route.query.type == "电站编辑") {
538
+    if (visible) {
539
+      selectedValue.value = [44];
540
+    } else {
541
+      if (selectedValue.value.length > 2) {
542
+      } else {
543
+        selectedValue.value = [];
544
+        if (yonghueditdata.value[0].citiesname) {
545
+          selectedValuename.value =
546
+            yonghueditdata.value[0].countriesname +
547
+            "/" +
548
+            yonghueditdata.value[0].statesname +
549
+            "/" +
550
+            yonghueditdata.value[0].citiesname +
551
+            "/" +
552
+            yonghueditdata.value[0].regionsname;
553
+        } else {
554
+          selectedValuename.value = "请选择地址";
555
+        }
556
+      }
557
+    }
558
+  }
559
+};
560
+
448
 onMounted(() => {
561
 onMounted(() => {
449
   if (route.query.type == "电站编辑") {
562
   if (route.query.type == "电站编辑") {
450
     getghuedit();
563
     getghuedit();
457
 <style scoped lang="scss">
570
 <style scoped lang="scss">
458
 @import "./addition.scss";
571
 @import "./addition.scss";
459
 </style>
572
 </style>
460
-<!-- -->
573
+<!--
574
+    
575
+ -->

+ 4
- 0
src/views/rawdata/index.scss View File

26
   justify-content: space-between;
26
   justify-content: space-between;
27
   margin-top: 20px;
27
   margin-top: 20px;
28
 }
28
 }
29
+.lexce {
30
+  margin-top: 20px;
31
+  font-size: 16px;
32
+}

+ 135
- 11
src/views/rawdata/index.vue View File

1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
     <div class="title">
3
     <div class="title">
4
-      原始数据
4
+      云端数据
5
       <div class="title_time">{{ currentDate }}</div>
5
       <div class="title_time">{{ currentDate }}</div>
6
     </div>
6
     </div>
7
     <div class="card">
7
     <div class="card">
31
             <el-option v-for="item in quipmentlist" :key="item.peek" :label="item.peek" :value="item.peek" />
31
             <el-option v-for="item in quipmentlist" :key="item.peek" :label="item.peek" :value="item.peek" />
32
           </el-select>
32
           </el-select>
33
         </div>
33
         </div>
34
+        <div>
35
+          &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;标题翻译&ensp;&ensp;
36
+          <el-select
37
+            v-model="translate.user.peekType"
38
+            placeholder="请选择设备类型"
39
+            size="large"
40
+            style="width: 240px"
41
+            clearable
42
+            @change="ontranslate"
43
+          >
44
+            <el-option v-for="item in translatelist" :key="item.id" :label="item.value" :value="item.id" />
45
+          </el-select>
46
+        </div>
34
       </div>
47
       </div>
35
       <div class="screen1">
48
       <div class="screen1">
36
         <div>
49
         <div>
38
           <el-date-picker
51
           <el-date-picker
39
             size="large"
52
             size="large"
40
             v-model="timevalue"
53
             v-model="timevalue"
54
+            :shortcuts="shortcuts"
41
             type="daterange"
55
             type="daterange"
42
             start-placeholder="开始时间"
56
             start-placeholder="开始时间"
43
             end-placeholder="结束时间"
57
             end-placeholder="结束时间"
44
             :default-value="timevalue"
58
             :default-value="timevalue"
45
             :disabled-date="pickerOptions"
59
             :disabled-date="pickerOptions"
46
             value-format="YYYY-MM-DD"
60
             value-format="YYYY-MM-DD"
61
+            format="YYYY-MM-DD"
47
           />
62
           />
48
         </div>
63
         </div>
49
         &ensp;&ensp; &ensp;&ensp;
64
         &ensp;&ensp; &ensp;&ensp;
59
       <el-table :data="tableData.list" style="width: 100%" border>
74
       <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" />
75
         <el-table-column width="250" :show-overflow-tooltip="true" v-for="item in head" :key="item" :prop="item" :label="item" />
61
       </el-table>
76
       </el-table>
62
-      <!-- 分页组件 -->
77
+      <!-- 分页 组件 -->
63
       <div class="pagination">
78
       <div class="pagination">
64
         <div></div>
79
         <div></div>
65
         <slot name="pagination">
80
         <slot name="pagination">
67
         </slot>
82
         </slot>
68
       </div>
83
       </div>
69
     </div>
84
     </div>
85
+    <el-dialog v-model="dialogVisible" title="导出中" top="300px" width="40%" @close="handleClose">
86
+      <div class="lexce">{{ message }}</div>
87
+      <template #footer>
88
+        <div class="dialog-footer" v-if="excelexport">
89
+          <el-button v-if="excelexport.progress == 0" @click="handleClose">取消导出</el-button>
90
+          <el-button v-if="excelexport.progress == 3" type="primary" @click="handleClose"> 确定 </el-button>
91
+        </div>
92
+      </template>
93
+    </el-dialog>
70
   </div>
94
   </div>
71
 </template>
95
 </template>
72
-
73
-<!-- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
74
-                                                                                                                                                                                                                          
75
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
76
-
96
+<!--    -->
77
 <script setup lang="ts">
97
 <script setup lang="ts">
78
 import {
98
 import {
79
   tdengineyuanshilURL,
99
   tdengineyuanshilURL,
80
   stationstationName,
100
   stationstationName,
81
   postemsSystemsingleStation,
101
   postemsSystemsingleStation,
82
   listexcellURL,
102
   listexcellURL,
83
-  powerlistURL
103
+  powerlistURL,
104
+  listexcelURL,
105
+  updateURL,
106
+  selectaccountNumber
84
 } from "@/api/home/Multisite";
107
 } from "@/api/home/Multisite";
85
 import { onMounted, Ref, ref } from "vue";
108
 import { onMounted, Ref, ref } from "vue";
86
 // import { useAuthButtons } from "@/hooks/useAuthButtons";
109
 // import { useAuthButtons } from "@/hooks/useAuthButtons";
87
 // const { BUTTONS } = useAuthButtons();
110
 // const { BUTTONS } = useAuthButtons();
88
 import { Station } from "@/api/interface";
111
 import { Station } from "@/api/interface";
89
 import Pagination from "@/components/ProTable/components/Pagination.vue";
112
 import Pagination from "@/components/ProTable/components/Pagination.vue";
113
+import { ElMessage } from "element-plus";
90
 
114
 
91
 // import { useRouter } from "vue-router";
115
 // import { useRouter } from "vue-router";
92
 // const router = useRouter();
116
 // const router = useRouter();
93
 const emsDeviceId = ref("");
117
 const emsDeviceId = ref("");
94
 const quipment = ref("");
118
 const quipment = ref("");
95
 const quipmentlist = ref();
119
 const quipmentlist = ref();
120
+const translate = ref();
121
+const translatelist = ref([
122
+  {
123
+    value: "中文",
124
+    id: "2"
125
+  },
126
+  {
127
+    value: "英文",
128
+    id: "1"
129
+  }
130
+]);
96
 
131
 
97
 const emsDevice: Ref<any[]> = ref([]);
132
 const emsDevice: Ref<any[]> = ref([]);
98
 
133
 
99
 const cities: Ref<Station.todo[]> = ref([]);
134
 const cities: Ref<Station.todo[]> = ref([]);
135
+
100
 const timevalue: Ref<any> = ref([]);
136
 const timevalue: Ref<any> = ref([]);
101
 
137
 
102
 const poststationstationName = async () => {
138
 const poststationstationName = async () => {
129
     (emsDeviceId.value = ""), getplatformuserlist();
165
     (emsDeviceId.value = ""), getplatformuserlist();
130
   }
166
   }
131
 };
167
 };
168
+const dialogVisible = ref(false);
169
+const message = ref("");
132
 
170
 
133
 const newaddition = async () => {
171
 const newaddition = async () => {
134
-  console.log(1);
172
+  if (timevalue.value.length == 0) {
173
+    console.log(timevalue.value.length == 0);
174
+
175
+    ElMessage.error("请选择时间范围!");
176
+    return;
177
+  }
178
+  message.value = "正在导出...";
179
+  dialogVisible.value = true;
180
+
135
   let obj = {
181
   let obj = {
136
     powerId: status.value,
182
     powerId: status.value,
137
     eId: emsDeviceId.value,
183
     eId: emsDeviceId.value,
140
     endTime: timevalue.value[1]
186
     endTime: timevalue.value[1]
141
   };
187
   };
142
   const { data } = await listexcellURL(obj);
188
   const { data } = await listexcellURL(obj);
189
+  console.log(data);
190
+
191
+  gitlistexcelURL();
192
+};
193
+const timerId = ref();
143
 
194
 
144
-  downloadxlsx(data);
195
+const excelexport = ref();
196
+const handleClose = async () => {
197
+  if (timerId.value) {
198
+    clearTimeout(timerId.value);
199
+    timerId.value = ""; // 清除引用
200
+    dialogVisible.value = false;
201
+  }
145
 };
202
 };
203
+const gitlistexcelURL = async () => {
204
+  const { data } = await listexcelURL();
205
+  console.log(data);
206
+  excelexport.value = data;
207
+  message.value = excelexport.value.message;
208
+  if (excelexport.value.progress == 0) {
209
+    timerId.value = setTimeout(() => {
210
+      gitlistexcelURL();
211
+    }, 2000);
212
+  } else if (excelexport.value.progress == 3) {
213
+    handleClose();
214
+    downloadxlsx(data);
215
+  }
216
+};
217
+
146
 const downloadxlsx = (data: any) => {
218
 const downloadxlsx = (data: any) => {
147
-  let fileUrl = `download/${data.msg}`;
219
+  let fileUrl = `download/${data.excelFileName}`;
148
   const date = new Date();
220
   const date = new Date();
149
   const hours = formatTime(date.getHours());
221
   const hours = formatTime(date.getHours());
150
   const minutes = formatTime(date.getMinutes());
222
   const minutes = formatTime(date.getMinutes());
193
 
265
 
194
   getplatformuserlist();
266
   getplatformuserlist();
195
 };
267
 };
268
+// 文件 编辑 选择
196
 const getplatformuserlist = async () => {
269
 const getplatformuserlist = async () => {
197
   let obj = {
270
   let obj = {
198
     powerId: status.value,
271
     powerId: status.value,
210
   pageable.value.total = tableData.value.page.totald;
283
   pageable.value.total = tableData.value.page.totald;
211
 };
284
 };
212
 const currentDate = ref();
285
 const currentDate = ref();
286
+const ontranslate = async (e: any) => {
287
+  console.log(e);
288
+  let obj = {
289
+    peekType: e
290
+  };
291
+  await updateURL(obj);
292
+  await getplatformuserlist();
293
+};
294
+const selectaccountNumberlist = async () => {
295
+  const { data } = await selectaccountNumber({});
296
+  console.log(data);
297
+  translate.value = data;
298
+};
299
+const shortcuts = [
300
+  {
301
+    text: "过去7天",
302
+    value: () => {
303
+      const end = new Date();
304
+      const start = new Date();
305
+      start.setDate(start.getDate() - 7);
306
+      return [start, end];
307
+    }
308
+  },
309
+  {
310
+    text: "过去1个月",
311
+    value: () => {
312
+      const end = new Date();
313
+      const start = new Date();
314
+      start.setMonth(start.getMonth() - 1);
315
+      return [start, end];
316
+    }
317
+  },
318
+  {
319
+    text: "过去3个月",
320
+    value: () => {
321
+      const end = new Date();
322
+      const start = new Date();
323
+      start.setMonth(start.getMonth() - 3);
324
+      return [start, end];
325
+    }
326
+  }
327
+];
213
 onMounted(() => {
328
 onMounted(() => {
214
   const current = localStorage.getItem("currentDate");
329
   const current = localStorage.getItem("currentDate");
215
   if (current) {
330
   if (current) {
216
     currentDate.value = current;
331
     currentDate.value = current;
217
   }
332
   }
333
+  const today = new Date();
334
+  const sevenDaysAgo = new Date(today);
335
+  sevenDaysAgo.setDate(today.getDate() - 7);
336
+  const sevenDaysAgoDate = sevenDaysAgo.toISOString().split("T")[0];
337
+
338
+  timevalue.value = [currentDate.value, sevenDaysAgoDate];
339
+  console.log(timevalue.value);
340
+
218
   getplatformuserlist();
341
   getplatformuserlist();
219
   poststationstationName();
342
   poststationstationName();
343
+  selectaccountNumberlist();
220
 });
344
 });
221
 </script>
345
 </script>
222
 <style scoped lang="scss">
346
 <style scoped lang="scss">

+ 293
- 80
src/views/reportforms/index.vue View File

23
                     v-if="timetype != 'year'"
23
                     v-if="timetype != 'year'"
24
                     v-model="timepicker"
24
                     v-model="timepicker"
25
                     :type="timetype"
25
                     :type="timetype"
26
+                    :shortcuts="shortcuts"
27
+                    :format="format"
28
+                    :value-format="format"
26
                     start-placeholder="开始时间"
29
                     start-placeholder="开始时间"
27
                     end-placeholder="结束时间"
30
                     end-placeholder="结束时间"
31
+                    size="large"
28
                     :disabled-date="pickerOptions"
32
                     :disabled-date="pickerOptions"
29
-                    @change="datepicker"
33
+                  />
34
+                  <el-date-picker
35
+                    v-if="timetype == 'year'"
36
+                    v-model="timepicker"
37
+                    type="yearrange"
38
+                    :format="format"
39
+                    :value-format="format"
40
+                    :shortcuts="shortcuts"
41
+                    start-placeholder="开始时间"
42
+                    end-placeholder="结束时间"
30
                     size="large"
43
                     size="large"
44
+                    :disabled-date="pickerOptions"
31
                   />
45
                   />
32
-                  <YearPicker
46
+                  <!-- <YearPicker
33
                     v-if="timetype == 'year'"
47
                     v-if="timetype == 'year'"
34
                     style="width: 300px"
48
                     style="width: 300px"
35
                     ref="statisticPicker"
49
                     ref="statisticPicker"
36
                     :label-width="50"
50
                     :label-width="50"
51
+                    :shortcuts="shortcuts"
37
                     :init-year="dateValue"
52
                     :init-year="dateValue"
38
                     :start-year1="timepicker[0]"
53
                     :start-year1="timepicker[0]"
39
                     :end-year2="timepicker[1]"
54
                     :end-year2="timepicker[1]"
40
                     @update-time-range="updateStatisticYear"
55
                     @update-time-range="updateStatisticYear"
41
-                  />
56
+                  /> -->
42
                   <el-select
57
                   <el-select
43
                     v-model="daymonthyearvalue"
58
                     v-model="daymonthyearvalue"
44
                     placeholder="选择日期"
59
                     placeholder="选择日期"
128
                   v-if="pickertype != 'year'"
143
                   v-if="pickertype != 'year'"
129
                   v-model="starttime"
144
                   v-model="starttime"
130
                   :type="pickertype"
145
                   :type="pickertype"
131
-                  placeholder="选择时间"
146
+                  :shortcuts="shortcuts"
147
+                  :format="format"
148
+                  :value-format="format"
149
+                  start-placeholder="开始时间"
150
+                  end-placeholder="结束时间"
132
                   size="large"
151
                   size="large"
133
                   clearable
152
                   clearable
134
                   :disabled-date="pickerOptions"
153
                   :disabled-date="pickerOptions"
135
-                  @change="yearstarttime"
136
                 />
154
                 />
137
-                <YearPicker
155
+                <el-date-picker
156
+                  v-if="pickertype == 'year'"
157
+                  v-model="starttime"
158
+                  type="yearrange"
159
+                  :format="format"
160
+                  :value-format="format"
161
+                  :shortcuts="shortcuts"
162
+                  start-placeholder="开始时间"
163
+                  end-placeholder="结束时间"
164
+                  size="large"
165
+                  :disabled-date="pickerOptions"
166
+                />
167
+                <!-- <YearPicker
138
                   v-if="pickertype == 'year'"
168
                   v-if="pickertype == 'year'"
139
                   style="width: 300px"
169
                   style="width: 300px"
140
                   ref="statisticPicker"
170
                   ref="statisticPicker"
143
                   :start-year1="starttime[0]"
173
                   :start-year1="starttime[0]"
144
                   :end-year2="starttime[1]"
174
                   :end-year2="starttime[1]"
145
                   @update-time-range="updateStatisticYear1"
175
                   @update-time-range="updateStatisticYear1"
146
-                />
176
+                /> -->
147
               </div>
177
               </div>
148
               &ensp;&ensp;
178
               &ensp;&ensp;
149
 
179
 
309
 </template>
339
 </template>
310
 <!--    
340
 <!--    
311
   
341
   
312
--->
342
+ -->
313
 <script setup lang="ts">
343
 <script setup lang="ts">
314
 import { onMounted, Ref, ref } from "vue";
344
 import { onMounted, Ref, ref } from "vue";
315
 import {
345
 import {
333
 } from "@/api/home/Multisite";
363
 } from "@/api/home/Multisite";
334
 import { useAuthButtons } from "@/hooks/useAuthButtons";
364
 import { useAuthButtons } from "@/hooks/useAuthButtons";
335
 const { BUTTONS } = useAuthButtons();
365
 const { BUTTONS } = useAuthButtons();
336
-import YearPicker from "@/components/year/index.vue";
366
+// import YearPicker from "@/components/year/index.vue";
337
 import * as echarts from "echarts";
367
 import * as echarts from "echarts";
338
 import { other, Station } from "@/api/interface";
368
 import { other, Station } from "@/api/interface";
339
 // 汇总表头
369
 // 汇总表头
503
 const timetype: Ref<any> = ref("daterange");
533
 const timetype: Ref<any> = ref("daterange");
504
 const handleClick = async (val: any) => {
534
 const handleClick = async (val: any) => {
505
   if (val.props.name == "站点汇总") {
535
   if (val.props.name == "站点汇总") {
506
-    const today = new Date();
507
-    const currentDate = today.toISOString().split("T")[0];
508
-    timepicker.value = [currentDate, currentDate];
509
-    getreportpowerday();
536
+    getdaymonthyear(1);
537
+    gatSummary();
510
   } else {
538
   } else {
511
-    chartindex.value = 1;
512
     await poststationstationName();
539
     await poststationstationName();
513
     await onreportforms(2);
540
     await onreportforms(2);
514
   }
541
   }
515
 };
542
 };
516
-//可选择区间,initYear传参,不传则所有年份有效,小于0判断一下?
517
-const dateValue = ref<any>({ startYear: 2000, endYear: new Date().getFullYear() });
518
-//选完/输入完成的回调
519
-const updateStatisticYear: any = (startYear: number, endYear: number) => {
520
-  timepicker.value = [startYear + "", endYear + ""];
521
-  getreportpoweryear();
522
-};
523
-const updateStatisticYear1: any = (startYear: number, endYear: number) => {
524
-  starttime.value = [startYear + "", endYear + ""];
525
-  getelectricitylevelyear();
526
-};
527
 
543
 
528
 // 格式化时间
544
 // 格式化时间
529
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
545
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
530
   return time.getTime(new Date()) > Date.now();
546
   return time.getTime(new Date()) > Date.now();
531
 };
547
 };
532
 // 选择时间
548
 // 选择时间
533
-const datepicker = (val: any) => {
534
-  timepicker.value = [formatDate(val[0]), formatDate(val[1])];
535
-};
549
+// const datepicker = (val: any) => {
550
+//   console.log(timepicker.value);
551
+
552
+//   timepicker.value = [formatDate(val[0]), formatDate(val[1])];
553
+// };
536
 // 选择日期
554
 // 选择日期
537
 
555
 
538
 const daymonthyearvalue = ref(1);
556
 const daymonthyearvalue = ref(1);
550
     label: "按年"
568
     label: "按年"
551
   }
569
   }
552
 ]);
570
 ]);
571
+const shortcuts = ref([
572
+  {
573
+    text: "过去7天",
574
+    value: () => {
575
+      const end = new Date();
576
+      const start = new Date();
577
+      start.setDate(start.getDate() - 7);
578
+      return [start, end];
579
+    }
580
+  },
581
+  {
582
+    text: "过去1个月",
583
+    value: () => {
584
+      const end = new Date();
585
+      const start = new Date();
586
+      start.setMonth(start.getMonth() - 1);
587
+      return [start, end];
588
+    }
589
+  },
590
+  {
591
+    text: "过去3个月",
592
+    value: () => {
593
+      const end = new Date();
594
+      const start = new Date();
595
+      start.setMonth(start.getMonth() - 3);
596
+      return [start, end];
597
+    }
598
+  }
599
+]);
600
+const format = ref("YYYY-MM-DD");
553
 const getdaymonthyear = async (value: any) => {
601
 const getdaymonthyear = async (value: any) => {
554
   daymonthyearvalue.value = value;
602
   daymonthyearvalue.value = value;
555
   if (value == 1) {
603
   if (value == 1) {
556
     timetype.value = "daterange";
604
     timetype.value = "daterange";
605
+    format.value = "YYYY-MM-DD";
606
+    shortcuts.value = [
607
+      {
608
+        text: "过去7天",
609
+        value: () => {
610
+          const end = new Date();
611
+          const start = new Date();
612
+          start.setDate(start.getDate() - 7);
613
+          return [start, end];
614
+        }
615
+      },
616
+      {
617
+        text: "过去1个月",
618
+        value: () => {
619
+          const end = new Date();
620
+          const start = new Date();
621
+          start.setMonth(start.getMonth() - 1);
622
+          return [start, end];
623
+        }
624
+      },
625
+      {
626
+        text: "过去3个月",
627
+        value: () => {
628
+          const end = new Date();
629
+          const start = new Date();
630
+          start.setMonth(start.getMonth() - 3);
631
+          return [start, end];
632
+        }
633
+      }
634
+    ];
557
     const today = new Date();
635
     const today = new Date();
558
     const currentDate = today.toISOString().split("T")[0];
636
     const currentDate = today.toISOString().split("T")[0];
559
     timepicker.value = [currentDate, currentDate];
637
     timepicker.value = [currentDate, currentDate];
560
-    getreportpowerday();
638
+    // getreportpowerday();
561
   } else if (value == 2) {
639
   } else if (value == 2) {
562
-    timetype.value = "monthrange";
563
-
564
     const today = new Date();
640
     const today = new Date();
565
     const currentDate = today.toISOString().split("T")[0];
641
     const currentDate = today.toISOString().split("T")[0];
566
-    // 获取过去 31 天的日期
567
-    const thirtyOneDaysAgoDate = new Date(today);
568
-    thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
569
-    const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
570
-    timepicker.value = [thirtyOneDaysAgo, currentDate];
571
-    getreportpoweryearMonth();
642
+    const currentYearMonth = currentDate.slice(0, 7);
643
+
644
+    timepicker.value = [currentYearMonth, currentYearMonth];
645
+    // getreportpoweryearMonth();
646
+    timetype.value = "monthrange";
647
+    format.value = "YYYY-MM";
648
+
649
+    shortcuts.value = [
650
+      {
651
+        text: "本月",
652
+        value: () => {
653
+          return [new Date(), new Date()];
654
+        }
655
+      },
656
+      {
657
+        text: "过去6个月",
658
+        value: () => {
659
+          const end = new Date();
660
+          const start = new Date();
661
+          start.setMonth(start.getMonth() - 6);
662
+          return [start, end];
663
+        }
664
+      },
665
+      {
666
+        text: "今年",
667
+        value: () => {
668
+          const end = new Date();
669
+          const start = new Date(new Date().getFullYear(), 0);
670
+          return [start, end];
671
+        }
672
+      }
673
+    ];
572
   } else {
674
   } else {
573
     const today = new Date();
675
     const today = new Date();
574
     const currentDate = today.toISOString().split("T")[0];
676
     const currentDate = today.toISOString().split("T")[0];
575
     // 获取去年同月的日期
677
     // 获取去年同月的日期
576
-    const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
577
-    const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
578
-    timepicker.value = [lastYearSameMonth.substring(0, 4), currentDate.substring(0, 4)];
678
+    timepicker.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
679
+    console.log(timepicker.value);
680
+    timetype.value = "yearrange";
681
+    format.value = "YYYY";
579
 
682
 
580
-    timetype.value = "year";
581
-    getreportpoweryear();
683
+    shortcuts.value = [
684
+      {
685
+        text: "今年",
686
+        value: () => {
687
+          return [new Date(), new Date()];
688
+        }
689
+      },
690
+      {
691
+        text: "过去1年",
692
+        value: () => {
693
+          const end = new Date();
694
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
695
+          return [start, end];
696
+        }
697
+      },
698
+      {
699
+        text: "过去2年",
700
+        value: () => {
701
+          const start = new Date();
702
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
703
+          return [start, end];
704
+        }
705
+      }
706
+    ];
707
+    // getreportpoweryear();
582
   }
708
   }
583
 };
709
 };
584
 // 查询
710
 // 查询
585
 const gatSummary = () => {
711
 const gatSummary = () => {
586
-  getdaymonthyear(daymonthyearvalue.value);
712
+  // getdaymonthyear(daymonthyearvalue.value);
713
+  if (daymonthyearvalue.value == 1) {
714
+    getreportpowerday();
715
+  } else if (daymonthyearvalue.value == 2) {
716
+    getreportpoweryearMonth();
717
+  } else if (daymonthyearvalue.value == 3) {
718
+    getreportpoweryear();
719
+  }
587
 };
720
 };
588
 // 重置
721
 // 重置
589
 const onreset = () => {
722
 const onreset = () => {
789
 const formatTime = (time: number) => {
922
 const formatTime = (time: number) => {
790
   return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
923
   return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
791
 };
924
 };
792
-const formatDate = (dateString: string | number | Date) => {
793
-  const date = new Date(dateString);
925
+// const formatDate = (dateString: string | number | Date) => {
926
+//   const date = new Date(dateString);
794
 
927
 
795
-  // 提取年、月、日、时、分信息
796
-  const year = date.getFullYear();
797
-  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
798
-  const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
799
-  const hours = String(date.getHours()).padStart(2, "0"); // 确保是两位数
800
-  const minutes = String(date.getMinutes()).padStart(2, "0"); // 确保是两位数
928
+//   // 提取年、月、日、时、分信息
929
+//   const year = date.getFullYear();
930
+//   const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份从0开始,需要加1,并确保是两位数
931
+//   const day = String(date.getDate()).padStart(2, "0"); // 确保是两位数
801
 
932
 
802
-  // 拼接成 "YYYY-MM-DD HH:MM" 格式
803
-  const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}`;
933
+//   // 拼接成 "YYYY-MM-DD HH:MM" 格式
934
+//   const formattedDate = `${year}-${month}-${day}`;
804
 
935
 
805
-  return formattedDate;
806
-};
936
+//   return formattedDate;
937
+// };
807
 const tableData = ref();
938
 const tableData = ref();
808
 // 日
939
 // 日
809
 const getreportpowerday = async () => {
940
 const getreportpowerday = async () => {
855
     pickertype.value = "date";
986
     pickertype.value = "date";
856
     starttime.value = currentDate.value;
987
     starttime.value = currentDate.value;
857
   } else if (val == 2) {
988
   } else if (val == 2) {
989
+    shortcuts.value = [
990
+      {
991
+        text: "过去7天",
992
+        value: () => {
993
+          const end = new Date();
994
+          const start = new Date();
995
+          start.setDate(start.getDate() - 7);
996
+          return [start, end];
997
+        }
998
+      },
999
+      {
1000
+        text: "过去1个月",
1001
+        value: () => {
1002
+          const end = new Date();
1003
+          const start = new Date();
1004
+          start.setMonth(start.getMonth() - 1);
1005
+          return [start, end];
1006
+        }
1007
+      },
1008
+      {
1009
+        text: "过去3个月",
1010
+        value: () => {
1011
+          const end = new Date();
1012
+          const start = new Date();
1013
+          start.setMonth(start.getMonth() - 3);
1014
+          return [start, end];
1015
+        }
1016
+      }
1017
+    ];
858
     pickertype.value = "daterange";
1018
     pickertype.value = "daterange";
1019
+    format.value = "YYYY-MM-DD";
859
     const today = new Date();
1020
     const today = new Date();
860
     const currentDate = today.toISOString().split("T")[0];
1021
     const currentDate = today.toISOString().split("T")[0];
861
     starttime.value = [currentDate, currentDate];
1022
     starttime.value = [currentDate, currentDate];
862
   } else if (val == 3) {
1023
   } else if (val == 3) {
863
-    pickertype.value = "monthrange";
864
     const today = new Date();
1024
     const today = new Date();
865
     const currentDate = today.toISOString().split("T")[0];
1025
     const currentDate = today.toISOString().split("T")[0];
866
-    const thirtyOneDaysAgoDate = new Date(today);
867
-    thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
868
-    const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
869
-    starttime.value = [thirtyOneDaysAgo, currentDate];
1026
+    const currentYearMonth = currentDate.slice(0, 7);
1027
+    starttime.value = [currentYearMonth, currentYearMonth];
1028
+    format.value = "YYYY-MM";
1029
+    pickertype.value = "monthrange";
1030
+
1031
+    shortcuts.value = [
1032
+      {
1033
+        text: "本月",
1034
+        value: () => {
1035
+          return [new Date(), new Date()];
1036
+        }
1037
+      },
1038
+      {
1039
+        text: "过去6个月",
1040
+        value: () => {
1041
+          const end = new Date();
1042
+          const start = new Date();
1043
+          start.setMonth(start.getMonth() - 6);
1044
+          return [start, end];
1045
+        }
1046
+      },
1047
+      {
1048
+        text: "今年",
1049
+        value: () => {
1050
+          const end = new Date();
1051
+          const start = new Date(new Date().getFullYear(), 0);
1052
+          return [start, end];
1053
+        }
1054
+      }
1055
+    ];
870
   } else if (val == 4) {
1056
   } else if (val == 4) {
871
-    pickertype.value = "year";
872
     const today = new Date();
1057
     const today = new Date();
873
     const currentDate = today.toISOString().split("T")[0];
1058
     const currentDate = today.toISOString().split("T")[0];
874
     // 获取去年同月的日期
1059
     // 获取去年同月的日期
875
-    const lastYearSameMonthDate = new Date(today.getFullYear() - 1, today.getMonth(), today.getDate());
876
-    const lastYearSameMonth = lastYearSameMonthDate.toLocaleDateString();
877
-    starttime.value = [lastYearSameMonth.substring(0, 4), currentDate.substring(0, 4)];
1060
+    starttime.value = [currentDate.substring(0, 4), currentDate.substring(0, 4)];
1061
+    pickertype.value = "yearrange";
1062
+    format.value = "YYYY";
1063
+
1064
+    shortcuts.value = [
1065
+      {
1066
+        text: "今年",
1067
+        value: () => {
1068
+          return [new Date(), new Date()];
1069
+        }
1070
+      },
1071
+      {
1072
+        text: "过去1年",
1073
+        value: () => {
1074
+          const end = new Date();
1075
+          const start = new Date(new Date().setFullYear(new Date().getFullYear() - 1));
1076
+          return [start, end];
1077
+        }
1078
+      },
1079
+      {
1080
+        text: "过去2年",
1081
+        value: () => {
1082
+          const start = new Date();
1083
+          const end = new Date(new Date().setFullYear(new Date().getFullYear() - 2));
1084
+          return [start, end];
1085
+        }
1086
+      }
1087
+    ];
1088
+
878
     getelectricitylevelyear();
1089
     getelectricitylevelyear();
879
   }
1090
   }
880
   reportformsindex.value = val;
1091
   reportformsindex.value = val;
923
 // 选择日期starttime
1134
 // 选择日期starttime
924
 const starttime: Ref<any> = ref("");
1135
 const starttime: Ref<any> = ref("");
925
 // 开始时间
1136
 // 开始时间
926
-const yearstarttime = async (val: any) => {
927
-  console.log(val);
1137
+// const yearstarttime = async (val: any) => {
1138
+//   console.log(val);
928
 
1139
 
929
-  if (reportformsindex.value == 1) {
930
-    starttime.value = formatDate(val);
931
-  } else if (reportformsindex.value == 2) {
932
-    starttime.value = [formatDate(val[0]), formatDate(val[1])];
933
-  } else if (reportformsindex.value == 3) {
934
-    starttime.value = [formatDate(val[0]), formatDate(val[1])];
935
-  } else if (reportformsindex.value == 4) {
936
-    for (let index = 0; index < val.length; index++) {
937
-      val[index] = formatDate(val[index]);
938
-    }
939
-    starttime.value = val;
940
-  }
941
-};
1140
+//   if (reportformsindex.value == 1) {
1141
+//     starttime.value = formatDate(val);
1142
+//   } else if (reportformsindex.value == 2) {
1143
+//     starttime.value = [formatDate(val[0]), formatDate(val[1])];
1144
+//   } else if (reportformsindex.value == 3) {
1145
+//     starttime.value = [formatDate(val[0]), formatDate(val[1])];
1146
+//   } else if (reportformsindex.value == 4) {
1147
+//     for (let index = 0; index < val.length; index++) {
1148
+//       val[index] = formatDate(val[index]);
1149
+//     }
1150
+//     starttime.value = val;
1151
+//   }
1152
+// };
942
 // 查询-文件夹
1153
 // 查询-文件夹
943
 const onselectsite = async () => {
1154
 const onselectsite = async () => {
944
   onreportformsid(reportformsindex.value);
1155
   onreportformsid(reportformsindex.value);
945
 };
1156
 };
946
 // 重置
1157
 // 重置
947
 const onselectreset = async () => {
1158
 const onselectreset = async () => {
948
-  onreportformsid(1);
1159
+  // onreportformsid(1);
1160
+  await onreportforms(2);
949
 };
1161
 };
950
 
1162
 
951
 const singleexport = async () => {
1163
 const singleexport = async () => {
1406
     };
1618
     };
1407
   });
1619
   });
1408
 };
1620
 };
1621
+
1409
 onMounted(() => {
1622
 onMounted(() => {
1410
   const current = localStorage.getItem("currentDate");
1623
   const current = localStorage.getItem("currentDate");
1411
   if (current) {
1624
   if (current) {

+ 56
- 25
src/views/role/addition.vue View File

163
 
163
 
164
 const submitForm = (formEl: FormInstance | undefined) => {
164
 const submitForm = (formEl: FormInstance | undefined) => {
165
   if (!formEl) return;
165
   if (!formEl) return;
166
+  // formEl.validate(async valid => {
167
+  //   if (valid) {
168
+  //     if (route.query.type == "角色新增") {
169
+  //       let obj = {
170
+  //         roleName: numberValidateForm.roleName,
171
+  //         roleKey: numberValidateForm.roleKey,
172
+  //         roleSort: numberValidateForm.roleSort,
173
+  //         status: numberValidateForm.status ? 0 : 1,
174
+  //         remark: numberValidateForm.remark,
175
+  //         menuIds: numberValidateForm.departmentId.toString()
176
+  //       };
177
+  //       const { data } = await platformroleadd(obj);
178
+  //       console.log(data);
179
+  //     } else {
180
+  //       let obj = {
181
+  //         roleName: numberValidateForm.roleName,
182
+  //         roleKey: numberValidateForm.roleKey,
183
+  //         roleSort: numberValidateForm.roleSort,
184
+  //         status: numberValidateForm.status ? 0 : 1,
185
+  //         remark: numberValidateForm.remark,
186
+  //         menuIds: numberValidateForm.departmentId.toString(),
187
+  //         id: route.query.id
188
+  //       };
189
+  //       const { data } = await platformroleedit(obj);
190
+  //       console.log(data);
191
+  //     }
192
+  //     router.back();
193
+  //   } else {
194
+  //     return false;
195
+  //   }
196
+  // });
166
   formEl.validate(async valid => {
197
   formEl.validate(async valid => {
167
     if (valid) {
198
     if (valid) {
168
-      if (route.query.type == "角色新增") {
169
-        let obj = {
170
-          roleName: numberValidateForm.roleName,
171
-          roleKey: numberValidateForm.roleKey,
172
-          roleSort: numberValidateForm.roleSort,
173
-          status: numberValidateForm.status ? 0 : 1,
174
-          remark: numberValidateForm.remark,
175
-          menuIds: numberValidateForm.departmentId.toString()
176
-        };
177
-        const { data } = await platformroleadd(obj);
178
-        console.log(data);
179
-      } else {
180
-        let obj = {
181
-          roleName: numberValidateForm.roleName,
182
-          roleKey: numberValidateForm.roleKey,
183
-          roleSort: numberValidateForm.roleSort,
184
-          status: numberValidateForm.status ? 0 : 1,
185
-          remark: numberValidateForm.remark,
186
-          menuIds: numberValidateForm.departmentId.toString(),
187
-          id: route.query.id
188
-        };
189
-        const { data } = await platformroleedit(obj);
190
-        console.log(data);
199
+      // Common object structure
200
+      const obj = {
201
+        roleName: numberValidateForm.roleName,
202
+        roleKey: numberValidateForm.roleKey,
203
+        roleSort: numberValidateForm.roleSort,
204
+        status: numberValidateForm.status ? 0 : 1,
205
+        remark: numberValidateForm.remark,
206
+        menuIds: numberValidateForm.departmentId.toString(),
207
+        ...(route.query.type === "角色编辑" && { id: route.query.id }) // Conditionally add ID for editing
208
+      };
209
+
210
+      try {
211
+        let responseData;
212
+
213
+        if (route.query.type === "角色新增") {
214
+          responseData = await platformroleadd(obj);
215
+        } else {
216
+          responseData = await platformroleedit(obj);
217
+        }
218
+
219
+        console.log(responseData.data);
220
+        router.back(); // Navigate back after success
221
+      } catch (error) {
222
+        console.error("Submission error:", error);
191
       }
223
       }
192
-      router.back();
193
     } else {
224
     } else {
194
-      return false;
225
+      console.log("Validation failed!");
195
     }
226
     }
196
   });
227
   });
197
 };
228
 };

+ 35
- 1
src/views/role/index.vue View File

20
         <div>
20
         <div>
21
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;角色状态&ensp;&ensp;<el-select
21
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;角色状态&ensp;&ensp;<el-select
22
             v-model="status"
22
             v-model="status"
23
-            placeholder="Select"
23
+            placeholder="请选择"
24
             size="large"
24
             size="large"
25
             style="width: 240px"
25
             style="width: 240px"
26
           >
26
           >
33
           创建时间&ensp;&ensp;<el-date-picker
33
           创建时间&ensp;&ensp;<el-date-picker
34
             v-model="createTime"
34
             v-model="createTime"
35
             type="daterange"
35
             type="daterange"
36
+            :shortcuts="shortcuts"
36
             size="large"
37
             size="large"
38
+            format="YYYY-MM-DD"
39
+            value-format="YYYY-MM-DD"
37
             start-placeholder="开始时间"
40
             start-placeholder="开始时间"
38
             end-placeholder="结束时间"
41
             end-placeholder="结束时间"
39
             :default-value="timedate"
42
             :default-value="timedate"
74
     </div>
77
     </div>
75
   </div>
78
   </div>
76
 </template>
79
 </template>
80
+<!--  
77
 
81
 
82
+-->
78
 <script setup lang="ts">
83
 <script setup lang="ts">
79
 import { platformrolelist, platformroleremove } from "@/api/home/Multisite";
84
 import { platformrolelist, platformroleremove } from "@/api/home/Multisite";
80
 import { useHandleData } from "@/hooks/useHandleData";
85
 import { useHandleData } from "@/hooks/useHandleData";
83
 import { useAuthButtons } from "@/hooks/useAuthButtons";
88
 import { useAuthButtons } from "@/hooks/useAuthButtons";
84
 const { BUTTONS } = useAuthButtons();
89
 const { BUTTONS } = useAuthButtons();
85
 const router = useRouter();
90
 const router = useRouter();
91
+const shortcuts = ref([
92
+  {
93
+    text: "过去7天",
94
+    value: () => {
95
+      const end = new Date();
96
+      const start = new Date();
97
+      start.setDate(start.getDate() - 7);
98
+      return [start, end];
99
+    }
100
+  },
101
+  {
102
+    text: "过去1个月",
103
+    value: () => {
104
+      const end = new Date();
105
+      const start = new Date();
106
+      start.setMonth(start.getMonth() - 1);
107
+      return [start, end];
108
+    }
109
+  },
110
+  {
111
+    text: "过去3个月",
112
+    value: () => {
113
+      const end = new Date();
114
+      const start = new Date();
115
+      start.setMonth(start.getMonth() - 3);
116
+      return [start, end];
117
+    }
118
+  }
119
+]);
86
 const options = ref([
120
 const options = ref([
87
   {
121
   {
88
     value: "",
122
     value: "",

+ 48
- 72
src/views/toconfigurevalue/index.vue View File

1
 <template>
1
 <template>
2
   <div>
2
   <div>
3
     <div class="title">
3
     <div class="title">
4
-      通信管理
4
+      采集点管理
5
       <div class="title_time">{{ currentDate }}</div>
5
       <div class="title_time">{{ currentDate }}</div>
6
     </div>
6
     </div>
7
     <div class="card content-box">
7
     <div class="card content-box">
8
       <div class="elform1">
8
       <div class="elform1">
9
         <div class="elformadd">
9
         <div class="elformadd">
10
-          <el-button type="primary" color="#0052d9" @click="addNewRow">新增行</el-button>
10
+          <el-button type="primary" color="#0052d9" @click="addNewRow">一键同步</el-button>
11
         </div>
11
         </div>
12
 
12
 
13
         <el-table :data="tableData" border style="width: 100%" @row-click="handleRowClick">
13
         <el-table :data="tableData" border style="width: 100%" @row-click="handleRowClick">
14
-          <el-table-column prop="mysqlName" label="mysqlName" width="240">
14
+          <el-table-column prop="peekEnglish" label="peekEnglish/英文" width="340">
15
             <template #default="scope">
15
             <template #default="scope">
16
-              <el-input
17
-                v-model="scope.row.mysqlName"
18
-                :disabled="getdisabled(scope.row.mysqlName)"
19
-                @blur="handleadd(scope.$index, scope.row)"
20
-              ></el-input>
16
+              <el-input v-model="scope.row.peekEnglish" disabled></el-input>
21
             </template>
17
             </template>
22
           </el-table-column>
18
           </el-table-column>
23
-          <el-table-column prop="tdengineName" label="tdengineName" width="240">
19
+          <el-table-column prop="peekChinese" label="peekChinese/中文" width="340">
24
             <template #default="scope">
20
             <template #default="scope">
25
-              <el-input
26
-                v-model="scope.row.tdengineName"
27
-                :disabled="getdisabled(scope.row.mysqlName)"
28
-                @blur="handleadds(scope.$index, scope.row)"
29
-              ></el-input>
21
+              <el-input v-model="scope.row.peekChinese" @blur="handleadds(scope.$index, scope.row)"></el-input>
22
+              <!-- :disabled="getdisabled(scope.row.peekChinese)" -->
30
             </template>
23
             </template>
31
           </el-table-column>
24
           </el-table-column>
32
           <!-- <el-table-column label="操作" align="center" width="240">
25
           <!-- <el-table-column label="操作" align="center" width="240">
40
     </div>
33
     </div>
41
   </div>
34
   </div>
42
 </template>
35
 </template>
43
-<!--    -->
36
+<!--
37
+ -->
38
+
44
 <script setup lang="ts">
39
 <script setup lang="ts">
45
 import { onMounted, ref } from "vue";
40
 import { onMounted, ref } from "vue";
46
-import { nextTick } from "vue";
47
-import { selectAllURL, updateMysqlTDengineURL } from "@/api/home/Multisite";
41
+// import { nextTick } from "vue";
42
+import { selectpeekURL, updatepeekURL, insertpeekURL } from "@/api/home/Multisite";
48
 import { ElMessage } from "element-plus";
43
 import { ElMessage } from "element-plus";
49
 
44
 
50
 interface TableData {
45
 interface TableData {
51
-  mysqlName: string;
52
-  tdengineName: string;
46
+  peekEnglish: string;
47
+  peekChinese: string;
53
 }
48
 }
54
 const tableData = ref();
49
 const tableData = ref();
55
 // 新增行
50
 // 新增行
56
-const addNewRow = () => {
57
-  const newRow = ref<TableData>({
58
-    mysqlName: "",
59
-    tdengineName: ""
60
-  });
61
-  tableData.value.push(newRow.value);
51
+const addNewRow = async () => {
52
+  // const newRow = ref<TableData>({
53
+  //   peekEnglish: "",
54
+  //   peekChinese: ""
55
+  // });
56
+  // tableData.value.push(newRow.value);
62
 
57
 
63
-  nextTick(() => {
64
-    const tableBody = document.querySelector(".el-table__body-wrapper");
65
-    if (tableBody) {
66
-      tableBody.scrollTop = tableBody.scrollHeight;
67
-    }
68
-  });
69
-};
70
-const handleadd = async (
71
-  index: number,
72
-  row: {
73
-    mysqlName: any;
74
-    id: any;
75
-  }
76
-) => {
77
-  // 处理编辑逻辑,例如更新数据源或发送请求
78
-  let obj = {
79
-    id: row.id,
80
-    TDengienName: "",
81
-    MysqlName: row.mysqlName
82
-  };
83
-  const { data } = await updateMysqlTDengineURL(obj);
84
-  if (data) {
85
-    ElMessage({
86
-      message: "保存成功",
87
-      type: "success"
88
-    });
89
-  } else {
90
-    ElMessage.error("保存失败");
91
-  }
58
+  // nextTick(() => {
59
+  //   const tableBody = document.querySelector(".el-table__body-wrapper");
60
+  //   if (tableBody) {
61
+  //     tableBody.scrollTop = tableBody.scrollHeight;
62
+  //   }
63
+  // });
64
+  await insertpeekURL({});
65
+  await getdata();
92
 };
66
 };
93
-const handleadds = async (index: number, row: { id: any; tdengineName: any }) => {
67
+
68
+const handleadds = async (index: number, row: { peekChinese: any; peekEnglish: any }) => {
94
   // 处理编辑逻辑,例如更新数据源或发送请求
69
   // 处理编辑逻辑,例如更新数据源或发送请求
95
   console.log(index, row);
70
   console.log(index, row);
96
   let obj = {
71
   let obj = {
97
-    id: row.id,
98
-    TDengienName: row.tdengineName,
99
-    MysqlName: ""
72
+    peekChinese: row.peekChinese,
73
+    peekEnglish: row.peekEnglish
100
   };
74
   };
101
-  const { data } = await updateMysqlTDengineURL(obj);
75
+  const { data } = await updatepeekURL(obj);
102
   if (data) {
76
   if (data) {
103
     ElMessage({
77
     ElMessage({
104
       message: "保存成功",
78
       message: "保存成功",
108
     ElMessage.error("保存失败");
82
     ElMessage.error("保存失败");
109
   }
83
   }
110
 };
84
 };
111
-const getdisabled = (val: any) => {
112
-  if (val == "ts") {
113
-    return true;
114
-  } else {
115
-    return false;
116
-  }
117
-  console.log(val);
118
-};
85
+// const getdisabled = (val: any) => {
86
+//   if (val == "ts") {
87
+//     return true;
88
+//   } else {
89
+//     return false;
90
+//   }
91
+//   console.log(val);
92
+// };
119
 const handleRowClick = (row: TableData) => {
93
 const handleRowClick = (row: TableData) => {
120
   console.log(row);
94
   console.log(row);
121
 
95
 
122
   // 点击行的处理逻辑,可以根据实际情况进行实现
96
   // 点击行的处理逻辑,可以根据实际情况进行实现
123
 };
97
 };
124
 const getdata = async () => {
98
 const getdata = async () => {
125
-  const { data } = await selectAllURL({});
99
+  const { data } = await selectpeekURL({});
126
   console.log(data);
100
   console.log(data);
127
 
101
 
128
   tableData.value = data;
102
   tableData.value = data;
134
 
108
 
135
 //   let obj = {
109
 //   let obj = {
136
 //     id: row.row.id,
110
 //     id: row.row.id,
137
-//     TDengienName: row.row.tdengineName,
138
-//     MysqlName: row.row.mysqlName
111
+//     peekChinese: row.row.peekChinese,
112
+//     peekEnglish: row.row.peekEnglish
139
 //   };
113
 //   };
140
-//   const { data } = await updateMysqlTDengineURL(obj);
114
+//   const { data } = await updatepeekURL(obj);
141
 //   if (data) {
115
 //   if (data) {
142
 //     ElMessage({
116
 //     ElMessage({
143
 //       message: "保存成功",
117
 //       message: "保存成功",
166
 <style scoped lang="scss">
140
 <style scoped lang="scss">
167
 @import "./index.scss";
141
 @import "./index.scss";
168
 </style>
142
 </style>
169
-<!-- -->
143
+<!--
144
+
145
+-->

+ 86
- 48
src/views/user/addition.vue View File

273
 const submitForm = (formEl: FormInstance | undefined) => {
273
 const submitForm = (formEl: FormInstance | undefined) => {
274
   console.log(formEl);
274
   console.log(formEl);
275
   if (!formEl) return;
275
   if (!formEl) return;
276
+  // formEl.validate(async valid => {
277
+  //   if (valid) {
278
+  //     if (route.query.type == "用户新增") {
279
+  //       const obj = {
280
+  //         userName: numberValidateForm.userName,
281
+  //         deptId: numberValidateForm.deptId,
282
+  //         phonenumber: numberValidateForm.phonenumber,
283
+  //         email: numberValidateForm.email,
284
+  //         loginName: numberValidateForm.loginName,
285
+  //         password: numberValidateForm.password,
286
+  //         sex: numberValidateForm.sex,
287
+  //         status: numberValidateForm.status ? 0 : 1,
288
+  //         postIds: numberValidateForm.postIds.toString(),
289
+  //         roleIds: numberValidateForm.roleIds.toString(),
290
+  //         remark: numberValidateForm.remark,
291
+  //         powerId: numberValidateForm.departmentId.toString(),
292
+  //         sendTime: numberValidateForm.emailTypetime,
293
+  //         emailType: numberValidateForm.emailType
294
+  //       };
295
+
296
+  //       const { data } = await platformadd(obj);
297
+  //       // let objobj = {
298
+  //       //   powerId: numberValidateForm.departmentId.toString()
299
+  //       // };
300
+  //       // const { data: res } = await savetenantpower(route.query.id, objobj);
301
+  //       // console.log(res);
302
+
303
+  //       console.log(data);
304
+  //     } else {
305
+  //       const obj = {
306
+  //         userName: numberValidateForm.userName,
307
+  //         deptId: numberValidateForm.deptId,
308
+  //         phonenumber: numberValidateForm.phonenumber,
309
+  //         email: numberValidateForm.email,
310
+  //         loginName: numberValidateForm.loginName,
311
+  //         // password: "",
312
+  //         sex: numberValidateForm.sex,
313
+  //         status: numberValidateForm.status ? 0 : 1,
314
+  //         postIds: numberValidateForm.postIds.toString(),
315
+  //         roleIds: numberValidateForm.roleIds.toString(),
316
+  //         remark: numberValidateForm.remark,
317
+  //         id: route.query.id,
318
+  //         powerId: numberValidateForm.departmentId.toString(),
319
+  //         sendTime: numberValidateForm.emailTypetime,
320
+  //         emailType: numberValidateForm.emailType
321
+  //       };
322
+
323
+  //       const { data } = await platformedit(obj);
324
+  //       console.log(data);
325
+  //     }
326
+
327
+  //     router.back();
328
+  //   } else {
329
+  //     console.log("error submit!");
330
+  //     return false;
331
+  //   }
332
+  // });
276
   formEl.validate(async valid => {
333
   formEl.validate(async valid => {
277
     if (valid) {
334
     if (valid) {
278
-      if (route.query.type == "用户新增") {
279
-        const obj = {
280
-          userName: numberValidateForm.userName,
281
-          deptId: numberValidateForm.deptId,
282
-          phonenumber: numberValidateForm.phonenumber,
283
-          email: numberValidateForm.email,
284
-          loginName: numberValidateForm.loginName,
285
-          password: numberValidateForm.password,
286
-          sex: numberValidateForm.sex,
287
-          status: numberValidateForm.status ? 0 : 1,
288
-          postIds: numberValidateForm.postIds.toString(),
289
-          roleIds: numberValidateForm.roleIds.toString(),
290
-          remark: numberValidateForm.remark,
291
-          powerId: numberValidateForm.departmentId.toString(),
292
-          sendTime: numberValidateForm.emailTypetime,
293
-          emailType: numberValidateForm.emailType
294
-        };
335
+      // Common object structure
336
+      const obj = {
337
+        userName: numberValidateForm.userName,
338
+        deptId: numberValidateForm.deptId,
339
+        phonenumber: numberValidateForm.phonenumber,
340
+        email: numberValidateForm.email,
341
+        loginName: numberValidateForm.loginName,
342
+        sex: numberValidateForm.sex,
343
+        status: numberValidateForm.status ? 0 : 1,
344
+        postIds: numberValidateForm.postIds.toString(),
345
+        roleIds: numberValidateForm.roleIds.toString(),
346
+        remark: numberValidateForm.remark,
347
+        powerId: numberValidateForm.departmentId.toString(),
348
+        sendTime: numberValidateForm.emailTypetime,
349
+        emailType: numberValidateForm.emailType,
350
+        ...(route.query.type === "用户编辑" && { id: route.query.id }) // Conditionally add ID for editing
351
+      };
295
 
352
 
296
-        const { data } = await platformadd(obj);
297
-        // let objobj = {
298
-        //   powerId: numberValidateForm.departmentId.toString()
299
-        // };
300
-        // const { data: res } = await savetenantpower(route.query.id, objobj);
301
-        // console.log(res);
353
+      try {
354
+        let responseData;
302
 
355
 
303
-        console.log(data);
304
-      } else {
305
-        const obj = {
306
-          userName: numberValidateForm.userName,
307
-          deptId: numberValidateForm.deptId,
308
-          phonenumber: numberValidateForm.phonenumber,
309
-          email: numberValidateForm.email,
310
-          loginName: numberValidateForm.loginName,
311
-          // password: "",
312
-          sex: numberValidateForm.sex,
313
-          status: numberValidateForm.status ? 0 : 1,
314
-          postIds: numberValidateForm.postIds.toString(),
315
-          roleIds: numberValidateForm.roleIds.toString(),
316
-          remark: numberValidateForm.remark,
317
-          id: route.query.id,
318
-          powerId: numberValidateForm.departmentId.toString(),
319
-          sendTime: numberValidateForm.emailTypetime,
320
-          emailType: numberValidateForm.emailType
321
-        };
356
+        if (route.query.type === "用户新增") {
357
+          responseData = await platformadd(obj);
358
+        } else {
359
+          responseData = await platformedit(obj);
360
+        }
322
 
361
 
323
-        const { data } = await platformedit(obj);
324
-        console.log(data);
362
+        console.log(responseData.data);
363
+        router.back(); // Navigate back after success
364
+      } catch (error) {
365
+        console.error("Submission error:", error);
325
       }
366
       }
326
-
327
-      router.back();
328
     } else {
367
     } else {
329
-      console.log("error submit!");
330
-      return false;
368
+      console.log("Validation failed!");
331
     }
369
     }
332
   });
370
   });
333
 };
371
 };

+ 2
- 1
src/views/user/index.vue View File

124
     </el-dialog>
124
     </el-dialog>
125
   </div>
125
   </div>
126
 </template>
126
 </template>
127
-<!--    -->
127
+<!--  
128
+-->
128
 <script setup lang="ts">
129
 <script setup lang="ts">
129
 import { useHandleData } from "@/hooks/useHandleData.js";
130
 import { useHandleData } from "@/hooks/useHandleData.js";
130
 import { ref, onMounted, reactive } from "vue";
131
 import { ref, onMounted, reactive } from "vue";

+ 5
- 4
src/views/userinformation/index.vue View File

33
         推送类型:<span class="user_div">
33
         推送类型:<span class="user_div">
34
           <div v-if="userdata.user.emailType == 0">暂不发送</div>
34
           <div v-if="userdata.user.emailType == 0">暂不发送</div>
35
           <div v-if="userdata.user.emailType == 1">详细邮件</div>
35
           <div v-if="userdata.user.emailType == 1">详细邮件</div>
36
-          <div v-if="userdata.user.emailType == 2">简邮件</div>
36
+          <div v-if="userdata.user.emailType == 2">简邮件</div>
37
         </span>
37
         </span>
38
         &nbsp; &nbsp; &nbsp; &nbsp;
38
         &nbsp; &nbsp; &nbsp; &nbsp;
39
         <el-button :icon="Share" @click="dialogemailType = true">修改</el-button>
39
         <el-button :icon="Share" @click="dialogemailType = true">修改</el-button>
121
         label: "暂不发送邮件"
121
         label: "暂不发送邮件"
122
       },
122
       },
123
       {
123
       {
124
-        value: "1",
124
+        value: "2",
125
         label: "发送邮件"
125
         label: "发送邮件"
126
       }
126
       }
127
     ];
127
     ];
133
       },
133
       },
134
       {
134
       {
135
         value: "1",
135
         value: "1",
136
-        label: "简易邮件"
136
+        label: "详细邮件"
137
       },
137
       },
138
       {
138
       {
139
         value: "2",
139
         value: "2",
140
-        label: "详细邮件"
140
+        label: "简易邮件"
141
       }
141
       }
142
     ];
142
     ];
143
   }
143
   }
202
     getplatformuserlist();
202
     getplatformuserlist();
203
   });
203
   });
204
 };
204
 };
205
+
205
 //
206
 //
206
 onMounted(() => {
207
 onMounted(() => {
207
   const current = localStorage.getItem("currentDate");
208
   const current = localStorage.getItem("currentDate");

Loading…
Cancel
Save