合并
This commit is contained in:
parent
5fdd0f6cd1
commit
6e13f318e5
@ -4,9 +4,9 @@ NODE_ENV=development
|
||||
VITE_DEV=true
|
||||
|
||||
# 请求路径
|
||||
# VITE_BASE_URL='http://10.10.7.132:48080'
|
||||
VITE_BASE_URL='http://10.10.7.132:48080'
|
||||
# VITE_BASE_URL='http://10.10.100.15:48080'
|
||||
VITE_BASE_URL='http://10.10.5.5:48080'
|
||||
# VITE_BASE_URL='http://10.10.5.5:48080'
|
||||
|
||||
# 文件上传类型:server - 后端上传, client - 前端直连上传,仅支持 S3 服务
|
||||
VITE_UPLOAD_TYPE=server
|
||||
|
@ -1,7 +1,5 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
|
||||
|
||||
//分页查询设备列表 看板信息设备目前用的是这个
|
||||
export const deviceInformationPage = async (params) => {
|
||||
return await request.get({ url: `/system/device/information/page`, params })
|
||||
@ -41,3 +39,6 @@ export const deviceGetInformationList = async (params) => {
|
||||
export const getMapDeviceImageUrl = async (params) => {
|
||||
return await request.get({ url: `/system/device/information/getMapImageUrl`, params })
|
||||
}
|
||||
export const getWareHouseTakePointList = async (data) => {
|
||||
return await request.post({ url: `/system/ware/house-take-point/list`, data })
|
||||
}
|
||||
|
@ -265,6 +265,7 @@
|
||||
<div
|
||||
class="item-inner-left-bottom-btn"
|
||||
:style="{ color: item.onlineStatus == 0 ? '#CCCCCC' : '#0D162A' }"
|
||||
@click="viewDeviceLog"
|
||||
>
|
||||
日志查看
|
||||
</div>
|
||||
@ -556,12 +557,26 @@ const clockCar = (item) => {
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
//前往地图定位
|
||||
const goToMap = (item) => {
|
||||
//地图定位
|
||||
const goMap = (item) => {
|
||||
if (!item.floor || !item.area) {
|
||||
message.warning('该车辆未配置地图信息')
|
||||
return
|
||||
}
|
||||
router.push({
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
id: item.id
|
||||
floor: item.floor,
|
||||
area: item.area
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const viewDeviceLog = () => {
|
||||
router.push({
|
||||
name: 'MapLogQueriesList',
|
||||
query: {
|
||||
activeTab: 2 // 指定打开车辆日志标签页
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -44,10 +44,24 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备IP" v-if="formData.deviceType !== 9">
|
||||
<el-input v-model="formData.deviceIp" :disabled="false" show-word-limit placeholder="请输入设备ip" maxlength="20" @input="formData.deviceIp=formData.deviceIp.replace(/[^\d.]/g,'')" />
|
||||
<el-input
|
||||
v-model="formData.deviceIp"
|
||||
:disabled="false"
|
||||
show-word-limit
|
||||
placeholder="请输入设备ip"
|
||||
maxlength="20"
|
||||
@input="formData.deviceIp = formData.deviceIp.replace(/[^\d.]/g, '')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="端口" v-if="formData.deviceType !== 9">
|
||||
<el-input v-model="formData.devicePort" :disabled="false" show-word-limit placeholder="请输入端口" maxlength="10" @input="formData.devicePort=formData.devicePort.replace(/[\u4E00-\u9FA5]/g,'')"/>
|
||||
<el-input
|
||||
v-model="formData.devicePort"
|
||||
:disabled="false"
|
||||
show-word-limit
|
||||
placeholder="请输入端口"
|
||||
maxlength="10"
|
||||
@input="formData.devicePort = formData.devicePort.replace(/[\u4E00-\u9FA5]/g, '')"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="充电桩类型" prop="deviceAttribute" v-if="formData.deviceType == 1">
|
||||
<el-select v-model="formData.deviceAttribute" clearable placeholder="请选择设备类型">
|
||||
@ -78,6 +92,31 @@
|
||||
<el-option :label="'启用'" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备取放货点位" v-if="formData.deviceType == 10" required>
|
||||
<el-select v-model="formData.takePointId" filterable placeholder="请输入取放货点位">
|
||||
<el-option
|
||||
v-for="item in takePointList"
|
||||
:key="item.id"
|
||||
:label="item.pointName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="检测区点位" v-if="formData.deviceType == 10" required>
|
||||
<el-select
|
||||
v-model="formData.checkPointIds"
|
||||
multiple
|
||||
filterable
|
||||
placeholder="请选择检测区点位"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in checkPointList"
|
||||
:key="item.id"
|
||||
:label="item.pointName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备图标">
|
||||
<UploadImg v-model="formData.mapImageUrl" :limit="1" />
|
||||
</el-form-item>
|
||||
@ -104,9 +143,9 @@
|
||||
<script lang="ts" setup>
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
import * as MapTaskAPi from '@/api/map/mapTask'
|
||||
import * as DeviceApi from '@/api/device/index'
|
||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const title = ref('新建') // form表单
|
||||
@ -121,11 +160,38 @@ const formData = ref({
|
||||
deviceEnable: undefined, //设备启用禁用 设备启用禁用(0:禁用、1:启用)
|
||||
devicePort: undefined, //端口
|
||||
deviceIp: undefined, //设备IP
|
||||
cameraType:undefined, //摄像头类型
|
||||
deviceLocation:undefined, //设备位置
|
||||
cameraCode:undefined //摄像头编号
|
||||
cameraType: undefined, //摄像头类型
|
||||
deviceLocation: undefined, //设备位置
|
||||
cameraCode: undefined, //摄像头编号
|
||||
takePointId: undefined, //取放货点位
|
||||
checkPointIds: [] //检测区点位
|
||||
})
|
||||
|
||||
// 取放货点位列表
|
||||
const takePointList = ref([])
|
||||
// 检测区点位列表
|
||||
const checkPointList = ref([])
|
||||
|
||||
// 获取取放货点位列表
|
||||
const getTakePointList = async () => {
|
||||
try {
|
||||
takePointList.value = await DeviceApi.getWareHouseTakePointList({ pointType: 1 })
|
||||
} catch (error) {
|
||||
console.error('获取取放货点位失败:', error)
|
||||
takePointList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
// 获取检测区点位列表
|
||||
const getCheckPointList = async () => {
|
||||
try {
|
||||
checkPointList.value = await DeviceApi.getWareHouseTakePointList({ pointType: 0 })
|
||||
} catch (error) {
|
||||
console.error('获取检测区点位失败:', error)
|
||||
checkPointList.value = []
|
||||
}
|
||||
}
|
||||
|
||||
const formRules = reactive({
|
||||
deviceType: [{ required: true, message: '设备类型不能为空', trigger: 'blur' }],
|
||||
deviceNo: [{ required: true, message: '设备编号不能为空', trigger: 'blur' }],
|
||||
@ -137,35 +203,46 @@ const formRules = reactive({
|
||||
deviceEnable: [{ required: true, message: '是否启用不能为空', trigger: 'blur' }],
|
||||
cameraType: [{ required: true, message: '摄像头类型不能为空', trigger: 'blur' }],
|
||||
cameraCode: [{ required: true, message: '摄像头编号不能为空', trigger: 'blur' }],
|
||||
takePointId: [{ required: true, message: '取放货点位不能为空', trigger: 'blur' }],
|
||||
checkPointIds: [{ required: true, message: '检测点不能为空', trigger: 'blur' }]
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type, id) => {
|
||||
// console.log(getDictOptions(DICT_TYPE.DEVICE_TYPE))
|
||||
dialogVisible.value = true
|
||||
resetForm()
|
||||
if (id) {
|
||||
title.value = '编辑'
|
||||
const data = await DeviceApi.deviceInformationGet({ id })
|
||||
formData.value = data
|
||||
if (!formData.value.mapImageUrl) {
|
||||
DeviceApi.getMapDeviceImageUrl({
|
||||
deviceType: formData.value.deviceType
|
||||
}).then((res) => {
|
||||
// console.log(res)
|
||||
formData.value.mapImageUrl = res ? res : undefined
|
||||
})
|
||||
}
|
||||
// 根据设备类型设置 cameraType
|
||||
if (formData.value.deviceType !== 9) {
|
||||
formData.value.cameraType = undefined;
|
||||
}
|
||||
await loadDeviceDetail(id)
|
||||
} else {
|
||||
title.value = '新建'
|
||||
}
|
||||
// getCanUseRobotList()
|
||||
// getTaskNo()
|
||||
}
|
||||
|
||||
/** 加载设备详情 */
|
||||
const loadDeviceDetail = async (id) => {
|
||||
const data = await DeviceApi.deviceInformationGet({ id })
|
||||
formData.value = data
|
||||
|
||||
if (!formData.value.mapImageUrl) {
|
||||
DeviceApi.getMapDeviceImageUrl({
|
||||
deviceType: formData.value.deviceType
|
||||
}).then((res) => {
|
||||
formData.value.mapImageUrl = res ? res : undefined
|
||||
})
|
||||
}
|
||||
|
||||
// 根据设备类型设置 cameraType
|
||||
if (formData.value.deviceType !== 9) {
|
||||
formData.value.cameraType = undefined
|
||||
}
|
||||
|
||||
// 如果是翻转机,获取点位列表
|
||||
if (formData.value.deviceType === 10) {
|
||||
await getTakePointList()
|
||||
await getCheckPointList()
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
@ -196,76 +273,46 @@ const submitForm = async () => {
|
||||
}
|
||||
}
|
||||
// 设备类型切换
|
||||
const deviceTypeChange = (e) => {
|
||||
const deviceTypeChange = async (e) => {
|
||||
DeviceApi.getMapDeviceImageUrl({
|
||||
deviceType: e
|
||||
}).then((res) => {
|
||||
// console.log(res)
|
||||
formData.value.mapImageUrl = res ? res : undefined
|
||||
})
|
||||
if (e === 9) {
|
||||
formData.value.cameraType = '1';
|
||||
formData.value.cameraType = '1'
|
||||
} else {
|
||||
formData.value.cameraType = undefined;
|
||||
formData.value.cameraType = undefined
|
||||
}
|
||||
}
|
||||
//前往任务管理页面
|
||||
const { push } = useRouter()
|
||||
const taskManagement = () => {
|
||||
push({ name: 'taskManagementCreateTask' })
|
||||
}
|
||||
|
||||
//查询能用的车辆
|
||||
const robotList = ref([])
|
||||
const getCanUseRobotList = async () => {
|
||||
robotList.value = await MapTaskAPi.getCanUseRobot()
|
||||
}
|
||||
|
||||
//获取任务号
|
||||
const getTaskNo = async () => {
|
||||
formData.value.taskNo = await MapTaskAPi.getTaskNo()
|
||||
}
|
||||
|
||||
//获取取货位置可选的列表
|
||||
const getLocationList = async (type, locationNo) => {
|
||||
return await MapTaskAPi.getLocationByName({
|
||||
type, // 放货类型(1:库位、2:线库、 3:区域)
|
||||
locationNo
|
||||
})
|
||||
}
|
||||
//放货的选择列表
|
||||
const loading = ref(false)
|
||||
const releaseRemoteMethod = async (query, item) => {
|
||||
if (query) {
|
||||
loading.value = true
|
||||
item.releaseList = await getLocationList(item.releaseType, query)
|
||||
loading.value = false
|
||||
} else {
|
||||
item.releaseList = []
|
||||
}
|
||||
}
|
||||
//取货的选择列表
|
||||
const takeRemoteMethod = async (query, item) => {
|
||||
if (query) {
|
||||
item.takeList = await getLocationList(item.takeType, query)
|
||||
} else {
|
||||
item.takeList = []
|
||||
// 当设备类型为翻转机(10)时,获取点位列表
|
||||
if (e === 10) {
|
||||
await getTakePointList()
|
||||
await getCheckPointList()
|
||||
// 重置点位选择
|
||||
formData.value.takePointId = undefined
|
||||
formData.value.checkPointIds = []
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
deviceType: undefined, //车辆类型id
|
||||
deviceType: undefined, //设备类型
|
||||
deviceNo: undefined, //车辆编号
|
||||
macAddress: undefined, //mac地址
|
||||
mapImageUrl: undefined, //设备在地图上图标
|
||||
pictureConfig: undefined, // 图片设置(1:默认图片、2:上传图片、 3:不显示图片)
|
||||
url: undefined, //上传图片附件
|
||||
deviceAttribute: undefined,//充电桩类型
|
||||
cameraType:undefined, //摄像头类型
|
||||
deviceLocation:undefined, //设备位置
|
||||
cameraCode:undefined, //摄像头编号
|
||||
deviceAttribute: undefined,
|
||||
deviceEnable: undefined, //设备启用禁用 设备启用禁用(0:禁用、1:启用)
|
||||
devicePort: undefined, //端口
|
||||
deviceIp: undefined, //设备IP
|
||||
cameraType: undefined, //摄像头类型
|
||||
deviceLocation: undefined, //设备位置
|
||||
cameraCode: undefined, //摄像头编号
|
||||
takePointId: undefined, //取放货点位
|
||||
checkPointIds: [] //检测区点位
|
||||
}
|
||||
|
||||
formRef.value?.resetFields()
|
||||
|
@ -43,91 +43,118 @@
|
||||
</div>
|
||||
</ContentWrap>
|
||||
<div class="new-list-box-all">
|
||||
<div class="new-list-box">
|
||||
<div class="item" v-for="(item, index) in list" :key="index">
|
||||
<div class="item-top">
|
||||
<div class="item-inner-left-name">
|
||||
<div class="item-inner-left-name-inner">
|
||||
{{ filterTypeFun(item.deviceType, typeList) }} {{ item.deviceNo }}
|
||||
<el-skeleton :rows="6" animated :loading="loading" :throttle="500">
|
||||
<template #template>
|
||||
<div style="padding: 20px">
|
||||
<el-skeleton-item variant="h1" style="width: 50%" />
|
||||
<div style="display: flex; justify-content: space-between; margin-top: 20px">
|
||||
<div style="width: 30%">
|
||||
<el-skeleton-item variant="image" style="width: 100%; height: 150px" />
|
||||
</div>
|
||||
<div style="width: 65%">
|
||||
<el-skeleton-item variant="text" style="width: 100%; margin-bottom: 10px" />
|
||||
<el-skeleton-item variant="text" style="width: 100%; margin-bottom: 10px" />
|
||||
<el-skeleton-item variant="text" style="width: 100%; margin-bottom: 10px" />
|
||||
<el-skeleton-item variant="text" style="width: 100%" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-top">
|
||||
<div class="swiper-item-box-top-msg">
|
||||
<el-dropdown>
|
||||
<div style="flex-shrink: 0">
|
||||
<el-icon size="20px"><MoreFilled /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<template #default>
|
||||
<div class="new-list-box">
|
||||
<div class="item" v-for="(item, index) in list" :key="index">
|
||||
<div class="item-top">
|
||||
<div class="item-inner-left-name">
|
||||
<div class="item-inner-left-name-inner">
|
||||
{{ filterTypeFun(item.deviceType, typeList) }} {{ item.deviceNo }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-top">
|
||||
<div class="swiper-item-box-top-msg">
|
||||
<el-popover placement="bottom" trigger="click">
|
||||
<template #reference>
|
||||
<div style="flex-shrink: 0; cursor: pointer">
|
||||
<el-icon size="20px"><MoreFilled /></el-icon>
|
||||
</div>
|
||||
</template>
|
||||
<div class="popover-menu">
|
||||
<div
|
||||
class="popover-menu-item"
|
||||
@click="openForm('update', item.id)"
|
||||
v-hasPermi="['device:index:edit']"
|
||||
>编辑</div
|
||||
>
|
||||
<div
|
||||
class="popover-menu-item"
|
||||
@click="clockDevice(item)"
|
||||
v-hasPermi="['device:index:lock']"
|
||||
>{{ item.deviceEnable == 0 ? '启用' : '禁用' }}</div
|
||||
>
|
||||
<div
|
||||
class="popover-menu-item"
|
||||
@click="deleteCar(item.id)"
|
||||
v-hasPermi="['device:index:delete']"
|
||||
>删除</div
|
||||
>
|
||||
</div>
|
||||
</el-popover>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<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)"
|
||||
v-hasPermi="['device:index:delete']"
|
||||
>删除</el-dropdown-item
|
||||
>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner">
|
||||
<div class="item-inner-left">
|
||||
<div class="item-inner-left-img-box">
|
||||
<el-image
|
||||
style="width: 100%; height: 100%"
|
||||
:src="item.url"
|
||||
:fit="'fill'"
|
||||
v-if="item.pictureConfig != 3"
|
||||
/>
|
||||
<div class="item-inner-left-img-box-no" v-else>
|
||||
<span>不显示图片</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-left-bottom">
|
||||
<div class="item-inner-left-bottom-btn" @click="goMap(item)"> 地图定位 </div>
|
||||
<div class="item-inner-left-bottom-btn"> 日志查看 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg">
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name">编号</div>
|
||||
<div class="item-inner-right-msg-item-value overhide">{{ item.deviceNo || '' }}</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name overhide">是否启用</div>
|
||||
<div class="item-inner-right-msg-item-value">
|
||||
<span v-if="item.deviceEnable == 0" style="color: #c60606">禁用</span>
|
||||
<span v-if="item.deviceEnable == 1" style="color: #4dc606">启用</span>
|
||||
<div class="item-inner">
|
||||
<div class="item-inner-left">
|
||||
<div class="item-inner-left-img-box">
|
||||
<el-image
|
||||
style="width: 100%; height: 100%"
|
||||
:src="item.url"
|
||||
:fit="'fill'"
|
||||
v-if="item.pictureConfig != 3"
|
||||
/>
|
||||
<div class="item-inner-left-img-box-no" v-else>
|
||||
<span>不显示图片</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-left-bottom">
|
||||
<div class="item-inner-left-bottom-btn" @click="goMap(item)"> 地图定位 </div>
|
||||
<div class="item-inner-left-bottom-btn" @click="viewDeviceLog(item)">
|
||||
日志查看
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name">位置</div>
|
||||
<div class="item-inner-right-msg-item-value" v-if="item.deviceLocation !== null"
|
||||
>{{ item.deviceLocation || '' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item">
|
||||
<div class="item-inner-right-msg-item-name overhide">最后通讯时间</div>
|
||||
<div
|
||||
class="item-inner-right-msg-item-value overhide"
|
||||
v-if="item.deviceLastTime !== null"
|
||||
>{{ item.deviceLastTime || '' }}
|
||||
<div class="item-inner-right-msg">
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name">编号</div>
|
||||
<div class="item-inner-right-msg-item-value overhide">{{
|
||||
item.deviceNo || ''
|
||||
}}</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name overhide">是否启用</div>
|
||||
<div class="item-inner-right-msg-item-value">
|
||||
<span v-if="item.deviceEnable == 0" style="color: #c60606">禁用</span>
|
||||
<span v-if="item.deviceEnable == 1" style="color: #4dc606">启用</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item m-b-10">
|
||||
<div class="item-inner-right-msg-item-name">位置</div>
|
||||
<div class="item-inner-right-msg-item-value" v-if="item.deviceLocation !== null"
|
||||
>{{ item.deviceLocation || '' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-inner-right-msg-item">
|
||||
<div class="item-inner-right-msg-item-name overhide">最后通讯时间</div>
|
||||
<div
|
||||
class="item-inner-right-msg-item-value overhide"
|
||||
v-if="item.deviceLastTime !== null"
|
||||
>{{ item.deviceLastTime || '' }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-skeleton>
|
||||
</div>
|
||||
<createEditDialog ref="createEditDialogRef" @success="initFun()" />
|
||||
</template>
|
||||
@ -149,6 +176,7 @@ const message = useMessage() // 消息弹窗
|
||||
const router = useRouter() // 路由对象
|
||||
const createEditDialogRef = ref(null)
|
||||
const list = ref([])
|
||||
const loading = ref(true) // 添加loading状态
|
||||
const queryParams = reactive({
|
||||
deviceNo: undefined,
|
||||
deviceType: undefined
|
||||
@ -156,25 +184,11 @@ const queryParams = reactive({
|
||||
|
||||
const activeName = ref('-1')
|
||||
const handleClick = (tab, event) => {
|
||||
loading.value = true // 切换标签时显示loading
|
||||
queryParams.deviceType = tab.props.name != -1 ? tab.props.name : undefined
|
||||
getCarList()
|
||||
}
|
||||
|
||||
const typeList = ref([])
|
||||
const typeListCache = new Map()
|
||||
|
||||
const getTypeList = () => {
|
||||
const cacheKey = 'device_type_list'
|
||||
if (typeListCache.has(cacheKey)) {
|
||||
typeList.value = typeListCache.get(cacheKey)
|
||||
} else {
|
||||
const options = getDictOptions(DICT_TYPE.DEVICE_TYPE) || []
|
||||
typeList.value = [{ label: '全部', value: '-1' }, ...options]
|
||||
typeListCache.set(cacheKey, typeList.value)
|
||||
}
|
||||
getRobotInformationStatistics()
|
||||
}
|
||||
|
||||
//根据type和列表返回对应中文
|
||||
const filterTypeFun = (type, list) => {
|
||||
if (!list?.length) return type
|
||||
@ -189,7 +203,7 @@ const goMap = (item) => {
|
||||
return
|
||||
}
|
||||
router.push({
|
||||
path: '/mapPage/realTimeMap',
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
floorArea: JSON.stringify([item.floor, item.positionMapId])
|
||||
}
|
||||
@ -199,22 +213,29 @@ const goMap = (item) => {
|
||||
const timerRef = ref(null)
|
||||
//查询车辆列表
|
||||
const getCarList = debounce(async () => {
|
||||
loading.value = true // 查询前显示loading
|
||||
try {
|
||||
list.value = await DeviceApi.deviceGetInformationList(queryParams)
|
||||
} catch (error) {
|
||||
console.error('获取设备列表失败:', error)
|
||||
} finally {
|
||||
loading.value = false // 无论成功失败都关闭loading
|
||||
}
|
||||
}, 300)
|
||||
|
||||
const carStatistics = ref({
|
||||
standby: 0,
|
||||
inTask: 0,
|
||||
doLock: 0,
|
||||
offline: 0,
|
||||
fault: 0,
|
||||
charge: 0,
|
||||
total: 0
|
||||
})
|
||||
const typeList = ref([])
|
||||
|
||||
const getTypeList = () => {
|
||||
const res = getDictOptions(DICT_TYPE.DEVICE_TYPE) || []
|
||||
const options = res.map((item) => {
|
||||
return {
|
||||
label: item.label,
|
||||
value: item.value
|
||||
}
|
||||
})
|
||||
typeList.value = [{ label: '全部', value: '-1' }, ...options]
|
||||
getRobotInformationStatistics()
|
||||
}
|
||||
|
||||
//查询车辆统计
|
||||
const getRobotInformationStatistics = async () => {
|
||||
@ -227,7 +248,8 @@ const getRobotInformationStatistics = async () => {
|
||||
|
||||
let total = 0
|
||||
typeList.value.forEach((item) => {
|
||||
const matchItem = res.find((resItem) => item.value === resItem.deviceType)
|
||||
// 将字符串类型的value转为数字进行比较,或将接口返回的deviceType转为字符串进行比较
|
||||
const matchItem = res.find((resItem) => String(resItem.deviceType) === item.value)
|
||||
item.number = matchItem ? Number(matchItem.number) : 0
|
||||
if (item.value !== '-1') {
|
||||
total += item.number
|
||||
@ -238,6 +260,7 @@ const getRobotInformationStatistics = async () => {
|
||||
console.error('获取设备统计失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
const clockDevice = (item) => {
|
||||
let valueStr = item.deviceEnable == 1 ? '禁用' : '启用'
|
||||
let data = JSON.parse(JSON.stringify(item))
|
||||
@ -248,6 +271,7 @@ const clockDevice = (item) => {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
loading.value = true // 操作前显示loading
|
||||
DeviceApi.deviceInformationUpdate(data).then((res) => {
|
||||
initFun()
|
||||
message.success(`${valueStr}成功`)
|
||||
@ -267,6 +291,7 @@ const deleteCar = (id) => {
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
loading.value = true // 操作前显示loading
|
||||
DeviceApi.deleteDeviceInformation(id).then((res) => {
|
||||
initFun()
|
||||
message.success('删除成功')
|
||||
@ -275,24 +300,6 @@ const deleteCar = (id) => {
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
const clockCar = (item) => {
|
||||
// let valueStr = item.robotTaskModel == 1 ? '锁定' : '解锁'
|
||||
// let data = JSON.parse(JSON.stringify(item))
|
||||
// data.robotTaskModel = item.robotTaskModel == 1 ? 0 : 1
|
||||
// ElMessageBox.confirm(`您确定要${valueStr}此车辆吗?`, '提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning'
|
||||
// })
|
||||
// .then(() => {
|
||||
// DeviceApi.robotInformationUpdate(data).then((res) => {
|
||||
// getCarList()
|
||||
// message.success(`${valueStr}成功`)
|
||||
// })
|
||||
// })
|
||||
// .catch(() => {})
|
||||
}
|
||||
|
||||
//前往地图定位
|
||||
const goToMap = (item) => {
|
||||
router.push({
|
||||
@ -303,7 +310,14 @@ const goToMap = (item) => {
|
||||
})
|
||||
}
|
||||
|
||||
const viewDeviceLog = (item) => {
|
||||
router.push({
|
||||
name: 'MapLogQueriesList'
|
||||
})
|
||||
}
|
||||
|
||||
const initFun = () => {
|
||||
loading.value = true // 初始化前显示loading
|
||||
getCarList()
|
||||
getTypeList()
|
||||
}
|
||||
@ -364,6 +378,23 @@ onBeforeRouteLeave((to, from, next) => {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
/* popover菜单样式 */
|
||||
.popover-menu {
|
||||
padding: 5px 0;
|
||||
}
|
||||
.popover-menu-item {
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
transition: background-color 0.3s;
|
||||
|
||||
&:hover {
|
||||
background-color: #f5f7fa;
|
||||
color: #1677ff;
|
||||
}
|
||||
}
|
||||
|
||||
.swiper-container {
|
||||
width: calc(100% - 60px);
|
||||
padding: 0 30px;
|
||||
|
@ -336,6 +336,7 @@ import { dateFormatter } from '@/utils/formatTime'
|
||||
defineOptions({ name: 'MapLogQueriesList' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const route = useRoute() // 路由对象
|
||||
|
||||
const activeName = ref('1') //tab栏
|
||||
|
||||
@ -459,9 +460,30 @@ const getCanUseRobotList = async () => {
|
||||
robotList.value = await MapTaskAPi.getCanUseRobot()
|
||||
}
|
||||
|
||||
// 处理URL参数
|
||||
const handleRouteParams = () => {
|
||||
const { query } = route
|
||||
|
||||
// 处理标签页切换
|
||||
if (query.activeTab) {
|
||||
activeName.value = query.activeTab
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getOperationLogList()
|
||||
// 处理URL参数
|
||||
handleRouteParams()
|
||||
|
||||
// 根据当前标签页加载对应数据
|
||||
if (activeName.value === '1') {
|
||||
getOperationLogList()
|
||||
} else if (activeName.value === '2') {
|
||||
getCarLogList()
|
||||
} else if (activeName.value === '3') {
|
||||
getTaskLogList()
|
||||
}
|
||||
|
||||
getCanUseRobotList()
|
||||
})
|
||||
</script>
|
||||
|
@ -34,7 +34,7 @@
|
||||
<script setup>
|
||||
import indexPage from './components/indexPage.vue'
|
||||
import createTaskDialog from './components/createTaskDialog.vue'
|
||||
import { ref, defineComponent, reactive, nextTick, onMounted } from 'vue'
|
||||
import { ref, defineComponent, reactive, nextTick, onMounted, watch } from 'vue'
|
||||
import * as MapApi from '@/api/map/map'
|
||||
import download from '@/utils/download'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@ -64,16 +64,47 @@ const getList = async () => {
|
||||
}))
|
||||
}))
|
||||
|
||||
// 处理从设备看板传来的floorArea参数
|
||||
const { query } = route
|
||||
if (query.floorArea) {
|
||||
try {
|
||||
const [floor, mapId] = JSON.parse(query.floorArea)
|
||||
if (floor && mapId) {
|
||||
mapValue.value = [String(floor), String(mapId)]
|
||||
handleChangeMap(mapValue.value)
|
||||
return
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析floorArea参数失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 处理从车辆看板传来的floor和area参数
|
||||
if (query.floor && query.area) {
|
||||
// 查找对应的地图ID
|
||||
const floorItem = list.value.find((item) => item.floor === query.floor)
|
||||
if (floorItem && floorItem.children) {
|
||||
const areaItem = floorItem.children.find((item) => item.area === query.area)
|
||||
if (areaItem) {
|
||||
mapValue.value = [String(query.floor), String(areaItem.id)]
|
||||
handleChangeMap(mapValue.value)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理mapId参数
|
||||
if (query.mapId) {
|
||||
let item = findItemById(query.mapId)
|
||||
if (item) {
|
||||
mapValue.value = [String(item.floor), String(item.id)]
|
||||
handleChangeMap(mapValue.value)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (mapValue.value.length) {
|
||||
handleChangeMap(mapValue.value)
|
||||
} else {
|
||||
// 如果没有参数或参数无效,使用默认值
|
||||
if (list.value.length > 0 && list.value[0].children && list.value[0].children.length > 0) {
|
||||
mapValue.value = [list.value[0].value, list.value[0].children[0].value]
|
||||
indexPageRef.value.getMapData(JSON.parse(JSON.stringify(list.value[0].children[0])))
|
||||
}
|
||||
@ -83,13 +114,17 @@ const getList = async () => {
|
||||
|
||||
const handleChangeMap = async (e) => {
|
||||
let item = findItemById(e[1])
|
||||
indexPageRef.value.getMapData(item)
|
||||
router.replace({
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
mapId: item.id
|
||||
}
|
||||
})
|
||||
if (item) {
|
||||
indexPageRef.value.getMapData(item)
|
||||
router.replace({
|
||||
name: 'MapPageRealTimeMap',
|
||||
query: {
|
||||
mapId: item.id
|
||||
}
|
||||
})
|
||||
} else {
|
||||
message.warning('未找到对应地图')
|
||||
}
|
||||
}
|
||||
|
||||
//新建任务
|
||||
@ -125,6 +160,8 @@ const emergencyStop = async () => {
|
||||
}
|
||||
|
||||
const getStopOrRestore = async () => {
|
||||
if (!mapValue.value || mapValue.value.length < 2) return
|
||||
|
||||
let res = await MapApi.getMapIsStop({
|
||||
id: mapValue.value[1]
|
||||
})
|
||||
@ -167,7 +204,35 @@ function findItemById(targetId) {
|
||||
return null
|
||||
}
|
||||
|
||||
const { query } = useRoute() // 查询参数
|
||||
// 监听路由参数变化,处理从其他页面跳转过来的情况
|
||||
watch(
|
||||
() => route.query,
|
||||
(newQuery) => {
|
||||
if (newQuery.floorArea && list.value.length > 0) {
|
||||
try {
|
||||
const [floor, mapId] = JSON.parse(newQuery.floorArea)
|
||||
if (floor && mapId) {
|
||||
mapValue.value = [String(floor), String(mapId)]
|
||||
handleChangeMap(mapValue.value)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('解析floorArea参数失败:', error)
|
||||
}
|
||||
} else if (newQuery.floor && newQuery.area && list.value.length > 0) {
|
||||
// 处理floor和area参数
|
||||
const floorItem = list.value.find((item) => item.floor === newQuery.floor)
|
||||
if (floorItem && floorItem.children) {
|
||||
const areaItem = floorItem.children.find((item) => item.area === newQuery.area)
|
||||
if (areaItem) {
|
||||
mapValue.value = [String(newQuery.floor), String(areaItem.id)]
|
||||
handleChangeMap(mapValue.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user