修改问题

This commit is contained in:
xhf 2025-04-01 14:37:06 +08:00
commit c2b41da61a
5 changed files with 3313 additions and 183 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

@ -154,3 +154,10 @@ export const getListByMapId = async (mapId) => {
url: `/system/robot/information/getListByMapId?mapId=` + mapId
})
}
//批量更新库位
export const updateBatchHouseLocation = async (data) => {
return await request.put({
url: `/system/ware/house-location/updateBatch`,
data
})
}

View File

@ -6,32 +6,35 @@
<div class="new-top-box-left-title"> 设备看板 </div>
</el-col>
<el-col :span="16">
<div style="width: 100%;height: 100%;padding-top: 5px;">
<div style="width: 100%; height: 100%; padding-top: 5px">
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane :label="item.label + ' ' + (item.number?item.number: 0)" :name="item.value" v-for="(item, index) in typeList" :key="index"/>
</el-tabs>
<el-tab-pane
:label="item.label + ' ' + (item.number ? item.number : 0)"
:name="item.value"
v-for="(item, index) in typeList"
:key="index"
/>
</el-tabs>
</div>
</el-col>
<el-col :span="6">
<div style="display: flex">
<el-input
style="height: 40px;margin-right: 16px;"
style="height: 40px; margin-right: 16px"
v-model="queryParams.deviceNo"
placeholder="请输入设备编号"
@keyup.enter="getCarList"
clearable
>
<template #append>
<el-button :icon="'search'" @click="getCarList"/>
</template>
<template #append>
<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')">新增设备</el-button>
</div>
</el-col>
</el-row>
</div>
</ContentWrap>
<div class="new-list-box-all">
<div class="new-list-box">
@ -64,9 +67,14 @@
<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"/>
<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>
<span>不显示图片</span>
</div>
</div>
<div class="item-inner-left-bottom">
@ -76,8 +84,10 @@
</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>
@ -103,111 +113,75 @@
</div>
</div>
</div>
<createEditDialog ref="createEditDialogRef" @success="getCarList" />
<createEditDialog ref="createEditDialogRef" @success="initFun()" />
</template>
<script setup>
import { ref, reactive, onMounted, onBeforeUnmount } from 'vue'
defineOptions({ name: 'BoardDevice' })
import * as DeviceApi from '@/api/device/index'
// import { Swiper, SwiperSlide } from 'swiper/vue'
// API
import { onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
const message = useMessage() //
// swiper
// import 'swiper/css/pagination' //
// import 'swiper/css/navigation' //
// import 'swiper/css/scrollbar' // 使import
// swiper
// import { Autoplay, Pagination, Navigation, Scrollbar } from 'swiper'
import createEditDialog from './createEditDialog.vue'
// import 'swiper/css'
import { formatter } from 'element-plus'
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
// DEVICE_TYPE
import * as DeviceApi from '@/api/device/index'
import createEditDialog from './createEditDialog.vue'
defineOptions({ name: 'BoardDevice' })
const message = useMessage() //
const router = useRouter() //
const createEditDialogRef = ref(null)
const list = ref([])
const queryParams = reactive({
// pageNo: 1,
// pageSize: 100,
deviceNo: undefined,
deviceType: undefined
})
// const spaceBetween = ref(20)
// const navigation = ref({
// nextEl: '.swiper-button-next-custome',
// prevEl: '.swiper-button-prev-custome'
// })
const activeName = ref('-1')
const handleClick = (tab, event) => {
console.log(tab, event)
queryParams.deviceType = tab.props.name !=-1?tab.props.name:undefined
queryParams.deviceType = tab.props.name != -1 ? tab.props.name : undefined
getCarList()
}
const typeList = ref([])
const typeList = ref([])
const getTypeList = () => {
typeList.value = getDictOptions(DICT_TYPE.DEVICE_TYPE)&&getDictOptions(DICT_TYPE.DEVICE_TYPE).length?JSON.parse(JSON.stringify(getDictOptions(DICT_TYPE.DEVICE_TYPE))):[]
console.log(typeList.value)
typeList.value =
getDictOptions(DICT_TYPE.DEVICE_TYPE) && getDictOptions(DICT_TYPE.DEVICE_TYPE).length
? JSON.parse(JSON.stringify(getDictOptions(DICT_TYPE.DEVICE_TYPE)))
: []
typeList.value.unshift({ label: '全部', value: '-1' })
getRobotInformationStatistics()
}
// modules使
// const modules = [Autoplay, Navigation, Scrollbar]
// Pagination
const prevEl = (item, index) => {
// console.log('' + index + item)
}
const nextEl = () => {
// console.log('')
}
// swiper
const onSlideChange = (swiper) => {
// swiperswiperactiveIndex
console.log(swiper.activeIndex)
}
//type
const filterTypeFun = (type, list) => {
if (list.length) {
let obj = list.find(item => {
return item.value == type
})
return obj == undefined ? type : obj.label
} else {
return type
}
if (list.length) {
let obj = list.find((item) => {
return item.value == type
})
return obj == undefined ? type : obj.label
} else {
return type
}
}
//
const goMap = (item) => {
if(item.floor == null || item.positionMapId == null){
if (item.floor == null || item.positionMapId == null) {
message.warning('该设备未配置地图信息,请前往实时地图-编辑地图进行配置')
return
}
console.log(item.floor,item.positionMapId)
router.push({
path: '/mapPage/realTimeMap',
query: {
floorArea: JSON.stringify([item.floor,item.positionMapId]),
router.push({
path: '/mapPage/realTimeMap',
query: {
floorArea: JSON.stringify([item.floor, item.positionMapId])
}
})
})
}
const timerRef = ref(null)
//
const getCarList = async () => {
// if (timerRef.value) {
// clearInterval(timerRef.value)
// timerRef.value = null
// }
// timerRef.value = setInterval(() => {
// getCarList()
// getRobotInformationStatistics()
// }, 5000)
let res = await DeviceApi.deviceGetInformationList(queryParams)
// console.log(res.list)
list.value = res
list.value = await DeviceApi.deviceGetInformationList(queryParams)
}
const carStatistics = ref({
standby: 0,
@ -218,16 +192,16 @@ const carStatistics = ref({
charge: 0,
total: 0
})
//
const getRobotInformationStatistics = async () => {
let res = await DeviceApi.deviceNumber({})
console.log('设备统计', res)
let total = 0
if (res) {
if(typeList.value.length){
typeList.value.forEach(item => {
res.forEach(resItem => {
if(item.value == resItem.deviceType){
if (typeList.value.length) {
typeList.value.forEach((item) => {
res.forEach((resItem) => {
if (item.value == resItem.deviceType) {
item.number = resItem.number
total += Number(resItem.number)
}
@ -236,7 +210,7 @@ const getRobotInformationStatistics = async () => {
}
typeList.value[0].number = total
} else {
typeList.value.forEach(item => {
typeList.value.forEach((item) => {
item.number = 0
})
}
@ -252,17 +226,11 @@ const clockDevice = (item) => {
})
.then(() => {
DeviceApi.deviceInformationUpdate(data).then((res) => {
getCarList()
getTypeList()
initFun()
message.success(`${valueStr}成功`)
})
})
.catch(() => {
// ElMessage({
// type: 'info',
// message: 'Delete canceled',
// })
})
.catch(() => {})
}
//
const openForm = (type, id) => {
@ -277,43 +245,33 @@ const deleteCar = (id) => {
})
.then(() => {
DeviceApi.deleteDeviceInformation(id).then((res) => {
getCarList()
initFun()
message.success('删除成功')
})
})
.catch(() => {
// ElMessage({
// type: 'info',
// message: 'Delete canceled',
// })
})
.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(() => {
// ElMessage({
// type: 'info',
// message: 'Delete canceled',
// })
})
// 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) => {
// console.log(item)
router.push({
name: 'MapPageRealTimeMap',
query: {
@ -321,28 +279,24 @@ const goToMap = (item) => {
}
})
}
onMounted(() => {
const initFun = () => {
getCarList()
getTypeList()
// getRobotInformationStatistics()
}
onMounted(() => {
initFun()
})
onBeforeUnmount(() => {
if (timerRef.value) {
clearInterval(timerRef.value)
timerRef.value = null
}
})
// beforeRouteLeave((to, from, next) => {
// console.log('beforeRouteLeave',to, from, next)
// if(timerRef.value){
// clearInterval(timerRef.value)
// timerRef.value = null
// }
// })
onBeforeRouteLeave((to, from, next) => {
// console.log('beforeRouteLeave',to, from)
onBeforeRouteLeave((to, from, next) => {
if (timerRef.value) {
clearInterval(timerRef.value)
timerRef.value = null
@ -359,15 +313,15 @@ onBeforeRouteLeave((to, from, next) => {
margin: 0px;
}
:deep(.is-active) {
background-color: #EBF1FF;
color: #0D162A;
background-color: #ebf1ff;
color: #0d162a;
}
:deep(.el-tabs__item) {
padding-left: 8px !important;
padding-right: 8px !important;
height: auto !important;
padding-top: 5px !important;
padding-bottom: 5px !important;
padding-left: 8px !important;
padding-right: 8px !important;
height: auto !important;
padding-top: 5px !important;
padding-bottom: 5px !important;
}
:deep(.el-tabs__active-bar) {
height: 0;
@ -378,11 +332,11 @@ onBeforeRouteLeave((to, from, next) => {
:deep(.el-tabs__nav-prev) {
line-height: 34px !important;
}
:deep(.el-input-group__append){
:deep(.el-input-group__append) {
background: none !important;
}
:deep(.el-input__wrapper){
border: 1px solid var(--el-input-border-color,var(--el-border-color));
:deep(.el-input__wrapper) {
border: 1px solid var(--el-input-border-color, var(--el-border-color));
border-right: none;
box-shadow: none !important;
}
@ -716,7 +670,7 @@ input::-webkit-input-placeholder {
.m-b-10 {
margin-bottom: 10px;
}
.item-inner-left-img-box-no{
.item-inner-left-img-box-no {
width: 100%;
height: 100%;
display: flex;

View File

@ -5,10 +5,10 @@
<div
class="store-dialog-left-item ellipsis"
@click="changeStore(item, index)"
v-for="(item, index) in storeData"
v-for="(item, index) in floorList"
:key="index"
:style="{
background: item.locationUseStatus == 1 ? '#4DC606' : '#F1BE0B',
background: item.locationUseStatus == 1 ? '#F1BE0B' : '#4DC606',
border: selectIndex == index ? '2px solid #00329F' : '2px solid rgba(0,0,0,0)'
}"
>
@ -41,24 +41,27 @@
{{ item.locationNo || '--' }}
</div>
</div>
<el-form :model="formData" label-width="auto" ref="formRef" :rules="formRules">
<el-form label-width="auto" ref="formRef">
<el-form-item label="库位编号">
<el-input v-model="formData.locationNo" :disabled="true" />
<el-input v-model="floorList[selectIndex].locationNo" :disabled="true" />
</el-form-item>
<el-form-item label="区域">
<el-input v-model="formData.areaName" :disabled="true" />
<el-input v-model="floorList[selectIndex].areaName" :disabled="true" />
</el-form-item>
<el-form-item label="物料信息">
<el-input v-model="formData.skuInfo" maxlength="30" show-word-limit />
<el-input v-model="floorList[selectIndex].skuInfo" maxlength="30" show-word-limit />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="formData.locationUseStatus" placeholder="请选择状态">
<el-select v-model="floorList[selectIndex].locationUseStatus" placeholder="请选择状态">
<el-option label="空闲" :value="0" />
<el-option label="占用" :value="1" />
</el-select>
</el-form-item>
<el-form-item label="禁用库位">
<el-select v-model="formData.locationEnable" placeholder="剧情选择是否禁用库位">
<el-select
v-model="floorList[selectIndex].locationEnable"
placeholder="剧情选择是否禁用库位"
>
<el-option label="禁用" :value="0" />
<el-option label="启用" :value="1" />
</el-select>
@ -76,8 +79,10 @@
const { t } = useI18n() //
const message = useMessage() //
import * as MapApi from '@/api/map/map'
const dialogVisible = ref(false) //
const formLoading = ref(false) // 12
const formRef = ref() // Ref
const formData = ref({
locationNo: undefined, //
@ -86,19 +91,14 @@ const formData = ref({
locationEnable: undefined, //01
skuInfo: undefined //
})
const formRules = reactive({})
const selectIndex = ref(0)
const formRef = ref() // Ref
const storeData = ref([])
const floorList = ref([])
/** 打开弹窗 */
const open = async (data) => {
console.log(data)
resetForm()
if (data && data.length) {
storeData.value = data.reverse()
selectIndex.value = 0
formData.value = JSON.parse(JSON.stringify(data[0]))
}
floorList.value = data.reverse()
selectIndex.value = 0
dialogVisible.value = true
}
defineExpose({ open }) // open
@ -106,14 +106,10 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
//
if (!formRef) return
const valid = await formRef.value.validate()
if (!valid) return
//
formLoading.value = true
try {
await MapApi.updateHouseLocation(formData.value)
await MapApi.updateBatchHouseLocation(floorList.value)
message.success('操作成功')
emit('success')
dialogVisible.value = false
@ -123,24 +119,11 @@ const submitForm = async () => {
}
const changeStore = (item, index) => {
formData.value = JSON.parse(JSON.stringify(item))
selectIndex.value = index
}
//
const { push } = useRouter()
/** 重置表单 */
const resetForm = () => {
formData.value = {
locationNo: undefined, //
areaName: undefined, //
locationUseStatus: undefined, // 01
locationEnable: undefined, //01
skuInfo: undefined //
}
formRef.value?.resetFields()
}
</script>
<style lang="scss" scoped>

File diff suppressed because it is too large Load Diff