Bladeren bron

大储离线导出导入

master
dong 1 jaar geleden
bovenliggende
commit
b84723517d

+ 1
- 9
.env.development Bestand weergeven

@@ -25,15 +25,7 @@ VITE_PROXY = [["/api","https://esos-iot.bjdexn.cn"]]
25 25
 # VITE_PROXY = [["/api-easymock","https://mock.mengxuegu.com"],["/api-fastmock","https://www.fastmock.site"]]
26 26
 # 故障列表 导出  /电站级
27 27
 # 邮箱分享报表 电量 收益    普通用户 / 故障信息  管理员
28
-# 0.3094     1.1344
29
-# 
30
-# 209        363
31
-# 
32
-#                                             
33
-# 
34
-# 
35
-#                                                                                                          
36
-# 
28
+
37 29
 
38 30
 
39 31
 

+ 2
- 0
.vscode/settings.json Bestand weergeven

@@ -78,10 +78,12 @@
78 78
     "openxmlformats",
79 79
     "operatingcurve",
80 80
     "Pageable",
81
+    "periodoftime",
81 82
     "persistedstate",
82 83
     "phonenumber",
83 84
     "pinia",
84 85
     "pjpeg",
86
+    "poststationstation",
85 87
     "Prefixs",
86 88
     "reportforms",
87 89
     "reportpowerday",

+ 34
- 0
src/api/home/Multisite.ts Bestand weergeven

