Merge branch 'xhf' of http://git.znkjfw.com/ak/zn-admin-vue3-wcs into xhf
This commit is contained in:
commit
b0347e9bd1
@ -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
|
||||
|
@ -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 })
|
||||
}
|
||||
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user