whychdw
2025-06-06 d0f98ad8e1047e3161a458399ad3005404ed87b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
<script setup>
import { nextTick, ref, watch, onMounted } from "vue";
import svgDiagram from '@/components/svgDiagram.vue';
import info from '@/components/info.vue';
import lineChart from '@/components/echarts/line1.vue';
import lineChart2 from '@/components/echarts/line2.vue';
// import lineChart from '@/components/echarts/BaseChart.vue';
// import lineChart from '../bar8.vue';
 
 
import {
    getHalfHourBattDevData,
    getHalfHourPwrHisAcinData,
    getHalfHourPwrHisDcoutData,
} from "@/api/realtime";
 
const props = defineProps({
    data: {
        type: Object,
        default: {},
    },
    powerId: {
        type: [Number, String],
    },
    devId: {
        type: [Number, String],
    },
    battgroupId: {
        type: [Number, String],
    },
});
 
const tabIdx0 = ref(0);
const tabIdx1 = ref(0);
 
const chart0 = ref(null);
const chart1 = ref(null);
const chart2 = ref(null);
 
watch(
    () => tabIdx0.value,
    () => {
        nextTick(() => {
            tabIdx0Change();
        });
    },
    { immediate: true }
);
 
watch(
    () => tabIdx1.value,
    () => {
        nextTick(() => {
            tabIdx1Change();
        });
    },
    { immediate: true }
);
 
watch(
    () => props.powerId,
    (n) => {
    if (!n) return;
 
        nextTick(() => {
            getAcinData();
            getDevData();
            getDcoutData();
        });
    },
    { immediate: true }
)
 
function tabIdx0Change() {
    // TODO
    if (chart0.value) {
        chart0.value.updateChart([1, 2, 3], [100, 200, 300]);
    }
}
 
function tabIdx1Change() {
    // TODO
    if (chart1.value) {
        chart1.value.updateChart([1, 2, 3], [100, 200, 300]);
    }
}
 
async function getAcinData(granularity = 5) {
    let { code, data, data2 } = await getHalfHourPwrHisAcinData(props.powerId, granularity);
    let list = [];
    if (code && data) {
        list = data2;
    }
    return list;
}
 
async function getDevData(granularity = 5) {
    let { code, data, data2 } = await getHalfHourBattDevData(props.battgroupId, granularity);
    let list = [];
    if (code && data) {
        list = data2;
    }
    return list;
}
 
async function getDcoutData(granularity = 5) {
    let { code, data, data2 } = await getHalfHourPwrHisDcoutData(props.powerId, granularity);
    let list = [];
    if (code && data) {
        list = data2;
    }
    return list;
}
 
onMounted(async () => {
    // await getAcinData();
    // await getDevData();
    // await getDcoutData();
 
    if (chart2.value) {
        chart2.value.updateChart(['04:12', '04:13', '04:14'], {
            '设备温度': [100, 200, 220],
            '组端电流': [100, 200, 220],
            '组端电压': [100, 200, 220],
            '负载电流': [100, 200, 220],
        });
    }
});
</script>
 
<template>
  <div class="tab-content">
    <div class="row pos-r">
      <div class="pos-full row-content">
        <div class="p-left">
          <div class="p-item">
            <div class="panel-title">当前核容信息</div>
            <div class="panel">
              <div class="panel-row">
                <div class="label">失败原因</div>
                <div class="value">无</div>
              </div>
              <div class="panel-row">
                <div class="label">停止原因</div>
                <div class="value">无</div>
              </div>
            </div>
          </div>
          <div class="p-item">
            <div class="panel-title">上次标准核容信息</div>
            <div class="panel">
              <div class="panel-row">
                <div class="label">开始时间</div>
                <div class="value">无</div>
              </div>
              <div class="panel-row">
                <div class="label">测试容量</div>
                <div class="value">无</div>
              </div>
              <div class="panel-row">
                <div class="label">测试时长</div>
                <div class="value">无</div>
              </div>
              <div class="panel-row">
                <div class="label">预估容量</div>
                <div class="value">无</div>
              </div>
              <div class="panel-row">
                <div class="label">终止原因</div>
                <div class="value">无</div>
              </div>
            </div>
          </div>
        </div>
        <div class="p-main">
          <svg-diagram class="svg-diagram"></svg-diagram>
        </div>
        <div class="p-right">
          <div class="control-contain">
            <div class="control-title">
              <svg-icon icon-class="controls"></svg-icon><span>控制管理</span>
            </div>
            <div class="control-btn">核容测试</div>
            <div class="control-btn">停止核容测试</div>
          </div>
          <div class="control-contain">
            <div class="control-title">
              <svg-icon icon-class="dev"></svg-icon><span>设备管理</span>
            </div>
            <div class="control-btn">远程重启</div>
            <div class="control-btn">系统参数设置</div>
            <div class="control-btn">告警参数设置</div>
          </div>
          <div class="control-contain no-wrap">
            <div class="control-btn">放电申请</div>
          </div>
        </div>
      </div>
    </div>
    <div class="row row2">
      <div class="card-item">
        <card title="交流输入">
          <template #tools>
            <el-radio-group class="tab-idx" v-model="tabIdx0" size="small">
              <el-radio-button label="电流" :value="0" />
              <el-radio-button label="电压" :value="1" />
            </el-radio-group>
            <svg-icon class-name="btn-setting" icon-class="setting"></svg-icon>
          </template>
          <line-chart
            ref="chart0"
            :type="['电流', '电压'][tabIdx0]"
          ></line-chart>
        </card>
      </div>
      <div class="card-item">
        <card title="直流输入">
          <template #tools>
            <el-radio-group class="tab-idx" v-model="tabIdx1" size="small">
              <el-radio-button label="电流" :value="0" />
              <el-radio-button label="电压" :value="1" />
            </el-radio-group>
            <svg-icon class-name="btn-setting" icon-class="setting"></svg-icon>
          </template>
          <line-chart
            ref="chart1"
            :type="['电流', '电压'][tabIdx1]"
          ></line-chart>
        </card>
      </div>
      <div class="card-item">
        <card title="核容设备信息">
          <template #tools>
            <svg-icon class-name="btn-setting" icon-class="setting"></svg-icon>
          </template>
          <line-chart2
            ref="chart2"
            :type="['电流', '电压'][tabIdx1]"
          ></line-chart2>
        </card>
      </div>
      <div class="card-item">
        <card title="蓄电池信息">
          <div class="batt grid">
            <info label="最大容量" value="#3 8Ah"></info>
            <info label="最小容量" value="100"></info>
            <info label="最高内阻" value="100"></info>
            <info label="最低内阻" value="100"></info>
            <info label="最高电压" value="100"></info>
            <info label="最低电压" value="100"></info>
            <info label="最高温度" value="100"></info>
            <info label="最低温度" value="100"></info>
          </div>
        </card>
      </div>
    </div>
  </div>
