he wei
5 天以前 3c3576d5792bfabcef84979757ee344712e71cd3
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
<script setup name="Power">
import { ref, reactive, computed, nextTick, watch, onMounted } from "vue";
import bar from '@/components/echarts/bar2.vue';
import bar1 from '@/components/echarts/bar3.vue';
import bar2 from '@/components/echarts/bar1.vue';
import bar4 from '@/components/echarts/bar4.vue';
import gauge from '@/components/echarts/gauge1.vue';
import water from '@/components/echarts/water.vue';
import ycTag from '@/components/ycTag.vue';
 
import getBinaryDigits from '@/utils/getBinaryDigits.js';
 
const lineIdx = ref(0);
const chart0 = ref(null);
const chart1 = ref(null);
const chart2 = ref(null);
const chart3 = ref(null);
const chart4 = ref(null);
const chart5 = ref(null);
const chart6 = ref(null);
 
const props = defineProps({
  data: {
    type: Object,
    default: {},
  },
});
 
// 整流器列表 最多16个
const modelList = computed(() => {
  return props.data.powerInf && props.data.powerInf.modelCfg ? getBinaryDigits(props.data.powerInf.modelCfg).map((v, i) => ({ value: v, label: i + 1 })).filter(vv => vv.value).map(v => v.label) : [];
});
 
const state = computed(() => {
  let rtData = props.data.pwrdevAcdcdata;
  return modelList.value.map((item) => !rtData[`isAcdcmod${item}Off`]);
});
 
const volList = computed(() => {
  let rtData = props.data.pwrdevAcdcdata;
  return modelList.value.map((item) => rtData[`m${item}OutVol`]);
});
 
watch(
  () => props.data,
  () => {
    nextTick(() => {
      updateRt();
    });
  },
  { immediate: true, deep: true }
);
 
function updateAcin() {
  let rtData = props.data.pwrdevAcdcdata;
  let line = lineIdx.value + 1;
  if (chart0.value) {
    chart0.value.updateChart(['A', 'B', 'C'], [rtData[`acin${line}Vola`], rtData[`acin${line}Volb`], rtData[`acin${line}Volc`]]);
  }
  if (chart1.value) {
    chart1.value.updateChart(['A', 'B', 'C'], [rtData[`acin${line}Curra`], rtData[`acin${line}Currb`], rtData[`acin${line}Currc`]]);
  }
}
 
function updateRt() {
  let rtData = props.data.pwrdevAcdcdata;
  updateAcin();
  if (chart2.value) {
    chart2.value.updateChart(['A', 'B', 'C'], [rtData[`acoutVola`], rtData[`acoutVolb`], rtData[`acoutVolc`]]);
  }
  if (chart3.value) {
    chart3.value.updateChart(rtData.dcoutVol);
  }
  if (chart4.value) {
    chart4.value.updateChart(rtData.dcoutCurr);
  }
  if (chart5.value) {
    chart5.value.updateChart(modelList.value.map((item) => `${item}#`), volList.value);
  }
  if (chart6.value) {
    chart6.value.updateChart(modelList.value.map((item) => `${item}#`), volList.value);
  }
}
 
onMounted(() => {
  
});
</script>
 
<template>
  <div class="tab-content">
    <div class="p-left">
      <div class="p-item">
        <card title="交流输入">
          <template #tools>
            <el-radio-group class="line-idx" v-model="lineIdx" @change="updateAcin" size="small">
              <el-radio-button label="一路" :value="0" />
              <el-radio-button label="二路" :value="1" />
            </el-radio-group>
          </template>
          <div class="wrap">
            <div class="g-vol">
              <bar ref="chart0"></bar>
            </div>
            <div class="g-curr">
              <bar1 ref="chart1"></bar1>
            </div>
          </div>
        </card>
      </div>
      <div class="p-item">
        <card title="交流母线电压">
          <div class="wrap2">
            <div class="g-vol">
              <bar2 :barW="40" ref="chart2"></bar2>
            </div>
            <div class="g-vol">
              <gauge ref="chart3"></gauge>
            </div>
            <div class="g-vol">
              <water ref="chart4"></water>
            </div>
          </div>
        </card>
      </div>
    </div>
    <div class="p-right">
      <div class="p-item">
        <card title="整流器开关状态">
          <div class="wrap scroll">
            <div class="grid">
              <div class="item" v-for="(i, idx) in modelList" :key="'list_' + idx">
                <yc-tag>
                  <div class="item-content">
                    <div class="idx">{{ i }}#</div>
                    <el-switch
                      v-model="state[idx]"
                      class="opacity1"
                      disabled
                      inline-prompt
                      active-text="开机"
                      inactive-text="关机"
                      style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
                      />
                  </div>
                </yc-tag>
              </div>
            </div>
          </div>
        </card>
      </div>
      <div class="p-item large">
        <card title="整流器输出电压">
          <div class="wrap">
            <div class="g-vol g-item">
              <bar4 ref="chart5"></bar4>
            </div>
            <div class="panel-title">整流器输出电流</div>
            <div class="g-curr g-item">
              <bar4 ref="chart6"></bar4>
            </div>
          </div>
        </card>
      </div>
    </div>
  </div>
</template>
 
<style scoped lang="less">
.tab-content {
  display: flex;
  flex-direction: row;
  height: 100%;
 
  .p-left {
    flex: 1;
    display: flex;
    flex-direction: column;
 
    .p-item {
      flex: 1;
      margin: 8px;
 
      .wrap {
        height: 100%;
        display: flex;
        .g-vol {
          flex: 1;
        }
        .g-curr {
          flex: 1;
        }
      }
      .wrap2 {
        height: 100%;
        display: flex;
        .g-vol {
          flex: 1;
          &~.g-vol {
            margin-left: 18px;
          }
        }
      }
    }
  }
 
  .p-right {
    flex: 1;
    display: flex;
    flex-direction: column;
 
    .p-item {
      flex: 1;
      margin: 8px;
      .wrap.scroll {
        height: 100%;
        overflow-y: auto;
      }
      .grid {
        // height: 100%;
        padding: 10px;
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        // grid-template-rows: repeat(2, 1fr);
        grid-gap: 10px 6px;
        place-content: stretch;
        // place-items: center stretch;
        // justify-items: stretch;
        // align-items: stretch;
        .item-content {
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          .idx {
            background: #0ff;
            color: #000;
            font-weight: 700;
            padding: 2px 6px;
            border-radius: 10px;
            margin-right: 10px;
            font-size: 17px;
          }
        }
      }
 
      &.large {
        flex: 2;
        .wrap {
          height: 100%;
          display: flex;
          flex-direction: column;
          .g-item {
            flex: 1;
          }
        }
      }
    }
  }
 
  .line-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>