This commit is contained in:
yyy 2025-04-07 09:02:29 +08:00
commit b0347e9bd1
6 changed files with 99 additions and 33 deletions

View File

@ -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

View File

@ -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 })
}

View File

@ -96,7 +96,7 @@
class="new-top-box-right-input-icon"
/>
</div>
<div class="new-top-box-right-button" @click="openForm('create')"> 新增车辆 </div>
<div class="new-top-box-right-button" @click="openForm('create')" v-hasPermi="['carBoard:index:add']"> 新增车辆 </div>
</div>
</div>
</div>
@ -131,13 +131,13 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openForm('update', item.id)">编辑</el-dropdown-item>
<el-dropdown-item @click="clockCar(item)">{{
<el-dropdown-item @click="openForm('update', item.id)" v-hasPermi="['carBoard:index:edit']">编辑</el-dropdown-item>
<el-dropdown-item @click="clockCar(item)" v-hasPermi="['carBoard:index:lock']">{{
item.robotTaskModel == 0 ? '解锁' : '锁定'
}}</el-dropdown-item>
<el-dropdown-item @click="deleteCar(item.id)">删除</el-dropdown-item>
<el-dropdown-item @click="clearCar(item.robotNo)">清除交管</el-dropdown-item>
<el-dropdown-item @click="recoveryTask(item.robotNo)">恢复任务</el-dropdown-item>
<el-dropdown-item @click="deleteCar(item.id)" v-hasPermi="['carBoard:index:delete']">删除</el-dropdown-item>
<el-dropdown-item @click="clearCar(item.robotNo)" v-hasPermi="['carBoard:index:clear']">清除交管</el-dropdown-item>
<el-dropdown-item @click="recoveryTask(item.robotNo)" v-hasPermi="['carBoard:index:recovery']">恢复任务</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>

View File

@ -31,7 +31,7 @@
<el-button :icon="'search'" @click="getCarList" />
</template>
</el-input>
<el-button style="height: 40px" @click="openForm('create')">新增设备</el-button>
<el-button style="height: 40px" @click="openForm('create')" v-hasPermi="['device:index:create']">新增设备</el-button>
</div>
</el-col>
</el-row>
@ -54,11 +54,11 @@
</div>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item @click="openForm('update', item.id)">编辑</el-dropdown-item>
<el-dropdown-item @click="clockDevice(item)">{{
<el-dropdown-item @click="openForm('update', item.id)" v-hasPermi="['device:index:edit']">编辑</el-dropdown-item>
<el-dropdown-item @click="clockDevice(item)" v-hasPermi="['device:index:lock']">{{
item.deviceEnable == 0 ? '启用' : '禁用'
}}</el-dropdown-item>
<el-dropdown-item @click="deleteCar(item.id)">删除</el-dropdown-item>
<el-dropdown-item @click="deleteCar(item.id)" v-hasPermi="['device:index:delete']">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>

View File

@ -109,7 +109,8 @@
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button type="primary" size="small" @click="editItem(scope.row)">编辑</el-button>
<el-button type="primary" size="small" v-hasPermi="['locationList:index:edit']" @click="editItem(scope.row)">编辑</el-button>
<el-button type="warning" size="small" v-hasPermi="['locationList:index:lock']" @click="handleLock(scope.row)">{{ scope.row.locationLock === 0 ? '解锁' : '锁定' }}</el-button>
</template>
</el-table-column>
</el-table>
@ -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()
}

View File

@ -113,11 +113,12 @@
>
<div
style="
font-size: 0.6875rem;
font-size: 0.6rem;
position: absolute;
top: -0.625rem;
left: 50%;
transform: translateX(-50%);
top: 50%;
left: 40%;
transform: translateX(-50%) translateY(-50%) ;
color: greenyellow;
"
>
{{ item.robotNo || '' }}
@ -194,6 +195,9 @@
? '等待点'
: ''
}}</div>
<div>
{{ item.sortNum || '' }}
</div>
</div>
</div>
</template>
@ -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
}
})
</script>
<style lang="scss" scoped>