whyczyk
2021-09-07 69f949b70f1cd2c80a9738afe602905b18e72e0b
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
<template>
    <div class="contentBox threeRoom">
        <div id="remap"></div>
        <transition name="el-zoom-in-top">
            <diagram-panel :position="text4Pos" title="电源参数" ref="text4Pos" v-show="showtext4">
                <div class="panel-item"><span class="label">电压:</span>
                    <el-input class="input" readonly="readonly" :value="panel4.rectifierVol"></el-input>
                    <span class="unit">V</span>
                </div>
                <div class="panel-item"><span class="label">电流:</span>
                    <el-input class="input" readonly="readonly" :value="panel4.rectifierCurr"></el-input>
                    <span class="unit">A</span>
                </div>
            </diagram-panel>
        </transition>
        <transition name="el-zoom-in-top">
            <diagram-panel :position="text5Pos" title="直流主配电板参数" ref="text5Pos" v-show="showtext5">
                <div class="panel-item">
                    <span class="label">1号进线屏开关:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.switchClose1st2500A==1?'合闸':'分闸'">
                    </el-input>
                    <span class="label" style="margin-left:20px;">2号进线屏开关:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.switchClose2st2500A==1?'合闸':'分闸'">
                    </el-input>
                </div>
                <div class="panel-item">
                    <span class="label">母联屏开关:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.switchCloseBusScreen==1?'合闸':'分闸'">
                    </el-input>
                </div>
                <div class="panel-item">
                    <span class="label">1号负载屏开关:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.switchClose1st2500ALoad==1?'合闸':'分闸'">
                    </el-input>
                    <span class="label" style="margin-left:20px;">2号负载屏开关:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.switchClose2st2500ALoad==1?'合闸':'分闸'">
                    </el-input>
                </div>
                <div class="panel-item">
                    <span class="label">A排电压:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.volA"></el-input>
                    <span class="unit">V</span>
                    <span class="label" style="margin-left:20px;">B排电压:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.volB"></el-input>
                    <span class="unit">V</span>
                </div>
                <div class="panel-item">
                    <span class="label">A排电流:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.currA"></el-input>
                    <span class="unit">A</span>
                    <span class="label" style="margin-left:20px;">B排电流:</span>
                    <el-input class="input" readonly="readonly" :value="panel5.currB"></el-input>
                    <span class="unit">A</span>
                </div>
            </diagram-panel>
        </transition>
    </div>
</template>
 
<script>
    import {
        InitThree
    } from "@/assets/js/three/InitThree";
    import {
        Aobjects,
    } from "@/assets/js/three/data";
    import DiagramPanel from '@/components/smallModule/DiagramPanel.vue';
    let threeBuild;
    export default {
        components: {
            DiagramPanel,
        },
        data() {
            return {
                initOption: {
                    cameraPosition: [0, 1200, -1800], //初始化相机视角位置
                    showAxisHelper: true,
                },
                showtext4: false,
                text4Pos: [],
                showtext5: false,
                text5Pos: [],
                panel4: {
                    rectifierVol: 0,
                    rectifierCurr: 0,
                },
                panel5: {
                    switchClose1st2500A: 0,
                    switchClose2st2500A: 0,
                    switchCloseBusScreen: 0,
                    switchClose1st2500ALoad: 0,
                    switchClose2st2500ALoad: 0,
                    currA: 0,
                    volA: 0,
                    currB: 0,
                    volB: 0,
                },
            };
        },
        mounted() {
            this.$nextTick(() => {
                this.initThreeEvent();
                threeBuild = new InitThree();
                threeBuild.initmsj3D("remap", this.initOption, Aobjects);
                threeBuild.start();
            });
        },
        methods: {
            //初始化three机房相关点击事件
            initThreeEvent() {
                let _this = this;
                Aobjects.events.dbclick = [{
                    findObject: function (_objname) { //点击整流器
                        if (_objname.indexOf("rectifier") >= 0) {
                            return true;
                        } else {
                            return false;
                        }
                    },
                    obj_uuid: "",
                    obj_event: function (_obj, event) {
                        _this.rectifierInfo(_obj, event);
                    }
                }, {
                    findObject: function (_objname) { //点击配电器
                        if (_objname.indexOf("distribution") >= 0) {
                            return true;
                        } else {
                            return false;
                        }
                    },
                    obj_uuid: "",
                    obj_event: function (_obj, event) {
                        _this.distributionInfo(_obj, event);
                    }
                }, ]
                //隐藏面板
                Aobjects.events.hidePanel = {
                    obj_event: function (_obj, event) {
                        _this.hidePanel(_obj, event);
                    }
                }
            },
            //点击电池
            batterInfo(_obj) {
                alert("您双击了" + _obj.name + "点击!");
            },
            rectifierInfo(_obj, event) {
                if (!this.showtext4) {
                    this.text4Pos = [event.offsetX + 20, event.offsetY - 40];
                }
                this.showtext4 = !this.showtext4;
            },
            //点击配电器
            distributionInfo(_obj, event) {
                if (!this.showtext5) {
                    this.text5Pos = [event.offsetX + 20, event.offsetY - 40];
                }
                this.showtext5 = !this.showtext5;
            },
            //隐藏面板
            hidePanel(_obj, event) {
                if (_obj.name == 'floor') {
                    this.showtext4 = false
                    this.showtext5 = false
                }
            }
        },
        destroyed() {
            threeBuild.stop();
        },
    };
</script>
 
<style scoped>
    .threeRoom {
        width: 100%;
        height: 100%;
        position: relative;
        padding: 20px;
    }
 
    #remap {
        width: 100%;
        height: 100%;
        overflow: hidden;
        transition: 0.3s;
    }
 
    #remap /deep/ canvas {
        outline: none;
    }
</style>