diff --git a/.env.local b/.env.local
index c8407918..8eb2bb63 100644
--- a/.env.local
+++ b/.env.local
@@ -4,9 +4,9 @@ NODE_ENV=development
VITE_DEV=true
# 请求路径
-# VITE_BASE_URL='http://192.168.0.74:48080'
+VITE_BASE_URL='http://192.168.0.74:48080'
# VITE_BASE_URL='http://192.168.0.153:48080'
-VITE_BASE_URL='http://192.168.0.45:48080'
+# VITE_BASE_URL='http://192.168.0.45:48080'
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
VITE_UPLOAD_TYPE=server
diff --git a/src/api/map/map.ts b/src/api/map/map.ts
index 3776bcf2..81a47a1d 100644
--- a/src/api/map/map.ts
+++ b/src/api/map/map.ts
@@ -161,3 +161,10 @@ export const updateBatchHouseLocation = async (data) => {
data
})
}
+
+// 获取楼层区域对应的机器人编号
+export const getRobotByFloorAndArea = async (params) => {
+ return await request.post({ url: `/system/robot/information/getRobotByFloorAndArea`, params })
+}
+
+
diff --git a/src/views/board/carBoard/index.vue b/src/views/board/carBoard/index.vue
index c290ae78..a340e48a 100644
--- a/src/views/board/carBoard/index.vue
+++ b/src/views/board/carBoard/index.vue
@@ -96,7 +96,7 @@
class="new-top-box-right-input-icon"
/>
-
新增车辆
+ 新增车辆
@@ -131,13 +131,13 @@
- 编辑
- {{
+ 编辑
+ {{
item.robotTaskModel == 0 ? '解锁' : '锁定'
}}
- 删除
- 清除交管
- 恢复任务
+ 删除
+ 清除交管
+ 恢复任务
diff --git a/src/views/board/device/index.vue b/src/views/board/device/index.vue
index a4e24fa6..75bab912 100644
--- a/src/views/board/device/index.vue
+++ b/src/views/board/device/index.vue
@@ -31,7 +31,7 @@
- 新增设备
+ 新增设备
@@ -54,11 +54,11 @@
- 编辑
- {{
+ 编辑
+ {{
item.deviceEnable == 0 ? '启用' : '禁用'
}}
- 删除
+ 删除
diff --git a/src/views/mapPage/locationList/index.vue b/src/views/mapPage/locationList/index.vue
index b9278b60..d930eb39 100644
--- a/src/views/mapPage/locationList/index.vue
+++ b/src/views/mapPage/locationList/index.vue
@@ -109,7 +109,8 @@
- 编辑
+ 编辑
+ {{ scope.row.locationLock === 0 ? '解锁' : '锁定' }}
@@ -170,7 +171,21 @@ const editFormDialogRef = ref()
const editItem = (item) => {
editFormDialogRef.value.open(item.id)
}
+const handleLock = (item) => {
+ ElMessageBox.confirm('是否确认' + (item.locationLock === 0 ? '解锁' : '锁定') + '?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(async () => {
+ let data = JSON.parse(JSON.stringify(item))
+ data.locationLock = item.locationLock === 0 ? 1 : 0
+ await BinLocationAPi.updateHouseLocation(data)
+ message.success('操作成功')
+ getList()
+ }).catch(() => {})
+
+}
const submitSuccess = () => {
getList()
}
diff --git a/src/views/mapPage/realTimeMap/components/indexPage.vue b/src/views/mapPage/realTimeMap/components/indexPage.vue
index 901762b3..f2e89b33 100644
--- a/src/views/mapPage/realTimeMap/components/indexPage.vue
+++ b/src/views/mapPage/realTimeMap/components/indexPage.vue
@@ -113,11 +113,12 @@
>
{{ item.robotNo || '' }}
@@ -194,6 +195,9 @@
? '等待点'
: ''
}}
+
+ {{ item.sortNum || '' }}
+
@@ -383,8 +387,8 @@ const emit = defineEmits(['transmitMapId'])
const storeDialogRef = ref(null) // 仓库信息弹窗
const list = ref([])
const testCarList = ref([]) //小车数组
-const carWidth = ref(60)
-const carHeight = ref(32)
+const carWidth = ref(200)
+const carHeight = ref(100)
// 定义属性
const props = defineProps({
@@ -715,18 +719,19 @@ const linkWebSocket = (url) => {
}
// testCarList.value = JSON.parse(JSON.stringify(dataList))
- testCarList.value = mergeCarArrays(testCarList.value, dataList)
- // testCarList.value = mergeArraysWithoutDelete(testCarList.value, dataList)
- // if (testCarList.value.length) {
- // testCarList.value.forEach((item) => {
- // item.originWidth = width
- // item.originHeight = height
- // item.origin = JSON.parse(imgBgObj.yamlJson).origin
- // item.realX = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).x
- // item.realY = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).y
- // item.robotNo =item.data.pose2d.robotNo
- // })
- // }
+ // testCarList.value = mergeCarArrays(testCarList.value, dataList)
+ testCarList.value = mergeArraysWithoutDelete(testCarList.value, dataList)
+
+ testCarList.value.forEach((item) => {
+ item.originWidth = imgBgObj.width
+ item.originHeight = imgBgObj.height
+ item.origin = imgBgObj.origin
+ item.realX = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).x
+ item.realY = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).y
+ item.robotNo =item.data.pose2d.robotNo
+ })
+
+ // console.log(testCarList.value)
}
//告警信息
if (jsonMsg.type == 'agv_warn') {
@@ -766,13 +771,44 @@ const linkWebSocket = (url) => {
// console.log('======规划路线======', JSON.parse(data).data)
let dataList = JSON.parse(data).data
if (lineList.value.length > 0) {
- console.log(lineList.value)
+ // console.log(lineList.value)
lineList.value = setIsSelect(lineList.value, dataList)
}
}
})
}
}
+// 现在车辆的逻辑是这样 websoket map_push类型推送消息 每次推送新车 我就添加到车辆列表中 testCarList 不删除车辆
+// 每几秒轮询调用查看当前楼层区域的在线车辆 如果不存在 则再把testCarList 中的车辆删除
+const robotByFloorAndAreaList = ref([]) // 机器人列表
+const robotListTimer = ref(5) //轮询时间
+const robotListTimerRef = ref(null) //轮询定时器
+const getRobotByFloorAndAreaList = () => {
+ if(robotListTimerRef.value){
+ clearInterval(robotListTimerRef.value)
+ robotListTimerRef.value = null
+ }
+ // robotByFloorAndAreaList.value = []
+ robotListTimerRef.value = setInterval(() => {
+ MapApi.getRobotByFloorAndArea({ floor: imgBgObj.floor, area: imgBgObj.area }).then((res) => {
+ // console.log(res)
+ robotByFloorAndAreaList.value = res
+ if(testCarList.value.length){
+ testCarList.value = filterArrayByRobotNo(testCarList.value, robotByFloorAndAreaList.value)
+ }
+ })
+ }, robotListTimer.value * 1000)
+}
+
+// 删掉不在线的车辆
+const filterArrayByRobotNo = (arr1, arr2) =>{
+ return arr1.filter(item => {
+ const robotNo = item.data.pose2d.robotNo;
+ return arr2.includes(robotNo);
+ });
+}
+
+
const mergeCarArrays = (arr1, arr2) => {
const result = []
const macAddressSet = new Set()
@@ -894,6 +930,7 @@ const getMapDownloadPng = async (mapInfo) => {
await getAllNodeList()
await getAllMapRoute()
await computedRatio()
+ await getRobotByFloorAndAreaList()
}
const initWebsocket = () => {
let websocketUrl = `${replaceHttpWithWs(import.meta.env.VITE_BASE_URL)}/infra/ws?type=map&floor=${imgBgObj.floor}&area=${imgBgObj.area}`
@@ -916,7 +953,7 @@ const computedRatio = () => {
imgBgObj.width = imgBgObj.width * radio.value
imgBgObj.height = imgBgObj.height * radio.value
- console.log(imgBgObj)
+ // console.log("====",testCarList.value)
}
})
}
@@ -1059,6 +1096,13 @@ const carDbClick = (item, index) => {
defineExpose({ getMapData }) // 提供 open 方法,用于打开弹窗
onMounted(() => {})
+onBeforeUnmount(() => {
+ // console.log('onBeforeUnmount')
+ if(robotListTimerRef.value){
+ clearInterval(robotListTimerRef.value)
+ robotListTimerRef.value = null
+ }
+})