|
|
|
@ -136,7 +136,16 @@
|
|
|
|
<el-card shadow="hover">
|
|
|
|
<el-card shadow="hover">
|
|
|
|
<template #header>
|
|
|
|
<template #header>
|
|
|
|
<div class="card-header">
|
|
|
|
<div class="card-header">
|
|
|
|
<span class="card-title">车间平均单机产量({{ workshopDateLabel }})<el-tooltip content="各车间总产量除以机床数量,反映每台机床的平均产出效率,消除车间规模差异。" placement="top"><span class="info-icon">ⓘ</span></el-tooltip></span>
|
|
|
|
<span class="card-title">车间平均单机产量({{ workshopDateLabel }})<el-tooltip placement="top">
|
|
|
|
|
|
|
|
<template #content>
|
|
|
|
|
|
|
|
<div style="max-width: 360px; line-height: 1.6">
|
|
|
|
|
|
|
|
<b>统计规则:</b>车间总产量 ÷ 车间机床数 ÷ 天数<br/><br/>
|
|
|
|
|
|
|
|
<b>数据来源:</b>系统每日凌晨1:00自动执行日终汇总,将每台机床当天所有产量分段按程序名合并计算,生成日产量记录。多天范围取日均单机产量。<br/><br/>
|
|
|
|
|
|
|
|
<b>产量计算:</b>以NC程序名标识零件,程序切换时自动结算上一段产量。同程序多次出现时分段记录、日汇总合并。含手工修正值。
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<span class="info-icon">ⓘ</span>
|
|
|
|
|
|
|
|
</el-tooltip></span>
|
|
|
|
<div class="date-filter">
|
|
|
|
<div class="date-filter">
|
|
|
|
<el-radio-group v-model="workshopDateType" size="small" @change="onWorkshopDateChange">
|
|
|
|
<el-radio-group v-model="workshopDateType" size="small" @change="onWorkshopDateChange">
|
|
|
|
<el-radio-button value="today">今日</el-radio-button>
|
|
|
|
<el-radio-button value="today">今日</el-radio-button>
|
|
|
|
@ -291,6 +300,14 @@ const workshopDateLabel = computed(() => dateLabels[workshopDateType.value])
|
|
|
|
const machineDateLabel = computed(() => dateLabels[machineDateType.value])
|
|
|
|
const machineDateLabel = computed(() => dateLabels[machineDateType.value])
|
|
|
|
const workerDateLabel = computed(() => dateLabels[workerDateType.value])
|
|
|
|
const workerDateLabel = computed(() => dateLabels[workerDateType.value])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 车间平均单机产量的日均单位
|
|
|
|
|
|
|
|
const workshopDays = computed(() => {
|
|
|
|
|
|
|
|
const { startDate, endDate } = getDateRange(workshopDateType.value, workshopDateRange.value)
|
|
|
|
|
|
|
|
return Math.max(1, Math.round((new Date(endDate).getTime() - new Date(startDate).getTime()) / 86400000) + 1)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
const workshopUnit = computed(() => workshopDays.value > 1 ? '件/台/天' : '件/台')
|
|
|
|
|
|
|
|
const workshopUnitLabel = computed(() => workshopDays.value > 1 ? '日均' : '平均')
|
|
|
|
|
|
|
|
|
|
|
|
function getDateRange(type: DateType, customRange?: [string, string]): { startDate: string; endDate: string } {
|
|
|
|
function getDateRange(type: DateType, customRange?: [string, string]): { startDate: string; endDate: string } {
|
|
|
|
const today = new Date()
|
|
|
|
const today = new Date()
|
|
|
|
const fmt = (d: Date) => d.toISOString().slice(0, 10)
|
|
|
|
const fmt = (d: Date) => d.toISOString().slice(0, 10)
|
|
|
|
@ -355,22 +372,24 @@ function alertTypeLabel(type: string): string {
|
|
|
|
|
|
|
|
|
|
|
|
function initWorkshopChart() {
|
|
|
|
function initWorkshopChart() {
|
|
|
|
if (workshopChartRef.value && workshopData.value.length) {
|
|
|
|
if (workshopChartRef.value && workshopData.value.length) {
|
|
|
|
|
|
|
|
const unit = workshopUnit.value
|
|
|
|
|
|
|
|
const unitLabel = workshopUnitLabel.value
|
|
|
|
workshopChart = echarts.init(workshopChartRef.value)
|
|
|
|
workshopChart = echarts.init(workshopChartRef.value)
|
|
|
|
workshopChart.setOption({
|
|
|
|
workshopChart.setOption({
|
|
|
|
tooltip: {
|
|
|
|
tooltip: {
|
|
|
|
trigger: 'axis',
|
|
|
|
trigger: 'axis',
|
|
|
|
formatter: (params: any) => {
|
|
|
|
formatter: (params: any) => {
|
|
|
|
const d = workshopData.value[params[0].dataIndex]
|
|
|
|
const d = workshopData.value[params[0].dataIndex]
|
|
|
|
return `${d.workshopName}<br/>平均产量: ${params[0].value} 件/台<br/>总产量: ${d.quantity} 件<br/>机床数: ${d.machineCount} 台`
|
|
|
|
return `${d.workshopName}<br/>${unitLabel}产量: ${params[0].value} ${unit}<br/>总产量: ${d.quantity} 件<br/>机床数: ${d.machineCount} 台`
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
grid: { left: 50, right: 20, top: 20, bottom: 30 },
|
|
|
|
grid: { left: 60, right: 20, top: 20, bottom: 30 },
|
|
|
|
xAxis: { type: 'category', data: workshopData.value.map(i => i.workshopName), axisLabel: { fontSize: 12 } },
|
|
|
|
xAxis: { type: 'category', data: workshopData.value.map(i => i.workshopName), axisLabel: { fontSize: 12 } },
|
|
|
|
yAxis: { type: 'value', name: '件/台', axisLabel: { fontSize: 12 } },
|
|
|
|
yAxis: { type: 'value', name: unit, axisLabel: { fontSize: 12 } },
|
|
|
|
series: [{
|
|
|
|
series: [{
|
|
|
|
type: 'bar', data: workshopData.value.map(i => i.avgQuantity),
|
|
|
|
type: 'bar', data: workshopData.value.map(i => i.avgQuantity),
|
|
|
|
itemStyle: { color: '#67C23A', borderRadius: [4, 4, 0, 0] }, barWidth: '40%',
|
|
|
|
itemStyle: { color: '#67C23A', borderRadius: [4, 4, 0, 0] }, barWidth: '40%',
|
|
|
|
label: { show: true, position: 'top', formatter: '{c} 件/台', fontSize: 12 },
|
|
|
|
label: { show: true, position: 'top', formatter: `{c} ${unit}`, fontSize: 12 },
|
|
|
|
}],
|
|
|
|
}],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|