@things-factory/kpi 9.0.29 → 9.0.30
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/client/google-map/common-google-map.ts +332 -0
- package/client/google-map/google-map-loader.ts +29 -0
- package/client/google-map/script-loader.ts +173 -0
- package/client/pages/kpi-dashboard/cards/kpi-level1-card.ts +248 -0
- package/client/pages/kpi-dashboard/cards/kpi-level2-comparison.ts +369 -0
- package/client/pages/kpi-dashboard/cards/kpi-level3-comparison.ts +443 -0
- package/client/pages/kpi-dashboard/components/kpi-chart-toggle.ts +73 -0
- package/client/pages/kpi-dashboard/components/kpi-map-panel.ts +222 -0
- package/client/pages/kpi-dashboard/kpi-dashboard-map.ts +786 -0
- package/client/pages/kpi-dashboard/kpi-dashboard.ts +416 -0
- package/client/route.ts +4 -0
- package/dist-client/google-map/common-google-map.d.ts +34 -0
- package/dist-client/google-map/common-google-map.js +300 -0
- package/dist-client/google-map/common-google-map.js.map +1 -0
- package/dist-client/google-map/google-map-loader.d.ts +6 -0
- package/dist-client/google-map/google-map-loader.js +22 -0
- package/dist-client/google-map/google-map-loader.js.map +1 -0
- package/dist-client/google-map/script-loader.d.ts +3 -0
- package/dist-client/google-map/script-loader.js +144 -0
- package/dist-client/google-map/script-loader.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.d.ts +17 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js +279 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level1-card.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.d.ts +19 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js +385 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level2-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.d.ts +23 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js +465 -0
- package/dist-client/pages/kpi-dashboard/cards/kpi-level3-comparison.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.d.ts +8 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js +79 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-chart-toggle.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.d.ts +23 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js +223 -0
- package/dist-client/pages/kpi-dashboard/components/kpi-map-panel.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.d.ts +38 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js +813 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard-map.js.map +1 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.d.ts +21 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js +398 -0
- package/dist-client/pages/kpi-dashboard/kpi-dashboard.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/route.js +3 -0
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/index.d.ts +1 -0
- package/dist-server/index.js +1 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/migrations/index.d.ts +1 -0
- package/dist-server/migrations/index.js +12 -0
- package/dist-server/migrations/index.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/index.ts +1 -0
- package/server/migrations/index.ts +9 -0
- package/things-factory.config.js +2 -1
- package/translations/en.json +1 -0
- package/translations/ja.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import { html, css, nothing } from 'lit';
|
|
3
|
+
import { customElement, state } from 'lit/decorators.js';
|
|
4
|
+
import { PageView } from '@operato/shell';
|
|
5
|
+
import { ScrollbarStyles } from '@operato/styles';
|
|
6
|
+
import { client } from '@operato/graphql';
|
|
7
|
+
import gql from 'graphql-tag';
|
|
8
|
+
import './components/kpi-map-panel';
|
|
9
|
+
// Google Maps API 키 (실제 구현 시 환경변수에서 가져와야 함)
|
|
10
|
+
// 개발 중에는 무료 API 키를 사용하거나, 키 없이 테스트용 지도 사용
|
|
11
|
+
const GOOGLE_MAPS_API_KEY = 'AIzaSyBgQZb-SFqjQBC_XTxNiz0XapejNwV9PgA'; // 실제 API 키가 없으므로 빈 문자열로 설정
|
|
12
|
+
let KpiDashboardMapPage = class KpiDashboardMapPage extends PageView {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.loading = true;
|
|
16
|
+
this.error = '';
|
|
17
|
+
this.selectedCategory = '전체 KPI';
|
|
18
|
+
this.selectedChartType = 'boxplot';
|
|
19
|
+
this.selectedPeriod = '월';
|
|
20
|
+
this.startDate = '전체';
|
|
21
|
+
this.endDate = '전체';
|
|
22
|
+
this.nationalData = null;
|
|
23
|
+
this.seoulData = null;
|
|
24
|
+
this.mapData = null;
|
|
25
|
+
// 팝업 관련 상태 추가
|
|
26
|
+
this.selectedRegion = null;
|
|
27
|
+
this.showRegionPopup = false;
|
|
28
|
+
}
|
|
29
|
+
static { this.styles = [
|
|
30
|
+
ScrollbarStyles,
|
|
31
|
+
css `
|
|
32
|
+
:host {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
height: 100vh;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
|
|
38
|
+
position: relative;
|
|
39
|
+
}
|
|
40
|
+
.dashboard-container {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex: 1;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
}
|
|
45
|
+
.left-panel {
|
|
46
|
+
width: 400px;
|
|
47
|
+
background: #fff;
|
|
48
|
+
border-right: 1px solid #e0e0e0;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
|
|
53
|
+
}
|
|
54
|
+
.left-panel-content {
|
|
55
|
+
padding: 24px;
|
|
56
|
+
overflow-y: auto;
|
|
57
|
+
flex: 1;
|
|
58
|
+
}
|
|
59
|
+
.right-panel {
|
|
60
|
+
flex: 1;
|
|
61
|
+
background: #f8f9fa;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
position: relative;
|
|
64
|
+
min-height: 500px;
|
|
65
|
+
}
|
|
66
|
+
.map-overlay {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 16px;
|
|
69
|
+
left: 16px;
|
|
70
|
+
z-index: 10;
|
|
71
|
+
background: rgba(255, 255, 255, 0.95);
|
|
72
|
+
border-radius: 8px;
|
|
73
|
+
padding: 12px 16px;
|
|
74
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
75
|
+
backdrop-filter: blur(4px);
|
|
76
|
+
}
|
|
77
|
+
.category-buttons {
|
|
78
|
+
display: flex;
|
|
79
|
+
gap: 8px;
|
|
80
|
+
flex-wrap: wrap;
|
|
81
|
+
}
|
|
82
|
+
.category-button {
|
|
83
|
+
padding: 6px 12px;
|
|
84
|
+
border: 1px solid #ced4da;
|
|
85
|
+
background: #fff;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
font-size: 0.85rem;
|
|
89
|
+
transition: all 0.2s;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
}
|
|
92
|
+
.category-button.active {
|
|
93
|
+
background: #667eea;
|
|
94
|
+
color: white;
|
|
95
|
+
border-color: #667eea;
|
|
96
|
+
}
|
|
97
|
+
.category-button:hover {
|
|
98
|
+
background: #f8f9fa;
|
|
99
|
+
}
|
|
100
|
+
.category-button.active:hover {
|
|
101
|
+
background: #5a6fd8;
|
|
102
|
+
}
|
|
103
|
+
.region-popup {
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: 0;
|
|
106
|
+
left: 402px; /* 왼쪽 패널 너비와 동일 */
|
|
107
|
+
width: 400px; /* 왼쪽 패널과 동일한 너비 */
|
|
108
|
+
height: 100%; /* 전체 화면 높이 */
|
|
109
|
+
background: #fff;
|
|
110
|
+
border-right: 1px solid #e0e0e0;
|
|
111
|
+
z-index: 1000;
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: column;
|
|
115
|
+
box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
|
|
116
|
+
}
|
|
117
|
+
.popup-content {
|
|
118
|
+
padding: 24px;
|
|
119
|
+
overflow-y: auto;
|
|
120
|
+
flex: 1;
|
|
121
|
+
}
|
|
122
|
+
.popup-header {
|
|
123
|
+
display: flex;
|
|
124
|
+
justify-content: space-between;
|
|
125
|
+
align-items: center;
|
|
126
|
+
padding: 20px 24px;
|
|
127
|
+
border-bottom: 1px solid #e0e0e0;
|
|
128
|
+
background: #fff;
|
|
129
|
+
height: 70px;
|
|
130
|
+
box-sizing: border-box;
|
|
131
|
+
}
|
|
132
|
+
.popup-title {
|
|
133
|
+
font-size: 1.2rem;
|
|
134
|
+
font-weight: bold;
|
|
135
|
+
color: #333;
|
|
136
|
+
}
|
|
137
|
+
.popup-close {
|
|
138
|
+
width: 32px;
|
|
139
|
+
height: 32px;
|
|
140
|
+
border: none;
|
|
141
|
+
background: #fff;
|
|
142
|
+
border-radius: 50%;
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: center;
|
|
147
|
+
font-size: 1.2rem;
|
|
148
|
+
color: #666;
|
|
149
|
+
transition: all 0.2s;
|
|
150
|
+
}
|
|
151
|
+
.popup-close:hover {
|
|
152
|
+
background: #e9ecef;
|
|
153
|
+
color: #333;
|
|
154
|
+
}
|
|
155
|
+
.panel-header {
|
|
156
|
+
display: flex;
|
|
157
|
+
justify-content: space-between;
|
|
158
|
+
align-items: center;
|
|
159
|
+
padding: 20px 24px;
|
|
160
|
+
border-bottom: 1px solid #e0e0e0;
|
|
161
|
+
background: #fff;
|
|
162
|
+
height: 70px;
|
|
163
|
+
box-sizing: border-box;
|
|
164
|
+
}
|
|
165
|
+
.panel-title {
|
|
166
|
+
font-size: 1.3rem;
|
|
167
|
+
font-weight: bold;
|
|
168
|
+
color: #333;
|
|
169
|
+
margin: 0;
|
|
170
|
+
}
|
|
171
|
+
.panel-close {
|
|
172
|
+
width: 32px;
|
|
173
|
+
height: 32px;
|
|
174
|
+
border: none;
|
|
175
|
+
background: #fff;
|
|
176
|
+
border-radius: 50%;
|
|
177
|
+
cursor: pointer;
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
font-size: 1.2rem;
|
|
182
|
+
color: #666;
|
|
183
|
+
transition: all 0.2s;
|
|
184
|
+
}
|
|
185
|
+
.panel-close:hover {
|
|
186
|
+
background: #e9ecef;
|
|
187
|
+
color: #333;
|
|
188
|
+
}
|
|
189
|
+
.sub-title {
|
|
190
|
+
font-size: 1rem;
|
|
191
|
+
font-weight: 600;
|
|
192
|
+
margin-bottom: 16px;
|
|
193
|
+
color: #495057;
|
|
194
|
+
}
|
|
195
|
+
.chart-section {
|
|
196
|
+
background: #f8f9fa;
|
|
197
|
+
border-radius: 8px;
|
|
198
|
+
padding: 16px;
|
|
199
|
+
margin-bottom: 20px;
|
|
200
|
+
}
|
|
201
|
+
.chart-toggle {
|
|
202
|
+
display: flex;
|
|
203
|
+
gap: 8px;
|
|
204
|
+
margin-bottom: 16px;
|
|
205
|
+
}
|
|
206
|
+
.toggle-button {
|
|
207
|
+
padding: 8px 16px;
|
|
208
|
+
border: 1px solid #ced4da;
|
|
209
|
+
background: #fff;
|
|
210
|
+
border-radius: 6px;
|
|
211
|
+
cursor: pointer;
|
|
212
|
+
font-size: 0.9rem;
|
|
213
|
+
transition: all 0.2s;
|
|
214
|
+
}
|
|
215
|
+
.toggle-button.active {
|
|
216
|
+
background: #667eea;
|
|
217
|
+
color: white;
|
|
218
|
+
border-color: #667eea;
|
|
219
|
+
}
|
|
220
|
+
.chart-container {
|
|
221
|
+
height: 300px;
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
justify-content: center;
|
|
225
|
+
background: white;
|
|
226
|
+
border-radius: 6px;
|
|
227
|
+
border: 1px solid #e9ecef;
|
|
228
|
+
}
|
|
229
|
+
.performance-table {
|
|
230
|
+
width: 100%;
|
|
231
|
+
border-collapse: collapse;
|
|
232
|
+
margin-top: 16px;
|
|
233
|
+
}
|
|
234
|
+
.performance-table th,
|
|
235
|
+
.performance-table td {
|
|
236
|
+
padding: 12px 8px;
|
|
237
|
+
text-align: left;
|
|
238
|
+
border-bottom: 1px solid #e9ecef;
|
|
239
|
+
}
|
|
240
|
+
.performance-table th {
|
|
241
|
+
background: #f8f9fa;
|
|
242
|
+
font-weight: 600;
|
|
243
|
+
color: #495057;
|
|
244
|
+
}
|
|
245
|
+
.performance-table td {
|
|
246
|
+
color: #333;
|
|
247
|
+
}
|
|
248
|
+
.change-rate {
|
|
249
|
+
display: flex;
|
|
250
|
+
align-items: center;
|
|
251
|
+
gap: 4px;
|
|
252
|
+
}
|
|
253
|
+
.change-up {
|
|
254
|
+
color: #dc3545;
|
|
255
|
+
}
|
|
256
|
+
.change-down {
|
|
257
|
+
color: #198754;
|
|
258
|
+
}
|
|
259
|
+
.change-neutral {
|
|
260
|
+
color: #6c757d;
|
|
261
|
+
}
|
|
262
|
+
.trend-chart {
|
|
263
|
+
width: 60px;
|
|
264
|
+
height: 30px;
|
|
265
|
+
background: #f8f9fa;
|
|
266
|
+
border-radius: 4px;
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: center;
|
|
269
|
+
justify-content: center;
|
|
270
|
+
font-size: 0.8rem;
|
|
271
|
+
color: #666;
|
|
272
|
+
}
|
|
273
|
+
.download-button {
|
|
274
|
+
margin-top: 16px;
|
|
275
|
+
padding: 8px 16px;
|
|
276
|
+
background: #28a745;
|
|
277
|
+
color: white;
|
|
278
|
+
border: none;
|
|
279
|
+
border-radius: 6px;
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
font-size: 0.9rem;
|
|
282
|
+
display: flex;
|
|
283
|
+
align-items: center;
|
|
284
|
+
gap: 8px;
|
|
285
|
+
}
|
|
286
|
+
.download-button:hover {
|
|
287
|
+
background: #218838;
|
|
288
|
+
}
|
|
289
|
+
.period-selector {
|
|
290
|
+
display: flex;
|
|
291
|
+
gap: 8px;
|
|
292
|
+
margin-bottom: 16px;
|
|
293
|
+
}
|
|
294
|
+
.period-button {
|
|
295
|
+
padding: 6px 12px;
|
|
296
|
+
border: 1px solid #ced4da;
|
|
297
|
+
background: #fff;
|
|
298
|
+
border-radius: 4px;
|
|
299
|
+
cursor: pointer;
|
|
300
|
+
font-size: 0.85rem;
|
|
301
|
+
transition: all 0.2s;
|
|
302
|
+
}
|
|
303
|
+
.period-button.active {
|
|
304
|
+
background: #667eea;
|
|
305
|
+
color: white;
|
|
306
|
+
border-color: #667eea;
|
|
307
|
+
}
|
|
308
|
+
.date-range-selector {
|
|
309
|
+
display: flex;
|
|
310
|
+
align-items: center;
|
|
311
|
+
gap: 8px;
|
|
312
|
+
margin-bottom: 16px;
|
|
313
|
+
}
|
|
314
|
+
.date-select {
|
|
315
|
+
padding: 6px 12px;
|
|
316
|
+
border: 1px solid #ced4da;
|
|
317
|
+
border-radius: 4px;
|
|
318
|
+
background: white;
|
|
319
|
+
font-size: 0.9rem;
|
|
320
|
+
}
|
|
321
|
+
.map-container {
|
|
322
|
+
width: 100%;
|
|
323
|
+
height: 100%;
|
|
324
|
+
position: relative;
|
|
325
|
+
overflow: hidden;
|
|
326
|
+
}
|
|
327
|
+
#map-container {
|
|
328
|
+
width: 100% !important;
|
|
329
|
+
height: 100% !important;
|
|
330
|
+
position: relative !important;
|
|
331
|
+
}
|
|
332
|
+
.region-cluster {
|
|
333
|
+
cursor: pointer;
|
|
334
|
+
transition: all 0.2s;
|
|
335
|
+
}
|
|
336
|
+
.region-cluster:hover {
|
|
337
|
+
opacity: 0.9;
|
|
338
|
+
transform: scale(1.1);
|
|
339
|
+
}
|
|
340
|
+
.map-controls {
|
|
341
|
+
position: absolute;
|
|
342
|
+
top: 16px;
|
|
343
|
+
right: 16px;
|
|
344
|
+
display: flex;
|
|
345
|
+
flex-direction: column;
|
|
346
|
+
gap: 8px;
|
|
347
|
+
}
|
|
348
|
+
.map-control-button {
|
|
349
|
+
width: 40px;
|
|
350
|
+
height: 40px;
|
|
351
|
+
background: white;
|
|
352
|
+
border: 1px solid #ced4da;
|
|
353
|
+
border-radius: 6px;
|
|
354
|
+
cursor: pointer;
|
|
355
|
+
display: flex;
|
|
356
|
+
align-items: center;
|
|
357
|
+
justify-content: center;
|
|
358
|
+
font-size: 1.2rem;
|
|
359
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
360
|
+
}
|
|
361
|
+
.map-control-button:hover {
|
|
362
|
+
background: #f8f9fa;
|
|
363
|
+
}
|
|
364
|
+
.map-scale {
|
|
365
|
+
position: absolute;
|
|
366
|
+
bottom: 16px;
|
|
367
|
+
right: 16px;
|
|
368
|
+
background: white;
|
|
369
|
+
padding: 8px 12px;
|
|
370
|
+
border-radius: 6px;
|
|
371
|
+
border: 1px solid #ced4da;
|
|
372
|
+
font-size: 0.8rem;
|
|
373
|
+
color: #666;
|
|
374
|
+
}
|
|
375
|
+
.region-tooltip {
|
|
376
|
+
position: absolute;
|
|
377
|
+
background: white;
|
|
378
|
+
border: 1px solid #ced4da;
|
|
379
|
+
border-radius: 6px;
|
|
380
|
+
padding: 8px 12px;
|
|
381
|
+
font-size: 0.9rem;
|
|
382
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
383
|
+
z-index: 1000;
|
|
384
|
+
pointer-events: none;
|
|
385
|
+
}
|
|
386
|
+
.loading {
|
|
387
|
+
display: flex;
|
|
388
|
+
align-items: center;
|
|
389
|
+
justify-content: center;
|
|
390
|
+
height: 200px;
|
|
391
|
+
color: #666;
|
|
392
|
+
font-size: 1rem;
|
|
393
|
+
}
|
|
394
|
+
.error {
|
|
395
|
+
display: flex;
|
|
396
|
+
align-items: center;
|
|
397
|
+
justify-content: center;
|
|
398
|
+
height: 200px;
|
|
399
|
+
color: #d32f2f;
|
|
400
|
+
font-size: 1rem;
|
|
401
|
+
}
|
|
402
|
+
`
|
|
403
|
+
]; }
|
|
404
|
+
connectedCallback() {
|
|
405
|
+
super.connectedCallback();
|
|
406
|
+
this.fetchDashboardData();
|
|
407
|
+
this.setupKeyboardEvents();
|
|
408
|
+
}
|
|
409
|
+
setupKeyboardEvents() {
|
|
410
|
+
document.addEventListener('keydown', e => {
|
|
411
|
+
if (e.key === 'Escape' && this.showRegionPopup) {
|
|
412
|
+
this.closeRegionPopup();
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
async fetchDashboardData() {
|
|
417
|
+
this.loading = true;
|
|
418
|
+
this.error = '';
|
|
419
|
+
try {
|
|
420
|
+
// 전국 KPI 데이터 조회
|
|
421
|
+
const nationalResponse = await client.query({
|
|
422
|
+
query: gql `
|
|
423
|
+
query {
|
|
424
|
+
kpiStatistics {
|
|
425
|
+
items {
|
|
426
|
+
id
|
|
427
|
+
valueDate
|
|
428
|
+
periodType
|
|
429
|
+
mean
|
|
430
|
+
median
|
|
431
|
+
standardDeviation
|
|
432
|
+
kpi {
|
|
433
|
+
id
|
|
434
|
+
name
|
|
435
|
+
category {
|
|
436
|
+
id
|
|
437
|
+
name
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
`
|
|
444
|
+
});
|
|
445
|
+
this.nationalData = nationalResponse.data.kpiStatistics.items || [];
|
|
446
|
+
// 서울특별시 데이터는 전국 데이터에서 필터링
|
|
447
|
+
this.seoulData = this.nationalData.filter((item) => item.kpi?.category?.name === '서울특별시');
|
|
448
|
+
// 지도 데이터 생성 (시도별)
|
|
449
|
+
this.generateMapData();
|
|
450
|
+
// 지도 데이터가 생성된 후 지도 초기화
|
|
451
|
+
if (this.mapData && this.mapData.length > 0) {
|
|
452
|
+
console.log('지도 데이터 생성 완료');
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch (e) {
|
|
456
|
+
console.error('대시보드 데이터를 불러오지 못했습니다:', e);
|
|
457
|
+
this.error = '대시보드 데이터를 불러오지 못했습니다.';
|
|
458
|
+
}
|
|
459
|
+
finally {
|
|
460
|
+
this.loading = false;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
generateMapData() {
|
|
464
|
+
// 시도별 샘플 데이터 생성 (실제 좌표 포함)
|
|
465
|
+
this.mapData = [
|
|
466
|
+
{ region: '강원', kpi: 101.5, change: -0.08, trend: 'down', lat: 37.8228, lng: 128.1555 },
|
|
467
|
+
{ region: '경북', kpi: 94.8, change: -0.1, trend: 'down', lat: 36.4919, lng: 128.8889 },
|
|
468
|
+
{ region: '대구', kpi: 79.4, change: -0.2, trend: 'down', lat: 35.8714, lng: 128.6014 },
|
|
469
|
+
{ region: '경남', kpi: 92.1, change: -0.08, trend: 'down', lat: 35.4606, lng: 128.2132 },
|
|
470
|
+
{ region: '부산', kpi: 85.2, change: -0.18, trend: 'down', lat: 35.1796, lng: 129.0756 },
|
|
471
|
+
{ region: '울산', kpi: 91.4, change: 0.19, trend: 'up', lat: 35.5384, lng: 129.3114 },
|
|
472
|
+
{ region: '서울', kpi: 98.1, change: 1.28, trend: 'up', lat: 37.5665, lng: 126.978 },
|
|
473
|
+
{ region: '인천', kpi: 87.3, change: 0.05, trend: 'up', lat: 37.4563, lng: 126.7052 },
|
|
474
|
+
{ region: '대전', kpi: 89.7, change: -0.12, trend: 'down', lat: 36.3504, lng: 127.3845 },
|
|
475
|
+
{ region: '광주', kpi: 91.1, change: -0.16, trend: 'down', lat: 35.1595, lng: 126.8526 },
|
|
476
|
+
{ region: '전북', kpi: 99.3, change: 0.15, trend: 'up', lat: 35.7175, lng: 127.153 },
|
|
477
|
+
{ region: '전남', kpi: 91.8, change: -0.12, trend: 'down', lat: 34.8679, lng: 126.991 },
|
|
478
|
+
{ region: '충북', kpi: 93.2, change: 0.08, trend: 'up', lat: 36.8, lng: 127.7 },
|
|
479
|
+
{ region: '충남', kpi: 88.9, change: -0.05, trend: 'down', lat: 36.5184, lng: 126.8 },
|
|
480
|
+
{ region: '제주', kpi: 95.6, change: 0.22, trend: 'up', lat: 33.4996, lng: 126.5312 }
|
|
481
|
+
];
|
|
482
|
+
}
|
|
483
|
+
onCategoryChange(event) {
|
|
484
|
+
const target = event.target;
|
|
485
|
+
this.selectedCategory = target.value;
|
|
486
|
+
this.fetchDashboardData();
|
|
487
|
+
}
|
|
488
|
+
onChartTypeChange(type) {
|
|
489
|
+
this.selectedChartType = type;
|
|
490
|
+
}
|
|
491
|
+
onPeriodChange(period) {
|
|
492
|
+
this.selectedPeriod = period;
|
|
493
|
+
}
|
|
494
|
+
onDateRangeChange() {
|
|
495
|
+
// 날짜 범위 변경 처리
|
|
496
|
+
}
|
|
497
|
+
downloadExcel() {
|
|
498
|
+
// 엑셀 다운로드 기능
|
|
499
|
+
console.log('엑셀 다운로드');
|
|
500
|
+
}
|
|
501
|
+
onRegionClick(region) {
|
|
502
|
+
this.selectedRegion = region;
|
|
503
|
+
this.showRegionPopup = true;
|
|
504
|
+
this.fetchRegionData(region);
|
|
505
|
+
}
|
|
506
|
+
closeRegionPopup() {
|
|
507
|
+
this.showRegionPopup = false;
|
|
508
|
+
this.selectedRegion = null;
|
|
509
|
+
}
|
|
510
|
+
async fetchRegionData(region) {
|
|
511
|
+
try {
|
|
512
|
+
// 선택된 지역의 KPI 데이터 조회
|
|
513
|
+
const response = await client.query({
|
|
514
|
+
query: gql `
|
|
515
|
+
query GetRegionKpiData($region: String) {
|
|
516
|
+
kpiStatistics(filters: [{ field: "kpi.category.name", operator: "eq", value: $region }]) {
|
|
517
|
+
items {
|
|
518
|
+
id
|
|
519
|
+
valueDate
|
|
520
|
+
periodType
|
|
521
|
+
mean
|
|
522
|
+
median
|
|
523
|
+
standardDeviation
|
|
524
|
+
kpi {
|
|
525
|
+
id
|
|
526
|
+
name
|
|
527
|
+
category {
|
|
528
|
+
id
|
|
529
|
+
name
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
`,
|
|
536
|
+
variables: { region }
|
|
537
|
+
});
|
|
538
|
+
this.seoulData = response.data.kpiStatistics.items || [];
|
|
539
|
+
}
|
|
540
|
+
catch (e) {
|
|
541
|
+
console.error('지역 데이터를 불러오지 못했습니다:', e);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
getChangeRateClass(change) {
|
|
545
|
+
if (change > 0)
|
|
546
|
+
return 'change-up';
|
|
547
|
+
if (change < 0)
|
|
548
|
+
return 'change-down';
|
|
549
|
+
return 'change-neutral';
|
|
550
|
+
}
|
|
551
|
+
getChangeIcon(change) {
|
|
552
|
+
if (change > 0)
|
|
553
|
+
return '▲';
|
|
554
|
+
if (change < 0)
|
|
555
|
+
return '▼';
|
|
556
|
+
return '─';
|
|
557
|
+
}
|
|
558
|
+
get context() {
|
|
559
|
+
return {
|
|
560
|
+
title: '전국 KPI 대시보드',
|
|
561
|
+
description: '전국 및 지역별 KPI 성과 분석 대시보드'
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
render() {
|
|
565
|
+
if (this.loading) {
|
|
566
|
+
return html `
|
|
567
|
+
<div style="display: flex; align-items: center; justify-content: center; height: 100vh;">
|
|
568
|
+
<div style="color: #666; font-size: 1.1rem;">데이터 로딩 중...</div>
|
|
569
|
+
</div>
|
|
570
|
+
`;
|
|
571
|
+
}
|
|
572
|
+
if (this.error) {
|
|
573
|
+
return html `
|
|
574
|
+
<div style="display: flex; align-items: center; justify-content: center; height: 100vh;">
|
|
575
|
+
<div style="color: #d32f2f; font-size: 1.1rem;">${this.error}</div>
|
|
576
|
+
</div>
|
|
577
|
+
`;
|
|
578
|
+
}
|
|
579
|
+
return html `
|
|
580
|
+
<div class="dashboard-container">
|
|
581
|
+
<!-- 좌측 패널: 전국 KPI -->
|
|
582
|
+
<div class="left-panel">
|
|
583
|
+
<div class="panel-header">
|
|
584
|
+
<div class="panel-title">전국 KPI</div>
|
|
585
|
+
<button class="panel-close" style="visibility: hidden;">×</button>
|
|
586
|
+
</div>
|
|
587
|
+
<div class="left-panel-content">
|
|
588
|
+
<!-- KPI 카테고리 선택 -->
|
|
589
|
+
<div style="margin-bottom: 20px;">
|
|
590
|
+
<select
|
|
591
|
+
.value=${this.selectedCategory}
|
|
592
|
+
@change=${this.onCategoryChange}
|
|
593
|
+
style="width: 100%; padding: 8px 12px; border: 1px solid #ced4da; border-radius: 6px; background: white;"
|
|
594
|
+
>
|
|
595
|
+
<option value="전체 KPI">전체 KPI</option>
|
|
596
|
+
<option value="일정 성과">일정 성과</option>
|
|
597
|
+
<option value="비용 성과">비용 성과</option>
|
|
598
|
+
<option value="품질 성과">품질 성과</option>
|
|
599
|
+
<option value="안전 성과">안전 성과</option>
|
|
600
|
+
<option value="환경 성과">환경 성과</option>
|
|
601
|
+
</select>
|
|
602
|
+
</div>
|
|
603
|
+
|
|
604
|
+
<!-- 종합 성과 -->
|
|
605
|
+
<div class="chart-section">
|
|
606
|
+
<div class="sub-title">종합 성과</div>
|
|
607
|
+
<div class="chart-toggle">
|
|
608
|
+
<button
|
|
609
|
+
class="toggle-button ${this.selectedChartType === 'boxplot' ? 'active' : ''}"
|
|
610
|
+
@click=${() => this.onChartTypeChange('boxplot')}
|
|
611
|
+
>
|
|
612
|
+
박스플롯
|
|
613
|
+
</button>
|
|
614
|
+
<button
|
|
615
|
+
class="toggle-button ${this.selectedChartType === 'radar' ? 'active' : ''}"
|
|
616
|
+
@click=${() => this.onChartTypeChange('radar')}
|
|
617
|
+
>
|
|
618
|
+
레이더차트
|
|
619
|
+
</button>
|
|
620
|
+
</div>
|
|
621
|
+
<div class="chart-container">
|
|
622
|
+
${this.selectedChartType === 'boxplot'
|
|
623
|
+
? html `<div style="color: #666;">박스플롯 차트</div>`
|
|
624
|
+
: html `<div style="color: #666;">레이더 차트</div>`}
|
|
625
|
+
</div>
|
|
626
|
+
</div>
|
|
627
|
+
|
|
628
|
+
<!-- 시도별 성과 -->
|
|
629
|
+
<div class="chart-section">
|
|
630
|
+
<div class="sub-title">시도별 성과</div>
|
|
631
|
+
<table class="performance-table">
|
|
632
|
+
<thead>
|
|
633
|
+
<tr>
|
|
634
|
+
<th>지역명</th>
|
|
635
|
+
<th>KPI</th>
|
|
636
|
+
<th>변동률(%)</th>
|
|
637
|
+
<th>성과 추이</th>
|
|
638
|
+
</tr>
|
|
639
|
+
</thead>
|
|
640
|
+
<tbody>
|
|
641
|
+
${this.mapData?.slice(0, 5).map((item) => html `
|
|
642
|
+
<tr
|
|
643
|
+
style="cursor: pointer; transition: background-color 0.2s;"
|
|
644
|
+
@click=${() => this.onRegionClick(item.region)}
|
|
645
|
+
@mouseenter=${(e) => (e.target.style.backgroundColor = '#f8f9fa')}
|
|
646
|
+
@mouseleave=${(e) => (e.target.style.backgroundColor = '')}
|
|
647
|
+
>
|
|
648
|
+
<td>${item.region}</td>
|
|
649
|
+
<td>${item.kpi}</td>
|
|
650
|
+
<td>
|
|
651
|
+
<div class="change-rate ${this.getChangeRateClass(item.change)}">
|
|
652
|
+
${this.getChangeIcon(item.change)}${Math.abs(item.change)}%
|
|
653
|
+
</div>
|
|
654
|
+
</td>
|
|
655
|
+
<td>
|
|
656
|
+
<div class="trend-chart">
|
|
657
|
+
${item.trend === 'up' ? '↗' : item.trend === 'down' ? '↘' : '→'}
|
|
658
|
+
</div>
|
|
659
|
+
</td>
|
|
660
|
+
</tr>
|
|
661
|
+
`)}
|
|
662
|
+
</tbody>
|
|
663
|
+
</table>
|
|
664
|
+
<button class="download-button" @click=${this.downloadExcel}>📊 엑셀 다운로드</button>
|
|
665
|
+
</div>
|
|
666
|
+
</div>
|
|
667
|
+
</div>
|
|
668
|
+
|
|
669
|
+
<!-- 우측 패널: 지도 -->
|
|
670
|
+
<kpi-map-panel
|
|
671
|
+
class="right-panel"
|
|
672
|
+
.selectedCategory=${this.selectedCategory}
|
|
673
|
+
.mapData=${this.mapData}
|
|
674
|
+
@category-change=${(e) => {
|
|
675
|
+
this.selectedCategory = e.detail.category;
|
|
676
|
+
this.fetchDashboardData();
|
|
677
|
+
}}
|
|
678
|
+
></kpi-map-panel>
|
|
679
|
+
|
|
680
|
+
<!-- 지역 상세 팝업 -->
|
|
681
|
+
${this.showRegionPopup
|
|
682
|
+
? html `
|
|
683
|
+
<div class="region-popup">
|
|
684
|
+
<div class="panel-header">
|
|
685
|
+
<div class="panel-title">${this.selectedRegion} KPI</div>
|
|
686
|
+
<button class="panel-close" @click=${this.closeRegionPopup}>×</button>
|
|
687
|
+
</div>
|
|
688
|
+
<div class="popup-content">
|
|
689
|
+
<!-- 종합 성과 -->
|
|
690
|
+
<div class="chart-section">
|
|
691
|
+
<div class="sub-title">종합 성과</div>
|
|
692
|
+
<div class="chart-toggle">
|
|
693
|
+
<button
|
|
694
|
+
class="toggle-button ${this.selectedChartType === 'boxplot' ? 'active' : ''}"
|
|
695
|
+
@click=${() => this.onChartTypeChange('boxplot')}
|
|
696
|
+
>
|
|
697
|
+
박스플롯
|
|
698
|
+
</button>
|
|
699
|
+
<button
|
|
700
|
+
class="toggle-button ${this.selectedChartType === 'radar' ? 'active' : ''}"
|
|
701
|
+
@click=${() => this.onChartTypeChange('radar')}
|
|
702
|
+
>
|
|
703
|
+
레이더차트
|
|
704
|
+
</button>
|
|
705
|
+
</div>
|
|
706
|
+
<div class="chart-container">
|
|
707
|
+
${this.selectedChartType === 'boxplot'
|
|
708
|
+
? html `<div style="color: #666;">${this.selectedRegion} 박스플롯</div>`
|
|
709
|
+
: html `<div style="color: #666;">${this.selectedRegion} 레이더 차트</div>`}
|
|
710
|
+
</div>
|
|
711
|
+
</div>
|
|
712
|
+
|
|
713
|
+
<!-- 기간별 성과 추이 -->
|
|
714
|
+
<div class="chart-section">
|
|
715
|
+
<div class="sub-title">기간별 성과 추이</div>
|
|
716
|
+
<div class="period-selector">
|
|
717
|
+
<button
|
|
718
|
+
class="period-button ${this.selectedPeriod === '월' ? 'active' : ''}"
|
|
719
|
+
@click=${() => this.onPeriodChange('월')}
|
|
720
|
+
>
|
|
721
|
+
월
|
|
722
|
+
</button>
|
|
723
|
+
<button
|
|
724
|
+
class="period-button ${this.selectedPeriod === '년' ? 'active' : ''}"
|
|
725
|
+
@click=${() => this.onPeriodChange('년')}
|
|
726
|
+
>
|
|
727
|
+
년
|
|
728
|
+
</button>
|
|
729
|
+
<button
|
|
730
|
+
class="period-button ${this.selectedPeriod === '전체' ? 'active' : ''}"
|
|
731
|
+
@click=${() => this.onPeriodChange('전체')}
|
|
732
|
+
>
|
|
733
|
+
전체
|
|
734
|
+
</button>
|
|
735
|
+
</div>
|
|
736
|
+
<div class="date-range-selector">
|
|
737
|
+
<select class="date-select" .value=${this.startDate} @change=${this.onDateRangeChange}>
|
|
738
|
+
<option value="전체">전체</option>
|
|
739
|
+
<option value="2024">2024</option>
|
|
740
|
+
<option value="2023">2023</option>
|
|
741
|
+
</select>
|
|
742
|
+
<span>~</span>
|
|
743
|
+
<select class="date-select" .value=${this.endDate} @change=${this.onDateRangeChange}>
|
|
744
|
+
<option value="전체">전체</option>
|
|
745
|
+
<option value="12">12월</option>
|
|
746
|
+
<option value="11">11월</option>
|
|
747
|
+
</select>
|
|
748
|
+
</div>
|
|
749
|
+
<div class="chart-container">
|
|
750
|
+
<div style="color: #666;">데이터 차트(꺾은선 그래프) 또는 테이블</div>
|
|
751
|
+
</div>
|
|
752
|
+
</div>
|
|
753
|
+
</div>
|
|
754
|
+
</div>
|
|
755
|
+
`
|
|
756
|
+
: nothing}
|
|
757
|
+
</div>
|
|
758
|
+
`;
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
__decorate([
|
|
762
|
+
state(),
|
|
763
|
+
__metadata("design:type", Object)
|
|
764
|
+
], KpiDashboardMapPage.prototype, "loading", void 0);
|
|
765
|
+
__decorate([
|
|
766
|
+
state(),
|
|
767
|
+
__metadata("design:type", Object)
|
|
768
|
+
], KpiDashboardMapPage.prototype, "error", void 0);
|
|
769
|
+
__decorate([
|
|
770
|
+
state(),
|
|
771
|
+
__metadata("design:type", Object)
|
|
772
|
+
], KpiDashboardMapPage.prototype, "selectedCategory", void 0);
|
|
773
|
+
__decorate([
|
|
774
|
+
state(),
|
|
775
|
+
__metadata("design:type", Object)
|
|
776
|
+
], KpiDashboardMapPage.prototype, "selectedChartType", void 0);
|
|
777
|
+
__decorate([
|
|
778
|
+
state(),
|
|
779
|
+
__metadata("design:type", Object)
|
|
780
|
+
], KpiDashboardMapPage.prototype, "selectedPeriod", void 0);
|
|
781
|
+
__decorate([
|
|
782
|
+
state(),
|
|
783
|
+
__metadata("design:type", Object)
|
|
784
|
+
], KpiDashboardMapPage.prototype, "startDate", void 0);
|
|
785
|
+
__decorate([
|
|
786
|
+
state(),
|
|
787
|
+
__metadata("design:type", Object)
|
|
788
|
+
], KpiDashboardMapPage.prototype, "endDate", void 0);
|
|
789
|
+
__decorate([
|
|
790
|
+
state(),
|
|
791
|
+
__metadata("design:type", Object)
|
|
792
|
+
], KpiDashboardMapPage.prototype, "nationalData", void 0);
|
|
793
|
+
__decorate([
|
|
794
|
+
state(),
|
|
795
|
+
__metadata("design:type", Object)
|
|
796
|
+
], KpiDashboardMapPage.prototype, "seoulData", void 0);
|
|
797
|
+
__decorate([
|
|
798
|
+
state(),
|
|
799
|
+
__metadata("design:type", Object)
|
|
800
|
+
], KpiDashboardMapPage.prototype, "mapData", void 0);
|
|
801
|
+
__decorate([
|
|
802
|
+
state(),
|
|
803
|
+
__metadata("design:type", Object)
|
|
804
|
+
], KpiDashboardMapPage.prototype, "selectedRegion", void 0);
|
|
805
|
+
__decorate([
|
|
806
|
+
state(),
|
|
807
|
+
__metadata("design:type", Object)
|
|
808
|
+
], KpiDashboardMapPage.prototype, "showRegionPopup", void 0);
|
|
809
|
+
KpiDashboardMapPage = __decorate([
|
|
810
|
+
customElement('kpi-dashboard-map')
|
|
811
|
+
], KpiDashboardMapPage);
|
|
812
|
+
export { KpiDashboardMapPage };
|
|
813
|
+
//# sourceMappingURL=kpi-dashboard-map.js.map
|