| | |
| | | <div class="msgBox" @click.stop="setShowMenuClick(true)"> |
| | | |
| | | <i style="font-size: 20px;" class="el-icon-chat-line-round"></i> |
| | | <el-badge v-show="$store.state.mapLayers.msgList.length > 0" :value="$store.state.mapLayers.msgList.length" class="item"> |
| | | <el-badge v-show="$store.state.mapLayers.msgList.length > 0" :value="$store.state.mapLayers.msgList.length" |
| | | class="item"> |
| | | </el-badge> |
| | | <el-dialog title="故障信息" :visible.sync="dialogVisible" width="30%" :show-close="false"> |
| | | <el-table :data="$store.state.mapLayers.msgList" style="width: 100%"> |
| | |
| | | <el-table-column label="操作" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> |
| | | <el-button @click="handleClick2(scope.row)" type="text" size="small">分发</el-button></el-button> |
| | | <el-button @click="handleClick2(scope.row)" type="text" size="small">分发</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | |
| | | import olMap from '@/components/mapOl/index.vue'; |
| | | |
| | | export default { |
| | |
| | | type: 'point', |
| | | isShow: false, |
| | | } |
| | | |
| | | this.parentData = JSON.stringify([obj]) |
| | | this.innerVisible = true |
| | | }, |
| | |
| | | this.wsSocket.onopen = (event) => { |
| | | console.log('WebSocket连接成功'); |
| | | }; |
| | | this.wsSocket.onclose = () => { |
| | | console.log('WebSocket连接关闭'); |
| | | this.wsSocket = null |
| | | }; |
| | | this.wsSocket.onmessage = (event) => { |
| | | |
| | | if (event.data != "连接成功") { |
| | | const obj = JSON.parse(event.data); |
| | | if (obj.mes) { |
| | | this.setShowMsg(obj) |
| | | if (obj.type == "error") { |
| | | if (this.$store.state.mapLayers.msgList.length == 0) { |
| | | this.$store.state.mapLayers.msgList.push(obj) |
| | | } else { |
| | | |
| | | var rs = this.$store.state.mapLayers.msgList; |
| | | var st = rs.filter(item => { |
| | | if (item.msg == obj.msg && item.point == obj.point && item.line == obj.line) { |
| | | return item |
| | | } |
| | | }) |
| | | if (st.length <= 0) { |
| | | this.$store.state.mapLayers.msgList.push(obj) |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | // 处理接收到的消息 |
| | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | // if (!this.wsSocket) { |
| | | // this.createSocket(); |
| | | // } |
| | | if (!this.wsSocket) { |
| | | this.createSocket(); |
| | | } |
| | | |
| | | }, |
| | | beforeDestroy() { |
| | | if (this.wsSocket) { |
| | | this.wsSocket.close(); |
| | | |
| | | } |
| | | |
| | | }, |
| | | } |