设备监控

This commit is contained in:
猫猫guowen
2025-12-08 11:54:34 +08:00
parent 8db3a61515
commit 9b4bbec353
5 changed files with 271 additions and 377 deletions

View File

@@ -0,0 +1,28 @@
import request from '@/utils/request'
// 查询输送机列表
export function listSsj(query) {
return request({
url: '/device/ssj/list',
method: 'get',
params: query
})
}
// 查询四向车列表
export function srgvList(query) {
return request({
url: '/device/srgv/list',
method: 'get',
params: query
})
}
// 查询提升机列表
export function tsjList(query) {
return request({
url: '/device/tsj/list',
method: 'get',
params: query
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

View File

@@ -1,420 +1,286 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索和操作区域 --> <el-row :gutter="20">
<el-col v-for="dev in Sagv" :key="dev.id" :span="12">
<el-card shadow="always" class="device-card">
<!-- 7个表格区域 --> <div slot="header" class="card-header gradient">
<el-row :gutter="20" class="table-container"> <span class="device-title">{{ dev.name }}</span>
<el-col :span="24" class="table-col"> <div class="header-tags">
<div class="table-card"> <el-tag size="small" type="info">{{ tagLeft(dev) }}</el-tag>
<div class="table-header"> <el-tag size="small" type="success">{{ tagRight(dev) }}</el-tag>
<span class="table-title">堆垛机监控</span> </div>
<el-tag type="success" size="mini">总计: 6 台</el-tag>
</div> </div>
<el-table :data="ddjData" size="mini" style="width: 100%"> <el-row :gutter="10" class="card-body">
<el-table-column label="id" align="center" prop="id"/> <el-col :span="16">
<el-table-column label="堆垛机名称" align="center" prop="name"/> <el-row class="data-grid">
<el-table-column label="当前巷道" align="center" prop="dqxd"/> <el-col :span="12" v-for="item in dataItems(dev)" :key="item.key" class="data-item">
<el-table-column label="任务号" align="center" prop="rwh"/> <span class="data-label">{{ item.label }}</span>
<el-table-column label="阶段标志" align="center" prop="jdbz"> <span v-if="!item.dict" class="data-value" :class="valueClass(item.key)">{{ item.value }}</span>
<template slot-scope="scope"> <dict-tag v-else :options="dict.type[item.dict]" :value="item.value" />
<dict-tag :options="dict.type.ddj_task_status" :value="scope.row.jdbz"/> </el-col>
</template> </el-row>
</el-table-column> </el-col>
<el-table-column label="设备状态" align="center" prop="sbzt"> <el-col :span="8" class="image-wrap">
<template slot-scope="scope"> <el-image :src="imageUrl2" fit="contain" class="device-image" />
<dict-tag :options="dict.type.ddj_sbzt" :value="scope.row.sbzt"/> </el-col>
</template> </el-row>
</el-table-column> </el-card>
<el-table-column label="操作方式" align="center" prop="czfs">
<template slot-scope="scope">
<dict-tag :options="dict.type.ddj_czfs" :value="scope.row.czfs"/>
</template>
</el-table-column>
<el-table-column label="允许下发" align="center" prop="yxxf">
<template slot-scope="scope">
<dict-tag :options="dict.type.ddj_yxxf" :value="scope.row.yxxf"/>
</template>
</el-table-column>
<el-table-column label="原排" align="center" prop="yph"/>
<el-table-column label="原列" align="center" prop="ylh"/>
<el-table-column label="原层" align="center" prop="ych"/>
<el-table-column label="目标排" align="center" prop="mbph"/>
<el-table-column label="目标列" align="center" prop="mblh"/>
<el-table-column label="目标层" align="center" prop="mbch"/>
<el-table-column label="心跳信号" align="center" prop="xtxh"/>
</el-table>
</div>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20" class="table-container"> <el-row :gutter="20">
<!-- 表格1:入库输送机 --> <el-col v-for="dev in SSJ" :key="dev.id" :span="12">
<el-col :span="8" class="table-col"> <el-card shadow="always" class="device-card">
<div class="table-card"> <div slot="header" class="card-header gradient">
<div class="table-header"> <span class="device-title">{{ dev.name }}</span>
<span class="table-title">巷道1输送机</span> <div class="header-tags">
<el-tag type="success" size="mini">{{ table1Data.length }}台</el-tag> <el-tag size="small" type="info">{{ tagLeft(dev) }}</el-tag>
<el-tag size="small" type="success">{{ tagRight(dev) }}</el-tag>
</div>
</div> </div>
<el-table :data="table1Data" size="mini" style="width: 100%"> <el-row :gutter="10" class="card-body">
<el-table-column label="设备编码" prop="deviceCode"/> <el-col :span="16">
<!-- <el-table-column label="设备名称" prop="name"/>--> <el-row class="data-grid">
<el-table-column label="任务号" prop="taskNo"/> <el-col :span="12" v-for="item in dataItems(dev)" :key="item.key" class="data-item">
<el-table-column label="到位" prop="dw"> <span class="data-label">{{ item.label }}</span>
<template slot-scope="scope"> <span v-if="!item.dict" class="data-value" :class="valueClass(item.key)">{{ item.value }}</span>
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/> <dict-tag v-else :options="dict.type[item.dict]" :value="item.value" />
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="空闲" prop="kx"> </el-col>
<template slot-scope="scope"> <el-col :span="8" class="image-wrap">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/> <el-image :src="imageUrl1" fit="contain" class="device-image" />
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="异常" prop="exception"> </el-card>
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
<!-- 表格2:出库输送机 -->
<el-col :span="8" class="table-col">
<div class="table-card">
<div class="table-header">
<span class="table-title">巷道2输送机</span>
<el-tag type="success" size="mini">{{ table2Data.length }}台</el-tag>
</div>
<el-table :data="table2Data" size="mini" style="width: 100%">
<el-table-column label="设备编码" prop="deviceCode"/>
<!-- <el-table-column label="设备名称" prop="name"/>-->
<el-table-column label="任务号" prop="taskNo"/>
<el-table-column label="到位" prop="dw">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/>
</template>
</el-table-column>
<el-table-column label="空闲" prop="kx">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/>
</template>
</el-table-column>
<el-table-column label="异常" prop="exception">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
<!-- 表格3:分拣输送机 -->
<el-col :span="8" class="table-col">
<div class="table-card">
<div class="table-header">
<span class="table-title">巷道3输送机</span>
<el-tag type="success" size="mini">{{ table3Data.length }}台</el-tag>
</div>
<el-table :data="table3Data" size="mini" style="width: 100%">
<el-table-column label="设备编码" prop="deviceCode"/>
<!-- <el-table-column label="设备名称" prop="name"/>-->
<el-table-column label="任务号" prop="taskNo"/>
<el-table-column label="到位" prop="dw">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/>
</template>
</el-table-column>
<el-table-column label="空闲" prop="kx">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/>
</template>
</el-table-column>
<el-table-column label="异常" prop="exception">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20">
<el-row :gutter="20" class="table-container"> <el-col v-for="dev in TSJ" :key="dev.id" :span="12">
<!-- 表格4:提升机 --> <el-card shadow="always" class="device-card">
<el-col :span="8" class="table-col"> <div slot="header" class="card-header gradient">
<div class="table-card"> <span class="device-title">{{ dev.name }}</span>
<div class="table-header"> <div class="header-tags">
<span class="table-title">巷道4输送机</span> <el-tag size="small" type="info">{{ tagLeft(dev) }}</el-tag>
<el-tag type="success" size="mini">{{ table4Data.length }}台</el-tag> <el-tag size="small" type="success">{{ tagRight(dev) }}</el-tag>
</div>
</div> </div>
<el-table :data="table4Data" size="mini" style="width: 100%"> <el-row :gutter="10" class="card-body">
<el-table-column label="设备编码" prop="deviceCode"/> <el-col :span="16">
<!-- <el-table-column label="设备名称" prop="name"/>--> <el-row class="data-grid">
<el-table-column label="任务号" prop="taskNo"/> <el-col :span="12" v-for="item in dataItems(dev)" :key="item.key" class="data-item">
<el-table-column label="到位" prop="dw"> <span class="data-label">{{ item.label }}</span>
<template slot-scope="scope"> <span v-if="!item.dict" class="data-value" :class="valueClass(item.key)">{{ item.value }}</span>
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/> <dict-tag v-else :options="dict.type[item.dict]" :value="item.value" />
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="空闲" prop="kx"> </el-col>
<template slot-scope="scope"> <el-col :span="8" class="image-wrap">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/> <el-image :src="imageUrl3" fit="contain" class="device-image" />
</template> </el-col>
</el-table-column> </el-row>
<el-table-column label="异常" prop="exception"> </el-card>
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
<!-- 表格5:移载机 -->
<el-col :span="8" class="table-col">
<div class="table-card">
<div class="table-header">
<span class="table-title">巷道5输送机</span>
<el-tag type="success" size="mini">{{ table5Data.length }}台</el-tag>
</div>
<el-table :data="table5Data" size="mini" style="width: 100%">
<el-table-column label="设备编码" prop="deviceCode"/>
<!-- <el-table-column label="设备名称" prop="name"/>-->
<el-table-column label="任务号" prop="taskNo"/>
<el-table-column label="到位" prop="dw">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/>
</template>
</el-table-column>
<el-table-column label="空闲" prop="kx">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/>
</template>
</el-table-column>
<el-table-column label="异常" prop="exception">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col>
<!-- 表格6:旋转台 -->
<el-col :span="8" class="table-col">
<div class="table-card">
<div class="table-header">
<span class="table-title">巷道6输送机</span>
<el-tag size="success">{{ table6Data.length }}台</el-tag>
</div>
<el-table :data="table6Data" size="mini" style="width: 100%">
<el-table-column label="设备编码" prop="deviceCode"/>
<!-- <el-table-column label="设备名称" prop="name"/>-->
<el-table-column label="任务号" prop="taskNo"/>
<el-table-column label="到位" prop="dw">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_dw" :value="scope.row.dw"/>
</template>
</el-table-column>
<el-table-column label="空闲" prop="kx">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_kx" :value="scope.row.kx"/>
</template>
</el-table-column>
<el-table-column label="异常" prop="exception">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_ex" :value="scope.row.exception"/>
</template>
</el-table-column>
<el-table-column label="模式" prop="traySize">
<template slot-scope="scope">
<dict-tag :options="dict.type.ssj_model" :value="scope.row.traySize"/>
</template>
</el-table-column>
</el-table>
</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
</template> </template>
<script> <script>
import {listSsj} from "@/api/device/ssj"; import "@/assets/styles/index.scss"
import "@/assets/styles/index.scss"; import ssjImg from "@/assets/images/ssj.png"
import {listDdj} from "@/api/device/ddj" import agvImg from "@/assets/images/agv.png"
import tsjImg from "@/assets/images/tsj.png"
import { srgvList, tsjList, listSsj } from "@/api/device/monitor"
import { selectDictLabel } from "@/utils/ruoyi"
export default { export default {
name: "deviceMonitor", name: "deviceMonitor",
dicts: ['ddj_task_status', 'ddj_sbzt', 'ddj_czfs', 'ddj_yxxf', 'ddj_hczt', 'ssj_dw', 'ssj_kx', 'ssj_model', 'ssj_ex'], dicts: ['srgv_work_phase','srgv_work_mode','srgv_status','srgv_err_msg','srgv_alarm','srgv_task_type','ssj_dw','ssj_kx','ssj_ex','tsj_zxjd'],
data() { data() {
return { return {
// 查询参数 imageUrl1: ssjImg,
queryParams: { imageUrl2: agvImg,
pageNum: 1, imageUrl3: tsjImg,
pageSize: 99 Sagv: [],
}, SSJ: [],
// 7个表格的模拟数据 TSJ: [],
table1Data: [], // 入库输送机 pollTimer: null
table2Data: [], // 出库输送机 }
table3Data: [], // 分拣输送机
table4Data: [], // 提升机
table5Data: [], // 移载机
table6Data: [], // 旋转台
ddjData: [], // 汇总统计
timer: null
};
}, },
created() { created() {
this.initMockData() this.fetchAll()
}, this.pollTimer = setInterval(() => {
mounted() { this.fetchAll()
this.timer = setInterval(() => { }, 3000)
this.initMockData();
}, 1000); // 每1秒刷新一次
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer); if (this.pollTimer) {
this.timer = null; clearInterval(this.pollTimer)
this.pollTimer = null
}
}, },
methods: { methods: {
/** 初始化模拟数据 */ valueClass(key) {
initMockData() { if (key === 'rowDistanceKm') return 'value-warn'
listDdj().then(response => { if (key === 'columnDistanceKm') return 'value-accent'
this.ddjData = response.rows return ''
}) },
listSsj(this.queryParams).then(response => { tagLeft(dev) {
this.table1Data = response.rows.filter(item => item.deviceCode === 'L2001' || item.deviceCode === 'L2002' || item.deviceCode === 'L2007' || item.deviceCode === 'L2008') if (dev.kind === 'ssj') return '任务号 ' + (dev.raw.taskNo || '-')
this.table2Data = response.rows.filter(item => item.deviceCode === 'L2003' || item.deviceCode === 'L2004' || item.deviceCode === 'L2009' || item.deviceCode === 'L2010') if (dev.kind === 'srgv') return '任务号 ' + (dev.raw.taskNo || '-')
this.table3Data = response.rows.filter(item => item.deviceCode === 'L2005' || item.deviceCode === 'L2006' || item.deviceCode === 'L2011' || item.deviceCode === 'L2012') if (dev.kind === 'tsj') return '任务号 ' + (dev.raw.rwh || '-')
this.table4Data = response.rows.filter(item => item.deviceCode === 'L1001' || item.deviceCode === 'L1002') return ''
this.table5Data = response.rows.filter(item => item.deviceCode === 'L1003' || item.deviceCode === 'L1004') },
this.table6Data = response.rows.filter(item => item.deviceCode === 'L1005' || item.deviceCode === 'L1006') tagRight(dev) {
}) if (dev.kind === 'ssj') return '空闲 ' + (dev.raw.kx+"" || '-')
if (dev.kind === 'srgv') return '层 ' + (dev.raw.currFloor || '-')
if (dev.kind === 'tsj') return '层 ' + (dev.raw.dqcs || '-')
return ''
},
dataItems(dev) {
if (dev.kind === 'ssj') {
const d = dev.raw
return [
{ key: 'deviceCode', label: '设备编码', value: d.deviceCode },
{ key: 'trayCode', label: '托盘条码', value: d.trayCode },
{ key: 'taskNo', label: '任务号', value: d.taskNo },
{ key: 'traySize', label: '托盘尺寸', value: d.traySize },
{ key: 'allowPut', label: '允许放货', value: d.allowPut },
{ key: 'kx', label: '空闲', value: d.kx, dict: 'ssj_kx' },
{ key: 'dw', label: '到位', value: d.dw, dict: 'ssj_dw' },
{ key: 'exception', label: '异常', value: d.exception, dict: 'ssj_ex'},
]
}
if (dev.kind === 'srgv') {
const d = dev.raw
return [
// { key: 'deviceName', label: '设备名称', value: d.deviceName },
{ key: 'deviceId', label: '设备编码', value: d.deviceId },
{ key: 'currSite', label: '当前位置', value: d.currSite },
{ key: 'srcSite', label: '原位置', value: d.srcSite },
{ key: 'tarSite', label: '目标位置', value: d.tarSite },
{ key: 'taskNo', label: '任务号', value: d.taskNo },
{ key: 'taskType', label: '任务类型', value: d.taskType, dict: 'srgv_task_type' },
{ key: 'battery', label: '电量', value: d.battery },
{ key: 'workMode', label: '工作模式', value: d.workMode, dict: 'srgv_work_mode' },
{ key: 'status', label: '车状态', value: d.status, dict: 'srgv_status' },
{ key: 'workPhase', label: '执行阶段', value: d.workPhase, dict: 'srgv_work_phase' },
{ key: 'chargeFlag', label: '充电标志', value: d.chargeFlag },
{ key: 'alarm', label: '报警信息', value: d.alarm, dict: 'srgv_alarm' },
{ key: 'errMsg', label: '异常信息', value: d.errMsg, dict: 'srgv_err_msg' },
{ key: 'currFloor', label: '当前层数', value: d.currFloor }
]
}
if (dev.kind === 'tsj') {
const d = dev.raw
return [
{ key: 'name', label: '设备名称', value: d.name },
{ key: 'rwh', label: '任务号', value: d.rwh },
{ key: 'yxxf', label: '允许下发', value: d.yxxf },
{ key: 'dqcs', label: '当前层数', value: d.dqcs },
{ key: 'yph', label: '原排', value: d.yph },
{ key: 'ylh', label: '原列', value: d.ylh },
{ key: 'ych', label: '原层', value: d.ych },
{ key: 'mbph', label: '目标排', value: d.mbph },
{ key: 'mblh', label: '目标列', value: d.mblh },
{ key: 'mbch', label: '目标层', value: d.mbch },
{ key: 'hczt', label: '载货状态', value: d.hczt },
{ key: 'xtxh', label: '心跳信号', value: d.xtxh },
{ key: 'sbzt', label: '设备状态', value: d.sbzt },
{ key: 'jdbz', label: '执行阶段', value: d.jdbz, dict: 'tsj_zxjd' }
]
}
return []
},
fetchAll() {
Promise.all([srgvList({}), listSsj({}), tsjList({})]).then(([srgvRes, ssjRes, tsjRes]) => {
const srgvRows = srgvRes.rows || srgvRes.data || []
const ssjRows = ssjRes.rows || ssjRes.data || []
const tsjRows = tsjRes.rows || tsjRes.data || []
this.Sagv = srgvRows.map(it => ({ id: it.deviceId || it.guid || it.id, name: it.deviceName || it.name, kind: 'srgv', raw: it }))
this.SSJ = ssjRows.map(it => ({ id: it.id || it.deviceCode, name: it.name, kind: 'ssj', raw: it }))
this.TSJ = tsjRows.map(it => ({ id: it.id, name: it.name, kind: 'tsj', raw: it }))
console.log(srgvRows)
}).catch(() => {})
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.el-form-item >>> .el-form-item__label { .device-card {
white-space: nowrap;
width: auto;
min-width: fit-content;
}
/* 表格容器样式 */
.table-container {
margin-bottom: 20px; margin-bottom: 20px;
} border-radius: 10px;
.table-col {
margin-bottom: 20px;
}
/* 表格卡片样式 */
.table-card {
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
overflow: hidden; overflow: hidden;
transition: all 0.3s ease;
} }
.card-body {
.table-card:hover { padding: 6px 8px;
box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
} }
.gradient {
/* 表格头部样式 */ background: linear-gradient(90deg, rgba(16,108,123,0.1), rgba(255,255,255,0));
.table-header { }
.card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.header-tags {
display: flex;
gap: 6px;
}
.device-title {
font-weight: 600;
font-size: 16px;
}
.stat-bar {
margin: 4px 0 8px 0;
}
.stat-box {
display: flex;
flex-direction: column;
align-items: center;
}
.stat-label {
margin-top: 6px;
font-size: 12px;
color: #606266;
}
.data-grid {
margin-top: 6px;
}
.data-item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; padding: 8px 10px;
padding: 15px 20px; border-bottom: 1px dashed #eee;
background: #ffffff; /* Element UI 主题蓝 */
color: rgb(0, 0, 0);
border-bottom: 1px solid #ebeef5;
} }
.data-label {
.table-title { color: #909399;
font-size: 16px;
font-weight: 600;
margin: 0;
} }
.data-value {
/* 表格样式调整 */ color: #303133;
.el-table {
border-radius: 0 0 8px 8px;
}
.el-table--mini {
font-size: 12px;
}
/* 响应式布局 */
@media (max-width: 1200px) {
.el-col-8 {
width: 50% !important;
}
}
@media (max-width: 768px) {
.el-col-8 {
width: 100% !important;
}
.table-header {
padding: 12px 15px;
}
.table-title {
font-size: 14px;
}
}
/* 标签样式优化 */
.el-tag {
font-weight: 500; font-weight: 500;
} }
.value-warn {
/* 进度条样式 */ color: #e6a23c;
.el-progress { }
.value-accent {
color: #67c23a;
}
.image-wrap {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.device-image {
width: 100%; width: 100%;
height: 100%;
border-radius: 8px;
box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}
.image-url {
margin-top: 8px;
font-size: 12px;
color: #999;
} }
</style> </style>