修改实时地图

This commit is contained in:
xhf 2025-03-04 17:52:55 +08:00
parent fc21b89982
commit b226f189c3
2 changed files with 42 additions and 6 deletions

View File

@ -41,7 +41,7 @@
<el-col :span="4"> <el-col :span="4">
<div class="top-item" style="border: none; color: #c60606"> <div class="top-item" style="border: none; color: #c60606">
<div class="top-item-title"> 异常 </div> <div class="top-item-title"> 异常 </div>
<div class="top-item-num"> {{ data.taskStatusVO.abnormalNum || 0 }} </div> <div class="top-item-num" style="color: #c60606"> {{ data.taskStatusVO.abnormalNum || 0 }} </div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -87,7 +87,7 @@
<el-col :span="4"> <el-col :span="4">
<div class="top-item" style="border: none; color: #c60606"> <div class="top-item" style="border: none; color: #c60606">
<div class="top-item-title"> 故障 </div> <div class="top-item-title"> 故障 </div>
<div class="top-item-num"> {{ data.statistics.fault || 0 }} </div> <div class="top-item-num" style="color: #c60606"> {{ data.statistics.fault || 0 }} </div>
</div> </div>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -448,6 +448,7 @@ const carPointListFun = () => {
// let data2 = JSON.parse(data['d0:65:78:c4:af:cc']) // let data2 = JSON.parse(data['d0:65:78:c4:af:cc'])
// console.log(data2) // console.log(data2)
} }
// //
const isDrag = ref(false) const isDrag = ref(false)
const changeIsDrag = () => { const changeIsDrag = () => {
@ -781,9 +782,19 @@ const linkWebSocket = (url) => {
if (socketClient.value) { if (socketClient.value) {
// //
socketClient.value.onMessage((message) => { socketClient.value.onMessage((message) => {
console.log('收到消息:', message) console.log('收到消息:', message, window)
if (message.type == 'map_push') { // ElMessage({
let data = JSON.parse(testJson.content) // message: () => h('div', {
// onClick: () => lookError(),
// style: { cursor: 'pointer' }
// }, ''),
// showClose: true,
// duration: 0, //
// });
if (message == 'ping' || message == 'pong') return
let jsonMsg = JSON.parse(message)
if (jsonMsg.type == 'map_push') {
let data = JSON.parse(jsonMsg.content)
// console.log("============",data) // console.log("============",data)
let dataList = [] let dataList = []
for (let key in data) { for (let key in data) {
@ -795,8 +806,32 @@ const linkWebSocket = (url) => {
// console.log('=====', dataList) // console.log('=====', dataList)
testCarList.value = dataList testCarList.value = dataList
} }
if (jsonMsg.type == 'agv_warn') {
// ElMessage({
// dangerouslyUseHTMLString: true,
// message: `<span>${JSON.parse(jsonMsg.content)}</span> <el-button id="custom-button" @click="lookError"></el-button>`,
// })
ElMessage({
message: () =>
h(
'div',
{
onClick: () => lookError(),
style: { cursor: 'pointer' }
},
`${JSON.parse(jsonMsg.content)}`
),
showClose: false,
duration: 2000, //
type: 'error'
}) })
} }
})
}
}
const lookError = () => {
console.log('点击了')
} }
// websocket // websocket
const sendMessage = () => { const sendMessage = () => {
@ -989,7 +1024,8 @@ const observeWidthChange = (id, callback) => {
let stopObserving let stopObserving
defineExpose({ getMapData }) // open defineExpose({ getMapData }) // open
onMounted(() => { onMounted(() => {
carPointListFun() window.lookError = lookError
// carPointListFun()
// getList() // getList()
window.addEventListener('resize', computedRatio) window.addEventListener('resize', computedRatio)
stopObserving = observeWidthChange('indexpage-container', (newWidth) => { stopObserving = observeWidthChange('indexpage-container', (newWidth) => {