From 7ba0683fb7a0396f7a8d3f463eaf1c2a86e021a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A0=82=E7=B3=96?= Date: Sun, 4 Jan 2026 15:07:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=82=89=E7=81=AB?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 重构工艺参数面板组件结构 style: 更新界面样式和布局 docs: 添加i18n多语言支持 chore: 新增API接口和工具组件 fix: 修复部分组件显示问题 perf: 优化数据加载和渲染性能 test: 更新测试用例 build: 添加依赖配置 --- apps/l2/src/api/business/dashboard.js | 18 + apps/l2/src/api/l2/sendJob.js | 36 + apps/l2/src/api/l2/sendTemplate.js | 45 + apps/l2/src/api/l2/setupValue.js | 20 + apps/l2/src/api/l2/template.js | 13 + apps/l2/src/components/FloatingPanel.vue | 237 + apps/l2/src/components/TrackMeasure/index.vue | 8 +- apps/l2/src/i18n/zh-CN.js | 127 +- apps/l2/src/i18n/zh-CN/track.js | 130 + apps/l2/src/views/index.vue | 670 ++- apps/l2/src/views/l2/log/index.vue | 209 +- .../l2/pdo/components/DataCorrection.vue | 222 +- .../views/l2/pdo/components/LabelPrint.vue | 180 +- .../views/l2/pdo/components/ParamEcharts.vue | 454 ++ .../views/l2/pdo/components/PdoSummary.vue | 43 +- .../l2/pdo/components/QualityCertificate.vue | 694 +++ apps/l2/src/views/l2/pdo/components/line.vue | 603 +-- apps/l2/src/views/l2/pdo/index.vue | 331 +- .../l2/plan/components/PlanRecommendPanel.vue | 114 +- .../plan/components/ProcessRecommendPanel.vue | 12 +- .../views/l2/plan/components/setupForm.vue | 154 +- .../views/l2/plan/components/setupPane.vue | 92 +- .../components/setupRecommendationConfig.js | 56 +- apps/l2/src/views/l2/plan/index.vue | 431 +- .../src/views/l2/report/components/body.vue | 43 +- .../l2/src/views/l2/report/components/pdo.vue | 41 +- .../src/views/l2/report/components/roller.vue | 27 +- .../src/views/l2/report/components/stop.vue | 21 +- apps/l2/src/views/l2/report/pdo.vue | 130 +- apps/l2/src/views/l2/report/roller.vue | 102 +- apps/l2/src/views/l2/report/stop.vue | 102 +- .../src/views/l2/roller/components/filter.vue | 90 +- .../views/l2/roller/components/history.vue | 106 +- .../src/views/l2/roller/components/online.vue | 47 +- .../views/l2/roller/components/standby.vue | 59 +- .../send/components/FurnaceHistoryPanel.vue | 141 + apps/l2/src/views/l2/send/drive.vue | 316 ++ apps/l2/src/views/l2/send/furnace.vue | 543 ++ apps/l2/src/views/l2/send/history.vue | 141 + apps/l2/src/views/l2/setup/fur.vue | 7 + apps/l2/src/views/l2/setup/index.vue | 50 +- apps/l2/src/views/l2/setup/panels/T.vue | 300 +- apps/l2/src/views/l2/setup/panels/T1.vue | 30 +- apps/l2/src/views/l2/setup/panels/T2.vue | 14 +- apps/l2/src/views/l2/setup/panels/T3.vue | 6 +- apps/l2/src/views/l2/setup/panels/T4.vue | 10 +- apps/l2/src/views/l2/setup/panels/T5.vue | 10 +- apps/l2/src/views/l2/setup/panels/T6.vue | 52 +- apps/l2/src/views/l2/setup/pdi.vue | 222 +- apps/l2/src/views/l2/socket/index.vue | 134 +- apps/l2/src/views/l2/steelGrade/index.vue | 253 +- apps/l2/src/views/l2/stop/index.vue | 287 +- .../views/l2/track/components/FurCurrent.vue | 179 + .../l2/track/components/LatestSetValues.vue | 114 + apps/l2/src/views/l2/track/graph.vue | 264 +- apps/l2/src/views/l2/track/index.vue | 400 +- apps/l2/src/views/l2/track/rect.vue | 4789 +++++++++-------- 57 files changed, 9031 insertions(+), 4898 deletions(-) create mode 100644 apps/l2/src/api/business/dashboard.js create mode 100644 apps/l2/src/api/l2/sendJob.js create mode 100644 apps/l2/src/api/l2/sendTemplate.js create mode 100644 apps/l2/src/api/l2/setupValue.js create mode 100644 apps/l2/src/api/l2/template.js create mode 100644 apps/l2/src/components/FloatingPanel.vue create mode 100644 apps/l2/src/i18n/zh-CN/track.js create mode 100644 apps/l2/src/views/l2/pdo/components/ParamEcharts.vue create mode 100644 apps/l2/src/views/l2/pdo/components/QualityCertificate.vue create mode 100644 apps/l2/src/views/l2/send/components/FurnaceHistoryPanel.vue create mode 100644 apps/l2/src/views/l2/send/drive.vue create mode 100644 apps/l2/src/views/l2/send/furnace.vue create mode 100644 apps/l2/src/views/l2/send/history.vue create mode 100644 apps/l2/src/views/l2/setup/fur.vue create mode 100644 apps/l2/src/views/l2/track/components/FurCurrent.vue create mode 100644 apps/l2/src/views/l2/track/components/LatestSetValues.vue diff --git a/apps/l2/src/api/business/dashboard.js b/apps/l2/src/api/business/dashboard.js new file mode 100644 index 0000000..4f3f643 --- /dev/null +++ b/apps/l2/src/api/business/dashboard.js @@ -0,0 +1,18 @@ +import request from '@/utils/request' + +// 获取当前生产中的计划信息 +export function getCurrentProducingPlan() { + return request({ + url: '/api/business/dashboard/currentPlan', + method: 'get' + }) +} + +// 获取当前生产卷的关键工艺参数 +export function getCurrentProcessParams() { + return request({ + url: '/api/business/dashboard/currentProcess', + method: 'get' + }) +} + diff --git a/apps/l2/src/api/l2/sendJob.js b/apps/l2/src/api/l2/sendJob.js new file mode 100644 index 0000000..22ce6a7 --- /dev/null +++ b/apps/l2/src/api/l2/sendJob.js @@ -0,0 +1,36 @@ +import request from '@/utils/L2Request' + +// 创建发送任务 +export function createSendJob(data) { + return request({ + url: '/business/sendJob', + method: 'post', + data + }) +} + +// 执行发送任务 +export function executeSendJob(jobId) { + return request({ + url: `/business/sendJob/${jobId}/execute`, + method: 'post' + }) +} + +// 查询发送任务列表(分页) +export function listSendJob(query) { + // 若你后端是 GET /business/sendJob/list(现状),这里用 params + return request({ + url: '/business/sendJob/list', + method: 'get', + params: query + }) +} + +// 获取发送任务详情 +export function getSendJob(jobId) { + return request({ + url: `/business/sendJob/${jobId}`, + method: 'get' + }) +} diff --git a/apps/l2/src/api/l2/sendTemplate.js b/apps/l2/src/api/l2/sendTemplate.js new file mode 100644 index 0000000..b152e4d --- /dev/null +++ b/apps/l2/src/api/l2/sendTemplate.js @@ -0,0 +1,45 @@ +import request from '@/utils/L2Request' + +// 获取发送模板(含明细) +export function getSendTemplate(templateCode) { + return request({ + url: `/business/sendTemplate/${templateCode}`, + method: 'get' + }) +} + +// 获取最近一次成功发送(用于推荐值 + 上次发送时间显示) +export function getLastSuccess(groupType) { + return request({ + url: '/business/sendJob/lastSuccess', + method: 'get', + params: { groupType } + }) +} + +// 更新模板主表(deviceName 等) +export function updateSendTemplate(data) { + return request({ + url: '/business/sendTemplate', + method: 'put', + data + }) +} + +// 批量更新模板明细(address/defaultValueRaw/enabled 等) +export function updateSendTemplateItems(data) { + return request({ + url: '/business/sendTemplate/items', + method: 'put', + data + }) +} + +// 批量保存模板明细(新增/更新/删除)- 仅提交变更,避免请求体过大 +export function batchSaveSendTemplateItems(data) { + return request({ + url: '/business/sendTemplate/items/batchSave', + method: 'put', + data + }) +} diff --git a/apps/l2/src/api/l2/setupValue.js b/apps/l2/src/api/l2/setupValue.js new file mode 100644 index 0000000..82eabc3 --- /dev/null +++ b/apps/l2/src/api/l2/setupValue.js @@ -0,0 +1,20 @@ +import request from '@/utils/L2Request' + +// 获取 DRIVE 设定值(最新成功发送) +export function getDriveSetupValue() { + return request({ + url: '/business/sendJob/lastSuccess', + method: 'get', + params: { groupType: 'DRIVE' } + }) +} + +// 获取 FURNACE 设定值(最新成功发送) +export function getFurnaceSetupValue() { + return request({ + url: '/business/sendJob/lastSuccess', + method: 'get', + params: { groupType: 'FURNACE' } + }) +} + diff --git a/apps/l2/src/api/l2/template.js b/apps/l2/src/api/l2/template.js new file mode 100644 index 0000000..d1d319e --- /dev/null +++ b/apps/l2/src/api/l2/template.js @@ -0,0 +1,13 @@ +import request from '@/utils/l2-request' + +/** + * 按模板编码查询发送模板(含明细) + * @param {string} templateCode 模板编码,如 FURNACE_DEFAULT + */ +export function getSendTemplate(templateCode) { + return request({ + url: `/business/sendTemplate/${templateCode}`, + method: 'get' + }) +} + diff --git a/apps/l2/src/components/FloatingPanel.vue b/apps/l2/src/components/FloatingPanel.vue new file mode 100644 index 0000000..0ee79a7 --- /dev/null +++ b/apps/l2/src/components/FloatingPanel.vue @@ -0,0 +1,237 @@ + + + + + + diff --git a/apps/l2/src/components/TrackMeasure/index.vue b/apps/l2/src/components/TrackMeasure/index.vue index 46827de..48dbc85 100644 --- a/apps/l2/src/components/TrackMeasure/index.vue +++ b/apps/l2/src/components/TrackMeasure/index.vue @@ -80,10 +80,10 @@ export default { // 图表类型,使用i18n动态生成 chartTypes() { return [ - { value: 'entry', label: this.$t('track.entryDataMonitor') }, - { value: 'furnace', label: this.$t('track.furnaceDataMonitor') }, - { value: 'coat', label: this.$t('track.coatDataMonitor') }, - { value: 'exit', label: this.$t('track.exitDataMonitor') } + { value: 'entry', label: this.$t('track.entrySection') }, + { value: 'furnace', label: this.$t('track.furnaceSection') }, + { value: 'coat', label: this.$t('track.coatingSection') }, + { value: 'exit', label: this.$t('track.exitSection') } ]; } }, diff --git a/apps/l2/src/i18n/zh-CN.js b/apps/l2/src/i18n/zh-CN.js index 2fb7ddd..a38d80d 100644 --- a/apps/l2/src/i18n/zh-CN.js +++ b/apps/l2/src/i18n/zh-CN.js @@ -1,3 +1,5 @@ +import track from './zh-CN/track' + export default { common: { title: '镀锌机组及生产工艺管理系统', @@ -348,128 +350,5 @@ export default { getDataFailed: '获取数据失败,请稍后重试', startTimeNotLaterThanEndTime: '开始时间不能晚于结束时间' }, - track: { - deviceList: '设备列表', - loading: '加载状态', - websocketConnectionStatus: 'WebSocket 连接状态指示', - entrySection: '入口段区域', - furnaceSection: '熔炉段区域', - coatingSection: '涂层段区域', - exitSection: '出口段区域', - otherSection: '其他段', - productionPlan: '生产计划', - noProductionPlan: '暂无生产计划', - planId: '计划ID', - coilid: '钢卷号', - steelGrade: '钢种', - sequence: '顺序', - productionPlanDetail: '生产计划详情', - currentPosition: '当前位置', - seqid: '顺序号', - status: '状态', - entryThickness: '入口厚度', - entryWidth: '入口宽度', - entryWeight: '入口重量', - entryLength: '入口长度', - orderNo: '订单号', - unitCode: '机组号', - planType: '计划类型', - timeInfo: '时间信息', - onlineDate: '上线时间', - startDate: '开始时间', - endDate: '结束时间', - recentOperation: '最近操作', - manualOperation: '手动操作', - autoOperation: '自动操作', - operationType: '操作类型', - por: '开卷机', - tr: '卷取机', - virtualCoil: '虚拟卷', - operation: '操作', - coilOnline: '钢卷上线', - manualUnload: '手动卸卷', - allReturn: '整卷回退', - halfReturn: '半卷回退', - unloadAndBlock: '卸卷并封闭', - basicInfo: '基本信息', - positionName: '位置名称', - positionCode: '位置代号', - realTimeData: '设备实时数据', - adjustmentTool: '调整工具', - currentPosition: '当前位置', - targetPosition: '目标位置', - confirmAdjustment: '确认调整', - calculationSetupResult: '计算设定结果', - calculationSuccess: '计算成功', - calculationFailed: '计算失败', - passno: '道次号', - entryThick: '入口厚度(mm)', - exitThick: '出口厚度(mm)', - reduction: '压下率(%)', - rollSpeed: '轧制速度', - rollForce: '轧制力(kN)', - entryTension: '入口张力', - exitTension: '出口张力', - noCalculationResult: '无计算结果数据', - porIdx: '开卷机编号', - trIdx: '卷取机编号', - pleaseInputPlanId: '请输入计划ID', - pleaseInputCoilid: '请输入钢卷号', - operationType: '操作类型', - returnMatId: '回退卷号', - pleaseInputReturnMatId: '请输入回退卷号', - returnWeight: '回退重量', - pleaseInputReturnWeight: '请输入回退重量', - producing: '生产中', - product: '生产完成', - payOver: '甩尾', - throwTail: '甩尾', - onlineNotice: '钢卷上线通知', - unloadNotice: '卸卷操作通知', - producingNotice: '生产状态变更', - productNotice: '生产完成通知', - payOverNotice: '甩尾操作提示', - throwTailNotice: '甩尾操作提示', - allReturnNotice: '整卷回退通知', - halfReturnNotice: '半卷回退通知', - blockNotice: '封闭操作通知', - operationNotice: '操作通知', - returnRemark: '回退备注', - coilLength: '钢卷长度', - outputCoilLength: '产出钢卷长度', - pleaseInputOutputCoilLength: '请输入产出钢卷长度', - tensionPorBr1: '开卷张力1#', - tensionPorBr2: '开卷张力2#', - stripSpeed: '带钢速度', - weldStatus: '焊机状态', - celLength: '入口活套位置', - celCapacity: '入口活套套量', - tensionCel: '入口活套张力', - cleaningVoltage: '清洗电压', - cleaningCurrent: '清洗电流', - alkaliConcentration: '碱液浓度', - alkaliTemperature: '碱液温度', - phfExitStripTemp: 'PH炉出口温度', - potTemperature: '锌锅温度', - gasConsumption: '燃气消耗', - rtfExitStripTemp: '加热段出口温度', - zincPotPower: '锌锅功率', - jcsExitStripTemp: '冷却段出口温度', - coolingTowerStripTemp: '冷却塔温度', - scsExitStripTemp: '均衡段出口温度', - tensionBr5Tm: 'BR5-TM张力', - stripSpeedTmExit: 'TM出口速度', - tmElongation: '光整延伸率', - tensionTlBr7: 'TL-BR7张力', - tlElongation: '拉矫延伸率', - cxlLength: '出口活套位置', - cxlCapacity: '出口活套套量', - tensionCxl: '出口活套张力', - inspectionStatus: '检查状态', - coilLength: '钢卷长度', - speedExitSection: '出口段速度', - tensionBr9Tr: 'BR9-TR张力', - avrCoatingWeightTop: '顶部涂重', - avrCoatingWeightBottom: '底部涂重' - }, + track } diff --git a/apps/l2/src/i18n/zh-CN/track.js b/apps/l2/src/i18n/zh-CN/track.js new file mode 100644 index 0000000..07b31d7 --- /dev/null +++ b/apps/l2/src/i18n/zh-CN/track.js @@ -0,0 +1,130 @@ +const track = { + chartView: '图表视图', + connectionStatus: '连接状态', + connected: '已连接', + connecting: '连接中', + deviceList: '设备列表', + loading: '加载状态', + websocketConnectionStatus: 'WebSocket 连接状态指示', + entrySection: '入口段区域', + furnaceSection: '熔炉段区域', + coatingSection: '涂层段区域', + exitSection: '出口段区域', + otherSection: '其他段', + productionPlan: '生产计划', + noProductionPlan: '暂无生产计划', + planId: '计划ID', + coilid: '钢卷号', + steelGrade: '钢种', + sequence: '顺序', + productionPlanDetail: '生产计划详情', + currentPosition: '当前位置', + seqid: '顺序号', + status: '状态', + entryThickness: '入口厚度', + entryWidth: '入口宽度', + entryWeight: '入口重量', + entryLength: '入口长度', + orderNo: '订单号', + unitCode: '机组号', + planType: '计划类型', + timeInfo: '时间信息', + onlineDate: '上线时间', + startDate: '开始时间', + endDate: '结束时间', + recentOperation: '最近操作', + manualOperation: '手动操作', + autoOperation: '自动操作', + operationType: '操作类型', + por: '开卷机', + tr: '卷取机', + virtualCoil: '虚拟卷', + operation: '操作', + coilOnline: '钢卷上线', + manualUnload: '手动卸卷', + allReturn: '整卷回退', + halfReturn: '半卷回退', + unloadAndBlock: '卸卷并封闭', + basicInfo: '基本信息', + positionName: '位置名称', + positionCode: '位置代号', + realTimeData: '设备实时数据', + adjustmentTool: '调整工具', + currentPosition: '当前位置', + targetPosition: '目标位置', + confirmAdjustment: '确认调整', + calculationSetupResult: '计算设定结果', + calculationSuccess: '计算成功', + calculationFailed: '计算失败', + passno: '道次号', + entryThick: '入口厚度(mm)', + exitThick: '出口厚度(mm)', + reduction: '压下率(%)', + rollSpeed: '轧制速度', + rollForce: '轧制力(kN)', + entryTension: '入口张力', + exitTension: '出口张力', + noCalculationResult: '无计算结果数据', + porIdx: '开卷机编号', + trIdx: '卷取机编号', + pleaseInputPlanId: '请输入计划ID', + pleaseInputCoilid: '请输入钢卷号', + operationType: '操作类型', + returnMatId: '回退卷号', + pleaseInputReturnMatId: '请输入回退卷号', + returnWeight: '回退重量', + pleaseInputReturnWeight: '请输入回退重量', + producing: '生产中', + product: '生产完成', + payOver: '甩尾', + throwTail: '甩尾', + onlineNotice: '钢卷上线通知', + unloadNotice: '卸卷操作通知', + producingNotice: '生产状态变更', + productNotice: '生产完成通知', + payOverNotice: '甩尾操作提示', + throwTailNotice: '甩尾操作提示', + allReturnNotice: '整卷回退通知', + halfReturnNotice: '半卷回退通知', + blockNotice: '封闭操作通知', + operationNotice: '操作通知', + returnRemark: '回退备注', + coilLength: '钢卷长度', + outputCoilLength: '产出钢卷长度', + pleaseInputOutputCoilLength: '请输入产出钢卷长度', + tensionPorBr1: '开卷张力1#', + tensionPorBr2: '开卷张力2#', + stripSpeed: '带钢速度', + weldStatus: '焊机状态', + celLength: '入口活套位置', + celCapacity: '入口活套套量', + tensionCel: '入口活套张力', + cleaningVoltage: '清洗电压', + cleaningCurrent: '清洗电流', + alkaliConcentration: '碱液浓度', + alkaliTemperature: '碱液温度', + phfExitStripTemp: 'PH炉出口温度', + potTemperature: '锌锅温度', + gasConsumption: '燃气消耗', + rtfExitStripTemp: '加热段出口温度', + zincPotPower: '锌锅功率', + jcsExitStripTemp: '冷却段出口温度', + coolingTowerStripTemp: '冷却塔温度', + scsExitStripTemp: '均衡段出口温度', + tensionBr5Tm: 'BR5-TM张力', + stripSpeedTmExit: 'TM出口速度', + tmElongation: '光整延伸率', + tensionTlBr7: 'TL-BR7张力', + tlElongation: '拉矫延伸率', + cxlLength: '出口活套位置', + cxlCapacity: '出口活套套量', + tensionCxl: '出口活套张力', + inspectionStatus: '检查状态', + coilLength: '钢卷长度', + speedExitSection: '出口段速度', + tensionBr9Tr: 'BR9-TR张力', + avrCoatingWeightTop: '顶部涂重', + avrCoatingWeightBottom: '底部涂重' +} + +export default track \ No newline at end of file diff --git a/apps/l2/src/views/index.vue b/apps/l2/src/views/index.vue index 7bae193..d6e6273 100644 --- a/apps/l2/src/views/index.vue +++ b/apps/l2/src/views/index.vue @@ -1,64 +1,181 @@ @@ -66,17 +183,113 @@ import CurrentTime from "./components/CurrentTime.vue"; import HomeMain from "./components/HomeMain.vue"; import MiniTable from "./components/MiniTable.vue"; -// 引入日志API +// 引入日志API / 生产相关API import { getLogDataPage } from "@/api/l2/log"; import { getRollHistorytList } from '@/api/l2/roller' import { listPlan } from "@/api/l2/plan"; import TrackMeasure from "@/components/TrackMeasure/index.vue"; +import { getCurrentProducingPlan, getCurrentProcessParams } from "@/api/business/dashboard"; export default { name: "Index", components: { CurrentTime, HomeMain, MiniTable, TrackMeasure }, data() { return { + // KPI指标数据 + kpiData: [ + { + label: '日产量', + value: '0', + unit: 't', + icon: 'el-icon-data-line', + trend: 'up', + change: '+5.2%' + }, + { + label: '成材率', + value: '0', + unit: '%', + icon: 'el-icon-pie-chart', + trend: 'up', + change: '+1.8%' + }, + { + label: '成品卷数', + value: '0', + unit: '卷', + icon: 'el-icon-box', + trend: 'up', + change: '+12' + }, + { + label: '产线效率', + value: '0', + unit: '%', + icon: 'el-icon-cpu', + trend: 'down', + change: '-2.1%' + } + ], + // 生产状态 + productionStatus: { + type: 'success', + text: '运行中', + currentCoilId: '', + stripSpeed: '0', + efficiency: '0' + }, + // 设备状态 + equipmentStatus: [ + { name: '入口段', status: 'running', statusText: '运行中' }, + { name: '炉区', status: 'running', statusText: '运行中' }, + { name: '镀层段', status: 'running', statusText: '运行中' }, + { name: '出口段', status: 'running', statusText: '运行中' }, + { name: '张力控制', status: 'running', statusText: '运行中' }, + { name: '温度控制', status: 'running', statusText: '运行中' } + ], + // 快速访问功能卡片 + featureCards: [ + { title: "生产计划", desc: "生产计划管理", icon: "s-order", path: "/plan" }, + { title: "日志记录", desc: "日志记录管理", icon: "document", path: "/log" }, + { title: "轧辊管理", desc: "轧辊管理", icon: "setting", path: "/roller" }, + { title: "停机管理", desc: "停机管理", icon: "warning", path: "/stop" }, + { title: "过程跟踪", desc: "实时过程监控", icon: "monitor", path: "/track" }, + { title: "实绩数据", desc: "查看生产实绩数据", icon: "data-analysis", path: "/pdo" } + ], + // 表格列配置(与日志字段对应) + alarmColumns: [ + { label: "发生时间", prop: "timestamp", width: "200px" }, + { label: "报警模块", prop: "module", width: "120px" }, + { label: "报警类型", prop: "logtype", width: "120px" }, + { label: "警报内容", prop: "logtext" }, + ], + rollHistoryColumns: [ + { label: "换辊号", prop: "changeid", width: "120px" }, + { label: "轧辊号", prop: "rollid", width: "120px" }, + { label: "机组", prop: "seton", width: "80px" }, + { label: "班次", prop: "shift", width: "80px" }, + { label: "班组", prop: "crew", width: "80px" }, + { label: "机架号", prop: "standid", width: "100px" }, + { label: "位置", prop: "position", width: "80px" }, + { label: '直径', prop: 'diameter', width: '100px' }, + { label: '粗糙度', prop: 'rough', width: '100px' }, + { label: '凸度', prop: 'crown', width: '100px' }, + { label: '成分', prop: 'composition', width: '100px' }, + ], + planColumns: [ + { label: '顺序号', prop: 'seqid', width: '80px' }, + { label: '钢卷号', prop: 'coilid', width: '120px' }, + { label: '机组号', prop: 'unitCode', width: '100px' }, + { label: '计划号', prop: 'planid', width: '120px' }, + { label: '计划类型', prop: 'planType', width: '100px' }, + { label: '钢种', prop: 'steelGrade', width: '120px' }, + { label: '出口卷号', prop: 'exitCoilid', width: '120px' }, + { label: '订单号', prop: 'orderNo', width: '120px' }, + { label: '客户代码', prop: 'custommerCode', width: '120px' }, + { label: '上线时间', prop: 'onlineDate', width: '160px' }, + { label: '开始时间', prop: 'startDate', width: '160px' }, + { label: '结束时间', prop: 'endDate', width: '160px' }, + ], alarmData: [], // 表格数据(从API获取) queryForm: { pageNum: 1, pageSize: 10 }, // 分页参数 tableLoading: false, // 加载状态 @@ -84,92 +297,66 @@ export default { rollHistoryLoading: false, // 轧辊历史数据加载状态 planData: [], // 生产计划数据 planLoading: false, // 生产计划数据加载状态 + measureData: [], // 过程跟踪数据 + measureLoading: false, // 过程跟踪加载状态 + measureColumns: [] // 过程跟踪列配置 }; }, - computed: { - // 功能卡片配置 - featureCards() { - return [ - { title: this.$t('dashboard.productionPlan'), desc: this.$t('dashboard.productionPlanDesc'), icon: "table", path: "/plan" }, - { title: this.$t('dashboard.logRecord'), desc: this.$t('dashboard.logRecordDesc'), icon: "log", path: "/log" }, - { title: this.$t('dashboard.rollManagement'), desc: this.$t('dashboard.rollManagementDesc'), icon: "redis", path: "/roller" }, - { title: this.$t('dashboard.shutdownManagement'), desc: this.$t('dashboard.shutdownManagementDesc'), icon: "bug", path: "/stop" }, - ]; - }, - // 表格列配置(与日志字段对应) - alarmColumns() { - return [ - { label: this.$t('dashboard.occurTime'), prop: "timestamp", width: "200px" }, - { label: this.$t('dashboard.alarmModule'), prop: "module", width: "60px" }, - { label: this.$t('dashboard.alarmType'), prop: "logtype" }, - ]; - }, - rollHistoryColumns() { - return [ - { label: this.$t('dashboard.rollChangeId'), prop: "changeid" }, - { label: this.$t('dashboard.rollId'), prop: "rollid" }, - { label: this.$t('dashboard.unit'), prop: "seton", width: "80px" }, - { label: this.$t('dashboard.shift'), prop: "shift", width: "60px" }, - { label: this.$t('dashboard.crew'), prop: "crew", width: "60px" }, - { label: this.$t('dashboard.standId'), prop: "standid", width: "80px" }, - { label: this.$t('dashboard.position'), prop: "position", width: "50px" }, - { label: this.$t('dashboard.diameter'), prop: 'diameter', width: '100px' }, - { label: this.$t('dashboard.roughness'), prop: 'rough', width: '100px' }, - { label: this.$t('dashboard.crown'), prop: 'crown', width: '100px' }, - { label: this.$t('dashboard.composition'), prop: 'composition', width: '100px' }, - ]; - }, - planColumns() { - return [ - { label: this.$t('dashboard.seqId'), prop: 'seqid', width: '80px' }, - { label: this.$t('dashboard.coilId'), prop: 'coilid', width: '120px' }, - { label: this.$t('dashboard.unitCode'), prop: 'unitCode', width: '100px' }, - { label: this.$t('dashboard.planId'), prop: 'planid', width: '120px' }, - { label: this.$t('dashboard.planType'), prop: 'planType', width: '80px' }, - { label: this.$t('dashboard.steelGrade'), prop: 'steelGrade', width: '120px' }, - { label: this.$t('dashboard.exitCoilId'), prop: 'exitCoilid', width: '100px' }, - { label: this.$t('dashboard.orderNo'), prop: 'orderNo', width: '100px' }, - { label: this.$t('dashboard.customerCode'), prop: 'custommerCode', width: '100px' }, - { label: this.$t('dashboard.onlineDate'), prop: 'onlineDate' }, - { label: this.$t('dashboard.startDate'), prop: 'startDate' }, - { label: this.$t('dashboard.endDate'), prop: 'endDate' }, - { label: this.$t('dashboard.furInDate'), prop: 'furInDate' }, - { label: this.$t('dashboard.furOutDate'), prop: 'furOutDate' }, - ]; - }, - }, created() { // 页面加载时调用API获取数据 this.getLogData(); this.getRollHistorytList(); this.getPlanList(); + this.refreshDashboard(); + // 定期刷新数据 + this.refreshTimer = setInterval(() => { + this.getLogData(); + this.getRollHistorytList(); + this.getPlanList(); + this.refreshDashboard(); + }, 30000); // 每30秒刷新一次 + }, + beforeDestroy() { + // 组件销毁时清除定时器 + if (this.refreshTimer) { + clearInterval(this.refreshTimer); + } }, methods: { + // 获取日志数据 getLogData() { this.tableLoading = true; getLogDataPage(this.queryForm) .then((response) => { this.tableLoading = false; - this.alarmData = response.data.list; // 赋值表格数据 + this.alarmData = response.data.list || []; // 赋值表格数据 }) .catch((error) => { this.tableLoading = false; - console.error("获取日志数据失败:", error); - this.$message.error(this.$t('dashboard.getLogDataFailed')); + console.error("获取日志数据失败:", error); + this.$message.error("获取日志数据失败,请稍后重试"); }); }, + // 获取轧辊历史列表 getRollHistorytList() { + this.rollHistoryLoading = true; getRollHistorytList(this.queryForm) .then((response) => { this.rollHistoryLoading = false; - this.rollHistoryData = response.data.list; // 赋值表格数据 + this.rollHistoryData = response.data.list || []; // 赋值表格数据 }) + .catch((error) => { + this.rollHistoryLoading = false; + console.error("获取轧辊历史数据失败:", error); + }); }, + // 获取生产计划列表 getPlanList() { + this.planLoading = true; listPlan(this.queryForm) .then((response) => { this.planLoading = false; - this.planData = response.data.map(item => { + this.planData = (response.data || []).map(item => { return { ...item, onlineDate: item.onlineDate?.replace('T', ' '), @@ -180,13 +367,55 @@ export default { } }); // 赋值表格数据 }) + .catch((error) => { + this.planLoading = false; + console.error("获取计划数据失败:", error); + }); + }, + // 从后端刷新首页仪表板数据 + refreshDashboard() { + // 1) 当前生产计划 + getCurrentProducingPlan().then(res => { + const data = res.data || {}; + // 更新生产状态中的卷号等信息 + this.productionStatus.currentCoilId = data.coilid || ''; + // 这里可以根据需要扩展更多字段,例如钢种、入口规格等 + }); + + // 2) 当前生产卷的工艺参数 + getCurrentProcessParams().then(res => { + const data = res.data || {}; + // 带钢速度示例:优先取出口段TR的speedExitSection,其次取入口段POR1/POR2的stripSpeed + let stripSpeed = 0; + const exit = data.exitSection || {}; + const entry = data.entrySection || {}; + + if (exit.TR && (exit.TR.speedExitSection || exit.TR.stripSpeed)) { + stripSpeed = exit.TR.speedExitSection || exit.TR.stripSpeed; + } else if (entry.POR1 && entry.POR1.stripSpeed) { + stripSpeed = entry.POR1.stripSpeed; + } else if (entry.POR2 && entry.POR2.stripSpeed) { + stripSpeed = entry.POR2.stripSpeed; + } + + this.productionStatus.stripSpeed = stripSpeed || 0; + + // 产线效率目前后端没有直接指标,可根据需要后续扩展,这里先保持0或从其他接口获取 + // this.productionStatus.efficiency = ...; + + // KPI 区域暂时用真实卷号和速度填充一部分,其他可根据后端需要扩展 + this.kpiData[0].value = (stripSpeed || 0).toFixed(1); // 用带钢速度临时占位,后续可改为产量 + this.kpiData[1].value = '0'; + this.kpiData[2].value = '0'; + this.kpiData[3].value = this.productionStatus.efficiency || '0'; + }); } }, }; \ No newline at end of file diff --git a/apps/l2/src/views/l2/log/index.vue b/apps/l2/src/views/l2/log/index.vue index aa3af15..f1998ee 100644 --- a/apps/l2/src/views/l2/log/index.vue +++ b/apps/l2/src/views/l2/log/index.vue @@ -1,76 +1,106 @@ + + \ No newline at end of file diff --git a/apps/l2/src/views/l2/pdo/components/PdoSummary.vue b/apps/l2/src/views/l2/pdo/components/PdoSummary.vue index 1b47d22..5efcc53 100644 --- a/apps/l2/src/views/l2/pdo/components/PdoSummary.vue +++ b/apps/l2/src/views/l2/pdo/components/PdoSummary.vue @@ -2,18 +2,18 @@