he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
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
<template>
  <flex-layout no-bg>
    <remote-restart-diagram
      ref="remoteDiagram"
      :update="diagram.update"
      :info="diagram.info">
      <template slot="tools">
        <div class="btn-list">
          <el-button type="primary" size="mini" @click="currSetDialog=true">电流设置</el-button>
          <el-button type="success" size="mini" @click="switchControlSetDialog=true">开关控制</el-button>
        </div>
        <div class="table-wrapper">
          <table>
            <tr>
              <td class="label-text">环境温度过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmTempEnvHigh"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">接触器1温度过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmTempJCQHigh1"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">接触器2温度过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmTempJCQHigh2"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">接触器3温度过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmTempJCQHigh3"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">总空开断开</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDZBreak"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路1空开断开</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBreak1"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路2空开断开</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBreak2"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路3空开断开</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBreak3"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路1电流过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmCURRZLHigh1"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路2电流过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmCURRZLHigh2"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">支路3电流过高</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmCURRZLHigh3"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">旁路1空开闭合</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBPConnect1"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">旁路2空开闭合</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBPConnect2"></hdw-light>
              </td>
            </tr>
            <tr>
              <td class="label-text">旁路3空开闭合</td>
              <td class="light-wrapper">
                <hdw-light :type="diagram.info.alarmKDBPConnect3"></hdw-light>
              </td>
            </tr>
          </table>
        </div>
      </template>
    </remote-restart-diagram>
 
    <!-- 电流设置 -->
    <el-dialog
      title="电流设置"
      width="auto"
      :visible.sync="currSetDialog"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false">
      <curr-param-set
        v-if="currSetDialog"
        :visible.sync="currSetDialog"
        :batt="batt"></curr-param-set>
    </el-dialog>
    <!-- 开关控制 -->
    <el-dialog
      title="开关控制"
      width="auto"
      :visible.sync="switchControlSetDialog"
      :close-on-click-modal="false"
      top="0"
      class="dialog-center"
      :modal-append-to-body="false">
      <switch-control-set
        v-if="switchControlSetDialog"
        :visible.sync="switchControlSetDialog"
        :batt="batt"
        :info="diagram.info"></switch-control-set>
    </el-dialog>
  </flex-layout>
</template>
 
<script>
import remoteRestartDiagram from "@/views/dataTest/components/diagrams/remoteRestart";
import CurrParamSet from "@/views/dataTest/components/remoteRestart/CurrParamSet";
import {getBattGroupInfo} from "@/views/dataMager/js/battGroupMager";
import SwitchControlSet from "@/views/dataTest/components/remoteRestart/SwitchControlSet";
import createWs from "@/assets/js/websocket";
import HdwLight from "@/components/HdwLight";
const WSMixin = createWs("dev61851State");
export default {
  name: "remoteRestartDevice",
  mixins: [WSMixin],
  components: {
    HdwLight,
    SwitchControlSet,
    CurrParamSet,
    remoteRestartDiagram
  },
  data() {
    return {
      currSetDialog: false,
      switchControlSetDialog: false,
      batt: {},
      diagram: {
        update: Math.random(),
        info: {
          alarmCURRZLHigh1: 0,
          alarmCURRZLHigh2: 0,
          alarmCURRZLHigh3: 0,
          alarmKDBPConnect1: 0,
          alarmKDBPConnect2: 0,
          alarmKDBPConnect3: 0,
          alarmKDBreak1: 0,
          alarmKDBreak2: 0,
          alarmKDBreak3: 0,
          alarmKDZBreak: 0,
          alarmTempEnvHigh: 0,
          alarmTempJCQHigh1: 0,
          alarmTempJCQHigh2: 0,
          alarmTempJCQHigh3: 0,
        }
      },
    }
  },
  watch: {
    "$route.params.BattGroupId"(battGroupId) {
      this.$nextTick(() => {
        this.getBattGroupInfo(battGroupId);
      });
    },
  },
  methods: {
    onWSOpen() {
      this.$nextTick(() => {
        this.sendMessage();
      });
    },
    sendMessage() {
      let batt = this.batt;
      if (!batt.battGroupId || !this.isWSOpen) {
        return false;
      }
      this.SOCKET.send(batt.fbsdeviceId);
    },
    onWSMessage(res) {
      let rs = JSON.parse(res.data);
      let data = {};
      if(rs.code==1&&rs.data) {
        data = rs.data;
      }
      this.diagram.update = Math.random();
      this.diagram.info = data;
      if(this.$refs.remoteDiagram.isDisconnect) {
        let alarmInfo = {
          alarmCURRZLHigh1: -1,
          alarmCURRZLHigh2: -1,
          alarmCURRZLHigh3: -1,
          alarmKDBPConnect1: -1,
          alarmKDBPConnect2: -1,
          alarmKDBPConnect3: -1,
          alarmKDBreak1: -1,
          alarmKDBreak2: -1,
          alarmKDBreak3: -1,
          alarmKDZBreak: -1,
          alarmTempEnvHigh: -1,
          alarmTempJCQHigh1: -1,
          alarmTempJCQHigh2: -1,
          alarmTempJCQHigh3: -1,
        };
 
        this.diagram.info = {...this.diagram.info, ...alarmInfo} ;
      }
 
    },
    getBattGroupInfo(battGroupId) {
      this.homeListShow = false;
      getBattGroupInfo(battGroupId)
        .then((res) => {
          res = res.data;
          if (res.code) {
            this.leafClick(res.data[0]);
          } else {
            this.$layer.msg("未获取到电池组的信息");
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    leafClick(data) {
      this.batt = data;
      this.$nextTick(()=>{
        this.sendMessage();
      });
    }
  },
  mounted() {
    let battGroupId = this.$route.params.battGroupId;
    if (battGroupId) {
      this.getBattGroupInfo(battGroupId);
    }
  }
}
</script>
 
<style scoped>
.btn-list {
  text-align: right;
}
.table-wrapper {
  margin-top: 8px;
  font-size: 14px;
}
.table-wrapper td {
  padding: 8px 0px;
}
.table-wrapper .label-text {
  padding-left: 16px;
  text-align: right;
}
.table-wrapper .light-wrapper {
  width: 48px;
  padding-right: 8px;
}
</style>