diff --git a/.gitignore b/.gitignore
index 5720563..d5552f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,4 @@ npm-debug.log*
.env
.env.*
!.env.example
+*.zip
\ No newline at end of file
diff --git a/src/components/CncCard.vue b/src/components/CncCard.vue
index 30d0a03..63b70cc 100644
--- a/src/components/CncCard.vue
+++ b/src/components/CncCard.vue
@@ -21,11 +21,14 @@
- 加工件数
- {{ md.currentProduceCount?.toLocaleString() }}件
+ 累计总产量
+ {{ totalProduceCount.toLocaleString() }}件
+
+
+ 今日产量
+ {{ todayProduceCount.toLocaleString() }}件
-
切削{{ formatTime(md.cuttime) }}
运行{{ formatTime(md.runtime) }}
@@ -50,6 +53,9 @@ const cncType = computed(() => {
if (props.device.online) return props.device.machineData?.sysInfo?.cncType || 'CNC'
return props.device.sysInfo?.cncType || 'CNC'
})
+const totalProduceCount = computed(() => Number(md.value.currentProduceCount || 0))
+/** 近 7 日窗口固定“最后一格=今天” */
+const todayProduceCount = computed(() => Number(props.device.weeklyStats?.produce?.[6] || 0))
function formatTime(str) { return formatFanucTimeShort(str) }
@@ -96,6 +102,9 @@ function formatTime(str) { return formatFanucTimeShort(str) }
.produce-label { font-size: 11px; color: #5a7a9a; font-weight: 600; }
.produce-val { font-size: 20px; font-weight: 800; color: #00e676; text-shadow: 0 0 8px rgba(0,230,118,0.3); }
.produce-val small { font-size: 11px; margin-left: 3px; opacity: 0.7; }
+.daily-row { display: flex; justify-content: space-between; align-items: baseline; }
+.daily-val { font-size: 14px; font-weight: 700; color: #8dd8ff; }
+.daily-val small { font-size: 10px; margin-left: 3px; opacity: 0.75; }
.time-rows { display: flex; gap: 10px; margin-top: auto; }
.time-item { flex: 1; background: rgba(0,0,0,0.2); padding: 4px 8px; border-radius: 4px; display: flex; justify-content: space-between; }
diff --git a/src/components/StatusSummary.vue b/src/components/StatusSummary.vue
index 21f0025..bdf19d2 100644
--- a/src/components/StatusSummary.vue
+++ b/src/components/StatusSummary.vue
@@ -41,10 +41,13 @@
-
+
生产与程序信息
-
加工件数{{ md.currentProduceCount?.toLocaleString() }} 件
+
累计总产量{{ cncTotalProduce.toLocaleString() }} 件
+
今日产量{{ cncTodayProduce.toLocaleString() }} 件
当前程序{{ md.programCurrent?.name }}
@@ -92,7 +92,11 @@
-
近7日产量与切削时长趋势
+
近7日产量与累计件数趋势
+
+ 累计总产量:{{ cncTotalProduce.toLocaleString() }} 件
+ (折线「累计件数」为近 7 日每日末累计快照)
+
@@ -251,6 +255,9 @@ const md = computed(() => device.value?.machineData || {})
const nc = computed(() => md.value?.CutSystemState?.NcState)
const ds = computed(() => md.value?.CutSystemState?.DeviceState)
const lmd = computed(() => md.value || {})
+const cncTotalProduce = computed(() => Number(md.value?.currentProduceCount || 0))
+/** CNC 日增量已在 mqttDeviceStore 由累计差分得到:produce[6] 代表今天 */
+const cncTodayProduce = computed(() => Number(device.value?.weeklyStats?.produce?.[6] || 0))
const powerPhases = computed(() => {
const s = md.value?.slave1
@@ -369,39 +376,103 @@ function updatePowerChart() {
function updateChart() {
if (!chartInstance || !device.value?.weeklyStats) return
const stats = device.value.weeklyStats
- const isLaser = device.value.type === 'laser'
+ const isCnc = device.value.type === 'cnc'
+ const xLabels = stats.dates || getLast7DaysChartInfo().labels
+ const cum = Array.isArray(stats.produceCumulative) ? stats.produceCumulative : new Array(7).fill(0)
- const option = {
- backgroundColor: 'transparent',
- tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } },
- legend: {
- data: [isLaser ? '穿孔数 (次)' : '产量 (件)', isLaser ? '激光时长 (h)' : '切削时长 (h)'],
- textStyle: { color: '#a0c0d0' }, top: 0
- },
- grid: { left: '3%', right: '4%', bottom: '3%', top: '40px', containLabel: true },
- xAxis: {
- type: 'category', data: stats.dates || getLast7DaysChartInfo().labels,
- axisLabel: { color: '#6a8a9a' }, axisLine: { lineStyle: { color: '#1a3a6a' } }
- },
- yAxis: [
- { type: 'value', name: isLaser ? '次数' : '件', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { lineStyle: { color: 'rgba(26,58,106,0.3)' } } },
- { type: 'value', name: '小时', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { show: false } }
- ],
- series: [
- {
- name: isLaser ? '穿孔数 (次)' : '产量 (件)', type: 'bar', barWidth: '30%',
- itemStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#00e5ff'},{offset:1,color:'#0070ff'}]), borderRadius: [4,4,0,0] },
- data: stats.produce
+ let option
+ if (isCnc) {
+ option = {
+ backgroundColor: 'transparent',
+ tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } },
+ legend: {
+ data: ['日产量 (件)', '累计件数'],
+ textStyle: { color: '#a0c0d0' },
+ top: 0
},
- {
- name: isLaser ? '激光时长 (h)' : '切削时长 (h)', type: 'line', yAxisIndex: 1, smooth: true,
- symbol: 'circle', symbolSize: 8,
- itemStyle: { color: isLaser ? '#ff4444' : '#00e676' },
- lineStyle: { width: 3, shadowColor: isLaser ? 'rgba(255,68,68,0.4)' : 'rgba(0,230,118,0.4)', shadowBlur: 10 },
- areaStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:isLaser?'rgba(255,68,68,0.25)':'rgba(0,230,118,0.25)'},{offset:1,color:'transparent'}]) },
- data: stats.cuttime
- }
- ]
+ grid: { left: '3%', right: '8%', bottom: '3%', top: '40px', containLabel: true },
+ xAxis: {
+ type: 'category',
+ data: xLabels,
+ axisLabel: { color: '#6a8a9a' },
+ axisLine: { lineStyle: { color: '#1a3a6a' } }
+ },
+ yAxis: [
+ {
+ type: 'value',
+ name: '日产量(件)',
+ nameTextStyle: { color: '#6a8a9a' },
+ axisLabel: { color: '#6a8a9a' },
+ splitLine: { lineStyle: { color: 'rgba(26,58,106,0.3)' } }
+ },
+ {
+ type: 'value',
+ name: '累计(件)',
+ position: 'right',
+ alignTicks: true,
+ nameTextStyle: { color: '#6a8a9a' },
+ axisLabel: { color: '#6a8a9a' },
+ splitLine: { show: false }
+ }
+ ],
+ series: [
+ {
+ name: '日产量 (件)',
+ type: 'bar',
+ yAxisIndex: 0,
+ barWidth: '26%',
+ itemStyle: {
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ offset: 0, color: '#00e5ff' }, { offset: 1, color: '#0070ff' }]),
+ borderRadius: [4, 4, 0, 0]
+ },
+ data: stats.produce
+ },
+ {
+ name: '累计件数',
+ type: 'line',
+ yAxisIndex: 1,
+ smooth: true,
+ symbol: 'circle',
+ symbolSize: 7,
+ itemStyle: { color: '#ffca28' },
+ lineStyle: { width: 2, type: 'dashed' },
+ data: cum
+ }
+ ]
+ }
+ } else {
+ option = {
+ backgroundColor: 'transparent',
+ tooltip: { trigger: 'axis', axisPointer: { type: 'cross' } },
+ legend: {
+ data: ['穿孔数 (次)', '激光时长 (h)'],
+ textStyle: { color: '#a0c0d0' }, top: 0
+ },
+ grid: { left: '3%', right: '4%', bottom: '3%', top: '40px', containLabel: true },
+ xAxis: {
+ type: 'category', data: xLabels,
+ axisLabel: { color: '#6a8a9a' }, axisLine: { lineStyle: { color: '#1a3a6a' } }
+ },
+ yAxis: [
+ { type: 'value', name: '次数', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { lineStyle: { color: 'rgba(26,58,106,0.3)' } } },
+ { type: 'value', name: '小时', nameTextStyle: { color: '#6a8a9a' }, axisLabel: { color: '#6a8a9a' }, splitLine: { show: false } }
+ ],
+ series: [
+ {
+ name: '穿孔数 (次)', type: 'bar', barWidth: '30%',
+ itemStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'#00e5ff'},{offset:1,color:'#0070ff'}]), borderRadius: [4,4,0,0] },
+ data: stats.produce
+ },
+ {
+ name: '激光时长 (h)', type: 'line', yAxisIndex: 1, smooth: true,
+ symbol: 'circle', symbolSize: 8,
+ itemStyle: { color: '#ff4444' },
+ lineStyle: { width: 3, shadowColor: 'rgba(255,68,68,0.4)', shadowBlur: 10 },
+ areaStyle: { color: new echarts.graphic.LinearGradient(0,0,0,1,[{offset:0,color:'rgba(255,68,68,0.25)'},{offset:1,color:'transparent'}]) },
+ data: stats.cuttime
+ }
+ ]
+ }
}
chartInstance.setOption(option, true)
}
@@ -433,7 +504,8 @@ watch(
device.value?.type,
device.value?.machineData?.timestamp,
device.value?.weeklyStats?.produce?.join(','),
- device.value?.weeklyStats?.cuttime?.join(',')
+ device.value?.weeklyStats?.cuttime?.join(','),
+ device.value?.weeklyStats?.produceCumulative?.join(',')
],
() => {
if (!device.value || device.value.type === 'power') return
@@ -553,6 +625,13 @@ onUnmounted(() => {
/* Chart */
.chart-card { flex: 1; min-height: 220px; }
+.chart-sub {
+ font-size: 12px;
+ color: #6a8a9a;
+ margin: -4px 0 8px;
+ padding-left: 8px;
+}
+.chart-hint { margin-left: 8px; font-size: 10px; color: #4a6a8a; }
.chart-container { width: 100%; height: 100%; min-height: 200px; }
/* Offline */