@@ -618,3 +618,37 @@ export const directorylURL = () => {
618 618
 export const directorylURL1 = () => {
619 619
   return http.get(`/Thisitem_20241029.tar.gz`, {}, { loading: false });
620 620
 };
621
+// 接口监控日志
622
+export const LogListpageURL = (params: {}) => {
623
+  return http.post(`/Generate/LogListpage`, qs.stringify(params));
624
+};
625
+// 设备控制启停
626
+export const mqttsendURL = (params: {}) => {
627
+  return http.post(`/mqtt/send`, qs.stringify(params));
628
+};
629
+// 设备控制时间段控制
630
+export const periodoftimeURL = (id: any, params: {}) => {
631
+  return http.post(`/mqtt/periodoftime?deviceId=${id}`, params);
632
+};
633
+// 本地文件上传查询接口
634
+export const selectfileURL = (params: {}) => {
635
+  return http.post(`/tdengineyuanshi/selectfile`, params);
636
+};
637
+// 上传文件
638
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
639
+export const tdengineyuanshiURL = (params: {}, body: FormData) => {
640
+  return http.post(`/tdengineyuanshi/upload`, body, {
641
+    params, // 将额外参数作为查询参数传递
642
+    headers: {
643
+      "Content-Type": "multipart/form-data" // 设置请求头为 multipart/form-data
644
+    }
645
+  });
646
+};
647
+// 大储本地文件下载
648
+export const downloadfileURL = (params: {}) => {
649
+  return http.download(`/tdengineyuanshi/downloadfile`, qs.stringify(params));
650
+};
651
+// 本地查询数字典
652
+export const selectfileidURL = (params: {}) => {
653
+  return http.post(`/tdengineyuanshi/selectfileid`, params);
654
+};

+ 1
- 1
src/api/index.ts Bestand weergeven

@@ -146,7 +146,7 @@ class RequestHttp {
146 146
   delete<T>(url: string, params?: any, _object = {}): Promise<ResultData<T>> {
147 147
     return this.service.delete(url, { params, ..._object });
148 148
   }
149
-  download(url: string, params?: object, _object = {}): Promise<BlobPart> {
149
+  download(url: string, params?: object | string, _object = {}): Promise<BlobPart> {
150 150
     return this.service.post(url, params, { ..._object, responseType: "blob" });
151 151
   }
152 152
 }

+ 1
- 0
src/api/interface/index.ts Bestand weergeven

@@ -156,6 +156,7 @@ export namespace Station {
156 156
   }
157 157
   // 设备监控 tap标签
158 158
   export interface deviceList {
159
+    name: string;
159 160
     deviceClass: number;
160 161
     deviceType: number;
161 162
     deviceClassName: string;

+ 22
- 9
src/views/home/index.vue Bestand weergeven

@@ -529,8 +529,13 @@ const getdaymonthyear = async (value: any) => {
529 529
     const currentDate = today.toISOString().split("T")[0];
530 530
     const sevenDaysAgoDate = new Date(today);
531 531
     sevenDaysAgoDate.setDate(today.getDate() - 6);
532
-    const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
533
-    value2.value = [sevenDaysAgo, currentDate];
532
+    // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
533
+    const year1 = sevenDaysAgoDate.getFullYear();
534
+    const month1 = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
535
+    const day1 = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
536
+    const formattedDate = `${year1}-${month1}-${day1}`;
537
+
538
+    value2.value = [formattedDate, currentDate];
534 539
     // getreportpowerday();
535 540
   } else if (value == 2) {
536 541
     const today = new Date();
@@ -690,9 +695,16 @@ const getsite = async () => {
690 695
   localStorage.setItem("currentDate", currentDate.value);
691 696
   const today = new Date();
692 697
   const sevenDaysAgoDate = new Date(today);
693
-  sevenDaysAgoDate.setDate(today.getDate() - 6);
694
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
695
-  value2.value = [sevenDaysAgo, currentDate.value];
698
+  sevenDaysAgoDate.setDate(today.getDate() - 7);
699
+  // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
700
+  // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
701
+  const year1 = sevenDaysAgoDate.getFullYear();
702
+  const month1 = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
703
+  const day1 = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
704
+
705
+  // Format the date as "YYYY-MM-DD"
706
+  const formattedDate = `${year1}-${month1}-${day1}`;
707
+  value2.value = [formattedDate, currentDate.value];
696 708
   const { data } = await gethomesite();
697 709
 
698 710
   multiStation.value = data;
@@ -710,7 +722,7 @@ const getmultiStation = async () => {
710 722
       dates.push([data[index].ymd, data[index].profit]);
711 723
     }
712 724
   } else {
713
-    dates.push([value2.value[0], "50"], [value2.value[1], "120"]);
725
+    dates.push([value2.value[0], "0"], [value2.value[1], "0"]);
714 726
   }
715 727
   const profits = [{ type: "bar" }];
716 728
 
@@ -729,7 +741,7 @@ const getmultiStationMonthMonth = async () => {
729 741
       dates.push([data[index].ymd, data[index].profit]);
730 742
     }
731 743
   } else {
732
-    dates.push([value2.value[0], "50"], [value2.value[1], "120"]);
744
+    dates.push([value2.value[0], "0"], [value2.value[1], "0"]);
733 745
   }
734 746
   const profits = [{ type: "bar" }];
735 747
 
@@ -864,7 +876,7 @@ const getmultiStationtopday = async () => {
864 876
     profitlist = sortedData.map(item => parseFloat(item.profit)); // 转回为数字
865 877
     stationNames = sortedData.map(item => item.stationName);
866 878
   } else {
867
-    profitlist = [60, 40, 70, 20, 80, 100, 120];
879
+    profitlist = [1, 1, 1, 1, 1, 1, 1];
868 880
     stationNames = ["演示电站一", "演示电站二", "演示电站三", "演示电站四", "演示电站五", "演示电站六", "演示电站七"];
869 881
   }
870 882
 
@@ -886,7 +898,7 @@ const getmultiStationtopdayMonth = async () => {
886 898
     profitlist = sortedData.map(item => parseFloat(item.profit)); // 转回为数字
887 899
     stationNames = sortedData.map(item => item.stationName);
888 900
   } else {
889
-    profitlist = [60, 40, 70, 20, 80, 100, 120];
901
+    profitlist = [1, 1, 1, 1, 1, 1, 1];
890 902
     stationNames = ["演示电站一", "演示电站二", "演示电站三", "演示电站四", "演示电站五", "演示电站六", "演示电站七"];
891 903
   }
892 904
 
@@ -1102,6 +1114,7 @@ const postmultiStationpagebaseInfo = async () => {
1102 1114
 
1103 1115
   pageable.value.total = tableData.value.total;
1104 1116
 };
1117
+
1105 1118
 onMounted(() => {
1106 1119
   getsite();
1107 1120
   getmultiStationtopday();

+ 32
- 0
src/views/localdata/index.scss Bestand weergeven

@@ -1,8 +1,14 @@
1 1
 .screen {
2 2
   display: flex;
3
+  justify-content: space-between;
3 4
   width: 100%;
4 5
   margin-bottom: 20px;
5 6
 }
7
+.screen_right {
8
+  display: flex;
9
+
10
+  // width: 100%;
11
+}
6 12
 .screen1 {
7 13
   display: flex;
8 14
   justify-content: space-between;
@@ -30,3 +36,29 @@
30 36
   margin-top: 20px;
31 37
   font-size: 16px;
32 38
 }
39
+.export {
40
+  margin-left: 40px;
41
+}
42
+.dialoglexce {
43
+  display: flex;
44
+  flex-direction: column;
45
+
46
+  // align-items: center;
47
+  height: 360px;
48
+  margin-top: 40px;
49
+}
50
+.dialoglexcebox {
51
+  display: flex;
52
+  align-items: center;
53
+}
54
+.dialogpileup {
55
+  margin-top: 40px;
56
+}
57
+.dialoglexce_box {
58
+  display: flex;
59
+}
60
+.dialoglexce_right {
61
+  box-sizing: border-box;
62
+  width: 50%;
63
+  padding: 30px;
64
+}

+ 253
- 140
src/views/localdata/index.vue Bestand weergeven

@@ -4,100 +4,50 @@
4 4
       本地数据
5 5
       <div class="title_time">{{ currentDate }}</div>
6 6
     </div>
7
-    <!-- <div class="card">
7
+
8
+    <div class="card">
8 9
       <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>
10
+        <el-radio-group v-model="commerce" size="large" fill="#0052d9" @change="oncommerce">
11
+          <el-radio-button label="工商业储能" :value="1" />
12
+          <el-radio-button label="大储储能" :value="2" />
13
+        </el-radio-group>
14
+
15
+        <div class="screen_right" v-if="commerce == 2">
16
+          <div>
17
+            电站&ensp;&ensp;
18
+            <el-cascader v-model="localdata" :options="optionsfile" :props="cascaderProps" filterable @change="postemsDevice" />
19
+          </div>
20
+          &ensp;&ensp;&ensp;&ensp;
66 21
           <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;
22
+          <div class="export">
23
+            <el-button type="primary" size="large" color="#0052d9" @click="newaddition">导入</el-button>
24
+          </div>
69 25
         </div>
70 26
       </div>
71
-    </div> -->
27
+    </div>
72 28
     <div class="card cardbottom">
73 29
       <div>&ensp;</div>
74 30
       <el-table
75
-        :data="tableData.children"
31
+        :data="commerce == 1 ? tableData.children : options"
76 32
         row-key="name"
77 33
         :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
78 34
         style="width: 100%"
79 35
         border
36
+        show-overflow-tooltip
80 37
         @row-click="handleRowClick"
81 38
       >
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 39
         <el-table-column prop="name" label="文件名称" />
86
-        <el-table-column prop="size" label="文件大小" />
87
-        <el-table-column prop="type" label="文件类型" />
40
+
41
+        <el-table-column prop="id" label="ID" />
42
+        <el-table-column prop="parentId" label="父ID" />
88 43
         <el-table-column label="操作" align="center" width="180">
89 44
           <template #default="scope">
90
-            <el-button v-if="scope.row.type == 'file'" @click="downloadxlsx(row.name)">下载</el-button>
45
+            <el-button v-if="scope.row.type == 'file'" @click="downloadxlsx(scope.row.name)">下载</el-button>
46
+            <el-button v-if="scope.row.fileType == 'file'" @click="downloadfilezip(scope.row)">下载</el-button>
91 47
           </template>
92 48
         </el-table-column>
93 49
       </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> -->
50
+      <!--    -->
101 51
     </div>
102 52
     <el-dialog v-model="dialogVisible" title="导出中" top="300px" width="40%" @close="handleClose">
103 53
       <div class="lexce">{{ message }}</div>
@@ -108,36 +58,96 @@
108 58
         </div>
109 59
       </template>
110 60
     </el-dialog>
61
+    <!-- 大储导出 -->
62
+    <el-dialog v-model="energystorage" title="大储导入" top="100px" width="40%" @close="handenergyClose">
63
+      <div class="dialoglexce_box">
64
+        <div class="dialoglexce">
65
+          <div class="dialoglexcebox">
66
+            电站&ensp;&ensp;
67
+            <el-cascader
68
+              v-model="status"
69
+              style="width: 300px"
70
+              :options="optionsfile"
71
+              :props="cascaderProps"
72
+              filterable
73
+              @change="e => onpostemsDevice(e)"
74
+            />
75
+          </div>
76
+          <div class="dialogpileup">
77
+            &ensp;&ensp;{{ acbcType == 1 ? "堆" : "PCS" }}&ensp;&ensp;<el-input
78
+              v-model="emsdevicename"
79
+              style="width: 300px"
80
+              size="large"
81
+              placeholder="请输入"
82
+            />
83
+          </div>
84
+          <div class="dialogpileup" v-if="acbcType == 1">
85
+            &ensp;&ensp;栈&ensp;&ensp;<el-input v-model="Stackename" style="width: 300px" size="large" placeholder="请输入" />
86
+          </div>
87
+        </div>
88
+        <div class="dialoglexce_right">
89
+          <el-upload class="upload-demo" :data="uploadData" drag :before-upload="beforeUpload" multiple>
90
+            <el-icon class="el-icon--upload"><upload-filled /></el-icon>
91
+            <div class="el-upload__text">点击上传 <em>拖拽上传</em></div>
92
+            <template #tip>
93
+              <div class="el-upload__tip">上传文件,文件大小500kb</div>
94
+            </template>
95
+          </el-upload>
96
+        </div>
97
+      </div>
98
+
99
+      <template #footer>
100
+        <div class="dialog-footer">
101
+          <el-button @click="handenergyClose">取消导出</el-button>
102
+          <el-button type="primary" @click="handenergysure"> 确定 </el-button>
103
+        </div>
104
+      </template>
105
+    </el-dialog>
111 106
   </div>
112 107
 </template>
113
-<!--    -->
108
+<!-- || -->
114 109
 <script setup lang="ts">
115
-import { directorylURL, stationstationName, selectaccountNumber } from "@/api/home/Multisite";
110
+import { directorylURL, selectfileURL, tdengineyuanshiURL, downloadfileURL, selectfileidURL } from "@/api/home/Multisite";
116 111
 import { onMounted, Ref, ref } from "vue";
112
+import { UploadFilled } from "@element-plus/icons-vue";
117 113
 // import { useAuthButtons } from "@/hooks/useAuthButtons";
118 114
 // const { BUTTONS } = useAuthButtons();
119
-import { Station } from "@/api/interface";
115
+// import { Station } from "@/api/interface";
120 116
 // import Pagination from "@/components/ProTable/components/Pagination.vue";
121
-import { TreeNode } from "element-plus";
117
+import { ElMessage, TreeNode } from "element-plus";
122 118
 // import { saveAs } from "file-saver";
123 119
 // import axios from "axios";
124 120
 
125 121
 // import { useRouter } from "vue-router";
126 122
 // const router = useRouter();
127
-const translate = ref();
128
-
129
-const cities: Ref<Station.todo[]> = ref([]);
123
+// const translate = ref();
130 124
 
131 125
 const timevalue: Ref<any> = ref([]);
132
-
133
-const poststationstationName = async () => {
134
-  const { data } = await stationstationName({});
135
-  cities.value = data;
126
+const options = ref();
127
+const cascaderProps = ref({
128
+  value: "id", // 绑定值的字段
129
+  label: "name", // 显示文本的字段
130
+  children: "children", // 子选项的字段
131
+  checkStrictly: true
132
+});
133
+const postselectfileURL = async () => {
134
+  const { data } = await selectfileURL({});
135
+  console.log(data);
136
+  options.value = data;
137
+};
138
+// 回显
139
+const optionsfile = ref();
140
+const onselectfileid = async () => {
141
+  const { data } = await selectfileidURL({});
142
+  console.log(data);
143
+  optionsfile.value = data;
136 144
 };
137
-
138 145
 const dialogVisible = ref(false);
139 146
 const message = ref("");
140 147
 
148
+const status = ref();
149
+const localdata = ref();
150
+
141 151
 const timerId = ref();
142 152
 
143 153
 const excelexport = ref();
@@ -157,29 +167,6 @@ const pageable = ref({
157 167
   ps: 10,
158 168
   total: 0
159 169
 });
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 170
 const currentPath = ref();
184 171
 const handleRowClick = (node: TreeNode) => {
185 172
   // 获取当前点击行的所有父级名称
@@ -211,19 +198,6 @@ const getParentNames = (currentNode: any, targetNode: any, parentNames: string[]
211 198
   return null;
212 199
 };
213 200
 
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 201
 const downloadxlsx = (name: any) => {
228 202
   let fileUrl = `myDeviceData/${name}`;
229 203
   let fileName = name;
@@ -248,17 +222,31 @@ const downloadxlsx = (name: any) => {
248 222
       console.error("下载文件时出错:", error);
249 223
     });
250 224
 };
225
+//
226
+const downloadfilezip = async (row: { name: any }) => {
227
+  console.log(row.name);
228
+  try {
229
+    let params = {
230
+      fileName: row.name
231
+    };
232
+    const response = await downloadfileURL(params); // 假设返回的是包含 headers 的完整响应
233
+    const blob = response; // 获取 Blob 数据
234
+    // 创建下载链接
235
+    const url = window.URL.createObjectURL(new Blob([blob]));
236
+    console.log(blob);
251 237
 
238
+    const a = document.createElement("a");
239
+    a.href = url;
240
+    a.setAttribute("download", `${row.name}.zip`); // 设置下载文件名
241
+    document.body.appendChild(a);
242
+    a.click();
243
+    document.body.removeChild(a);
244
+    return;
245
+  } catch (error) {
246
+    console.error("下载失败:", error);
247
+  }
248
+};
252 249
 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 250
   const { data } = await directorylURL();
263 251
 
264 252
   tableData.value = data;
@@ -266,12 +254,136 @@ const getplatformuserlist = async () => {
266 254
   head.value = Object.keys(tableData.value.list[0]);
267 255
   pageable.value.total = tableData.value.page.totald;
268 256
 };
257
+
269 258
 const currentDate = ref();
270 259
 
271
-const selectaccountNumberlist = async () => {
272
-  const { data } = await selectaccountNumber({});
273
-  console.log(data);
274
-  translate.value = data;
260
+const commerce = ref(1);
261
+
262
+const oncommerce = async () => {
263
+  console.log(commerce.value);
264
+  if (commerce.value == 1) {
265
+    getplatformuserlist();
266
+  } else {
267
+    postselectfileURL();
268
+    onselectfileid();
269
+  }
270
+};
271
+// 大储弹窗
272
+const energystorage = ref(false);
273
+
274
+const handenergyClose = async () => {
275
+  energystorage.value = false;
276
+};
277
+
278
+const emsdevicename = ref("");
279
+const Stackename = ref("");
280
+const uploadData = ref();
281
+const handenergysure = async () => {
282
+  // 构建额外参数对象
283
+  console.log(status.value);
284
+  console.log(emsdevicename.value);
285
+  console.log(Stackename.value);
286
+
287
+  if (acbcType.value == 1) {
288
+    if (status.value == undefined || emsdevicename.value == "" || Stackename.value == "" || uploadData.value == undefined) {
289
+      ElMessage({
290
+        type: "warning",
291
+        message: "请输入完整信息"
292
+      });
293
+      return;
294
+    } else if (status.value.length < 4) {
295
+      ElMessage({
296
+        type: "warning",
297
+        message: "最少选择到仓级"
298
+      });
299
+      return;
300
+    }
301
+  } else if (acbcType.value == 2) {
302
+    if (status.value == undefined || emsdevicename.value == "" || uploadData.value == undefined) {
303
+      ElMessage({
304
+        type: "warning",
305
+        message: "请输入完整信息"
306
+      });
307
+      return;
308
+    } else if (status.value.length < 4) {
309
+      ElMessage({
310
+        type: "warning",
311
+        message: "最少选择到仓级"
312
+      });
313
+      return;
314
+    }
315
+  }
316
+
317
+  let obj = {
318
+    deviceId: status.value[1],
319
+    acdcType: acbcType.value,
320
+    acdcId: status.value[2],
321
+    syspileId: emsdevicename.value,
322
+    crowdId: Stackename.value
323
+  };
324
+  // 创建 FormData 对象
325
+  const formData = new FormData();
326
+  formData.append("file", uploadData.value); // 添加文件
327
+  try {
328
+    // 调用上传接口
329
+    const { data } = await tdengineyuanshiURL(obj, formData);
330
+    console.log(data);
331
+    energystorage.value = false;
332
+  } catch (error) {
333
+    console.error("上传失败:", error);
334
+  }
335
+};
336
+const newaddition = async () => {
337
+  console.log(commerce.value);
338
+  energystorage.value = true;
339
+};
340
+const acbcType = ref(1);
341
+const onpostemsDevice = async (e: any) => {
342
+  console.log(e);
343
+  console.log(options);
344
+
345
+  if (e.length == 3) {
346
+    const [firstLevel, secondLevel, thirdLevel] = e;
347
+
348
+    // 查找第一层
349
+    const firstLevelOption = options.value.find((item: { id: any }) => item.id === firstLevel);
350
+    if (firstLevelOption && firstLevelOption.children) {
351
+      // 查找第二层
352
+      const secondLevelOption = firstLevelOption.children.find((item: { id: any }) => item.id === secondLevel);
353
+      if (secondLevelOption && secondLevelOption.children) {
354
+        // 查找第三层
355
+        const selectedOption = secondLevelOption.children.find((item: { id: any }) => item.id === thirdLevel);
356
+        console.log("当前点击的节点:", selectedOption);
357
+        acbcType.value = selectedOption.acbcType;
358
+      }
359
+    }
360
+    emsdevicename.value = "";
361
+    Stackename.value = "";
362
+  } else if (e.length == 4) {
363
+    emsdevicename.value = e[3];
364
+    Stackename.value = "";
365
+  } else if (e.length == 5) {
366
+    emsdevicename.value = e[3];
367
+    Stackename.value = e[4];
368
+  }
369
+};
370
+const postemsDevice = async (e: any) => {
371
+  console.log(e);
372
+};
373
+const query = async (e: any) => {
374
+  console.log(e);
375
+};
376
+const beforeUpload = (file: Blob | MediaSource) => {
377
+  // 获取文件的临时路径
378
+  const filePath = URL.createObjectURL(file);
379
+  console.log("文件临时路径:", filePath);
380
+  console.log(file);
381
+  uploadData.value = file;
382
+  // 手动上传文件
383
+  // uploadFile(file);
384
+
385
+  // 返回 false,阻止默认上传行为
386
+  return false;
275 387
 };
276 388
 
277 389
 onMounted(() => {
@@ -287,14 +399,15 @@ onMounted(() => {
287 399
   timevalue.value = [currentDate.value, sevenDaysAgoDate];
288 400
   console.log(timevalue.value);
289 401
 
290
-  getplatformuserlist();
291
-  poststationstationName();
292
-  selectaccountNumberlist();
402
+  oncommerce();
403
+  // postselectfileURL();
293 404
 });
294 405
 </script>
295 406
 <style scoped lang="scss">
296 407
 @import "./index.scss";
297 408
 </style>
298 409
 <!--
410
+<style>
299 411
 
300
--->
412
+</style>
413
+ -->

+ 37
- 0
src/views/log/index.scss Bestand weergeven

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

+ 214
- 0
src/views/log/index.vue Bestand weergeven

@@ -0,0 +1,214 @@
1
+<template>
2
+  <div>
3
+    <div class="title">
4
+      本地数据
5
+      <div class="title_time">{{ currentDate }}</div>
6
+    </div>
7
+
8
+    <div class="card">
9
+      <div>
10
+        时间范围&ensp;&ensp;
11
+        <el-date-picker
12
+          size="large"
13
+          v-model="timevalue"
14
+          :shortcuts="shortcuts"
15
+          type="daterange"
16
+          start-placeholder="开始时间"
17
+          end-placeholder="结束时间"
18
+          :default-value="timevalue"
19
+          :disabled-date="pickerOptions"
20
+          value-format="YYYY-MM-DD"
21
+          format="YYYY-MM-DD"
22
+          @change="getplatformuserlist"
23
+        />
24
+      </div>
25
+    </div>
26
+    <div class="card cardbottom">
27
+      <div>&ensp;</div>
28
+      <el-table :data="tableData.records" style="width: 100%" border @row-click="handleRowClick" show-overflow-tooltip>
29
+        <el-table-column prop="operIp" label="IP" />
30
+        <el-table-column prop="operTime" label="时间" />
31
+        <el-table-column prop="status" label="状态" />
32
+        <el-table-column prop="method" label="接口" />
33
+        <el-table-column prop="jsonResult" label="响应数据" />
34
+        <el-table-column prop="errorMsg" label="错误消息" />
35
+      </el-table>
36
+      <!-- 分页 组件 -->
37
+      <div class="pagination">
38
+        <div></div>
39
+        <slot name="pagination">
40
+          <Pagination :pageable="pageable" :handle-size-change="handleSizeChange" :handle-current-change="handleCurrentChange" />
41
+        </slot>
42
+      </div>
43
+    </div>
44
+    <el-dialog v-model="dialogVisible" title="导出中" top="300px" width="40%" @close="handleClose">
45
+      <div class="lexce">{{ message }}</div>
46
+      <template #footer>
47
+        <div class="dialog-footer" v-if="excelexport">
48
+          <el-button v-if="excelexport.progress == 0" @click="handleClose">取消导出</el-button>
49
+          <el-button v-if="excelexport.progress == 3" type="primary" @click="handleClose"> 确定 </el-button>
50
+        </div>
51
+      </template>
52
+    </el-dialog>
53
+  </div>
54
+</template>
55
+<!--  
56
+
57
+-->
58
+<script setup lang="ts">
59
+import { LogListpageURL } from "@/api/home/Multisite";
60
+import { onMounted, Ref, ref } from "vue";
61
+// import { useAuthButtons } from "@/hooks/useAuthButtons";
62
+// const { BUTTONS } = useAuthButtons();
63
+// import { Station } from "@/api/interface";
64
+import Pagination from "@/components/ProTable/components/Pagination.vue";
65
+import { TreeNode } from "element-plus";
66
+// import { saveAs } from "file-saver";
67
+// import axios from "axios";
68
+
69
+// import { useRouter } from "vue-router";
70
+// const router = useRouter();
71
+// const translate = ref();
72
+
73
+// const cities: Ref<Station.todo[]> = ref([]);
74
+
75
+const timevalue: Ref<any> = ref([]);
76
+
77
+const dialogVisible = ref(false);
78
+const message = ref("");
79
+
80
+const timerId = ref();
81
+
82
+const excelexport = ref();
83
+
84
+const handleClose = async () => {
85
+  if (timerId.value) {
86
+    clearTimeout(timerId.value);
87
+    timerId.value = ""; // 清除引用
88
+    dialogVisible.value = false;
89
+  }
90
+};
91
+
92
+const tableData = ref();
93
+const shortcuts = [
94
+  {
95
+    text: "过去7天",
96
+    value: () => {
97
+      const end = new Date();
98
+      const start = new Date();
99
+      start.setDate(start.getDate() - 7);
100
+      return [start, end];
101
+    }
102
+  },
103
+  {
104
+    text: "过去1个月",
105
+    value: () => {
106
+      const end = new Date();
107
+      const start = new Date();
108
+      start.setMonth(start.getMonth() - 1);
109
+      return [start, end];
110
+    }
111
+  },
112
+  {
113
+    text: "过去3个月",
114
+    value: () => {
115
+      const end = new Date();
116
+      const start = new Date();
117
+      start.setMonth(start.getMonth() - 3);
118
+      return [start, end];
119
+    }
120
+  }
121
+];
122
+const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
123
+  return time.getTime(new Date()) > Date.now();
124
+};
125
+// const head = ref();
126
+const pageable = ref({
127
+  pn: 1,
128
+  ps: 10,
129
+  total: 0
130
+});
131
+// 表格操作 Hooks
132
+const handleSizeChange = async (e: any) => {
133
+  pageable.value.ps = e;
134
+  getplatformuserlist();
135
+};
136
+const handleCurrentChange = async (e: any) => {
137
+  pageable.value.pn = e;
138
+
139
+  getplatformuserlist();
140
+};
141
+
142
+const currentPath = ref();
143
+const handleRowClick = (node: TreeNode) => {
144
+  // 获取当前点击行的所有父级名称
145
+  const parentNames = getParentNames(tableData.value, node, []);
146
+  console.log("点击的节点: ", node); // 输出当前点击节点
147
+  // 拼接成字符串
148
+  currentPath.value = parentNames?.join("/"); // 不反转顺序,确保路径是从根节点到目标节点的顺序
149
+  console.log("父级路径: ", currentPath.value); // 输出拼接后的父级路径
150
+};
151
+
152
+// 明确指定参数类型和返回类型
153
+const getParentNames = (currentNode: any, targetNode: any, parentNames: string[]): string[] | null => {
154
+  // 如果找到了目标节点
155
+  if (currentNode.name === targetNode.name) {
156
+    parentNames.push(currentNode.name); // 添加当前节点的名称到父级路径
157
+    return parentNames;
158
+  }
159
+
160
+  // 如果当前节点有子节点,递归查找
161
+  if (currentNode.children && currentNode.children.length) {
162
+    const newParentNames = [...parentNames, currentNode.name]; // 创建新的父级名称数组
163
+    for (let child of currentNode.children) {
164
+      const result = getParentNames(child, targetNode, newParentNames);
165
+      if (result) return result;
166
+    }
167
+  }
168
+
169
+  // 如果没有找到,返回 null
170
+  return null;
171
+};
172
+
173
+const getplatformuserlist = async () => {
174
+  let obj = {
175
+    operparam: "2f4bc06e-6caf-48f6-a4cc-8ad92becb709",
176
+    page: pageable.value.pn,
177
+    rows: pageable.value.ps,
178
+    stationTime: timevalue.value[1],
179
+    endTime: timevalue.value[0]
180
+  };
181
+  const { data } = await LogListpageURL(obj);
182
+
183
+  tableData.value = data;
184
+
185
+  // head.value = Object.keys(tableData.value.list[0]);
186
+  pageable.value.total = tableData.value.total;
187
+};
188
+const currentDate = ref();
189
+
190
+onMounted(() => {
191
+  const current = localStorage.getItem("currentDate");
192
+  if (current) {
193
+    currentDate.value = current;
194
+  }
195
+  const today = new Date();
196
+  const sevenDaysAgo = new Date(today);
197
+  sevenDaysAgo.setDate(today.getDate() - 7);
198
+  const sevenDaysAgoDate = sevenDaysAgo.toISOString().split("T")[0];
199
+
200
+  timevalue.value = [currentDate.value, sevenDaysAgoDate];
201
+  console.log(timevalue.value);
202
+
203
+  getplatformuserlist();
204
+  // poststationstationName();
205
+  // selectaccountNumberlist();
206
+});
207
+</script>
208
+<style scoped lang="scss">
209
+@import "./index.scss";
210
+</style>
211
+
212
+<!-- 
213
+
214
+-->

+ 23
- 1
src/views/monitor/index.vue Bestand weergeven

@@ -41,11 +41,15 @@
41 41
     <div class="equipment">
42 42
       <el-card>
43 43
         <el-tabs v-model="activeName" class="demo-tabs" @tab-change="handletabs">
44
-          <el-tab-pane v-for="(item, index) in deviceList" :key="index" :label="item.deviceClassName" :name="index">
44
+          <el-tab-pane v-for="(item, index) in deviceList" :key="index" :label="item.name" :name="index">
45 45
             <div class="demo_div">
46 46
               <div v-for="(items, indexs) in item.devices" :key="indexs">
47 47
                 <div :class="devicesClickindex == indexs ? 'demo_tabsccc' : 'demo_tabs'" @click="devicesClick(indexs, items.id)">
48 48
                   {{ items.deviceName }}
49
+                  <!-- 储能变流器 -->
50
+                  <!-- 电池 -->
51
+                  <!--  系统-->
52
+                  <!--  液冷-->
49 53
                 </div>
50 54
               </div>
51 55
             </div>
@@ -966,12 +970,30 @@ const postemsDevice = async (value: any) => {
966 970
 };
967 971
 const deviceList: Ref<Station.deviceList[]> = ref([]);
968 972
 const deviceType = ref(1);
973
+// 定义排序优先级
974
+const typeMap: Record<string, { name: string; order: number }> = {
975
+  pcs: { name: "变流器", order: 1 },
976
+  bms: { name: "电池", order: 2 },
977
+  sys: { name: "系统", order: 3 },
978
+  lcs: { name: "液冷", order: 4 }
979
+};
969 980
 
970 981
 const getstationrealtime = async () => {
971 982
   const { data } = await poststationdeviceList({ emsId: emsDeviceId.value }, Singlevalue.value);
972 983
   if (data.length == 0) return;
973 984
 
974 985
   deviceList.value = data;
986
+
987
+  // 按优先级排序
988
+  deviceList.value = deviceList.value
989
+    .map(item => ({
990
+      ...item,
991
+      name: typeMap[item.deviceClassName]?.name || "未知设备"
992
+    }))
993
+    .sort((a, b) => (typeMap[a.deviceClassName]?.order || Infinity) - (typeMap[b.deviceClassName]?.order || Infinity));
994
+  // 然后按 deviceType 排序
995
+  console.log(deviceList.value);
996
+
975 997
   deviceType.value = data[0].deviceType;
976 998
   handleClick();
977 999
   // 清除定时器的示例

+ 8
- 0
src/views/overview/index.scss Bestand weergeven

@@ -243,6 +243,14 @@
243 243
   align-items: center;
244 244
   font-size: 14px;
245 245
 }
246
+.gridpiechartnameleft1 {
247
+  display: flex;
248
+  align-items: center;
249
+  width: 200px; /* 内容宽度超过容器 */
250
+  overflow: hidden; /* 隐藏溢出内容 */
251
+  font-size: 14px;
252
+  white-space: nowrap; /* 不换行 */
253
+}
246 254
 .home {
247 255
   display: flex;
248 256
   align-items: center;

+ 116
- 10
src/views/overview/index.vue Bestand weergeven

@@ -217,8 +217,15 @@
217 217
             </div>
218 218
             <div class="gridpiechartdiv">
219 219
               <div class="gridpiechartnameright">电站地址</div>
220
-              <div class="gridpiechartnameleft">
221
-                <el-icon><Location /></el-icon>&nbsp;{{ stationinfodata.province }}{{ stationinfodata.city }}
220
+              <div class="gridpiechartnameleft1">
221
+                <el-icon><Location /></el-icon>&nbsp;<el-tooltip
222
+                  class="box-item"
223
+                  effect="dark"
224
+                  :content="stationinfodata.detailedaddress"
225
+                  placement="left-start"
226
+                >
227
+                  {{ stationinfodata.detailedaddress }}
228
+                </el-tooltip>
222 229
               </div>
223 230
             </div>
224 231
           </div>
@@ -423,6 +430,7 @@ const onselect = (val: any) => {
423 430
   postmultiStationpagebaseInfo();
424 431
   onhandleClick();
425 432
   getsite();
433
+  onpowerblur();
426 434
 };
427 435
 
428 436
 const cities: Ref<Station.todo[]> = ref([]);
@@ -515,8 +523,14 @@ const getdaymonthyear1 = async (value: any) => {
515 523
     const currentDate = today.toISOString().split("T")[0];
516 524
     const sevenDaysAgoDate = new Date(today);
517 525
     sevenDaysAgoDate.setDate(today.getDate() - 7);
518
-    const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
519
-    value2.value = [sevenDaysAgo, currentDate];
526
+    // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
527
+    const year = sevenDaysAgoDate.getFullYear();
528
+    const month = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
529
+    const day = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
530
+
531
+    // Format the date as "YYYY-MM-DD"
532
+    const formattedDate = `${year}-${month}-${day}`;
533
+    value2.value = [formattedDate, currentDate];
520 534
 
521 535
     // getreportpowerday();
522 536
   } else if (value == 2) {
@@ -695,9 +709,44 @@ const onhandleClick = () => {
695 709
   }
696 710
 };
697 711
 // 收益统计----日
712
+const listday = ref([
713
+  {
714
+    ymd: "2025-02-12",
715
+    profit: 1
716
+  },
717
+  {
718
+    ymd: "2025-02-13",
719
+    profit: 1
720
+  },
721
+  {
722
+    ymd: "2025-02-14",
723
+    profit: 1
724
+  },
725
+  {
726
+    ymd: "2025-02-15",
727
+    profit: 1
728
+  },
729
+  {
730
+    ymd: "2025-02-16",
731
+    profit: 1
732
+  },
733
+  {
734
+    ymd: "2025-02-17",
735
+    profit: 1
736
+  },
737
+  {
738
+    ymd: "2025-02-18",
739
+    profit: 1
740
+  }
741
+]);
742
+
698 743
 const gatsinglestationday = async () => {
699 744
   const { data } = await singlestationday({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
700 745
   const dates = [["product", "收益"]];
746
+
747
+  if (data.list.length < 1) {
748
+    data.list.push(...listday.value);
749
+  }
701 750
   for (let index = 0; index < data.list.length; index++) {
702 751
     dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
703 752
   }
@@ -710,6 +759,9 @@ const gatsinglestationday = async () => {
710 759
 const getsinglestationdayMonth = async () => {
711 760
   const { data } = await singlestationdayMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
712 761
   const dates = [["product", "收益"]];
762
+  if (data.list.length < 1) {
763
+    data.list.push(...listday.value);
764
+  }
713 765
   for (let index = 0; index < data.list.length; index++) {
714 766
     dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
715 767
   }
@@ -725,7 +777,9 @@ const gatsinglestationyearMonth = async () => {
725 777
     Singlevalue.value
726 778
   );
727 779
   const dates = [["product", "收益"]];
728
-
780
+  if (data.list.length < 1) {
781
+    data.list.push(...listday.value);
782
+  }
729 783
   for (let index = 0; index < data.list.length; index++) {
730 784
     dates.push([data.list[index].ymd, data.list[index].profit.toFixed()]);
731 785
   }
@@ -734,10 +788,49 @@ const gatsinglestationyearMonth = async () => {
734 788
   baroptionchart(dates, profits, "收益/元");
735 789
 };
736 790
 // 充放电统计图
791
+const TotalKwh = ref([
792
+  {
793
+    ymd: "2025-02-12",
794
+    chargeTotal: 1,
795
+    dischargeTotal: 0.5
796
+  },
797
+  {
798
+    ymd: "2025-02-13",
799
+    chargeTotal: 1,
800
+    dischargeTotal: 0.5
801
+  },
802
+  {
803
+    ymd: "2025-02-14",
804
+    chargeTotal: 1,
805
+    dischargeTotal: 0.5
806
+  },
807
+  {
808
+    ymd: "2025-02-15",
809
+    chargeTotal: 1,
810
+    dischargeTotal: 0.5
811
+  },
812
+  {
813
+    ymd: "2025-02-16",
814
+    chargeTotal: 1,
815
+    dischargeTotal: 0.5
816
+  },
817
+  {
818
+    ymd: "2025-02-17",
819
+    chargeTotal: 1,
820
+    dischargeTotal: 0.5
821
+  },
822
+  {
823
+    ymd: "2025-02-18",
824
+    chargeTotal: 1,
825
+    dischargeTotal: 0.5
826
+  }
827
+]);
737 828
 const getmultiStatiopower = async () => {
738 829
   const { data } = await postsexportKwh({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
739 830
   const dates = [["product", "充电", "放电"]];
740
-
831
+  if (data.length < 1) {
832
+    data.push(...TotalKwh.value);
833
+  }
741 834
   for (let index = 0; index < data.length; index++) {
742 835
     dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
743 836
   }
@@ -749,7 +842,9 @@ const getmultiStatiopower = async () => {
749 842
 const getpostsexportKwhMonth = async () => {
750 843
   const { data } = await postsexportKwhMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
751 844
   const dates = [["product", "充电", "放电"]];
752
-
845
+  if (data.length < 1) {
846
+    data.push(...TotalKwh.value);
847
+  }
753 848
   for (let index = 0; index < data.length; index++) {
754 849
     dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
755 850
   }
@@ -761,6 +856,9 @@ const getpostsexportKwhMonth = async () => {
761 856
 const getsinglestationchargingMonth = async () => {
762 857
   const { data } = await singlestationchargingMonth({ startDate: value2.value[0], endDate: value2.value[1] }, Singlevalue.value);
763 858
   const dates = [["product", "充电", "放电"]];
859
+  if (data.length < 1) {
860
+    data.push(...TotalKwh.value);
861
+  }
764 862
   for (let index = 0; index < data.length; index++) {
765 863
     dates.push([data[index].ymd, data[index].chargeTotal.toString(), data[index].dischargeTotal.toString()]);
766 864
   }
@@ -1193,9 +1291,17 @@ onMounted(() => {
1193 1291
   const today = new Date();
1194 1292
   const sevenDaysAgoDate = new Date(today);
1195 1293
   sevenDaysAgoDate.setDate(today.getDate() - 7);
1196
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
1197
-  value2.value = [sevenDaysAgo, currentDate.value];
1198
-  timedayslist.value = [sevenDaysAgo, currentDate.value];
1294
+  // const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
1295
+
1296
+  // Get year, month, and day components
1297
+  const year = sevenDaysAgoDate.getFullYear();
1298
+  const month = String(sevenDaysAgoDate.getMonth() + 1).padStart(2, "0"); // Months are zero-based
1299
+  const day = String(sevenDaysAgoDate.getDate()).padStart(2, "0");
1300
+
1301
+  // Format the date as "YYYY-MM-DD"
1302
+  const formattedDate = `${year}-${month}-${day}`;
1303
+  value2.value = [formattedDate, currentDate.value];
1304
+  timedayslist.value = [formattedDate, currentDate.value];
1199 1305
 
1200 1306
   poststationstationName();
1201 1307
 });

+ 2
- 2
src/views/post/index.vue Bestand weergeven

@@ -62,8 +62,8 @@
62 62
     </div>
63 63
   </div>
64 64
 </template>
65
-<!--
66
-        
65
+<!--      
66
+                                                                                                                                                                                                                                     
67 67
 --->
68 68
 <script setup lang="ts">
69 69
 import { platformpostlist, platformpostremove } from "@/api/home/Multisite";

+ 7
- 5
src/views/powerStation/index.vue Bestand weergeven

@@ -27,7 +27,7 @@
27 27
         <el-table-column type="index" prop="date" label="序号" width="60" />
28 28
         <el-table-column prop="powerName" label="电站名称" width="180" />
29 29
         <el-table-column prop="stationName" label="安装人" :show-overflow-tooltip="true" />
30
-        <el-table-column prop="contactPhone" label="安装人电话">
30
+        <el-table-column prop="contactPhone" label="客户电话">
31 31
           <!-- <template #default="scope">
32 32
             {{ scope.row.pcsStatus == "" ? "-" : scope.row.pcsStatus }}
33 33
           </template> -->
@@ -35,7 +35,7 @@
35 35
         <el-table-column prop="installedPower" label="装机功率(MW)" />
36 36
         <el-table-column prop="installedCap" label="装机容量(kWh)" />
37 37
         <el-table-column prop="country" label="电站地址">
38
-          <template #default="scope"> {{ scope.row.country }} {{ scope.row.province }} {{ scope.row.city }} </template>
38
+          <template #default="scope"> {{ scope.row.address }} </template>
39 39
         </el-table-column>
40 40
         <el-table-column prop="operationDate" label="投运时间" />
41 41
         <el-table-column prop="url" label="电站图片" width="200">
@@ -191,6 +191,7 @@
191 191
     </el-dialog>
192 192
   </div>
193 193
 </template>
194
+<!--    -->
194 195
 <script setup lang="ts">
195 196
 import { onMounted, ref } from "vue";
196 197
 import { stationmanage } from "@/api/home/Multisite";
@@ -220,6 +221,7 @@ const cities = ref([
220 221
     id: "1"
221 222
   }
222 223
 ]);
224
+
223 225
 const tableData = ref();
224 226
 const getstationmanage = async () => {
225 227
   let params = {
@@ -309,6 +311,6 @@ onMounted(() => {
309 311
 <style scoped lang="scss">
310 312
 @import "./index.scss";
311 313
 </style>
312
-<!--     
313
- 
314
- -->
314
+<!--   
315
+  
316
+--->

+ 88
- 0
src/views/powerconfiguration/index.scss Bestand weergeven

@@ -0,0 +1,88 @@
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
+.btn-group {
30
+  display: flex;
31
+  gap: 10px; /* 按钮之间的间隔 */
32
+  align-items: center; /* 垂直居中按钮 */
33
+  justify-content: center; /* 水平居中按钮 */
34
+}
35
+.dialog_box {
36
+  display: flex;
37
+  align-items: center;
38
+  width: 100%;
39
+  padding: 20px 60px;
40
+  margin-top: 40px;
41
+}
42
+.dialog_box1 {
43
+  display: flex;
44
+  width: 100%;
45
+  padding: 20px 60px;
46
+  margin-top: 10px;
47
+}
48
+.dialog_box2 {
49
+  display: flex;
50
+  align-items: center;
51
+  width: 100%;
52
+  padding: 20px 60px;
53
+  margin-top: 10px;
54
+  margin-bottom: 10px;
55
+}
56
+.dialog_name {
57
+  display: flex;
58
+  margin-right: 20px;
59
+}
60
+.dialog_footer {
61
+  display: flex;
62
+  align-items: center;
63
+  justify-content: center;
64
+  margin-top: 20px;
65
+  margin-bottom: 20px;
66
+  color: #999999;
67
+}
68
+.dialog_footer1 {
69
+  display: flex;
70
+  align-items: center;
71
+  justify-content: center;
72
+  margin-top: 50px;
73
+  margin-bottom: 10px;
74
+}
75
+.dialog_footer2 {
76
+  display: flex;
77
+  margin-bottom: 10px;
78
+  color: #000000;
79
+}
80
+.elimageurl {
81
+  display: flex;
82
+  overflow: hidden;
83
+  overflow: auto auto;
84
+}
85
+.Required {
86
+  width: 10px;
87
+  color: red;
88
+}

+ 729
- 0
src/views/powerconfiguration/index.vue Bestand weergeven

@@ -0,0 +1,729 @@
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;<el-select v-model="Singlevalue" placeholder="选择电站" size="large" style="width: 240px">
11
+            <el-option v-for="item in cities" :key="item.id" :label="item.stationName" :value="item.id" />
12
+          </el-select>
13
+        </div>
14
+        &ensp;&ensp; &ensp;&ensp;
15
+        <div>
16
+          设备名称&ensp;&ensp;<el-input v-model="emsdevicename" style="width: 300px" size="large" placeholder="输入设备名称" />
17
+        </div>
18
+        <!-- <div>
19
+            &ensp;&ensp;&ensp;&ensp;
20
+            岗位名称&ensp;&ensp;<el-input
21
+              v-model="postName"
22
+              style="width: 300px"
23
+              size="large"
24
+              placeholder="输入岗位名称"
25
+            />
26
+          </div> -->
27
+        &ensp;&ensp; &ensp;&ensp;
28
+        <div>
29
+          <el-button type="primary" size="large" color="#0052d9" @click="query(0)">查询</el-button>
30
+          <el-button size="large" @click="query(1)">重置</el-button>&ensp;&ensp;
31
+        </div>
32
+      </div>
33
+      <div class="screen1"></div>
34
+    </div>
35
+    <div class="card cardbottom">
36
+      <!-- <el-button type="primary" size="large" color="#0052d9" @click="newaddition">新增</el-button> -->
37
+
38
+      <div>&ensp;</div>
39
+      <el-table :data="tableData.records" style="width: 100%" border show-overflow-tooltip>
40
+        <el-table-column prop="eid" label="设备编号" />
41
+        <el-table-column prop="emsDeviceId" label="设备名称" />
42
+        <el-table-column prop="powerName" label="归属电站" />
43
+        <el-table-column prop="binding" label="绑定状态" align="center">
44
+          <template #default="scope">
45
+            <!-- <div v-if="scope.row.binding == 1">绑定</div>
46
+              <div v-else>未绑定</div> -->
47
+
48
+            <div v-if="scope.row.binding == 1">已绑定</div>
49
+            <div v-if="scope.row.binding == 0">未绑定</div>
50
+          </template>
51
+        </el-table-column>
52
+        <el-table-column prop="createTime" label="创建时间" />
53
+        <el-table-column prop="updateTime" label="修改时间" />
54
+        <!-- <el-table-column prop="url" label="设备图片" align="center" width="200">
55
+          <template #default="scope">
56
+            <div class="elimageurl">
57
+              <div v-for="(item, index) in scope.row.url" :key="index">
58
+                <el-image
59
+                  style="width: 60px; height: 60px; margin-right: 10px"
60
+                  :src="item"
61
+                  :zoom-rate="1.2"
62
+                  :max-scale="7"
63
+                  :min-scale="0.2"
64
+                  :preview-teleported="true"
65
+                  :preview-src-list="scope.row.url"
66
+                  :initial-index="index"
67
+                  fit="cover"
68
+                />
69
+              </div>
70
+            </div>
71
+
72
+          </template>
73
+        </el-table-column> -->
74
+        <el-table-column prop="url" label="设备启停控制" align="center" width="200">
75
+          <template #default="scope">
76
+            <el-switch
77
+              v-model="scope.row.binding"
78
+              active-value="1"
79
+              inactive-value="0"
80
+              @change="newValue => changeswitch(newValue, scope.row)"
81
+              size="large"
82
+            />
83
+          </template>
84
+        </el-table-column>
85
+
86
+        <el-table-column label="设备运行策略" align="center">
87
+          <template #default="scope">
88
+            <el-button color="#0052d9" type="primary" @click="newition(scope.row)"> 配置 </el-button>
89
+          </template>
90
+        </el-table-column>
91
+      </el-table>
92
+      <!-- 分页组件 -->
93
+      <div class="pagination">
94
+        <div></div>
95
+        <slot name="pagination">
96
+          <Pagination :pageable="pageable" :handle-size-change="handleSizeChange" :handle-current-change="handleCurrentChange" />
97
+        </slot>
98
+      </div>
99
+    </div>
100
+    <el-dialog v-model="dialogVisible" title="参数配置" width="1200" :before-close="handleClose" border>
101
+      <template #footer>
102
+        <div class="dialog_footer2">夜间电网充放电配置(市电)</div>
103
+        <div class="dialog_footer">
104
+          充电开始时间&ensp;&ensp;&ensp;&ensp;
105
+
106
+          <el-time-select
107
+            v-model="Sys_Params_cz1"
108
+            style="width: 240px"
109
+            :max-time="Sys_Params_cy1"
110
+            class="mr-4"
111
+            placeholder="充电开始时间"
112
+            start="00:00"
113
+            step="00:01"
114
+            end="24:00"
115
+          />
116
+          &ensp;&ensp;&ensp;&ensp; 充电结束时间&ensp;&ensp;&ensp;&ensp;
117
+
118
+          <el-time-select
119
+            v-model="Sys_Params_cy1"
120
+            style="width: 240px"
121
+            :max-time="Sys_Params_fz1"
122
+            :min-time="Sys_Params_cz1"
123
+            placeholder="充电结束时间"
124
+            start="00:00"
125
+            step="00:01"
126
+            end="24:00"
127
+            @change="handleFocus(1)"
128
+          />
129
+          &ensp;&ensp;&ensp;&ensp;充电功率&ensp;&ensp;
130
+          <el-input
131
+            type="number"
132
+            v-model="Sys_Params_VPP_ChargePower_1"
133
+            min="0"
134
+            max="100"
135
+            style="width: 160px"
136
+            placeholder="请输入充电功率"
137
+            @input="ChargePower1input"
138
+          />
139
+          &ensp;&ensp;
140
+        </div>
141
+        <div class="dialog_footer">
142
+          放电开始时间&ensp;&ensp;&ensp;&ensp;
143
+
144
+          <el-time-select
145
+            v-model="Sys_Params_fz1"
146
+            style="width: 240px"
147
+            :min-time="Sys_Params_cy1"
148
+            :max-time="Sys_Params_fy1"
149
+            class="mr-4"
150
+            placeholder="放电开始时间"
151
+            start="00:00"
152
+            step="00:01"
153
+            end="24:00"
154
+          />
155
+          &ensp;&ensp;&ensp;&ensp; 放电结束时间&ensp;&ensp;&ensp;&ensp;
156
+
157
+          <el-time-select
158
+            v-model="Sys_Params_fy1"
159
+            style="width: 240px"
160
+            :min-time="Sys_Params_fz1"
161
+            :max-time="Sys_Params_cz2"
162
+            placeholder="放电结束时间"
163
+            start="00:00"
164
+            step="00:01"
165
+            end="24:00"
166
+            @change="handleFocus(2)"
167
+          />
168
+          &ensp;&ensp;&ensp;&ensp;放电功率&ensp;&ensp;
169
+          <el-input
170
+            v-model="Sys_Params_VPP_DischargePower_1"
171
+            type="number"
172
+            min="0"
173
+            max="100"
174
+            style="width: 160px"
175
+            placeholder="请输入放电功率"
176
+            @input="ChargePower2input"
177
+          />
178
+          &ensp;&ensp;
179
+        </div>
180
+        <div class="dialog_footer2">白天光伏充放电配置(光电)</div>
181
+
182
+        <div class="dialog_footer">
183
+          充电开始时间&ensp;&ensp;&ensp;&ensp;
184
+
185
+          <el-time-select
186
+            v-model="Sys_Params_cz2"
187
+            style="width: 240px"
188
+            :min-time="Sys_Params_fy1"
189
+            :max-time="Sys_Params_cy2"
190
+            class="mr-4"
191
+            placeholder="充电开始时间"
192
+            start="00:00"
193
+            step="00:01"
194
+            end="24:00"
195
+          />
196
+
197
+          &ensp;&ensp;&ensp;&ensp; 充电结束时间&ensp;&ensp;&ensp;&ensp;
198
+
199
+          <el-time-select
200
+            v-model="Sys_Params_cy2"
201
+            style="width: 240px"
202
+            :min-time="Sys_Params_cz2"
203
+            :max-time="Sys_Params_fz2"
204
+            placeholder="充电结束时间"
205
+            start="00:00"
206
+            step="00:01"
207
+            end="24:00"
208
+            @change="handleFocus(3)"
209
+          />
210
+          &ensp;&ensp;&ensp;&ensp;充电功率&ensp;&ensp;
211
+          <el-input
212
+            v-model="Sys_Params_VPP_ChargePower_2"
213
+            type="number"
214
+            min="0"
215
+            max="100"
216
+            style="width: 160px"
217
+            placeholder="请输入充电功率"
218
+            @input="ChargePower3input"
219
+          />
220
+          &ensp;&ensp;
221
+        </div>
222
+        <div class="dialog_footer">
223
+          放电开始时间&ensp;&ensp;&ensp;&ensp;
224
+
225
+          <el-time-select
226
+            v-model="Sys_Params_fz2"
227
+            style="width: 240px"
228
+            :min-time="Sys_Params_cy2"
229
+            :max-time="Sys_Params_fy2"
230
+            class="mr-4"
231
+            placeholder="放电开始时间"
232
+            start="00:00"
233
+            step="00:01"
234
+            end="24:00"
235
+          />
236
+
237
+          &ensp;&ensp;&ensp;&ensp; 放电结束时间&ensp;&ensp;&ensp;&ensp;
238
+
239
+          <el-time-select
240
+            v-model="Sys_Params_fy2"
241
+            style="width: 240px"
242
+            :min-time="Sys_Params_fz2"
243
+            placeholder="放电结束时间"
244
+            start="00:00"
245
+            step="00:01"
246
+            end="24:00"
247
+          />
248
+          &ensp;&ensp;&ensp;&ensp;放电功率&ensp;&ensp;
249
+          <el-input
250
+            v-model="Sys_Params_VPP_DischargePower_2"
251
+            type="number"
252
+            min="0"
253
+            max="100"
254
+            style="width: 160px"
255
+            placeholder="请输入放电功率"
256
+            @input="ChargePower4input"
257
+          />
258
+          &ensp;&ensp;
259
+        </div>
260
+        <div class="dialog_footer1">
261
+          <el-button type="primary" @click="determine" size="large" color="#0052d9"> 确定 </el-button>
262
+        </div>
263
+      </template>
264
+    </el-dialog>
265
+  </div>
266
+</template>
267
+<!--  
268
+ 
269
+-->
270
+<script setup lang="ts">
271
+import { selectemssytemNameURL, stationstationName, periodoftimeURL, mqttsendURL } from "@/api/home/Multisite";
272
+import Pagination from "@/components/ProTable/components/Pagination.vue";
273
+import { onMounted, ref, Ref } from "vue";
274
+import { Station } from "@/api/interface";
275
+// import UploadImgs from "@/components/Upload/Imgs.vue";
276
+// import { useAuthButtons } from "@/hooks/useAuthButtons";
277
+import { ElMessage, ElMessageBox } from "element-plus";
278
+
279
+// const { BUTTONS } = useAuthButtons();
280
+// 绑定设备
281
+const Singlevalue = ref("");
282
+const cities: Ref<Station.todo[]> = ref([]);
283
+// 编辑绑定设备
284
+const powerstation: Ref<Station.todo[]> = ref([]);
285
+
286
+const poststationstationName = async () => {
287
+  const { data } = await stationstationName({});
288
+  const res = await stationstationName({});
289
+  powerstation.value = res.data;
290
+  cities.value = data;
291
+  cities.value.unshift({
292
+    id: "",
293
+    stationName: "全部",
294
+    energyMgrMode: 0,
295
+    priceCfgMode: 0,
296
+    sortNo: 0,
297
+    timezone: ""
298
+  });
299
+  Singlevalue.value = data[0].id;
300
+};
301
+const query = (val: any) => {
302
+  if (val == 0) {
303
+    getplatformuserlist();
304
+  } else {
305
+    (emsdevicename.value = ""), (Singlevalue.value = "");
306
+    getplatformuserlist();
307
+  }
308
+};
309
+// 编辑
310
+const emsId = ref();
311
+const dialogVisible = ref();
312
+const strategy = ref();
313
+const muserlistObj = ref<{ [key: string]: any }>({});
314
+// const muserlist = ref([]);
315
+
316
+const newition = async (row: { url: never[]; emsDeviceId: any; eid: any; periodoftime: any }) => {
317
+  dialogVisible.value = true;
318
+
319
+  emsId.value = row.eid;
320
+  strategy.value = row.periodoftime;
321
+
322
+  for (let index = 0; index < strategy.value.length; index++) {
323
+    for (let i = 0; i < strategy.value[index].length; i++) {
324
+      // 将 value 转换为整数
325
+      strategy.value[index][i].value = Number(strategy.value[index][i].value) | 0;
326
+
327
+      const key = strategy.value[index][i].k; // 使用 'k' 属性作为键
328
+      const value = strategy.value[index][i].value + "";
329
+      const value1 = String(value).padStart(2, "0");
330
+      // 将键值对推入 muserlist Sys_Params_VPP_ChargePower_1:30
331
+
332
+      // 将键值对存入 muserlistObj
333
+      muserlistObj.value[key] = value1;
334
+    }
335
+  }
336
+
337
+  // 从 muserlistObj.value 中获取值并赋值给 Sys_Params_*
338
+  Sys_Params_VPP_ChargePower_1.value = muserlistObj.value["Sys_Params_VPP_ChargePower_1"] || 0;
339
+  Sys_Params_cz1.value = `${muserlistObj.value["Sys_Params_VPP_Charge_StartHour_1"] || ""}:${muserlistObj.value["Sys_Params_VPP_Charge_StartMin_1"] || ""}`;
340
+  Sys_Params_cy1.value = `${muserlistObj.value["Sys_Params_VPP_Charge_StopHour_1"] || ""}:${muserlistObj.value["Sys_Params_VPP_Charge_StopMin_1"] || ""}`;
341
+
342
+  Sys_Params_VPP_ChargePower_2.value = muserlistObj.value["Sys_Params_VPP_ChargePower_2"] || 0;
343
+  Sys_Params_cz2.value = `${muserlistObj.value["Sys_Params_VPP_Charge_StartHour_2"] || ""}:${muserlistObj.value["Sys_Params_VPP_Charge_StartMin_2"] || ""}`;
344
+  Sys_Params_cy2.value = `${muserlistObj.value["Sys_Params_VPP_Charge_StopHour_2"] || ""}:${muserlistObj.value["Sys_Params_VPP_Charge_StopMin_2"] || ""}`;
345
+
346
+  Sys_Params_VPP_DischargePower_1.value = muserlistObj.value["Sys_Params_VPP_DischargePower_1"] || 0;
347
+  Sys_Params_fz1.value = `${muserlistObj.value["Sys_Params_VPP_Discharge_StartHour_1"] || ""}:${muserlistObj.value["Sys_Params_VPP_Discharge_StartMin_1"] || ""}`;
348
+  Sys_Params_fy1.value = `${muserlistObj.value["Sys_Params_VPP_Discharge_StopHour_1"] || ""}:${muserlistObj.value["Sys_Params_VPP_Discharge_StopMin_1"] || ""}`;
349
+
350
+  Sys_Params_VPP_DischargePower_2.value = muserlistObj.value["Sys_Params_VPP_DischargePower_2"] || 0;
351
+  Sys_Params_fz2.value = `${muserlistObj.value["Sys_Params_VPP_Discharge_StartHour_2"] || ""}:${muserlistObj.value["Sys_Params_VPP_Discharge_StartMin_2"] || ""}`;
352
+  Sys_Params_fy2.value = `${muserlistObj.value["Sys_Params_VPP_Discharge_StopHour_2"] || ""}:${muserlistObj.value["Sys_Params_VPP_Discharge_StopMin_2"] || ""}`;
353
+  // setTimeout(() => {
354
+  //   loading.close();
355
+  //   getplatformuserlist();
356
+  // }, 2000);
357
+};
358
+const Switchvalue = ref();
359
+
360
+const changeswitch = async (
361
+  newValue: any,
362
+  row: {
363
+    eid: any;
364
+    binding: string;
365
+  }
366
+) => {
367
+  console.log("Switch value:", newValue);
368
+  console.log("Switch value:", row);
369
+
370
+  if (newValue == 0) {
371
+    Switchvalue.value = "确定关闭设备吗?";
372
+  } else {
373
+    Switchvalue.value = "确定开启设备吗?";
374
+  }
375
+  ElMessageBox.confirm(Switchvalue.value, "设备控制", {
376
+    confirmButtonText: "确定",
377
+    cancelButtonText: "取消",
378
+    type: "warning"
379
+  })
380
+    .then(async () => {
381
+      let obj = {
382
+        deviceId: row.eid,
383
+        value: newValue == 0 ? 0 : 1,
384
+        id: "7721e827-610e-4d15-8497-3590eb120c5f",
385
+        name: "Sys_Cmd_StartStop"
386
+      };
387
+      const { data } = await mqttsendURL(obj);
388
+      const res = data as { msg?: string }; // 类型断言,msg 是可选的
389
+
390
+      ElMessage({
391
+        type: "success",
392
+        message: res.msg ?? "操作成功" // 如果 msg 不存在,使用默认值
393
+      });
394
+    })
395
+    .catch(() => {
396
+      ElMessage({
397
+        type: "info",
398
+        message: "取消操作"
399
+      });
400
+      row.binding = row.binding === "1" ? "0" : "1"; // 恢复到原来的状态
401
+    });
402
+};
403
+// 确定
404
+const determine = async () => {
405
+  if (
406
+    Sys_Params_VPP_ChargePower_1.value == 0 ||
407
+    Sys_Params_VPP_ChargePower_2.value == 0 ||
408
+    Sys_Params_cz1.value == undefined ||
409
+    Sys_Params_cy1.value == undefined ||
410
+    Sys_Params_cz2.value == undefined ||
411
+    Sys_Params_cy2.value == undefined ||
412
+    Sys_Params_VPP_DischargePower_1.value == 0 ||
413
+    Sys_Params_VPP_DischargePower_2.value == 0 ||
414
+    Sys_Params_fz1.value == undefined ||
415
+    Sys_Params_fy1.value == undefined ||
416
+    Sys_Params_fz2.value == undefined ||
417
+    Sys_Params_fy2.value == undefined
418
+  ) {
419
+    ElMessage({
420
+      type: "warning",
421
+      message: "请输入充放电时间及功率" // 如果 msg 不存在,使用默认值
422
+    });
423
+    return;
424
+  }
425
+
426
+  let obj = [
427
+    [
428
+      {
429
+        value: Sys_Params_VPP_ChargePower_1.value,
430
+        id: "c50df00f-1c76-49a5-b3ed-70452bf40182",
431
+        k: "Sys_Params_VPP_ChargePower_1"
432
+      },
433
+      {
434
+        value: Sys_Params_cz1.value.split(":")[0],
435
+        id: "96df77d1-0367-4b11-b4d0-94d854ee4e03",
436
+        k: "Sys_Params_VPP_Charge_StartHour_1"
437
+      },
438
+      {
439
+        value: Sys_Params_cz1.value.split(":")[1],
440
+        id: "1ce66892-15ea-44a4-b6ba-cc85668ed060",
441
+        k: "Sys_Params_VPP_Charge_StartMin_1"
442
+      },
443
+      {
444
+        value: Sys_Params_cy1.value.split(":")[0],
445
+        id: "5a40a3c7-03c0-4f35-ad0d-8dd0b12e3fe8",
446
+        k: "Sys_Params_VPP_Charge_StopHour_1"
447
+      },
448
+      {
449
+        value: Sys_Params_cy1.value.split(":")[1],
450
+        id: "6a1ab2a9-e8f4-4687-83d5-7214fa246c4c",
451
+        k: "Sys_Params_VPP_Charge_StopMin_1"
452
+      }
453
+    ],
454
+    [
455
+      {
456
+        value: Sys_Params_VPP_ChargePower_2.value,
457
+        id: "b3d2a5f1-79ba-40f8-8458-fa6fd5cec7c1",
458
+        k: "Sys_Params_VPP_ChargePower_2"
459
+      },
460
+      {
461
+        value: Sys_Params_cz2.value.split(":")[0],
462
+        id: "8f80fdef-bbd2-4099-bf0b-7213de084f99",
463
+        k: "Sys_Params_VPP_Charge_StartHour_2"
464
+      },
465
+      {
466
+        value: Sys_Params_cz2.value.split(":")[1],
467
+
468
+        id: "6fb9fe2b-b7d9-43c6-80b8-bcc67a5ddba5",
469
+        k: "Sys_Params_VPP_Charge_StartMin_2"
470
+      },
471
+      {
472
+        value: Sys_Params_cy2.value.split(":")[0],
473
+        id: "cad0cec9-97fe-42b6-8f42-87816bd7d5fe",
474
+        k: "Sys_Params_VPP_Charge_StopHour_2"
475
+      },
476
+      {
477
+        value: Sys_Params_cy2.value.split(":")[1],
478
+        id: "c73dfc92-d76a-45ea-9ffe-1628547cf850",
479
+        k: "Sys_Params_VPP_Charge_StopMin_2"
480
+      }
481
+    ],
482
+    [
483
+      {
484
+        value: Sys_Params_VPP_DischargePower_1.value,
485
+        id: "1b1822f4-a28f-4e1a-bf7f-93ddeca96a59",
486
+        k: "Sys_Params_VPP_DischargePower_1"
487
+      },
488
+      {
489
+        value: Sys_Params_fz1.value.split(":")[0],
490
+
491
+        id: "84005a81-1a5d-4fb2-9077-a7b277e9c489",
492
+        k: "Sys_Params_VPP_Discharge_StartHour_1"
493
+      },
494
+      {
495
+        value: Sys_Params_fz1.value.split(":")[1],
496
+
497
+        id: "b2ed27a4-4afa-4cbf-a59e-fdb24df82658",
498
+        k: "Sys_Params_VPP_Discharge_StartMin_1"
499
+      },
500
+      {
501
+        value: Sys_Params_fy1.value.split(":")[0],
502
+
503
+        id: "3d149d90-82c5-4ebf-89d2-3dad5773b5d5",
504
+        k: "Sys_Params_VPP_Discharge_StopHour_1"
505
+      },
506
+      {
507
+        value: Sys_Params_fy1.value.split(":")[1],
508
+
509
+        id: "ce2904d4-42d2-4cb2-bef8-4ba1bd9a6687",
510
+        k: "Sys_Params_VPP_Discharge_StopMin_1"
511
+      }
512
+    ],
513
+    [
514
+      {
515
+        value: Sys_Params_VPP_DischargePower_2.value,
516
+        id: "13b67750-d6fe-4198-8b2c-6a2a34a12c6c",
517
+        k: "Sys_Params_VPP_DischargePower_2"
518
+      },
519
+      {
520
+        value: Sys_Params_fz2.value.split(":")[0],
521
+        id: "dc2ab3f4-0c0a-4444-8600-800ca3ac138d",
522
+        k: "Sys_Params_VPP_Discharge_StartHour_2"
523
+      },
524
+      {
525
+        value: Sys_Params_fz2.value.split(":")[1],
526
+        id: "07f2edcb-2ef8-4ab8-94c0-fdc1fb057b2e",
527
+        k: "Sys_Params_VPP_Discharge_StartMin_2"
528
+      },
529
+      {
530
+        value: Sys_Params_fy2.value.split(":")[0],
531
+        id: "3d61e26d-915c-4e26-86f4-52d0244deaac",
532
+        k: "Sys_Params_VPP_Discharge_StopHour_2"
533
+      },
534
+      {
535
+        value: Sys_Params_fy2.value.split(":")[1],
536
+        id: "ffe51d70-8cc5-443a-8724-f7d796beaca3",
537
+        k: "Sys_Params_VPP_Discharge_StopMin_2"
538
+      }
539
+    ]
540
+  ];
541
+  console.log(obj);
542
+
543
+  const { data } = await periodoftimeURL(emsId.value, obj);
544
+  const res = data as { msg?: string }; // 类型断言,msg 是可选的
545
+
546
+  ElMessage({
547
+    type: "success",
548
+    message: res.msg ?? "操作成功" // 如果 msg 不存在,使用默认值
549
+  });
550
+  getplatformuserlist();
551
+  dialogVisible.value = false;
552
+};
553
+// 弹出取消
554
+const handleClose = () => {
555
+  dialogVisible.value = false;
556
+};
557
+const tableData = ref();
558
+const emsdevicename = ref("");
559
+const pageable = ref({
560
+  pn: 1,
561
+  ps: 10,
562
+  total: 0
563
+});
564
+
565
+// 表格操作 Hooks
566
+const handleSizeChange = async (e: any) => {
567
+  pageable.value.ps = e;
568
+  getplatformuserlist();
569
+};
570
+const handleCurrentChange = async (e: any) => {
571
+  pageable.value.pn = e;
572
+
573
+  getplatformuserlist();
574
+};
575
+// 时间
576
+const Sys_Params_cz1 = ref("");
577
+const Sys_Params_cy1 = ref("");
578
+const Sys_Params_fz1 = ref("");
579
+const Sys_Params_fy1 = ref("");
580
+const Sys_Params_cz2 = ref("");
581
+const Sys_Params_cy2 = ref("");
582
+const Sys_Params_fz2 = ref("");
583
+const Sys_Params_fy2 = ref("");
584
+// 时间
585
+
586
+// 功率
587
+const Sys_Params_VPP_ChargePower_1 = ref(0);
588
+const Sys_Params_VPP_ChargePower_2 = ref(0);
589
+const Sys_Params_VPP_DischargePower_1 = ref(0);
590
+const Sys_Params_VPP_DischargePower_2 = ref(0);
591
+
592
+// 处理点击事件
593
+const handleFocus = (a: number) => {
594
+  if (a == 1) {
595
+    if (Sys_Params_cy1.value) {
596
+      // 解析当前时间
597
+      const [hour, minute] = Sys_Params_cy1.value.split(":").map(Number);
598
+
599
+      // 增加一分钟
600
+      let newMinute = minute + 1;
601
+      let newHour = hour;
602
+
603
+      // 处理分钟超过 59 的情况
604
+      if (newMinute > 59) {
605
+        newMinute = 0;
606
+        newHour += 1;
607
+
608
+        // 处理小时超过 23 的情况
609
+        if (newHour > 23) {
610
+          newHour = 0;
611
+        }
612
+      }
613
+
614
+      // 格式化时间
615
+      const formattedTime = `${String(newHour).padStart(2, "0")}:${String(newMinute).padStart(2, "0")}`;
616
+
617
+      // 更新 Sys_Params_cy1 的值
618
+      Sys_Params_fz1.value = formattedTime;
619
+    }
620
+  } else if (a == 2) {
621
+    if (Sys_Params_fy1.value) {
622
+      // 解析当前时间
623
+      const [hour, minute] = Sys_Params_fy1.value.split(":").map(Number);
624
+
625
+      // 增加一分钟
626
+      let newMinute = minute + 1;
627
+      let newHour = hour;
628
+
629
+      // 处理分钟超过 59 的情况
630
+      if (newMinute > 59) {
631
+        newMinute = 0;
632
+        newHour += 1;
633
+
634
+        // 处理小时超过 23 的情况
635
+        if (newHour > 23) {
636
+          newHour = 0;
637
+        }
638
+      }
639
+
640
+      // 格式化时间
641
+      const formattedTime = `${String(newHour).padStart(2, "0")}:${String(newMinute).padStart(2, "0")}`;
642
+
643
+      // 更新 Sys_Params_cy1 的值
644
+      Sys_Params_cz2.value = formattedTime;
645
+    }
646
+  } else if (a == 3) {
647
+    if (Sys_Params_cy2.value) {
648
+      // 解析当前时间
649
+      const [hour, minute] = Sys_Params_cy2.value.split(":").map(Number);
650
+
651
+      // 增加一分钟
652
+      let newMinute = minute + 1;
653
+      let newHour = hour;
654
+
655
+      // 处理分钟超过 59 的情况
656
+      if (newMinute > 59) {
657
+        newMinute = 0;
658
+        newHour += 1;
659
+
660
+        // 处理小时超过 23 的情况
661
+        if (newHour > 23) {
662
+          newHour = 0;
663
+        }
664
+      }
665
+
666
+      // 格式化时间
667
+      const formattedTime = `${String(newHour).padStart(2, "0")}:${String(newMinute).padStart(2, "0")}`;
668
+
669
+      // 更新 Sys_Params_cy1 的值
670
+      Sys_Params_fz2.value = formattedTime;
671
+    }
672
+  }
673
+};
674
+const getplatformuserlist = async () => {
675
+  let obj = {
676
+    powerId: Singlevalue.value, //查询电站id
677
+    emsdeviceId: emsdevicename.value, // 设备名称
678
+    pn: pageable.value.pn,
679
+    ps: pageable.value.ps
680
+  };
681
+  const { data } = await selectemssytemNameURL(obj);
682
+  tableData.value = data;
683
+  pageable.value.total = tableData.value.total;
684
+};
685
+const ChargePower1input = async (e: any) => {
686
+  if (e < 0) {
687
+    Sys_Params_VPP_ChargePower_1.value = 0;
688
+  } else if (e > 100) {
689
+    Sys_Params_VPP_ChargePower_1.value = 100;
690
+  }
691
+};
692
+const ChargePower2input = async (e: any) => {
693
+  if (e < 0) {
694
+    Sys_Params_VPP_DischargePower_1.value = 0;
695
+  } else if (e > 100) {
696
+    Sys_Params_VPP_DischargePower_1.value = 100;
697
+  }
698
+};
699
+const ChargePower3input = async (e: any) => {
700
+  if (e < 0) {
701
+    Sys_Params_VPP_ChargePower_2.value = 0;
702
+  } else if (e > 100) {
703
+    Sys_Params_VPP_ChargePower_2.value = 100;
704
+  }
705
+};
706
+const ChargePower4input = async (e: any) => {
707
+  if (e < 0) {
708
+    Sys_Params_VPP_DischargePower_2.value = 0;
709
+  } else if (e > 100) {
710
+    Sys_Params_VPP_DischargePower_2.value = 100;
711
+  }
712
+};
713
+const currentDate = ref();
714
+
715
+onMounted(() => {
716
+  const current = localStorage.getItem("currentDate");
717
+  if (current) {
718
+    currentDate.value = current;
719
+  }
720
+  poststationstationName();
721
+  getplatformuserlist();
722
+});
723
+</script>
724
+<style scoped lang="scss">
725
+@import "./index.scss";
726
+</style>
727
+<!--  
728
+
729
+-->

+ 21
- 0
src/views/rawdata/index.scss Bestand weergeven

@@ -3,6 +3,18 @@
3 3
   width: 100%;
4 4
   margin-bottom: 20px;
5 5
 }
6
+.filter_item {
7
+  display: flex;
8
+  align-items: center;
9
+  width: calc(100% - 80%);
10
+  white-space: nowrap;
11
+}
12
+.filter_item1 {
13
+  display: flex;
14
+  align-items: center;
15
+  width: calc(100% - 75%);
16
+  white-space: nowrap;
17
+}
6 18
 .screen1 {
7 19
   display: flex;
8 20
   justify-content: space-between;
@@ -30,3 +42,12 @@
30 42
   margin-top: 20px;
31 43
   font-size: 16px;
32 44
 }
45
+.cardbottom1 {
46
+  display: flex;
47
+}
48
+.cardbottom2 {
49
+  display: flex;
50
+  width: 240px;
51
+  padding-bottom: 10px;
52
+  padding-left: 10px;
53
+}

+ 64
- 43
src/views/rawdata/index.vue Bestand weergeven

@@ -6,41 +6,33 @@
6 6
     </div>
7 7
     <div class="card">
8 8
       <div class="screen">
9
-        <div>
9
+        <div class="filter_item">
10 10
           电站&ensp;&ensp;
11
-          <el-select v-model="status" placeholder="选择电站" size="large" style="width: 240px" @change="postemsDevice">
11
+          <el-select v-model="status" placeholder="选择电站" @change="postemsDevice">
12 12
             <el-option v-for="item in cities" :key="item.id" :label="item.stationName" :value="item.id" />
13 13
           </el-select>
14 14
         </div>
15
-        <div>
15
+        <div class="filter_item1">
16 16
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;所属设备&ensp;&ensp;
17 17
           <el-select
18 18
             v-model="emsDeviceId"
19 19
             placeholder="请先选择电站在选择所属设备"
20 20
             size="large"
21
-            style="width: 240px"
22 21
             clearable
23 22
             @change="getpostdeviceClass"
24 23
           >
25 24
             <el-option v-for="item in emsDevice" :key="item.id" :label="item.emsDeviceId" :value="item.id" />
26 25
           </el-select>
27 26
         </div>
28
-        <div>
27
+        <div class="filter_item1">
29 28
           &ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;&ensp;设备类型&ensp;&ensp;
30
-          <el-select v-model="quipment" placeholder="请选择设备类型" size="large" style="width: 240px" clearable>
29
+          <el-select v-model="quipment" placeholder="请选择设备类型" size="large" clearable>
31 30
             <el-option v-for="item in quipmentlist" :key="item.peek" :label="item.peek" :value="item.peek" />
32 31
           </el-select>
33 32
         </div>
34
-        <div>
33
+        <div class="filter_item1">
35 34
           &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
-          >
35
+          <el-select v-model="translate.user.peekType" placeholder="请选择设备类型" size="large" clearable @change="ontranslate">
44 36
             <el-option v-for="item in translatelist" :key="item.id" :label="item.value" :value="item.id" />
45 37
           </el-select>
46 38
         </div>
@@ -71,8 +63,15 @@
71 63
     </div>
72 64
     <div class="card cardbottom">
73 65
       <div>&ensp;</div>
74
-      <el-table :data="tableData.list" style="width: 100%" border>
75
-        <el-table-column width="250" :show-overflow-tooltip="true" v-for="item in head" :key="item" :prop="item" :label="item" />
66
+      <el-table :data="tableData.list" style="width: 100%" border @header-click="toggleColumn" show-overflow-tooltip>
67
+        <el-table-column
68
+          v-for="item in headdata"
69
+          :key="item"
70
+          :prop="visibleColumns[item] ? item : ''"
71
+          :label="visibleColumns[item] ? item : ''"
72
+          :width="visibleColumns[item] ? 250 : 10"
73
+          style="overflow: auto"
74
+        />
76 75
       </el-table>
77 76
       <!-- 分页 组件 -->
78 77
       <div class="pagination">
@@ -93,7 +92,7 @@
93 92
     </el-dialog>
94 93
   </div>
95 94
 </template>
96
-<!--    -->
95
+
97 96
 <script setup lang="ts">
98 97
 import {
99 98
   tdengineyuanshilURL,
@@ -106,14 +105,9 @@ import {
106 105
   selectaccountNumber
107 106
 } from "@/api/home/Multisite";
108 107
 import { onMounted, Ref, ref } from "vue";
109
-// import { useAuthButtons } from "@/hooks/useAuthButtons";
110
-// const { BUTTONS } = useAuthButtons();
111
-import { Station } from "@/api/interface";
112 108
 import Pagination from "@/components/ProTable/components/Pagination.vue";
113 109
 import { ElMessage } from "element-plus";
114 110
 
115
-// import { useRouter } from "vue-router";
116
-// const router = useRouter();
117 111
 const emsDeviceId = ref("");
118 112
 const quipment = ref("");
119 113
 const quipmentlist = ref();
@@ -130,33 +124,32 @@ const translatelist = ref([
130 124
 ]);
131 125
 
132 126
 const emsDevice: Ref<any[]> = ref([]);
133
-
134
-const cities: Ref<Station.todo[]> = ref([]);
135
-
127
+const cities = ref();
136 128
 const timevalue: Ref<any> = ref([]);
137 129
 
138 130
 const poststationstationName = async () => {
139 131
   const { data } = await stationstationName({});
140 132
   cities.value = data;
141 133
 };
134
+
142 135
 const postemsDevice = async (value: any) => {
143 136
   console.log(value);
144 137
 
145 138
   emsDevice.value = [];
146 139
   emsDeviceId.value = "";
147 140
   const { data } = await postemsSystemsingleStation({}, value);
148
-  // emsDeviceId.value = data[0].id;
149 141
   emsDevice.value = data;
150 142
 };
143
+
151 144
 const pickerOptions = (time: { getTime: (arg0: Date) => number }) => {
152 145
   return time.getTime(new Date()) > Date.now();
153 146
 };
154
-// 设备类型
147
+
155 148
 const getpostdeviceClass = async () => {
156 149
   const { data } = await powerlistURL({ eId: emsDeviceId.value });
157
-
158 150
   quipmentlist.value = data;
159 151
 };
152
+
160 153
 const query = (val: any) => {
161 154
   if (val == 0) {
162 155
     getplatformuserlist();
@@ -165,6 +158,7 @@ const query = (val: any) => {
165 158
     (emsDeviceId.value = ""), getplatformuserlist();
166 159
   }
167 160
 };
161
+
168 162
 const dialogVisible = ref(false);
169 163
 const message = ref("");
170 164
 
@@ -190,9 +184,10 @@ const newaddition = async () => {
190 184
 
191 185
   gitlistexcelURL();
192 186
 };
193
-const timerId = ref();
194 187
 
188
+const timerId = ref();
195 189
 const excelexport = ref();
190
+
196 191
 const handleClose = async () => {
197 192
   if (timerId.value) {
198 193
     clearTimeout(timerId.value);
@@ -200,6 +195,7 @@ const handleClose = async () => {
200 195
     dialogVisible.value = false;
201 196
   }
202 197
 };
198
+
203 199
 const gitlistexcelURL = async () => {
204 200
   const { data } = await listexcelURL();
205 201
   console.log(data);
@@ -225,17 +221,13 @@ const downloadxlsx = (data: any) => {
225 221
   fetch(fileUrl)
226 222
     .then(response => response.blob())
227 223
     .then(blob => {
228
-      // 创建一个临时的URL对象
229 224
       const url = URL.createObjectURL(blob);
230
-      // 创建一个隐藏的<a>标签,并设置其href属性为临时URL
231 225
       const a = document.createElement("a");
232 226
       a.href = url;
233
-      a.download = fileName; // 设置下载的文件名
227
+      a.download = fileName;
234 228
       a.style.display = "none";
235
-      // 将<a>标签添加到文档中,并模拟点击下载
236 229
       document.body.appendChild(a);
237 230
       a.click();
238
-      // 下载完成后,移除<a>标签和临时URL对象
239 231
       document.body.removeChild(a);
240 232
       URL.revokeObjectURL(url);
241 233
     })
@@ -243,29 +235,44 @@ const downloadxlsx = (data: any) => {
243 235
       console.error("下载文件时出错:", error);
244 236
     });
245 237
 };
238
+
246 239
 const formatTime = (time: number) => {
247
-  return time < 10 ? `0${time}` : time; // 如果时间小于 10,在前面加上 0
240
+  return time < 10 ? `0${time}` : time;
248 241
 };
249
-const tableData = ref();
250 242
 
243
+const tableData = ref();
251 244
 const status = ref("");
252
-const head = ref();
253 245
 const pageable = ref({
254 246
   pn: 1,
255 247
   ps: 10,
256 248
   total: 0
257 249
 });
258
-// 表格操作 Hooks
250
+
259 251
 const handleSizeChange = async (e: any) => {
260 252
   pageable.value.ps = e;
261 253
   getplatformuserlist();
262 254
 };
255
+
263 256
 const handleCurrentChange = async (e: any) => {
264 257
   pageable.value.pn = e;
265
-
266 258
   getplatformuserlist();
267 259
 };
268
-// 文件 编辑 选择
260
+
261
+const visibleColumns = ref<{ [key: string]: boolean }>({});
262
+
263
+const toggleColumn = (column: any) => {
264
+  console.log("点击的列对象:", column);
265
+  const columnLabel = column.rawColumnKey; // 获取列名
266
+  console.log("当前 visibleColumns:", visibleColumns.value);
267
+
268
+  if (columnLabel) {
269
+    visibleColumns.value[columnLabel] = !visibleColumns.value[columnLabel]; // 切换列的显示状态
270
+    console.log(`列 ${columnLabel} 的显示状态:`, visibleColumns.value[columnLabel]);
271
+  }
272
+};
273
+const headdata = ref();
274
+const head = ref();
275
+
269 276
 const getplatformuserlist = async () => {
270 277
   let obj = {
271 278
     powerId: status.value,
@@ -278,10 +285,21 @@ const getplatformuserlist = async () => {
278 285
   };
279 286
   const { data } = await tdengineyuanshilURL(obj);
280 287
   tableData.value = data;
288
+  console.log(tableData.value.list[0]);
281 289
 
282 290
   head.value = Object.keys(tableData.value.list[0]);
291
+  head.value.forEach((item: string) => {
292
+    if (!visibleColumns.value[item]) {
293
+      visibleColumns.value[item] = true; // 默认显示所有列
294
+    }
295
+  });
296
+  headdata.value = head.value;
297
+
298
+  console.log(visibleColumns.value);
299
+
283 300
   pageable.value.total = tableData.value.page.totald;
284 301
 };
302
+
285 303
 const currentDate = ref();
286 304
 const ontranslate = async (e: any) => {
287 305
   console.log(e);
@@ -291,11 +309,13 @@ const ontranslate = async (e: any) => {
291 309
   await updateURL(obj);
292 310
   await getplatformuserlist();
293 311
 };
312
+
294 313
 const selectaccountNumberlist = async () => {
295 314
   const { data } = await selectaccountNumber({});
296 315
   console.log(data);
297 316
   translate.value = data;
298 317
 };
318
+
299 319
 const shortcuts = [
300 320
   {
301 321
     text: "过去7天",
@@ -325,6 +345,7 @@ const shortcuts = [
325 345
     }
326 346
   }
327 347
 ];
348
+
328 349
 onMounted(() => {
329 350
   const current = localStorage.getItem("currentDate");
330 351
   if (current) {
@@ -335,7 +356,7 @@ onMounted(() => {
335 356
   sevenDaysAgo.setDate(today.getDate() - 7);
336 357
   const sevenDaysAgoDate = sevenDaysAgo.toISOString().split("T")[0];
337 358
 
338
-  timevalue.value = [currentDate.value, sevenDaysAgoDate];
359
+  timevalue.value = [sevenDaysAgoDate, currentDate.value];
339 360
   console.log(timevalue.value);
340 361
 
341 362
   getplatformuserlist();
@@ -343,7 +364,7 @@ onMounted(() => {
343 364
   selectaccountNumberlist();
344 365
 });
345 366
 </script>
367
+
346 368
 <style scoped lang="scss">
347 369
 @import "./index.scss";
348 370
 </style>
349
-<!-- -->

+ 4
- 3
src/views/system/index.vue Bestand weergeven

@@ -535,7 +535,7 @@ const recently = (val: any) => {
535 535
   timetype.value = val;
536 536
 
537 537
   const today = new Date();
538
-  const currentDate = today.toLocaleDateString();
538
+  const currentDate = today.toISOString().split("T")[0];
539 539
   const currentHour = today.getHours();
540 540
   const currentMinute = today.getMinutes();
541 541
   // 格式化小时、分钟和秒,确保它们始终有两位数
@@ -547,11 +547,12 @@ const recently = (val: any) => {
547 547
   // 获取过去 7 天的日期
548 548
   const sevenDaysAgoDate = new Date(today);
549 549
   sevenDaysAgoDate.setDate(today.getDate() - 7);
550
-  const sevenDaysAgo = sevenDaysAgoDate.toLocaleDateString();
550
+  const sevenDaysAgo = sevenDaysAgoDate.toISOString().split("T")[0];
551
+
551 552
   // 获取过去 31 天的日期
552 553
   const thirtyOneDaysAgoDate = new Date(today);
553 554
   thirtyOneDaysAgoDate.setDate(today.getDate() - 31);
554
-  const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toLocaleDateString();
555
+  const thirtyOneDaysAgo = thirtyOneDaysAgoDate.toISOString().split("T")[0];
555 556
   if (val == 1) {
556 557
     value2.value = [currentDate + " " + "00:00", currentDate + " " + currentTime];
557 558
   } else if (val == 7) {

Laden…
Annuleren
Opslaan