hydro-graph 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -0
- package/dist/hydro-graph.es.js +29391 -0
- package/dist/hydro-graph.umd.js +121 -0
- package/dist/style.css +1 -0
- package/package.json +36 -0
- package/src/App.vue +103 -0
- package/src/HydroGraph.vue +2586 -0
- package/src/api/index.js +9 -0
- package/src/assets/images/copy.png +0 -0
- package/src/assets/images/exportPng.png +0 -0
- package/src/assets/images/restore.png +0 -0
- package/src/index.js +4 -0
- package/src/index.scss +86 -0
- package/src/main.js +6 -0
- package/src/utils/ruoyi.js +228 -0
package/src/api/index.js
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/index.js
ADDED
package/src/index.scss
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
.box {
|
|
2
|
+
position: relative;
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
|
|
8
|
+
.title {
|
|
9
|
+
color: red;
|
|
10
|
+
font-size: 25px;
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
text-align: center;
|
|
13
|
+
height: 25px;
|
|
14
|
+
line-height: 25px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.subTitle {
|
|
18
|
+
color: #3a4ce1;
|
|
19
|
+
font-size: 14px;
|
|
20
|
+
font-weight: bold;
|
|
21
|
+
text-align: center;
|
|
22
|
+
height: 25px;
|
|
23
|
+
line-height: 25px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.legend-box {
|
|
27
|
+
margin-left: 33px;
|
|
28
|
+
z-index: 10;
|
|
29
|
+
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
|
|
34
|
+
&>.el-checkbox {
|
|
35
|
+
margin-right: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:deep(.el-dropdown) {
|
|
39
|
+
margin-right: 8px;
|
|
40
|
+
|
|
41
|
+
.el-tooltip__trigger {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.mychart {
|
|
49
|
+
flex: 1;
|
|
50
|
+
position: relative;
|
|
51
|
+
|
|
52
|
+
:deep(.line-name-tooltip-style) {
|
|
53
|
+
position: absolute;
|
|
54
|
+
padding: 8px;
|
|
55
|
+
background: rgba(255, 255, 255, 0.95);
|
|
56
|
+
border-radius: 4px;
|
|
57
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
transform: translate(-100%, -120%);
|
|
62
|
+
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
|
|
63
|
+
z-index: 1000;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:deep(.el-checkbox) {
|
|
69
|
+
.el-checkbox__label {
|
|
70
|
+
color: var(--fill-color);
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
padding-left: 3px;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.el-checkbox__input.is-checked .el-checkbox__inner,
|
|
77
|
+
.el-checkbox__input.is-indeterminate .el-checkbox__inner {
|
|
78
|
+
background-color: var(--fill-color);
|
|
79
|
+
border-color: var(--fill-color) !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.el-checkbox__input.is-focus .el-checkbox__inner,
|
|
83
|
+
.el-checkbox__inner:hover {
|
|
84
|
+
border-color: var(--fill-color) !important;
|
|
85
|
+
}
|
|
86
|
+
}
|
package/src/main.js
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// 工具函数
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
|
|
4
|
+
export function generateGUID() {
|
|
5
|
+
let d = new Date().getTime();
|
|
6
|
+
if (window.performance && typeof window.performance.now === "function") {
|
|
7
|
+
d += performance.now();
|
|
8
|
+
}
|
|
9
|
+
const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
|
10
|
+
/[xy]/g,
|
|
11
|
+
function (c) {
|
|
12
|
+
const r = ((d + Math.random() * 16) % 16) | 0;
|
|
13
|
+
d = Math.floor(d / 16);
|
|
14
|
+
return (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
|
|
15
|
+
},
|
|
16
|
+
);
|
|
17
|
+
return uuid;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const getColors = [
|
|
21
|
+
"#E3A8F7",
|
|
22
|
+
"#5C2D91",
|
|
23
|
+
"#8AE2C2",
|
|
24
|
+
"#FF6B8B",
|
|
25
|
+
"#3A7BD5",
|
|
26
|
+
"#F9D423",
|
|
27
|
+
"#7B4397",
|
|
28
|
+
"#40E0D0",
|
|
29
|
+
"#FF416C",
|
|
30
|
+
"#11998E",
|
|
31
|
+
"#C94B4B",
|
|
32
|
+
"#4CA1AF",
|
|
33
|
+
"#FF8008",
|
|
34
|
+
"#8A2387",
|
|
35
|
+
"#8EC5FC",
|
|
36
|
+
"#E0C3FC",
|
|
37
|
+
"#74EBD5",
|
|
38
|
+
"#FFD89B",
|
|
39
|
+
"#FD6585",
|
|
40
|
+
"#A3CB38",
|
|
41
|
+
"#6A11CB",
|
|
42
|
+
"#FF5E62",
|
|
43
|
+
"#3494E6",
|
|
44
|
+
"#EC6EAD",
|
|
45
|
+
"#FFE000",
|
|
46
|
+
"#799F0C",
|
|
47
|
+
"#00416A",
|
|
48
|
+
"#834D9B",
|
|
49
|
+
"#0052D4",
|
|
50
|
+
"#43C6AC",
|
|
51
|
+
"#8E2DE2",
|
|
52
|
+
"#4A00E0",
|
|
53
|
+
"#FF4B1F",
|
|
54
|
+
"#1CB5E0",
|
|
55
|
+
"#FF7E5F",
|
|
56
|
+
"#FBD3E9",
|
|
57
|
+
"#BB377D",
|
|
58
|
+
"#FF5F6D",
|
|
59
|
+
"#FFC371",
|
|
60
|
+
"#159957",
|
|
61
|
+
"#155799",
|
|
62
|
+
"#3CA55C",
|
|
63
|
+
"#D66D75",
|
|
64
|
+
"#F3904F",
|
|
65
|
+
"#B3FFAB",
|
|
66
|
+
"#12FFF7",
|
|
67
|
+
"#AA076B",
|
|
68
|
+
"#61045F",
|
|
69
|
+
"#FF7A00",
|
|
70
|
+
"#FFD200",
|
|
71
|
+
"#00B4DB",
|
|
72
|
+
"#0083B0",
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
export function isTimeFormat(time) {
|
|
76
|
+
let nyrsf = /^(\d{4})-(\d{2})-(\d{2}) ([01]\d|2[0-3]):[0-5]\d$/;
|
|
77
|
+
let yrsf = /^(\d{2})-(\d{2}) ([01]\d|2[0-3]):[0-5]\d$/;
|
|
78
|
+
let nyr = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
79
|
+
return nyrsf.test(time) || yrsf.test(time) || nyr.test(time);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function getInterval(min, max, type) {
|
|
83
|
+
let value = "";
|
|
84
|
+
if (max - min <= 1) {
|
|
85
|
+
value = 0.1;
|
|
86
|
+
} else if (max - min <= 5) {
|
|
87
|
+
value = 0.5;
|
|
88
|
+
} else if (max - min <= 10) {
|
|
89
|
+
value = 1;
|
|
90
|
+
} else if (max - min <= 25) {
|
|
91
|
+
value = 2.5;
|
|
92
|
+
} else if (max - min <= 50) {
|
|
93
|
+
value = 5;
|
|
94
|
+
} else if (max - min <= 100) {
|
|
95
|
+
value = 10;
|
|
96
|
+
} else if (max - min <= 250) {
|
|
97
|
+
value = 25;
|
|
98
|
+
} else if (max - min <= 500) {
|
|
99
|
+
value = 50;
|
|
100
|
+
} else if (max - min <= 1000) {
|
|
101
|
+
value = 100;
|
|
102
|
+
} else if (max - min <= 2500) {
|
|
103
|
+
value = 250;
|
|
104
|
+
} else if (max - min <= 5000) {
|
|
105
|
+
value = 500;
|
|
106
|
+
} else if (max - min <= 10000) {
|
|
107
|
+
value = 1000;
|
|
108
|
+
} else if (max - min <= 20000) {
|
|
109
|
+
value = 2000;
|
|
110
|
+
} else if (max - min <= 30000) {
|
|
111
|
+
value = 3000;
|
|
112
|
+
} else if (max - min <= 40000) {
|
|
113
|
+
value = 4000;
|
|
114
|
+
} else if (max - min <= 50000) {
|
|
115
|
+
value = 5000;
|
|
116
|
+
} else if (max - min <= 60000) {
|
|
117
|
+
value = 6000;
|
|
118
|
+
} else if (max - min <= 70000) {
|
|
119
|
+
value = 7000;
|
|
120
|
+
} else if (max - min <= 80000) {
|
|
121
|
+
value = 8000;
|
|
122
|
+
} else if (max - min <= 90000) {
|
|
123
|
+
value = 9000;
|
|
124
|
+
} else if (max - min <= 100000) {
|
|
125
|
+
value = 10000;
|
|
126
|
+
} else if (max - min <= 110000) {
|
|
127
|
+
value = 11000;
|
|
128
|
+
} else if (max - min <= 120000) {
|
|
129
|
+
value = 12000;
|
|
130
|
+
} else if (max - min <= 130000) {
|
|
131
|
+
value = 13000;
|
|
132
|
+
} else if (max - min <= 140000) {
|
|
133
|
+
value = 14000;
|
|
134
|
+
} else if (max - min <= 150000) {
|
|
135
|
+
value = 15000;
|
|
136
|
+
} else if (max - min <= 160000) {
|
|
137
|
+
value = 16000;
|
|
138
|
+
} else if (max - min <= 170000) {
|
|
139
|
+
value = 17000;
|
|
140
|
+
} else if (max - min <= 180000) {
|
|
141
|
+
value = 18000;
|
|
142
|
+
} else if (max - min <= 190000) {
|
|
143
|
+
value = 19000;
|
|
144
|
+
} else if (max - min <= 200000) {
|
|
145
|
+
value = 20000;
|
|
146
|
+
}
|
|
147
|
+
if (type == 1) {
|
|
148
|
+
value = value * 2;
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function formatToFlowValue(f) {
|
|
154
|
+
if (isNaN(f)) {
|
|
155
|
+
return "";
|
|
156
|
+
}
|
|
157
|
+
var value = parseFloat(f);
|
|
158
|
+
if (value > 1) {
|
|
159
|
+
var n = 0;
|
|
160
|
+
var Arrange = [
|
|
161
|
+
1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000,
|
|
162
|
+
];
|
|
163
|
+
for (var i = 0; i < Arrange.length; i++) {
|
|
164
|
+
if (value >= Arrange[i] && value < Arrange[i + 1]) n = Arrange[i];
|
|
165
|
+
}
|
|
166
|
+
if (n == 0) {
|
|
167
|
+
return value.toString();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var d = Math.round((value / n) * 100) / 100;
|
|
171
|
+
d = d * n;
|
|
172
|
+
if (d >= 100) {
|
|
173
|
+
return d.toFixed(0);
|
|
174
|
+
} else if (d >= 10) {
|
|
175
|
+
return d.toFixed(1);
|
|
176
|
+
} else {
|
|
177
|
+
return d.toFixed(2);
|
|
178
|
+
}
|
|
179
|
+
} else if (value >= 0) {
|
|
180
|
+
return value.toFixed(3);
|
|
181
|
+
} else if (value < 0) {
|
|
182
|
+
return "-" + formatToFlowValue(Math.abs(value));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function getTimeRange(start, end, interval) {
|
|
187
|
+
const times = [];
|
|
188
|
+
let current = new Date(start);
|
|
189
|
+
while (current <= end) {
|
|
190
|
+
const minutes = current.getMinutes();
|
|
191
|
+
if (minutes % interval === 0) {
|
|
192
|
+
times.push(dayjs(new Date(current)).format("YYYY-MM-DD HH:mm"));
|
|
193
|
+
}
|
|
194
|
+
current.setMinutes(minutes + 1);
|
|
195
|
+
}
|
|
196
|
+
return times;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function getMultipleTimeRange(arr, step) {
|
|
200
|
+
arr = arr.sort((a, b) => Date.parse(a) - Date.parse(b));
|
|
201
|
+
let startTM,
|
|
202
|
+
_pieces = [];
|
|
203
|
+
for (let i = 0; i < arr.length; i++) {
|
|
204
|
+
if (i == 0) {
|
|
205
|
+
startTM = arr[i];
|
|
206
|
+
}
|
|
207
|
+
let currentTM = dayjs(arr[i])
|
|
208
|
+
.add(step, "minute")
|
|
209
|
+
.format("YYYY-MM-DD HH:mm");
|
|
210
|
+
if (!arr.includes(currentTM)) {
|
|
211
|
+
_pieces.push({ startTm: startTM, endTm: arr[i] });
|
|
212
|
+
|
|
213
|
+
if (i + 1 < arr.length) {
|
|
214
|
+
startTM = arr[i + 1];
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return _pieces;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export const isAnnualFirstDay = (dateToCheck) => {
|
|
222
|
+
return (
|
|
223
|
+
dateToCheck.month() === 0 &&
|
|
224
|
+
dateToCheck.date() === 1 &&
|
|
225
|
+
dateToCheck.hour() === 0 &&
|
|
226
|
+
dateToCheck.minute() === 0
|
|
227
|
+
);
|
|
228
|
+
};
|