完善下线统计 工位节拍 工位JPH的功能
This commit is contained in:
@@ -385,6 +385,82 @@ export default {
|
|||||||
isQualified: 'Qualified',
|
isQualified: 'Qualified',
|
||||||
noData: 'No data'
|
noData: 'No data'
|
||||||
},
|
},
|
||||||
|
offLinePartCount: {
|
||||||
|
productionTimeLabel: 'Production Time:',
|
||||||
|
startDate: 'Start Date',
|
||||||
|
endDate: 'End Date',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
orderNumberLabel: 'Order No.',
|
||||||
|
orderNumberPlaceholder: 'Please enter order number',
|
||||||
|
productModelLabel: 'Product Model:',
|
||||||
|
selectProductModel: 'Please select product model',
|
||||||
|
trendGranularityLabel: 'Trend Granularity:',
|
||||||
|
byDay: 'By Day',
|
||||||
|
byHour: 'By Hour',
|
||||||
|
search: 'Search',
|
||||||
|
export: 'Export',
|
||||||
|
exporting: 'Exporting....',
|
||||||
|
sequence: 'No.',
|
||||||
|
orderNumber: 'Order No.',
|
||||||
|
productNumber: 'Product No.',
|
||||||
|
productModel: 'Product Model',
|
||||||
|
offlineTime: 'Offline Time',
|
||||||
|
trendTitle: 'Offline Output Trend Analysis',
|
||||||
|
saveAsImage: 'Save as Image',
|
||||||
|
dateAxis: 'Date',
|
||||||
|
hourAxis: 'Hour',
|
||||||
|
offlineQuantityAxis: 'Offline Engine Qty',
|
||||||
|
offlineQuantitySeries: 'Offline Qty',
|
||||||
|
selectDateRange: 'Please select start date and end date!',
|
||||||
|
noData: 'No data'
|
||||||
|
},
|
||||||
|
stationBeat: {
|
||||||
|
productionTimeLabel: 'Production Time:',
|
||||||
|
startDate: 'Start Date',
|
||||||
|
endDate: 'End Date',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
stationLabel: 'Station:',
|
||||||
|
selectStation: 'Please select station',
|
||||||
|
orderNumberLabel: 'Order No.',
|
||||||
|
orderNumberPlaceholder: 'Please enter order number',
|
||||||
|
productModelLabel: 'Product Model:',
|
||||||
|
selectProductModel: 'Please select product model',
|
||||||
|
search: 'Search',
|
||||||
|
excel: 'Excel',
|
||||||
|
sequence: 'No.',
|
||||||
|
station: 'Station',
|
||||||
|
totalAverageBeat: 'Total Avg Beat (s)',
|
||||||
|
totalAverageBeatChartTitle: 'Total Average Beat Bar Chart',
|
||||||
|
totalAverageBeatAxis: 'Total Avg Beat (s)',
|
||||||
|
totalAverageBeatSeries: 'Total Avg Beat',
|
||||||
|
saveAsImage: 'Save as Image',
|
||||||
|
noData: 'No data'
|
||||||
|
},
|
||||||
|
stationJph: {
|
||||||
|
productionTimeLabel: 'Production Time:',
|
||||||
|
startDate: 'Start Date',
|
||||||
|
endDate: 'End Date',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
stationLabel: 'Station:',
|
||||||
|
selectStation: 'Please select station',
|
||||||
|
orderNumberLabel: 'Work Order',
|
||||||
|
orderNumberPlaceholder: 'Please enter work order',
|
||||||
|
productModelLabel: 'Product Model:',
|
||||||
|
selectProductModel: 'Please select product model',
|
||||||
|
search: 'Search',
|
||||||
|
export: 'Export',
|
||||||
|
realtimeTab: 'Realtime Today',
|
||||||
|
historyTab: 'History',
|
||||||
|
realtimeChartTitle: 'Realtime Hourly Output by Station',
|
||||||
|
historyChartTitle: 'Historical Hourly Output by Station',
|
||||||
|
saveAsImage: 'Save as Image',
|
||||||
|
sequence: 'No.',
|
||||||
|
date: 'Date',
|
||||||
|
station: 'Station',
|
||||||
|
hourSlot: 'Hour Slot',
|
||||||
|
outputQty: 'Output Qty',
|
||||||
|
noData: 'No data'
|
||||||
|
},
|
||||||
materialDataQuery: {
|
materialDataQuery: {
|
||||||
stationNumberLabel: 'Station No.:',
|
stationNumberLabel: 'Station No.:',
|
||||||
selectStationNumber: 'Please select station number',
|
selectStationNumber: 'Please select station number',
|
||||||
@@ -524,6 +600,9 @@ export default {
|
|||||||
'过站信息查询': 'Station Pass',
|
'过站信息查询': 'Station Pass',
|
||||||
'分线质量查询': 'Line Quality',
|
'分线质量查询': 'Line Quality',
|
||||||
'分线物料查询': 'Line Material',
|
'分线物料查询': 'Line Material',
|
||||||
|
'下线统计': 'Offline Count',
|
||||||
|
'工位节拍': 'Station Beat',
|
||||||
|
'工位JPH': 'Station JPH',
|
||||||
'生产计划订单完工': 'Order Complete',
|
'生产计划订单完工': 'Order Complete',
|
||||||
'SPC分析': 'SPC Analysis',
|
'SPC分析': 'SPC Analysis',
|
||||||
'基本趋势图': 'Trend Chart',
|
'基本趋势图': 'Trend Chart',
|
||||||
|
|||||||
@@ -385,6 +385,82 @@ export default {
|
|||||||
isQualified: '是否合格',
|
isQualified: '是否合格',
|
||||||
noData: '暂无数据'
|
noData: '暂无数据'
|
||||||
},
|
},
|
||||||
|
offLinePartCount: {
|
||||||
|
productionTimeLabel: '生产时间:',
|
||||||
|
startDate: '开始日期',
|
||||||
|
endDate: '结束日期',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
orderNumberLabel: '订单号',
|
||||||
|
orderNumberPlaceholder: '请输入订单号',
|
||||||
|
productModelLabel: '产品型号:',
|
||||||
|
selectProductModel: '请选择产品型号',
|
||||||
|
trendGranularityLabel: '趋势粒度:',
|
||||||
|
byDay: '按天',
|
||||||
|
byHour: '按小时',
|
||||||
|
search: '查询',
|
||||||
|
export: '导出',
|
||||||
|
exporting: '正在导出....',
|
||||||
|
sequence: '序号',
|
||||||
|
orderNumber: '订单号',
|
||||||
|
productNumber: '产品编号',
|
||||||
|
productModel: '产品型号',
|
||||||
|
offlineTime: '下线时间',
|
||||||
|
trendTitle: '下线产量趋势分析',
|
||||||
|
saveAsImage: '保存为图片',
|
||||||
|
dateAxis: '日期',
|
||||||
|
hourAxis: '小时',
|
||||||
|
offlineQuantityAxis: '下线发动机数量',
|
||||||
|
offlineQuantitySeries: '下线数量',
|
||||||
|
selectDateRange: '请选择开始时间与结束时间!',
|
||||||
|
noData: '暂无数据'
|
||||||
|
},
|
||||||
|
stationBeat: {
|
||||||
|
productionTimeLabel: '生产时间:',
|
||||||
|
startDate: '开始日期',
|
||||||
|
endDate: '结束日期',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
stationLabel: '工位:',
|
||||||
|
selectStation: '请选择工位',
|
||||||
|
orderNumberLabel: '订单号',
|
||||||
|
orderNumberPlaceholder: '请输入订单号',
|
||||||
|
productModelLabel: '产品型号:',
|
||||||
|
selectProductModel: '请选择产品型号',
|
||||||
|
search: '查询',
|
||||||
|
excel: 'Excel',
|
||||||
|
sequence: '序号',
|
||||||
|
station: '工位',
|
||||||
|
totalAverageBeat: '总平均节拍(秒)',
|
||||||
|
totalAverageBeatChartTitle: '总平均节拍横向柱状图',
|
||||||
|
totalAverageBeatAxis: '总平均节拍(秒)',
|
||||||
|
totalAverageBeatSeries: '总平均节拍',
|
||||||
|
saveAsImage: '保存为图片',
|
||||||
|
noData: '暂无数据'
|
||||||
|
},
|
||||||
|
stationJph: {
|
||||||
|
productionTimeLabel: '生产时间:',
|
||||||
|
startDate: '开始日期',
|
||||||
|
endDate: '结束日期',
|
||||||
|
dateRangeSeparator: '~',
|
||||||
|
stationLabel: '工位:',
|
||||||
|
selectStation: '请选择工位',
|
||||||
|
orderNumberLabel: '工单号',
|
||||||
|
orderNumberPlaceholder: '请输入工单号',
|
||||||
|
productModelLabel: '产品型号:',
|
||||||
|
selectProductModel: '请选择产品型号',
|
||||||
|
search: '查询',
|
||||||
|
export: '导出',
|
||||||
|
realtimeTab: '今日实时',
|
||||||
|
historyTab: '历史',
|
||||||
|
realtimeChartTitle: '工位每小时实时产量',
|
||||||
|
historyChartTitle: '工位每小时历史产量',
|
||||||
|
saveAsImage: '保存为图片',
|
||||||
|
sequence: '序号',
|
||||||
|
date: '日期',
|
||||||
|
station: '工位',
|
||||||
|
hourSlot: '小时段',
|
||||||
|
outputQty: '产量',
|
||||||
|
noData: '暂无数据'
|
||||||
|
},
|
||||||
materialDataQuery: {
|
materialDataQuery: {
|
||||||
stationNumberLabel: '工位号:',
|
stationNumberLabel: '工位号:',
|
||||||
selectStationNumber: '请选择工位号',
|
selectStationNumber: '请选择工位号',
|
||||||
@@ -524,6 +600,9 @@ export default {
|
|||||||
'过站信息查询': '过站信息查询',
|
'过站信息查询': '过站信息查询',
|
||||||
'分线质量查询': '分线质量查询',
|
'分线质量查询': '分线质量查询',
|
||||||
'分线物料查询': '分线物料查询',
|
'分线物料查询': '分线物料查询',
|
||||||
|
'下线统计': '下线统计',
|
||||||
|
'工位节拍': '工位节拍',
|
||||||
|
'工位JPH': '工位JPH',
|
||||||
'生产计划订单完工': '生产计划订单完工',
|
'生产计划订单完工': '生产计划订单完工',
|
||||||
'SPC分析': 'SPC分析',
|
'SPC分析': 'SPC分析',
|
||||||
'基本趋势图': '基本趋势图',
|
'基本趋势图': '基本趋势图',
|
||||||
|
|||||||
@@ -1,32 +1,32 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="topCard">
|
<el-card class="topCard">
|
||||||
<el-row class="toolbarRow">
|
<el-row class="toolbarRow">
|
||||||
<span class="promptText">生产时间:</span>
|
<span class="promptText">{{ $t('offLinePartCount.productionTimeLabel') }}</span>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="dateTime"
|
v-model="dateTime"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
align="center"
|
align="center"
|
||||||
end-placeholder="结束日期"
|
:end-placeholder="$t('offLinePartCount.endDate')"
|
||||||
format="yyyy-MM-dd"
|
format="yyyy-MM-dd"
|
||||||
range-separator="~"
|
:range-separator="$t('offLinePartCount.dateRangeSeparator')"
|
||||||
size="small"
|
size="small"
|
||||||
start-placeholder="开始日期"
|
:start-placeholder="$t('offLinePartCount.startDate')"
|
||||||
style="width: 240px"
|
style="width: 240px"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
/>
|
/>
|
||||||
<span style="margin-left: 10px">订单号</span>
|
<span style="margin-left: 10px">{{ $t('offLinePartCount.orderNumberLabel') }}</span>
|
||||||
<el-input
|
<el-input
|
||||||
v-model="orderNumberValue"
|
v-model="orderNumberValue"
|
||||||
placeholder="请输入订单号"
|
:placeholder="$t('offLinePartCount.orderNumberPlaceholder')"
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
style="width: 150px"
|
style="width: 150px"
|
||||||
/>
|
/>
|
||||||
<span class="promptText">产品型号:</span>
|
<span class="promptText">{{ $t('offLinePartCount.productModelLabel') }}</span>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="engineTypeValue"
|
v-model="engineTypeValue"
|
||||||
placeholder="请选择产品型号"
|
:placeholder="$t('offLinePartCount.selectProductModel')"
|
||||||
filterable
|
filterable
|
||||||
clearable
|
clearable
|
||||||
size="small"
|
size="small"
|
||||||
@@ -40,10 +40,10 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<span class="promptText">趋势粒度:</span>
|
<span class="promptText">{{ $t('offLinePartCount.trendGranularityLabel') }}</span>
|
||||||
<el-radio-group v-model="trendMode" size="small">
|
<el-radio-group v-model="trendMode" size="small">
|
||||||
<el-radio-button label="day">按天</el-radio-button>
|
<el-radio-button label="day">{{ $t('offLinePartCount.byDay') }}</el-radio-button>
|
||||||
<el-radio-button label="hour">按小时</el-radio-button>
|
<el-radio-button label="hour">{{ $t('offLinePartCount.byHour') }}</el-radio-button>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<el-button
|
<el-button
|
||||||
class="functionButton"
|
class="functionButton"
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
icon="el-icon-search"
|
icon="el-icon-search"
|
||||||
plain
|
plain
|
||||||
@click="searchTable(true)"
|
@click="searchTable(true)"
|
||||||
>查询</el-button>
|
>{{ $t('offLinePartCount.search') }}</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="info"
|
type="info"
|
||||||
style="margin-left: 0"
|
style="margin-left: 0"
|
||||||
@@ -60,8 +60,8 @@
|
|||||||
size="small"
|
size="small"
|
||||||
plain
|
plain
|
||||||
@click="exportExcel()"
|
@click="exportExcel()"
|
||||||
>导出</el-button>
|
>{{ $t('offLinePartCount.export') }}</el-button>
|
||||||
<span v-show="isExporting" style="color: #16a188">正在导出....</span>
|
<span v-show="isExporting" style="color: #16a188">{{ $t('offLinePartCount.exporting') }}</span>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
@@ -85,25 +85,25 @@
|
|||||||
<el-table-column
|
<el-table-column
|
||||||
type="index"
|
type="index"
|
||||||
align="center"
|
align="center"
|
||||||
label="序号"
|
:label="$t('offLinePartCount.sequence')"
|
||||||
width="90px"
|
width="90px"
|
||||||
/>
|
/>
|
||||||
<el-table-column width="200px" label="订单号" align="center">
|
<el-table-column width="200px" :label="$t('offLinePartCount.orderNumber')" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.订单号 }}
|
{{ scope.row.订单号 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column min-width="240px" label="产品编号" align="center">
|
<el-table-column min-width="240px" :label="$t('offLinePartCount.productNumber')" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.发动机号 }}
|
{{ scope.row.发动机号 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品型号" width="200px" align="center">
|
<el-table-column :label="$t('offLinePartCount.productModel')" width="200px" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.机型 }}
|
{{ scope.row.机型 }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="下线时间" width="250px" align="center">
|
<el-table-column :label="$t('offLinePartCount.offlineTime')" width="250px" align="center">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ scope.row.离开时间 }}
|
{{ scope.row.离开时间 }}
|
||||||
</template>
|
</template>
|
||||||
@@ -282,7 +282,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.trendChart.setOption({
|
this.trendChart.setOption({
|
||||||
title: {
|
title: {
|
||||||
text: '下线产量趋势分析',
|
text: this.$t('offLinePartCount.trendTitle'),
|
||||||
left: 'center'
|
left: 'center'
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@@ -298,14 +298,14 @@ export default {
|
|||||||
show: true,
|
show: true,
|
||||||
feature: {
|
feature: {
|
||||||
saveAsImage: {
|
saveAsImage: {
|
||||||
title: '保存为图片',
|
title: this.$t('offLinePartCount.saveAsImage'),
|
||||||
type: 'png'
|
type: 'png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
name: this.trendMode === 'day' ? '日期' : '小时',
|
name: this.trendMode === 'day' ? this.$t('offLinePartCount.dateAxis') : this.$t('offLinePartCount.hourAxis'),
|
||||||
data: this.trendXAxis,
|
data: this.trendXAxis,
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
interval: 0,
|
interval: 0,
|
||||||
@@ -314,11 +314,11 @@ export default {
|
|||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'value',
|
||||||
name: '下线发动机数量',
|
name: this.$t('offLinePartCount.offlineQuantityAxis'),
|
||||||
minInterval: 1
|
minInterval: 1
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
name: '下线数量',
|
name: this.$t('offLinePartCount.offlineQuantitySeries'),
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barMaxWidth: 40,
|
barMaxWidth: 40,
|
||||||
data: this.trendSeries,
|
data: this.trendSeries,
|
||||||
@@ -344,7 +344,7 @@ export default {
|
|||||||
this.dateTime && this.dateTime.length === 2 ? dateTimeCheck = 1 : dateTimeCheck = 0
|
this.dateTime && this.dateTime.length === 2 ? dateTimeCheck = 1 : dateTimeCheck = 0
|
||||||
if (dateTimeCheck === 0) {
|
if (dateTimeCheck === 0) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '请选择开始时间与结束时间!',
|
message: this.$t('offLinePartCount.selectDateRange'),
|
||||||
type: 'error'
|
type: 'error'
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -368,7 +368,7 @@ export default {
|
|||||||
this.isExporting = false
|
this.isExporting = false
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
this.$message.warning('暂无数据')
|
this.$message.warning(this.$t('offLinePartCount.noData'))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSizeChanges(val) {
|
handleSizeChanges(val) {
|
||||||
@@ -382,6 +382,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
'$i18n.locale'() {
|
||||||
|
this.renderTrendChart()
|
||||||
|
},
|
||||||
trendMode() {
|
trendMode() {
|
||||||
this.getTrendData()
|
this.getTrendData()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-card class="topCard">
|
<el-card class="topCard">
|
||||||
<el-row>
|
<el-row class="toolbarRow">
|
||||||
<span class="promptText">
|
<span class="promptText">{{ $t('stationBeat.productionTimeLabel') }}</span>
|
||||||
时间范围:
|
|
||||||
</span>
|
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeFrame"
|
v-model="dateTime"
|
||||||
:picker-options="pickerOptions"
|
:clearable="false"
|
||||||
type="datetimerange"
|
align="center"
|
||||||
class="functionButton"
|
:end-placeholder="$t('stationBeat.endDate')"
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
format="yyyy-MM-dd"
|
||||||
format="yyyy-MM-dd HH:mm:ss"
|
:range-separator="$t('stationBeat.dateRangeSeparator')"
|
||||||
range-separator="至"
|
size="small"
|
||||||
start-placeholder="开始日期"
|
:start-placeholder="$t('stationBeat.startDate')"
|
||||||
end-placeholder="结束日期"
|
style="width: 240px"
|
||||||
align="right"/>
|
type="daterange"
|
||||||
<span class="promptText">
|
value-format="yyyy-MM-dd"
|
||||||
工位:
|
/>
|
||||||
</span>
|
<span class="promptText">{{ $t('stationBeat.stationLabel') }}</span>
|
||||||
<el-select v-model="station" class="functionButton" multiple collapse-tags placeholder="请选择" @change="select1()">
|
<el-select
|
||||||
|
v-model="stationValues"
|
||||||
|
:placeholder="$t('stationBeat.selectStation')"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
collapse-tags
|
||||||
|
multiple
|
||||||
|
size="small"
|
||||||
|
style="width: 320px"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stationOptions"
|
v-for="item in stationOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -26,339 +33,346 @@
|
|||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button class="functionButton" type="success" icon="el-icon-search" plain @click="searchTable()">查询</el-button>
|
<span style="margin-left: 10px">{{ $t('stationBeat.orderNumberLabel') }}</span>
|
||||||
<el-button class="functionButton" style="margin-left: 0" type="success" icon="el-icon-document" plain @click="exportExcel()">导出</el-button>
|
<el-input
|
||||||
<span v-show="isExporting" style="color: #16a188">正在导出....</span>
|
v-model="orderNumberValue"
|
||||||
|
:placeholder="$t('stationBeat.orderNumberPlaceholder')"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
style="width: 150px"
|
||||||
|
/>
|
||||||
|
<span class="promptText">{{ $t('stationBeat.productModelLabel') }}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="engineTypeValue"
|
||||||
|
:placeholder="$t('stationBeat.selectProductModel')"
|
||||||
|
filterable
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
style="width: 150px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in engineType"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-button
|
||||||
|
class="functionButton"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-search"
|
||||||
|
plain
|
||||||
|
@click="searchTable()"
|
||||||
|
>{{ $t('stationBeat.search') }}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-download"
|
||||||
|
plain
|
||||||
|
@click="exportExcel()"
|
||||||
|
>{{ $t('stationBeat.excel') }}</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<div class="chartCard">
|
||||||
|
<div id="stationBeatChart" class="chartDom" />
|
||||||
|
</div>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="13">
|
|
||||||
<div>
|
|
||||||
<el-table
|
<el-table
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
ref="tableDataBeat"
|
|
||||||
:data="tableData"
|
:data="tableData"
|
||||||
highlight-current-row
|
|
||||||
border
|
border
|
||||||
stripe
|
stripe
|
||||||
class="tableCustomization"
|
class="tableCustomization"
|
||||||
height="730px"
|
height="650px"
|
||||||
@sort-change="sortChange">
|
style="width: 100%"
|
||||||
<el-table-column type="index" align="center" label="序号" width="70px"/>
|
>
|
||||||
<el-table-column width="80px" label="工位" prop="StationName" align="center" sortable>
|
<el-table-column type="index" align="center" :label="$t('stationBeat.sequence')" width="80" />
|
||||||
<template slot-scope="scope">
|
<el-table-column prop="工位" :label="$t('stationBeat.station')" align="center" min-width="140" />
|
||||||
{{ scope.row.StationName }}
|
<el-table-column prop="总平均节拍" :label="$t('stationBeat.totalAverageBeat')" align="center" min-width="140" />
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column width="160px" label="总平均节拍(s)" prop="AB" align="center" sortable>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row.AB }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-for="(item, index) in tableHeader"
|
v-for="item in dynamicDateColumns"
|
||||||
:key="index"
|
:key="item.prop"
|
||||||
:label="item.时间"
|
:prop="item.prop"
|
||||||
min-width="111px"
|
:label="item.label"
|
||||||
align="center">
|
align="center"
|
||||||
<template slot-scope="scope">
|
min-width="130"
|
||||||
{{ scope.row[item.时间] }}
|
/>
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<!--<div class="block" style="margin-top: 10px;">
|
|
||||||
<el-pagination
|
|
||||||
:current-page="pageCurrent"
|
|
||||||
:page-sizes="[10, 20, 30, 40, 100]"
|
|
||||||
:page-size="pageSize"
|
|
||||||
:total="total"
|
|
||||||
layout="total, sizes, prev, pager, next, jumper"
|
|
||||||
@size-change="handleSizeChanges"
|
|
||||||
@current-change="handleCurrentChanges"/>
|
|
||||||
</div>-->
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="11">
|
|
||||||
<div style="margin-top: 26px;">
|
|
||||||
<div id="dashboardOne" style="height: 730px;width: 800px;border: 1px solid #9f9f9f"/>
|
|
||||||
</div>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import { getNowShotTime } from '../../../utils/tool'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isExporting: false,
|
dateTime: [],
|
||||||
dataZoomStart: 0,
|
stationValues: [],
|
||||||
dataZoomEnd: 50,
|
|
||||||
chartDom1: null,
|
|
||||||
myChart1X: [],
|
|
||||||
myChart1Y: [],
|
|
||||||
// 时间范围
|
|
||||||
timeFrame: '',
|
|
||||||
tableHeader: [],
|
|
||||||
pickerOptions: {
|
|
||||||
shortcuts: [{
|
|
||||||
text: '最近一周',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: '最近一个月',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: '最近三个月',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
// 两个复选框
|
|
||||||
alarmNameOptions: [],
|
|
||||||
stationOptions: [],
|
stationOptions: [],
|
||||||
station: [],
|
orderNumberValue: '',
|
||||||
stationString: '',
|
engineTypeValue: '',
|
||||||
alarmCode: [],
|
engineType: [],
|
||||||
alarmCodeString: '',
|
|
||||||
// 表格
|
|
||||||
tableData: [],
|
tableData: [],
|
||||||
loading: false,
|
loading: false,
|
||||||
// 分页
|
dynamicDateColumns: [],
|
||||||
pageCurrent: 1, // 分页当前页
|
isExporting: false,
|
||||||
pageSize: 10, // 分页每页显示条数
|
chartDom: null
|
||||||
total: 0 // 分页总数
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
activated() {
|
created() {
|
||||||
this.getStation()
|
this.dateTime = [getNowShotTime(), getNowShotTime()]
|
||||||
this.initCharDom()
|
this.getStationOptions()
|
||||||
|
this.getEngineType()
|
||||||
|
this.searchTable()
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.initChart()
|
||||||
|
window.addEventListener('resize', this.handleResize)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.handleResize)
|
||||||
|
if (this.chartDom) {
|
||||||
|
this.chartDom.dispose()
|
||||||
|
this.chartDom = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$i18n.locale'() {
|
||||||
|
this.renderChart()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sortChange({ column, prop, order }) {
|
getStationOptions() {
|
||||||
this.myChart1X = []
|
|
||||||
this.myChart1Y = []
|
|
||||||
for (let i = 0; i < this.$refs.tableDataBeat.tableData.length; i++) {
|
|
||||||
this.myChart1X.push(this.$refs.tableDataBeat.tableData[i].StationName)
|
|
||||||
this.myChart1Y.push(this.$refs.tableDataBeat.tableData[i].AB)
|
|
||||||
}
|
|
||||||
this.drawDashboardOne()
|
|
||||||
},
|
|
||||||
initCharDom() {
|
|
||||||
this.chartDom1 = echarts.init(document.getElementById('dashboardOne'))
|
|
||||||
},
|
|
||||||
select1() {
|
|
||||||
this.stationString = ''
|
|
||||||
if (this.station.length > 0) {
|
|
||||||
this.stationString = "'" + this.station[0] + "'"
|
|
||||||
for (let i = 1; i < this.station.length; i++) {
|
|
||||||
this.stationString = this.stationString + ",'" + this.station[i] + "'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (this.station.length <= 25 && this.station.length !== 0) { this.dataZoomEnd = 100 } else { this.dataZoomEnd = 50 }
|
|
||||||
},
|
|
||||||
getStation() {
|
|
||||||
this.stationOptions = []
|
this.stationOptions = []
|
||||||
const Data = this.CreateData('11', 'SP_Station_Query')
|
const param = []
|
||||||
|
const Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
|
||||||
this.ExecDatabase(Data).then(response => {
|
this.ExecDatabase(Data).then(response => {
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
const source = response.data || []
|
||||||
this.stationOptions.push({
|
this.stationOptions = source.map(item => ({
|
||||||
label: response.data[i].StationName,
|
label: item.工位名称 ? `【${item.工位号}】${item.工位名称}` : item.工位号,
|
||||||
value: response.data[i].StationName
|
value: item.工位号
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
getEngineType() {
|
||||||
|
this.engineType = []
|
||||||
|
const param = []
|
||||||
|
const Data = this.CreateData('11', 'MES_基本变量_机型代码_查询', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
|
const source = response.data || []
|
||||||
|
this.engineType = source.map(item => ({
|
||||||
|
label: item.发动机型号 + '-' + item.标识字符,
|
||||||
|
value: item.发动机机型标志
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchTable() {
|
searchTable() {
|
||||||
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
|
|
||||||
this.loading = true
|
this.loading = true
|
||||||
this.myChart1X = []
|
const param = []
|
||||||
this.myChart1Y = []
|
param[0] = ['开始时间', this.dateTime[0]]
|
||||||
let timeFrame_check, Station_check
|
param[1] = ['结束时间', this.dateTime[1]]
|
||||||
this.timeFrame ? timeFrame_check = 1 : timeFrame_check = 0
|
param[2] = ['工位_check', stationCheck]
|
||||||
this.stationString ? Station_check = 1 : Station_check = 0
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
if (timeFrame_check === 0) {
|
param[4] = ['订单号_check', orderCheck]
|
||||||
this.$message({
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
message: '请选择开始时间与结束时间!',
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
type: 'error'
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态_工位节拍统计', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
|
const source = response.data || []
|
||||||
|
this.buildDynamicTable(source)
|
||||||
|
this.renderChart()
|
||||||
|
this.loading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.tableData = []
|
||||||
|
this.dynamicDateColumns = []
|
||||||
|
this.renderChart()
|
||||||
|
this.loading = false
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
buildDynamicTable(source) {
|
||||||
|
const dateMap = {}
|
||||||
|
const rowMap = {}
|
||||||
|
|
||||||
|
source.forEach(item => {
|
||||||
|
if (!dateMap[item.日期]) {
|
||||||
|
dateMap[item.日期] = true
|
||||||
|
}
|
||||||
|
if (!rowMap[item.工位]) {
|
||||||
|
rowMap[item.工位] = {
|
||||||
|
工位: item.工位,
|
||||||
|
总平均节拍: item.总平均节拍
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowMap[item.工位][item.日期] = item.当日平均节拍
|
||||||
|
rowMap[item.工位].总平均节拍 = item.总平均节拍
|
||||||
|
})
|
||||||
|
|
||||||
|
const dates = Object.keys(dateMap).sort()
|
||||||
|
this.dynamicDateColumns = dates.map(date => ({
|
||||||
|
label: date,
|
||||||
|
prop: date
|
||||||
|
}))
|
||||||
|
|
||||||
|
this.tableData = Object.keys(rowMap).map(key => {
|
||||||
|
const row = rowMap[key]
|
||||||
|
dates.forEach(date => {
|
||||||
|
if (typeof row[date] === 'undefined') {
|
||||||
|
row[date] = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return row
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initChart() {
|
||||||
|
const dom = document.getElementById('stationBeatChart')
|
||||||
|
if (!dom) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.tableData = []
|
this.chartDom = this.$echarts.getInstanceByDom(dom)
|
||||||
const param = []
|
if (!this.chartDom) {
|
||||||
param[0] = ['timeFrame_check', timeFrame_check]
|
this.chartDom = this.$echarts.init(dom)
|
||||||
param[1] = ['QueryStartTime', this.timeFrame[0]]
|
|
||||||
param[2] = ['QueryEndTime', this.timeFrame[1]]
|
|
||||||
param[3] = ['Station_check', Station_check]
|
|
||||||
param[4] = ['Station', this.stationString]
|
|
||||||
const Data = this.CreateData('11', 'SP_His_StationBeat_TableHeaderQuery', param)
|
|
||||||
this.ExecDatabase(Data).then(response => {
|
|
||||||
if (response.data.length > 0) {
|
|
||||||
this.tableHeader = response.data
|
|
||||||
// 查询表的信息
|
|
||||||
const param1 = []
|
|
||||||
param1[0] = ['Station_check', Station_check]
|
|
||||||
param1[1] = ['Station', this.stationString]
|
|
||||||
const Data1 = this.CreateData('11', 'SP_His_StationBeat_Query', param1)
|
|
||||||
this.ExecDatabase(Data1).then(response => {
|
|
||||||
this.tableData = response.data
|
|
||||||
for (let i = 0; i < this.tableData.length; i++) {
|
|
||||||
this.myChart1X.push(this.tableData[i].StationName)
|
|
||||||
this.myChart1Y.push(this.tableData[i].AB)
|
|
||||||
}
|
}
|
||||||
if (this.tableData.length <= 25 && this.tableData.length !== 0) { this.dataZoomEnd = 100 } else { this.dataZoomEnd = 30 }
|
this.renderChart()
|
||||||
this.total = response.data.length
|
|
||||||
this.loading = false
|
|
||||||
this.drawDashboardOne()
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$message({
|
|
||||||
message: '选择的该时间段没有数据!',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
this.loading = false
|
|
||||||
this.drawDashboardOne()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
drawDashboardOne() {
|
renderChart() {
|
||||||
this.chartDom1.setOption({
|
if (!this.chartDom) {
|
||||||
|
this.initChart()
|
||||||
|
}
|
||||||
|
if (!this.chartDom) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const chartData = [...this.tableData]
|
||||||
|
.map(item => ({
|
||||||
|
station: item.工位,
|
||||||
|
beat: Number(item.总平均节拍 || 0)
|
||||||
|
}))
|
||||||
|
.sort((a, b) => b.beat - a.beat)
|
||||||
|
|
||||||
|
this.chartDom.setOption({
|
||||||
title: {
|
title: {
|
||||||
text: '工位平均节拍统计',
|
text: this.$t('stationBeat.totalAverageBeatChartTitle'),
|
||||||
left: 'center'
|
left: 'center'
|
||||||
},
|
},
|
||||||
grid: [
|
|
||||||
{
|
|
||||||
left: '8%',
|
|
||||||
top: '10%',
|
|
||||||
right: '8%',
|
|
||||||
bottom: '10%'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
axisPointer: {
|
axisPointer: {
|
||||||
type: 'shadow'
|
type: 'shadow'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dataZoom: [
|
grid: {
|
||||||
{
|
left: '6%',
|
||||||
type: 'slider', // slider表示有滑动块的,inside表示内置的
|
right: '6%',
|
||||||
|
bottom: '8%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
show: true,
|
show: true,
|
||||||
xAxisIndex: [0],
|
feature: {
|
||||||
start: this.dataZoomStart,
|
saveAsImage: {
|
||||||
end: this.dataZoomEnd
|
title: this.$t('stationBeat.saveAsImage'),
|
||||||
|
type: 'png'
|
||||||
}
|
}
|
||||||
],
|
|
||||||
xAxis: {
|
|
||||||
name: '工位号',
|
|
||||||
type: 'category',
|
|
||||||
data: this.myChart1X,
|
|
||||||
axisLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
splitLine: {
|
xAxis: {
|
||||||
show: false
|
type: 'value',
|
||||||
}
|
name: this.$t('stationBeat.totalAverageBeatAxis')
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value',
|
type: 'category',
|
||||||
name: '平均节拍',
|
data: chartData.map(item => item.station),
|
||||||
axisLine: {
|
name: this.$t('stationBeat.station')
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#000'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
splitLine: {
|
series: [{
|
||||||
show: false
|
name: this.$t('stationBeat.totalAverageBeatSeries'),
|
||||||
}
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '平均节拍',
|
|
||||||
data: this.myChart1Y,
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
itemStyle: '#209de2',
|
data: chartData.map(item => item.beat),
|
||||||
|
barMaxWidth: 28,
|
||||||
|
itemStyle: {
|
||||||
|
color: '#67C23A'
|
||||||
|
},
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
color: '#000',
|
position: 'right',
|
||||||
formatter: '{c}',
|
color: '#333'
|
||||||
position: 'top'
|
|
||||||
}
|
}
|
||||||
|
}]
|
||||||
|
}, true)
|
||||||
|
},
|
||||||
|
handleResize() {
|
||||||
|
if (this.chartDom) {
|
||||||
|
this.chartDom.resize()
|
||||||
}
|
}
|
||||||
]
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
exportExcel() {
|
exportExcel() {
|
||||||
if (this.tableData.length !== 0) {
|
if (this.tableData.length === 0) {
|
||||||
let timeFrame_check, Station_check
|
this.$message.warning(this.$t('stationBeat.noData'))
|
||||||
this.timeFrame ? timeFrame_check = 1 : timeFrame_check = 0
|
|
||||||
this.stationString ? Station_check = 1 : Station_check = 0
|
|
||||||
if (timeFrame_check === 0) {
|
|
||||||
this.$message({
|
|
||||||
message: '请选择开始时间与结束时间!',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const param = []
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
param[0] = ['timeFrame_check', timeFrame_check]
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
param[1] = ['QueryStartTime', this.timeFrame[0]]
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
param[2] = ['QueryEndTime', this.timeFrame[1]]
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
param[3] = ['Station_check', Station_check]
|
|
||||||
param[4] = ['Station', this.stationString]
|
|
||||||
const Data = this.CreateData('11', 'SP_His_StationBeat_TableHeaderQuery', param)
|
|
||||||
this.ExecDatabase(Data).then(response => {
|
|
||||||
if (response.data.length > 0) {
|
|
||||||
this.isExporting = true
|
this.isExporting = true
|
||||||
const param1 = []
|
const param = []
|
||||||
param1[0] = ['Station_check', Station_check]
|
param[0] = ['开始时间', this.dateTime[0]]
|
||||||
param1[1] = ['Station', this.stationString]
|
param[1] = ['结束时间', this.dateTime[1]]
|
||||||
const Data1 = this.CreateData('2003', 'SP_His_StationBeat_ExportExcel', param1)
|
param[2] = ['工位_check', stationCheck]
|
||||||
const blob = 'data:image/gif;base64,R0lGODlhCQACAIAAAMzMzP///yH5BAEAAAEALAAAAAAJAAIAAAIEjI9pUAA7'
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
this.exportExcel_NPOI(Data1, blob).then(res => {
|
param[4] = ['订单号_check', orderCheck]
|
||||||
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
const Data = this.CreateData('2001', '质量数据查询_测量数据发动机在线状态_工位节拍统计_导出', param)
|
||||||
|
this.exportExcel_NPOI(Data).then(() => {
|
||||||
|
this.isExporting = false
|
||||||
|
}).catch(() => {
|
||||||
this.isExporting = false
|
this.isExporting = false
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
this.$message({
|
|
||||||
message: '选择的该时间段没有数据!',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$message.warning('暂无数据')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleSizeChanges(val) {
|
|
||||||
this.pageCurrent = 1
|
|
||||||
this.pageSize = val
|
|
||||||
this.searchTable()
|
|
||||||
},
|
|
||||||
handleCurrentChanges(val) {
|
|
||||||
this.pageCurrent = val
|
|
||||||
this.searchTable()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.topCard {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbarRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px 0;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chartCard {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chartDom {
|
||||||
|
width: 100%;
|
||||||
|
height: 360px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
|
||||||
<el-card class="topCard">
|
<el-card class="topCard">
|
||||||
<el-tabs v-model="activeName">
|
<el-tabs v-model="activeTab" @tab-click="handleTabChange">
|
||||||
<el-tab-pane label="各区JPH完成统计" name="first">
|
<el-tab-pane :label="$t('stationJph.realtimeTab')" name="realtime">
|
||||||
<div style="height: 780px;overflow: auto;width: 1500px">
|
<div class="chartCard">
|
||||||
<el-row v-for="item in JPHDataList" :key="item" style="margin: 5px">
|
<div id="stationJphRealtimeChart" class="chartDom" />
|
||||||
<div style="height: 500px;border: 1px solid #868686">
|
|
||||||
<div style="position: absolute;right: 5%;top: 2%;font-size: 1.5rem">
|
|
||||||
<div style="padding: 12px 20px;line-height: 1;border: 2px solid #00893d;">
|
|
||||||
<span>当班产量:</span>
|
|
||||||
<span style="font-weight: bolder">{{ currentBeatCount.get(item) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<el-button type="text" icon="el-icon-refresh" style="position: absolute;right: 2%;top: 2%;font-size: 1.5rem" @click="searchChartData4_opPlanCount"/>
|
|
||||||
<div :id="item + '_big'" style="width: 1400px;height: 500px;margin: 5px"/>
|
|
||||||
</div>
|
|
||||||
</el-row>
|
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="工位JPH查询" name="second">
|
|
||||||
<el-row>
|
<el-tab-pane :label="$t('stationJph.historyTab')" name="history">
|
||||||
<span class="promptText">日期范围:</span>
|
<el-row class="toolbarRow">
|
||||||
|
<span class="promptText">{{ $t('stationJph.productionTimeLabel') }}</span>
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="timeFrame"
|
v-model="dateTime"
|
||||||
:picker-options="pickerOptions"
|
:clearable="false"
|
||||||
type="daterange"
|
align="center"
|
||||||
class="functionButton"
|
:end-placeholder="$t('stationJph.endDate')"
|
||||||
value-format="yyyy-MM-dd"
|
|
||||||
format="yyyy-MM-dd"
|
format="yyyy-MM-dd"
|
||||||
range-separator="至"
|
:range-separator="$t('stationJph.dateRangeSeparator')"
|
||||||
start-placeholder="开始日期"
|
size="small"
|
||||||
end-placeholder="结束日期"
|
:start-placeholder="$t('stationJph.startDate')"
|
||||||
align="right"/>
|
style="width: 240px"
|
||||||
<span class="promptText">工位:</span>
|
type="daterange"
|
||||||
<el-select v-model="station" class="functionButton" placeholder="请选择">
|
value-format="yyyy-MM-dd"
|
||||||
|
/>
|
||||||
|
<span class="promptText">{{ $t('stationJph.stationLabel') }}</span>
|
||||||
|
<el-select
|
||||||
|
v-model="stationValues"
|
||||||
|
:placeholder="$t('stationJph.selectStation')"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
collapse-tags
|
||||||
|
multiple
|
||||||
|
size="small"
|
||||||
|
style="width: 320px"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in stationOptions"
|
v-for="item in stationOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -41,484 +41,443 @@
|
|||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-button class="functionButton" type="success" icon="el-icon-search" plain @click="searchTable()">查询</el-button>
|
<span style="margin-left: 10px">{{ $t('stationJph.orderNumberLabel') }}</span>
|
||||||
<el-button class="functionButton" style="margin-left: 0" type="success" icon="el-icon-document" plain @click="exportExcel()">导出</el-button>
|
<el-input
|
||||||
<span v-show="isExporting" style="color: #16a188">正在导出....</span>
|
v-model="orderNumberValue"
|
||||||
<div style="height: 50px;line-height: 50px">
|
:placeholder="$t('stationJph.orderNumberPlaceholder')"
|
||||||
<span>
|
clearable
|
||||||
小时范围:
|
size="small"
|
||||||
</span>
|
style="width: 150px"
|
||||||
<div style="display: inline-block;width: 1000px">
|
/>
|
||||||
<el-slider
|
<span class="promptText">{{ $t('stationJph.productModelLabel') }}</span>
|
||||||
v-model="timeRange"
|
<el-select
|
||||||
:max="23"
|
v-model="engineTypeValue"
|
||||||
:marks="marks"
|
:placeholder="$t('stationJph.selectProductModel')"
|
||||||
range
|
filterable
|
||||||
@change="changeHourRange" />
|
clearable
|
||||||
</div>
|
size="small"
|
||||||
</div>
|
style="width: 150px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in engineType"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-button
|
||||||
|
class="functionButton"
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-search"
|
||||||
|
plain
|
||||||
|
@click="handleSearch()"
|
||||||
|
>{{ $t('stationJph.search') }}</el-button>
|
||||||
|
<el-button
|
||||||
|
type="info"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-download"
|
||||||
|
plain
|
||||||
|
@click="exportExcel()"
|
||||||
|
>{{ $t('stationJph.export') }}</el-button>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
|
||||||
<el-table v-loading="loading" :data="tableData" :cell-style="set_cell_style" highlight-current-row border stripe class="tableCustomization" height="730px">
|
<div class="chartCard">
|
||||||
<el-table-column width="50px" label="ID" align="center">
|
<div id="stationJphHistoryChart" class="chartDom" />
|
||||||
<template slot-scope="scope">
|
</div>
|
||||||
{{ scope.row.ID }}
|
<el-table
|
||||||
</template>
|
v-loading="historyLoading"
|
||||||
</el-table-column>
|
:data="historyTableData"
|
||||||
<el-table-column width="105px" label="日期" align="center">
|
border
|
||||||
<template slot-scope="scope">
|
stripe
|
||||||
{{ scope.row.日期 }}
|
height="560px"
|
||||||
</template>
|
style="width: 100%"
|
||||||
</el-table-column>
|
>
|
||||||
<el-table-column
|
<el-table-column type="index" align="center" :label="$t('stationJph.sequence')" width="80" />
|
||||||
v-for="(item, index) in JPHHeaderF"
|
<el-table-column prop="日期" :label="$t('stationJph.date')" align="center" min-width="120" />
|
||||||
:key="index"
|
<el-table-column prop="小时段" :label="$t('stationJph.hourSlot')" align="center" min-width="120" />
|
||||||
:label="item"
|
<el-table-column prop="产量" :label="$t('stationJph.outputQty')" align="center" min-width="100" />
|
||||||
:width="calculateCellWidth(item)"
|
|
||||||
align="center">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
{{ scope.row[item] }}
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-row>
|
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import echarts from 'echarts'
|
import { getNowShotTime } from '../../../utils/tool'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
timer: null,
|
activeTab: 'realtime',
|
||||||
currentBeatCount: new Map(),
|
dateTime: [],
|
||||||
JPHData: new Map(),
|
stationValues: [],
|
||||||
JPHData_PlanCount: new Map(),
|
|
||||||
JPHDataList: [],
|
|
||||||
activeName: 'first',
|
|
||||||
isExporting: false,
|
|
||||||
timeRange: [0, 23],
|
|
||||||
marks: {
|
|
||||||
'0': '00',
|
|
||||||
'1': '01',
|
|
||||||
'2': '02',
|
|
||||||
'3': '03',
|
|
||||||
'4': '04',
|
|
||||||
'5': '05',
|
|
||||||
'6': '06',
|
|
||||||
'7': '07',
|
|
||||||
'8': '08',
|
|
||||||
'9': '09',
|
|
||||||
'10': '10',
|
|
||||||
'11': '11',
|
|
||||||
'12': '12',
|
|
||||||
'13': '13',
|
|
||||||
'14': '14',
|
|
||||||
'15': '15',
|
|
||||||
'16': '16',
|
|
||||||
'17': '17',
|
|
||||||
'18': '18',
|
|
||||||
'19': '19',
|
|
||||||
'20': '20',
|
|
||||||
'21': '21',
|
|
||||||
'22': '22',
|
|
||||||
'23': '23'
|
|
||||||
},
|
|
||||||
JPHHeader: ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'],
|
|
||||||
JPHHeader2: ['结果'],
|
|
||||||
JPHHeaderF: [],
|
|
||||||
// 时间范围
|
|
||||||
timeFrame: '',
|
|
||||||
tableHeader: [],
|
|
||||||
pickerOptions: {
|
|
||||||
shortcuts: [{
|
|
||||||
text: '最近一周',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: '最近一个月',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
text: '最近三个月',
|
|
||||||
onClick(picker) {
|
|
||||||
const end = new Date()
|
|
||||||
const start = new Date()
|
|
||||||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
|
|
||||||
picker.$emit('pick', [start, end])
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
// 两个复选框
|
|
||||||
alarmNameOptions: [],
|
|
||||||
stationOptions: [],
|
stationOptions: [],
|
||||||
station: '',
|
orderNumberValue: '',
|
||||||
alarmCode: [],
|
engineTypeValue: '',
|
||||||
alarmCodeString: '',
|
engineType: [],
|
||||||
// 表格
|
historyTableData: [],
|
||||||
tableData: [],
|
realtimeLoading: false,
|
||||||
loading: false,
|
historyLoading: false,
|
||||||
// 分页
|
realtimeChart: null,
|
||||||
pageCurrent: 1, // 分页当前页
|
historyChart: null,
|
||||||
pageSize: 10, // 分页每页显示条数
|
realtimeSource: [],
|
||||||
total: 0 // 分页总数
|
historySource: [],
|
||||||
|
realtimeTimer: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
|
||||||
},
|
|
||||||
created() {
|
created() {
|
||||||
this.JPHHeaderF = [...this.JPHHeader, ...this.JPHHeader2]
|
this.dateTime = [getNowShotTime(), getNowShotTime()]
|
||||||
this.getStation()
|
this.getStationOptions()
|
||||||
// this.searchChartData4_opPlanCount()
|
this.getEngineType()
|
||||||
this.searchTable56()
|
this.getRealtimeData()
|
||||||
|
this.getHistoryData()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.timer = setInterval(() => {
|
this.$nextTick(() => {
|
||||||
// this.searchChartData4_opPlanCount()
|
this.initRealtimeChart()
|
||||||
}, 1000 * 60)
|
this.initHistoryChart()
|
||||||
|
if (this.activeTab === 'realtime') {
|
||||||
|
this.startRealtimePolling()
|
||||||
|
}
|
||||||
|
window.addEventListener('resize', this.handleResize)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
clearInterval(this.timer)
|
this.stopRealtimePolling()
|
||||||
|
window.removeEventListener('resize', this.handleResize)
|
||||||
|
if (this.realtimeChart) {
|
||||||
|
this.realtimeChart.dispose()
|
||||||
|
this.realtimeChart = null
|
||||||
|
}
|
||||||
|
if (this.historyChart) {
|
||||||
|
this.historyChart.dispose()
|
||||||
|
this.historyChart = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
'$i18n.locale'() {
|
||||||
|
this.renderRealtimeChart()
|
||||||
|
this.renderHistoryChart()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getStation() {
|
getStationOptions() {
|
||||||
this.stationOptions = []
|
|
||||||
const Data = this.CreateData('11', 'SP_Station_Query')
|
|
||||||
this.ExecDatabase(Data).then(response => {
|
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
|
||||||
this.stationOptions.push({
|
|
||||||
label: response.data[i].StationName,
|
|
||||||
value: response.data[i].StationName
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.station = this.stationOptions[0].value
|
|
||||||
})
|
|
||||||
},
|
|
||||||
changeHourRange(value) {
|
|
||||||
const newArray = this.JPHHeader.slice(value[0], value[1] + 1)
|
|
||||||
this.JPHHeaderF = [...newArray, ...this.JPHHeader2]
|
|
||||||
console.log(newArray)
|
|
||||||
for (let i = 1; i < this.tableData.length; i++) {
|
|
||||||
const tempData = this.tableData[i]
|
|
||||||
let tempDataResultOkCount = 0
|
|
||||||
let tempDataResultAll = 0
|
|
||||||
for (const responseKey in tempData) {
|
|
||||||
if (newArray.indexOf(responseKey) !== -1) {
|
|
||||||
tempDataResultAll += 1
|
|
||||||
if (tempData[responseKey + '_result']) {
|
|
||||||
tempDataResultOkCount += 1
|
|
||||||
}
|
|
||||||
tempData['结果'] = `${tempDataResultOkCount} / ${tempDataResultAll}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 设置单元格颜色
|
|
||||||
set_cell_style({ row, column, rowIndex, columnIndex }) {
|
|
||||||
if (row.日期 !== '目标产量') {
|
|
||||||
if (this.JPHHeader.indexOf(column.label) !== -1) {
|
|
||||||
if (row[column.label + '_result']) {
|
|
||||||
return {
|
|
||||||
'background': '#00893d',
|
|
||||||
'color': 'white'
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
'background': '#fcb3bb',
|
|
||||||
'color': 'white'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
searchTable() {
|
|
||||||
if (this.timeFrame === null || this.timeFrame === '' || this.timeFrame[0] === '') {
|
|
||||||
this.$message.error('请选择日期范围')
|
|
||||||
this.loading = false
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 查询表的信息
|
|
||||||
this.loading = true
|
|
||||||
this.tableData = []
|
|
||||||
const param = []
|
const param = []
|
||||||
let tableDataTemp = []
|
const Data = this.CreateData('11', 'MES_计划BOM_工位与名称_查询', param)
|
||||||
const Data = this.CreateData('11', 'SP_His_StationJPH_TableHeaderQuery', param)
|
|
||||||
this.ExecDatabase(Data).then(response => {
|
this.ExecDatabase(Data).then(response => {
|
||||||
if (response.data.length > 0) {
|
const source = response.data || []
|
||||||
tableDataTemp = response.data
|
this.stationOptions = source.map(item => ({
|
||||||
const param1 = []
|
label: item.工位名称 ? `【${item.工位号}】${item.工位名称}` : item.工位号,
|
||||||
param1[0] = ['QueryStartDate', this.timeFrame[0]]
|
value: item.工位号
|
||||||
param1[1] = ['QueryEndDate', this.timeFrame[1]]
|
}))
|
||||||
param1[2] = ['Station', this.station]
|
|
||||||
const Data1 = this.CreateData('11', 'SP_His_StationJPH_Query', param1)
|
|
||||||
this.ExecDatabase(Data1).then(response => {
|
|
||||||
if (response.data.length > 0) {
|
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
|
||||||
const tempData = response.data[i]
|
|
||||||
let tempDataResult = false
|
|
||||||
let tempDataResultOkCount = 0
|
|
||||||
let tempDataResultAll = 0
|
|
||||||
for (const responseKey in tempData) {
|
|
||||||
if (this.JPHHeader.indexOf(responseKey) !== -1) {
|
|
||||||
tempDataResultAll += 1
|
|
||||||
if (tempData[responseKey] > tableDataTemp[0][responseKey]) {
|
|
||||||
tempDataResult = true
|
|
||||||
tempDataResultOkCount += 1
|
|
||||||
} else {
|
|
||||||
tempDataResult = false
|
|
||||||
}
|
|
||||||
tempData[responseKey + '_result'] = tempDataResult
|
|
||||||
tempData['结果'] = `${tempDataResultOkCount} / ${tempDataResultAll}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tableDataTemp.push(tempData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.tableData = tableDataTemp
|
|
||||||
this.loading = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$message({
|
|
||||||
message: '选择的该时间段没有数据!',
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
this.loading = false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
exportExcel() {
|
getEngineType() {
|
||||||
if (this.tableData.length === 0) {
|
const param = []
|
||||||
this.$message.warning('请查询要导出的内容')
|
const Data = this.CreateData('11', 'MES_基本变量_机型代码_查询', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
|
const source = response.data || []
|
||||||
|
this.engineType = source.map(item => ({
|
||||||
|
label: item.发动机型号 + '-' + item.标识字符,
|
||||||
|
value: item.发动机机型标志
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
buildParams(type) {
|
||||||
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
|
|
||||||
|
const param = []
|
||||||
|
param[0] = ['开始时间', this.dateTime[0]]
|
||||||
|
param[1] = ['结束时间', this.dateTime[1]]
|
||||||
|
param[2] = ['工位_check', stationCheck]
|
||||||
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
|
param[4] = ['订单号_check', orderCheck]
|
||||||
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
return this.CreateData(type, '', param)
|
||||||
|
},
|
||||||
|
handleSearch() {
|
||||||
|
this.getHistoryData()
|
||||||
|
},
|
||||||
|
handleTabChange() {
|
||||||
|
if (this.activeTab === 'realtime') {
|
||||||
|
this.getRealtimeData()
|
||||||
|
this.startRealtimePolling()
|
||||||
|
} else {
|
||||||
|
this.stopRealtimePolling()
|
||||||
|
}
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.handleResize()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getRealtimeData() {
|
||||||
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
|
this.realtimeLoading = true
|
||||||
|
const param = []
|
||||||
|
param[0] = ['开始时间', getNowShotTime()]
|
||||||
|
param[1] = ['结束时间', getNowShotTime()]
|
||||||
|
param[2] = ['工位_check', stationCheck]
|
||||||
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
|
param[4] = ['订单号_check', orderCheck]
|
||||||
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态_工位JPH_实时', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
|
this.realtimeSource = response.data || []
|
||||||
|
this.renderRealtimeChart()
|
||||||
|
this.realtimeLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.realtimeSource = []
|
||||||
|
this.renderRealtimeChart()
|
||||||
|
this.realtimeLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
startRealtimePolling() {
|
||||||
|
this.stopRealtimePolling()
|
||||||
|
this.realtimeTimer = setInterval(() => {
|
||||||
|
if (this.activeTab === 'realtime') {
|
||||||
|
this.getRealtimeData()
|
||||||
|
}
|
||||||
|
}, 30000)
|
||||||
|
},
|
||||||
|
stopRealtimePolling() {
|
||||||
|
if (this.realtimeTimer) {
|
||||||
|
clearInterval(this.realtimeTimer)
|
||||||
|
this.realtimeTimer = null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getHistoryData() {
|
||||||
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
|
this.historyLoading = true
|
||||||
|
const param = []
|
||||||
|
param[0] = ['开始时间', this.dateTime[0]]
|
||||||
|
param[1] = ['结束时间', this.dateTime[1]]
|
||||||
|
param[2] = ['工位_check', stationCheck]
|
||||||
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
|
param[4] = ['订单号_check', orderCheck]
|
||||||
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
const Data = this.CreateData('11', '质量数据查询_测量数据发动机在线状态_工位JPH_历史', param)
|
||||||
|
this.ExecDatabase(Data).then(response => {
|
||||||
|
this.historySource = response.data || []
|
||||||
|
this.historyTableData = this.historySource
|
||||||
|
this.renderHistoryChart()
|
||||||
|
this.historyLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.historySource = []
|
||||||
|
this.historyTableData = []
|
||||||
|
this.renderHistoryChart()
|
||||||
|
this.historyLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initRealtimeChart() {
|
||||||
|
const dom = document.getElementById('stationJphRealtimeChart')
|
||||||
|
if (!dom) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.tableData.length) {
|
this.realtimeChart = this.$echarts.getInstanceByDom(dom)
|
||||||
this.isExporting = false
|
if (!this.realtimeChart) {
|
||||||
const newTable = []
|
this.realtimeChart = this.$echarts.init(dom)
|
||||||
for (let i = 0; i < this.tableData.length; i++) {
|
|
||||||
newTable.push({
|
|
||||||
'ID': this.tableData[i]['ID'],
|
|
||||||
'日期': this.tableData[i]['日期'],
|
|
||||||
'00': this.tableData[i]['00'] ? this.tableData[i]['00'] : 0,
|
|
||||||
'01': this.tableData[i]['01'] ? this.tableData[i]['01'] : 0,
|
|
||||||
'02': this.tableData[i]['02'] ? this.tableData[i]['02'] : 0,
|
|
||||||
'03': this.tableData[i]['03'] ? this.tableData[i]['03'] : 0,
|
|
||||||
'04': this.tableData[i]['04'] ? this.tableData[i]['04'] : 0,
|
|
||||||
'05': this.tableData[i]['05'] ? this.tableData[i]['05'] : 0,
|
|
||||||
'06': this.tableData[i]['06'] ? this.tableData[i]['06'] : 0,
|
|
||||||
'07': this.tableData[i]['07'] ? this.tableData[i]['07'] : 0,
|
|
||||||
'08': this.tableData[i]['08'] ? this.tableData[i]['08'] : 0,
|
|
||||||
'09': this.tableData[i]['09'] ? this.tableData[i]['09'] : 0,
|
|
||||||
'10': this.tableData[i]['10'] ? this.tableData[i]['10'] : 0,
|
|
||||||
'11': this.tableData[i]['11'] ? this.tableData[i]['11'] : 0,
|
|
||||||
'12': this.tableData[i]['12'] ? this.tableData[i]['12'] : 0,
|
|
||||||
'13': this.tableData[i]['13'] ? this.tableData[i]['13'] : 0,
|
|
||||||
'14': this.tableData[i]['14'] ? this.tableData[i]['14'] : 0,
|
|
||||||
'15': this.tableData[i]['15'] ? this.tableData[i]['15'] : 0,
|
|
||||||
'16': this.tableData[i]['16'] ? this.tableData[i]['16'] : 0,
|
|
||||||
'17': this.tableData[i]['17'] ? this.tableData[i]['17'] : 0,
|
|
||||||
'18': this.tableData[i]['18'] ? this.tableData[i]['18'] : 0,
|
|
||||||
'19': this.tableData[i]['19'] ? this.tableData[i]['19'] : 0,
|
|
||||||
'20': this.tableData[i]['20'] ? this.tableData[i]['20'] : 0,
|
|
||||||
'21': this.tableData[i]['21'] ? this.tableData[i]['21'] : 0,
|
|
||||||
'22': this.tableData[i]['22'] ? this.tableData[i]['22'] : 0,
|
|
||||||
'23': this.tableData[i]['23'] ? this.tableData[i]['23'] : 0,
|
|
||||||
'结果': this.tableData[i]['结果'] ? this.tableData[i]['结果'] : ''
|
|
||||||
})
|
|
||||||
}
|
|
||||||
import('@/vendor/Export2Excel').then(excel => {
|
|
||||||
const dataGroup = []
|
|
||||||
const filterVal = ['ID', '日期', '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '结果']
|
|
||||||
const data = newTable.map(v => filterVal.map(j => v[j]))
|
|
||||||
dataGroup.push(data)
|
|
||||||
// 这个导出可以指定多个sheet表即使你只导出一个,你也要把 headerGroup定义为二维数组!!!!!!
|
|
||||||
const headerGroup = [['ID', '日期', '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '结果']]
|
|
||||||
const sheetGroup = ['工位JPH']
|
|
||||||
excel.export_json_to_excel({
|
|
||||||
headerGroup: headerGroup,
|
|
||||||
dataGroup: dataGroup,
|
|
||||||
sheetGroup: sheetGroup,
|
|
||||||
filename: '工位JPH',
|
|
||||||
autoWidth: true,
|
|
||||||
bookType: 'xlsx'
|
|
||||||
})
|
|
||||||
this.isExporting = false
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.$message.warning('请查询要导出的内容')
|
|
||||||
}
|
}
|
||||||
|
this.renderRealtimeChart()
|
||||||
},
|
},
|
||||||
calculateCellWidth(rowName) {
|
initHistoryChart() {
|
||||||
if (rowName === '结果') {
|
const dom = document.getElementById('stationJphHistoryChart')
|
||||||
return '80px'
|
if (!dom) {
|
||||||
} else {
|
return
|
||||||
return '40px'
|
|
||||||
}
|
}
|
||||||
|
this.historyChart = this.$echarts.getInstanceByDom(dom)
|
||||||
|
if (!this.historyChart) {
|
||||||
|
this.historyChart = this.$echarts.init(dom)
|
||||||
|
}
|
||||||
|
this.renderHistoryChart()
|
||||||
},
|
},
|
||||||
// JPH查询
|
renderRealtimeChart() {
|
||||||
searchChartData4() {
|
if (!this.realtimeChart) {
|
||||||
const scope = this
|
this.initRealtimeChart()
|
||||||
this.JPHData = new Map()
|
|
||||||
var param4 = []
|
|
||||||
var Data4 = this.CreateData('11', 'Visualization_HoursOutput_Query', param4)
|
|
||||||
this.ExecDatabase(Data4).then(response => {
|
|
||||||
if (response.data.length !== 0) {
|
|
||||||
const list = []
|
|
||||||
for (const argument of response.data) {
|
|
||||||
const temp = this.JPHData.get(argument.StationName)
|
|
||||||
if (temp) {
|
|
||||||
temp['HH'].push(argument['HH'])
|
|
||||||
temp['DataCount'].push(argument['DataCount'])
|
|
||||||
} else {
|
|
||||||
list.push(argument.StationName)
|
|
||||||
this.JPHData.set(argument.StationName, {
|
|
||||||
HH: [argument['HH']],
|
|
||||||
DataCount: [argument['DataCount']],
|
|
||||||
StationName: argument.StationName,
|
|
||||||
PlanCount: this.JPHData_PlanCount.get(argument.StationName)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
if (!this.realtimeChart) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
scope.JPHDataList = list
|
const xAxis = this.realtimeSource.map(item => item.小时段)
|
||||||
this.$nextTick(() => {
|
const series = this.realtimeSource.map(item => Number(item.产量 || 0))
|
||||||
this.drawDashboardTwo(this.JPHData)
|
this.realtimeChart.setOption({
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
drawDashboardTwo(JPHData) {
|
|
||||||
JPHData.forEach(function(value, key) {
|
|
||||||
let chartsDom1 = echarts.getInstanceByDom(document.getElementById(key.toString() + '_big'))
|
|
||||||
if (chartsDom1 == null) {
|
|
||||||
chartsDom1 = echarts.init(document.getElementById(key.toString() + '_big'))
|
|
||||||
}
|
|
||||||
chartsDom1.setOption({
|
|
||||||
title: {
|
title: {
|
||||||
show: true,
|
text: this.$t('stationJph.realtimeChartTitle'),
|
||||||
text: key,
|
left: 'center'
|
||||||
left: 'center',
|
|
||||||
textStyle: {
|
|
||||||
color: '#ffaa13'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
grid: [
|
|
||||||
{
|
|
||||||
top: '15%',
|
|
||||||
left: '3%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '3%',
|
|
||||||
containLabel: true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis',
|
trigger: 'axis'
|
||||||
axisPointer: {
|
},
|
||||||
type: 'shadow'
|
grid: {
|
||||||
|
left: '4%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '12%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
saveAsImage: {
|
||||||
|
title: this.$t('stationJph.saveAsImage'),
|
||||||
|
type: 'png'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
name: 'H',
|
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: value['HH'],
|
data: xAxis,
|
||||||
axisLine: {
|
|
||||||
lineStyle: {
|
|
||||||
color: '#6c6c6c'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
axisLabel: {
|
axisLabel: {
|
||||||
color: '#6c6c6c'
|
interval: 0,
|
||||||
|
rotate: 35
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
name: '台',
|
|
||||||
type: 'value',
|
type: 'value',
|
||||||
axisLine: {
|
name: this.$t('stationJph.outputQty')
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
color: '#6c6c6c'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
splitLine: {
|
series: [{
|
||||||
show: false
|
name: this.$t('stationJph.outputQty'),
|
||||||
}
|
|
||||||
},
|
|
||||||
series: [
|
|
||||||
{
|
|
||||||
name: '下线台数',
|
|
||||||
data: value['DataCount'],
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
|
barMaxWidth: 28,
|
||||||
|
data: series,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: '#209de2'
|
color: '#409EFF'
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
color: '#050505',
|
position: 'top',
|
||||||
position: 'top'
|
color: '#333'
|
||||||
},
|
|
||||||
markLine: {
|
|
||||||
symbol: 'none',
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
name: '计划产量',
|
|
||||||
yAxis: value['PlanCount']
|
|
||||||
}
|
}
|
||||||
],
|
}]
|
||||||
lineStyle: {
|
}, true)
|
||||||
color: '#ffbe00'
|
|
||||||
},
|
},
|
||||||
label: {
|
renderHistoryChart() {
|
||||||
|
if (!this.historyChart) {
|
||||||
|
this.initHistoryChart()
|
||||||
|
}
|
||||||
|
if (!this.historyChart) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const xAxis = this.historySource.map(item => `${item.日期} ${item.小时段}`)
|
||||||
|
const series = this.historySource.map(item => Number(item.产量 || 0))
|
||||||
|
this.historyChart.setOption({
|
||||||
|
title: {
|
||||||
|
text: this.$t('stationJph.historyChartTitle'),
|
||||||
|
left: 'center'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
left: '4%',
|
||||||
|
right: '4%',
|
||||||
|
bottom: '14%',
|
||||||
|
containLabel: true
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
show: true,
|
show: true,
|
||||||
color: '#020202',
|
feature: {
|
||||||
fontSize: '2rem',
|
saveAsImage: {
|
||||||
position: 'end',
|
title: this.$t('stationJph.saveAsImage'),
|
||||||
formatter: '{c} 台'
|
type: 'png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
searchChartData4_opPlanCount() {
|
xAxis: {
|
||||||
var param4 = []
|
type: 'category',
|
||||||
var Data4 = this.CreateData('11', 'SP_Config_BeatCountOpName_Query', param4)
|
data: xAxis,
|
||||||
this.ExecDatabase(Data4).then(response => {
|
axisLabel: {
|
||||||
if (response.data.length !== 0) {
|
interval: 0,
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
rotate: 40
|
||||||
this.JPHData_PlanCount.set(response.data[i].StationName, response.data[i].PlanCount)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
this.searchChartData4()
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
searchTable56() {
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
name: this.$t('stationJph.outputQty')
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: this.$t('stationJph.outputQty'),
|
||||||
|
type: 'bar',
|
||||||
|
barMaxWidth: 28,
|
||||||
|
data: series,
|
||||||
|
itemStyle: {
|
||||||
|
color: '#67C23A'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, true)
|
||||||
|
},
|
||||||
|
handleResize() {
|
||||||
|
if (this.realtimeChart) {
|
||||||
|
this.realtimeChart.resize()
|
||||||
|
}
|
||||||
|
if (this.historyChart) {
|
||||||
|
this.historyChart.resize()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
exportExcel() {
|
||||||
|
if (this.historyTableData.length === 0) {
|
||||||
|
this.$message.warning(this.$t('stationJph.noData'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let stationCheck, orderCheck, engineTypeCheck
|
||||||
|
this.stationValues.length > 0 ? stationCheck = 1 : stationCheck = 0
|
||||||
|
this.orderNumberValue ? orderCheck = 1 : orderCheck = 0
|
||||||
|
this.engineTypeValue ? engineTypeCheck = 1 : engineTypeCheck = 0
|
||||||
|
|
||||||
const param = []
|
const param = []
|
||||||
const Data = this.CreateData('11', 'Visualization_JPH_FiveOp_Query', param)
|
param[0] = ['开始时间', this.dateTime[0]]
|
||||||
this.ExecDatabase(Data).then(response => {
|
param[1] = ['结束时间', this.dateTime[1]]
|
||||||
for (let i = 0; i < response.data.length; i++) {
|
param[2] = ['工位_check', stationCheck]
|
||||||
this.currentBeatCount.set(response.data[i].StationName, response.data[i].NumCount)
|
param[3] = ['工位列表', this.stationValues.join(',')]
|
||||||
}
|
param[4] = ['订单号_check', orderCheck]
|
||||||
})
|
param[5] = ['订单号', this.orderNumberValue]
|
||||||
|
param[6] = ['产品型号代码_check', engineTypeCheck]
|
||||||
|
param[7] = ['产品型号代码', this.engineTypeValue]
|
||||||
|
const Data = this.CreateData('2001', '质量数据查询_测量数据发动机在线状态_工位JPH_历史_导出', param)
|
||||||
|
this.exportExcel_NPOI(Data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.topCard {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toolbarRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px 0;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chartCard {
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 12px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
border-radius: 4px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chartDom {
|
||||||
|
width: 100%;
|
||||||
|
height: 360px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user