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_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.153:48080'
VITE_BASE_URL='http://192.168.0.45:48080' # VITE_BASE_URL='http://192.168.0.45:48080'
# 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务 # 文件上传类型server - 后端上传, client - 前端直连上传,仅支持 S3 服务
VITE_UPLOAD_TYPE=server VITE_UPLOAD_TYPE=server

View File

@ -161,3 +161,10 @@ export const updateBatchHouseLocation = async (data) => {
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" class="new-top-box-right-input-icon"
/> />
</div> </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> </div>
</div> </div>
@ -131,13 +131,13 @@
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="openForm('update', item.id)">编辑</el-dropdown-item> <el-dropdown-item @click="openForm('update', item.id)" v-hasPermi="['carBoard:index:edit']">编辑</el-dropdown-item>
<el-dropdown-item @click="clockCar(item)">{{ <el-dropdown-item @click="clockCar(item)" v-hasPermi="['carBoard:index:lock']">{{
item.robotTaskModel == 0 ? '解锁' : '锁定' item.robotTaskModel == 0 ? '解锁' : '锁定'
}}</el-dropdown-item> }}</el-dropdown-item>
<el-dropdown-item @click="deleteCar(item.id)">删除</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)">清除交管</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)">恢复任务</el-dropdown-item> <el-dropdown-item @click="recoveryTask(item.robotNo)" v-hasPermi="['carBoard:index:recovery']">恢复任务</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>

View File

@ -31,7 +31,7 @@
<el-button :icon="'search'" @click="getCarList" /> <el-button :icon="'search'" @click="getCarList" />
</template> </template>
</el-input> </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> </div>
</el-col> </el-col>
</el-row> </el-row>
@ -54,11 +54,11 @@
</div> </div>
<template #dropdown> <template #dropdown>
<el-dropdown-menu> <el-dropdown-menu>
<el-dropdown-item @click="openForm('update', item.id)">编辑</el-dropdown-item> <el-dropdown-item @click="openForm('update', item.id)" v-hasPermi="['device:index:edit']">编辑</el-dropdown-item>
<el-dropdown-item @click="clockDevice(item)">{{ <el-dropdown-item @click="clockDevice(item)" v-hasPermi="['device:index:lock']">{{
item.deviceEnable == 0 ? '启用' : '禁用' item.deviceEnable == 0 ? '启用' : '禁用'
}}</el-dropdown-item> }}</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> </el-dropdown-menu>
</template> </template>
</el-dropdown> </el-dropdown>

View File

@ -109,7 +109,8 @@
<el-table-column label="操作" align="center"> <el-table-column label="操作" align="center">
<template #default="scope"> <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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -170,7 +171,21 @@ const editFormDialogRef = ref()
const editItem = (item) => { const editItem = (item) => {
editFormDialogRef.value.open(item.id) 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 = () => { const submitSuccess = () => {
getList() getList()
} }

View File

@ -113,11 +113,12 @@
> >
<div <div
style=" style="
font-size: 0.6875rem; font-size: 0.6rem;
position: absolute; position: absolute;
top: -0.625rem; top: 50%;
left: 50%; left: 40%;
transform: translateX(-50%); transform: translateX(-50%) translateY(-50%) ;
color: greenyellow;
" "
> >
{{ item.robotNo || '' }} {{ item.robotNo || '' }}
@ -194,6 +195,9 @@
? '等待点' ? '等待点'
: '' : ''
}}</div> }}</div>
<div>
{{ item.sortNum || '' }}
</div>
</div> </div>
</div> </div>
</template> </template>
@ -383,8 +387,8 @@ const emit = defineEmits(['transmitMapId'])
const storeDialogRef = ref(null) // const storeDialogRef = ref(null) //
const list = ref([]) const list = ref([])
const testCarList = ref([]) // const testCarList = ref([]) //
const carWidth = ref(60) const carWidth = ref(200)
const carHeight = ref(32) const carHeight = ref(100)
// //
const props = defineProps({ const props = defineProps({
@ -715,18 +719,19 @@ const linkWebSocket = (url) => {
} }
// testCarList.value = JSON.parse(JSON.stringify(dataList)) // testCarList.value = JSON.parse(JSON.stringify(dataList))
testCarList.value = mergeCarArrays(testCarList.value, dataList) // testCarList.value = mergeCarArrays(testCarList.value, dataList)
// testCarList.value = mergeArraysWithoutDelete(testCarList.value, dataList) testCarList.value = mergeArraysWithoutDelete(testCarList.value, dataList)
// if (testCarList.value.length) {
// testCarList.value.forEach((item) => { testCarList.value.forEach((item) => {
// item.originWidth = width item.originWidth = imgBgObj.width
// item.originHeight = height item.originHeight = imgBgObj.height
// item.origin = JSON.parse(imgBgObj.yamlJson).origin item.origin = imgBgObj.origin
// item.realX = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).x 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.realY = convertActualToBrowser(item.data.pose2d.x, item.data.pose2d.y).y
// item.robotNo =item.data.pose2d.robotNo item.robotNo =item.data.pose2d.robotNo
// }) })
// }
// console.log(testCarList.value)
} }
// //
if (jsonMsg.type == 'agv_warn') { if (jsonMsg.type == 'agv_warn') {
@ -766,13 +771,44 @@ const linkWebSocket = (url) => {
// console.log('======线======', JSON.parse(data).data) // console.log('======线======', JSON.parse(data).data)
let dataList = JSON.parse(data).data let dataList = JSON.parse(data).data
if (lineList.value.length > 0) { if (lineList.value.length > 0) {
console.log(lineList.value) // console.log(lineList.value)
lineList.value = setIsSelect(lineList.value, dataList) 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 mergeCarArrays = (arr1, arr2) => {
const result = [] const result = []
const macAddressSet = new Set() const macAddressSet = new Set()
@ -894,6 +930,7 @@ const getMapDownloadPng = async (mapInfo) => {
await getAllNodeList() await getAllNodeList()
await getAllMapRoute() await getAllMapRoute()
await computedRatio() await computedRatio()
await getRobotByFloorAndAreaList()
} }
const initWebsocket = () => { const initWebsocket = () => {
let websocketUrl = `${replaceHttpWithWs(import.meta.env.VITE_BASE_URL)}/infra/ws?type=map&floor=${imgBgObj.floor}&area=${imgBgObj.area}` 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.width = imgBgObj.width * radio.value
imgBgObj.height = imgBgObj.height * 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 defineExpose({ getMapData }) // open
onMounted(() => {}) onMounted(() => {})
onBeforeUnmount(() => {
// console.log('onBeforeUnmount')
if(robotListTimerRef.value){
clearInterval(robotListTimerRef.value)
robotListTimerRef.value = null
}
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>