</template>
 
<style scoped lang="less">
.tab-content {
  height: 100%;
  padding-left: 8px;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
 
  .row {
    flex: 1.52;
 
    .row-content {
      display: flex;
      flex-direction: row;
      height: 100%;
    }
 
    .p-left {
      width: 240px;
      display: flex;
      flex-direction: column;
 
      .p-item {
        margin: 8px;
        display: flex;
        flex-direction: column;
 
        .panel-title {
          font-size: 24px;
        }
 
        .panel {
          border: 1px solid #5FA9CF;
          background: #073451;
          border-radius: 6px;
          padding: 10px 6px;
          margin-top: 6px;
          margin-bottom: 30px;
          font-size: 12px;
          display: flex;
          flex-direction: column;
 
          .panel-row {
            display: flex;
            flex-direction: row;
            margin-bottom: 4px;
 
            .label {
              flex: 0 0 6em;
              margin-right: 0.6em;
              text-align: right;
 
              &::after {
                content: ":";
              }
            }
 
            .value {
              flex: 1;
            }
          }
        }
      }
    }
 
    .p-main {
      flex: 1;
    }
 
    .p-right {
      width: 160px;
      margin-left: 20px;
      margin-right: 6px;
      padding-top: 20px;
      display: flex;
      flex-direction: column;
 
      .control-contain {
        display: flex;
        flex-direction: column;
        background: #08354F;
        border-radius: 6px 6px 0 0;
        margin-top: 6px;
        margin-bottom: 8px;
        padding-bottom: 4px;
        overflow: hidden;
        font-size: 12px;
 
        .control-title {
          background: #0B415D;
          font-size: 20px;
          padding: 6px 0;
          text-align: center;
          font-weight: 700;
          margin-bottom: 4px;
 
          span {
            margin-left: 0.6em;
          }
        }
 
        .control-btn {
          margin: 2px 4px;
          cursor: pointer;
          border: 1px solid #3D9CC9;
          box-shadow: inset 0 0 10px 4px #3D9CC9;
          padding: 6px 0;
          text-align: center;
          border-radius: 4px;
 
          &:hover {
            color: #FDFE01;
            border: 1px solid #DF7B26;
            box-shadow: inset 0 0 10px 4px #DF7B26;
          }
        }
 
        &.no-wrap {
          background: transparent;
 
          .control-btn {
            flex: 1;
            border: 1px solid #0BF9FE;
            color: #0bf9fe;
            font-weight: bold;
            font-size: 14px;
            box-shadow: inset 0 0 10px 4px #0BF9FE;
 
            &:hover {
              color: #FDFE01;
              border: 1px solid #DF7B26;
              box-shadow: inset 0 0 10px 4px #DF7B26;
            }
          }
        }
      }
    }
 
    &.row2 {
      flex: 1;
      margin-top: 4px;
      display: flex;
      flex-direction: row;
 
      .card-item {
        flex: 1;
        margin: 4px;
      }
    }
  }
 
  .svg-diagram {}
 
  .btn-setting {
    display: inline-block;
    cursor: pointer;
    margin-left: 0.4em;
    transition: all 1.3s ease;
 
    &:hover {
      transform: rotate(360deg);
      color: #FDFE01;
    }
  }
 
  .batt.grid {
    height: 100%;
    padding: 4px 6px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    // grid-template-rows: repeat(4, 1fr);
    gap: 12px;
    place-content: center;
  }
 
  .tab-idx {
 
    :deep(.el-radio-button:first-child .el-radio-button__inner) {
      border-left: 1px solid #4D81BA;
      border-radius: 0;
      box-shadow: none !important;
    }
 
    // .el-radio-button--small .el-radio-button__inner {
    //     border-radius: 0;
    //     font-size: 12px;
    //     padding: 5px 11px;
    // }
    :deep(.el-radio-button__inner) {
      background: #183A55;
      border: 1px solid #4D81BA;
      border-left: 0;
      border-radius: 0;
      color: #fff;
      font-weight: 500;
      padding: 4px 10px;
    }
 
    :deep(.el-radio-button.is-active .el-radio-button__original-radio:not(:disabled)+.el-radio-button__inner) {
      background: linear-gradient(69deg, #6EABE4, #6EABE4 25%, #0A3E77 75%, #0A3E77);
      // border: 0 none;
      box-shadow: none;
      color: #fff;
    }
  }
}
</style>