...
|
...
|
@@ -25,14 +25,21 @@ |
25
|
25
|
</template>
|
26
|
26
|
</BasicTable>
|
27
|
27
|
</div>
|
28
|
|
- <a-button type="primary" @click="handleClick">打开弹窗</a-button>
|
29
|
|
- <BasicModal @register="registerModal" title="历史数据" width="70%">
|
|
28
|
+ <a-button type="primary" @click="openHistoryModal">打开弹窗</a-button>
|
|
29
|
+ <BasicModal
|
|
30
|
+ @register="registerModal"
|
|
31
|
+ title="历史数据"
|
|
32
|
+ width="70%"
|
|
33
|
+ :footer="null"
|
|
34
|
+ @cancel="cancelHistoryModal"
|
|
35
|
+ >
|
30
|
36
|
<BasicForm @register="registerForm" />
|
|
37
|
+ <div ref="chartRef" :style="{ height: '300px', width }"></div>
|
31
|
38
|
</BasicModal>
|
32
|
39
|
</div>
|
33
|
40
|
</template>
|
34
|
41
|
<script lang="ts">
|
35
|
|
- import { defineComponent, ref, nextTick, unref, onMounted } from 'vue';
|
|
42
|
+ import { defineComponent, ref, nextTick, unref, onMounted, Ref } from 'vue';
|
36
|
43
|
import { useScript } from '/@/hooks/web/useScript';
|
37
|
44
|
import { formSchema, columns } from './config.data';
|
38
|
45
|
import { BasicTable, useTable } from '/@/components/Table';
|
...
|
...
|
@@ -43,6 +50,10 @@ |
43
|
50
|
import { useModal, BasicModal } from '/@/components/Modal';
|
44
|
51
|
import { BasicForm, useForm } from '/@/components/Form';
|
45
|
52
|
import { schemas } from './config.data';
|
|
53
|
+
|
|
54
|
+ import { useECharts } from '/@/hooks/web/useECharts';
|
|
55
|
+ import { getLineData } from './data';
|
|
56
|
+
|
46
|
57
|
export default defineComponent({
|
47
|
58
|
name: 'BaiduMap',
|
48
|
59
|
components: {
|
...
|
...
|
@@ -77,9 +88,6 @@ |
77
|
88
|
map.centerAndZoom(point, 15);
|
78
|
89
|
map.enableScrollWheelZoom(true);
|
79
|
90
|
}
|
80
|
|
- onMounted(() => {
|
81
|
|
- initMap();
|
82
|
|
- });
|
83
|
91
|
|
84
|
92
|
const [registerTable] = useTable({
|
85
|
93
|
api: devicePage,
|
...
|
...
|
@@ -106,6 +114,7 @@ |
106
|
114
|
};
|
107
|
115
|
map.centerAndZoom(point, 15);
|
108
|
116
|
map.enableScrollWheelZoom(true);
|
|
117
|
+ // 创建信息窗口对象
|
109
|
118
|
let infoWindow = new BMap.InfoWindow(
|
110
|
119
|
`
|
111
|
120
|
<div style="display:flex;justify-content:space-between; margin:20px 0px;">
|
...
|
...
|
@@ -129,7 +138,7 @@ |
129
|
138
|
</div>
|
130
|
139
|
`,
|
131
|
140
|
options
|
132
|
|
- ); // 创建信息窗口对象
|
|
141
|
+ );
|
133
|
142
|
map.openInfoWindow(infoWindow, map.getCenter());
|
134
|
143
|
let preMarker = null;
|
135
|
144
|
const rivet =
|
...
|
...
|
@@ -161,22 +170,89 @@ |
161
|
170
|
};
|
162
|
171
|
|
163
|
172
|
const [registerModal, { openModal }] = useModal();
|
164
|
|
- const [registerForm] = useForm({
|
|
173
|
+ const [registerForm, { resetFields }] = useForm({
|
165
|
174
|
labelWidth: 120,
|
166
|
175
|
schemas,
|
167
|
176
|
});
|
168
|
|
- const handleClick = () => {
|
|
177
|
+
|
|
178
|
+ const chartRef = ref<HTMLDivElement | null>(null);
|
|
179
|
+ const { setOptions, echarts } = useECharts(chartRef as Ref<HTMLDivElement>);
|
|
180
|
+ const { lineData, category } = getLineData;
|
|
181
|
+ const openHistoryModal = () => {
|
169
|
182
|
openModal(true);
|
|
183
|
+ setOptions({
|
|
184
|
+ backgroundColor: '#0f375f',
|
|
185
|
+ tooltip: {
|
|
186
|
+ trigger: 'axis',
|
|
187
|
+ axisPointer: {
|
|
188
|
+ type: 'shadow',
|
|
189
|
+ label: {
|
|
190
|
+ show: true,
|
|
191
|
+ backgroundColor: '#333',
|
|
192
|
+ },
|
|
193
|
+ },
|
|
194
|
+ },
|
|
195
|
+ xAxis: {
|
|
196
|
+ data: category,
|
|
197
|
+ axisLine: {
|
|
198
|
+ lineStyle: {
|
|
199
|
+ color: '#ccc',
|
|
200
|
+ },
|
|
201
|
+ },
|
|
202
|
+ },
|
|
203
|
+ yAxis: {
|
|
204
|
+ splitLine: { show: false },
|
|
205
|
+ axisLine: {
|
|
206
|
+ lineStyle: {
|
|
207
|
+ color: '#ccc',
|
|
208
|
+ },
|
|
209
|
+ },
|
|
210
|
+ },
|
|
211
|
+ series: [
|
|
212
|
+ {
|
|
213
|
+ name: '当日数据',
|
|
214
|
+ type: 'line',
|
|
215
|
+ smooth: true,
|
|
216
|
+ showAllSymbol: 'auto',
|
|
217
|
+ symbol: 'emptyCircle',
|
|
218
|
+ symbolSize: 15,
|
|
219
|
+ data: lineData,
|
|
220
|
+ },
|
|
221
|
+ {
|
|
222
|
+ name: 'line',
|
|
223
|
+ type: 'bar',
|
|
224
|
+ barGap: '-100%',
|
|
225
|
+ barWidth: 10,
|
|
226
|
+ itemStyle: {
|
|
227
|
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
228
|
+ { offset: 0, color: 'rgba(20,200,212,0.5)' },
|
|
229
|
+ { offset: 0.2, color: 'rgba(20,200,212,0.2)' },
|
|
230
|
+ { offset: 1, color: 'rgba(20,200,212,0)' },
|
|
231
|
+ ]),
|
|
232
|
+ },
|
|
233
|
+ z: -12,
|
|
234
|
+ data: lineData,
|
|
235
|
+ },
|
|
236
|
+ ],
|
|
237
|
+ });
|
|
238
|
+ };
|
|
239
|
+ const cancelHistoryModal = () => {
|
|
240
|
+ resetFields();
|
170
|
241
|
};
|
|
242
|
+ onMounted(() => {
|
|
243
|
+ initMap();
|
|
244
|
+ });
|
171
|
245
|
|
172
|
246
|
return {
|
173
|
247
|
wrapRef,
|
174
|
248
|
registerTable,
|
175
|
249
|
deviceRowClick,
|
176
|
250
|
DeviceState,
|
177
|
|
- handleClick,
|
178
|
251
|
registerModal,
|
179
|
252
|
registerForm,
|
|
253
|
+ chartRef,
|
|
254
|
+ openHistoryModal,
|
|
255
|
+ cancelHistoryModal,
|
180
|
256
|
};
|
181
|
257
|
},
|
182
|
258
|
});
|
...
|
...
|
|