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_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
|
||||||
|
@ -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 })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
@ -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>
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user