白坯排列图、白坯性能报表开发

master
zhaoxiaolin 3 months ago
parent ce629f0dde
commit 8e9a309e15

@ -257,3 +257,43 @@ export function getMonthOfDataDefect(query) {
params: query
});
}
export function getDefectItemTitle(query) {
return request({
url: '/quality/staticTable/getDefectItemTitle',
method: 'get',
params: query
});
}
export function getDefectItemData(query) {
return request({
url: '/quality/staticTable/getDefectItemData',
method: 'get',
params: query
});
}
export function getDefectItemLine(query) {
return request({
url: '/quality/staticTable/getDefectItemLine',
method: 'get',
params: query
});
}
export function getDefectItemDataPC(query) {
return request({
url: '/quality/staticTable/getDefectItemDataPC',
method: 'get',
params: query
});
}
export function getDefectItemLinePC(query) {
return request({
url: '/quality/staticTable/getDefectItemLinePC',
method: 'get',
params: query
});
}

@ -197,9 +197,9 @@ export default {
/** 导出按钮操作 */
handleExport() {
this.download('mes/reportWork/getHourProductionNewExport', {
this.download('quality/staticTable/getMonthOfDataDefectExport', {
...this.queryParams
}, `hourProduction_${new Date().getTime()}.xlsx`)
}, `bpDefect_${new Date().getTime()}.xlsx`)
},
//

@ -0,0 +1,342 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="检验月份" prop="yearMonthDate">
<el-date-picker
v-model="queryParams.yearMonthDate"
type="month"
placeholder="选择月">
</el-date-picker>
</el-form-item>
<el-form-item label="白坯名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入白坯名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
<span style="color:firebrick;font-size: small; text-align: center;padding-left:30px">说明空白处表示当日未生产</span>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="图表" name="first">
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="24" style="text-align:center">
<h2>{{form.column080090}} {{form.column090100}} </h2>
</el-col>
</el-row>
<el-descriptions title="" border :column="3" :contentStyle="content_style" :label-style="label_style">
<el-descriptions-item label="产品名称" class="my-description-item1">{{form.materialName}}</el-descriptions-item>
<el-descriptions-item label="抽样数" class="my-description-item1">{{form.sampleQty}}</el-descriptions-item>
<el-descriptions-item label="生产车间" class="my-description-item1">{{form.workCenter}}</el-descriptions-item>
<el-descriptions-item label="不良品数" class="my-description-item1">{{form.noOkQty}}</el-descriptions-item>
<el-descriptions-item label="不良率" class="my-description-item1">{{form.noOkNumRate}}</el-descriptions-item>
<el-descriptions-item label="合格率" class="my-description-item1">{{form.okNumRate}}</el-descriptions-item>
</el-descriptions>
</el-form>
<div id="echartss" style="width:1200px;height:450px;"></div>
</el-tab-pane>
<el-tab-pane label="报表" name="second">
<el-table v-loading="loading" :data="itemProList" border>
<el-table-column label="序号" type="index" align="center" :index="indexMethod" fixed/>
<el-table-column label="项目" align="center" prop="dataType" min-width="100" fixed/>
<template v-for="(column, index) in showTitles">
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {getDefectItemTitle,getDefectItemData,getDefectItemLine} from "@/api/quality/qcTable";
import moment from 'moment';
import * as echarts from "echarts";
export default {
name: "BpDefectItem",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
itemProList: [],
activeName: 'first',
showTitles:[],//
//
title: "",
//
open: false,
//
queryParams: {
yearMonthDate:null,
yearMonth:null,
productDateArray: [],
pageNum: 1,
pageSize: 10,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
prodType: null,
productName: null,
productSpc: null,
productDate: null,
equTypeCode: "equ_type_hf"
},
//
form: {},
// list
workShift: [],
equipmentTypeOption:[
{equipmentTypeCode:"equ_type_cxj",equipmentTypeName:"成型机"},
{equipmentTypeCode:"equ_type_hf",equipmentTypeName:"烘房"}
],
spanArr: [],
position: 0,
content_style: {
'text-align': 'center',
'min-width': '200px',
'word-break': 'break-all'
},
label_style: {
'color': '#000',
'text-align': 'center',
'font-weight': '600',
'height': '40px',
'background-color': '#d6dbe1',
'min-width': '100px',
'word-break': 'keep-all'
},
};
},
created() {
this.getDate();
this.getList();
},
methods: {
/**获取默认查询时间段**/
getDate() {
let start = this.Fungetdate (0);
this.queryParams.yearMonthDate = start;
},
Fungetdate (num) {
var dd = new Date();
dd.setDate(dd.getDate() + num);
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//
return y + "-" + m ;
},
/** 查询设备小时产量列表 */
getList() {
if(this.queryParams.yearMonthDate!=null){
this.queryParams.yearMonth = moment(this.queryParams.yearMonthDate).format('YYYY-MM');
}else{
this.$message.error("请填写月份");
return
}
this.spanArr = [];
this.position = 0;
this.loading = true;
//Table
getDefectItemTitle(this.queryParams).then(response => {
this.showTitles = [];
for(let i=0;i<=response.length-1;i++){
var pobj={};
pobj.id="item"+i;
pobj.titleName = response[i];
this.showTitles.push(pobj)
}
});
//Table
getDefectItemData(this.queryParams).then(response => {
this.itemProList = response;
this.getTbody();
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
prepareId: null,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
prodType: null,
productName: null,
productSpc: null,
wetDetailPlanId: null,
productDate: null,
shiftId: null,
ancestors: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
factoryCode: null
};
this.resetForm("form");
this.spanArr = [];
this.position = 0;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('quality/staticTable/getDefectItemDataExport', {
...this.queryParams
}, `bpDefectItem_${new Date().getTime()}.xlsx`)
},
handleClick(){
this.$nextTick(()=>{
this.$refs.tables.doLayout()//table
})
},
async getTbody(){
this.loading=true
this.$nextTick(()=>{
this.$refs.tables.doLayout()//table
})
let _this = this
getDefectItemLine(this.queryParams).then(response => {
_this.form = response;
_this.getEcharts(response.supplierCodes,response.columns1,response.columns2)
});
},
getEcharts(xData,yDataLeft,yDdataRight){
var _this=this
var chartDom = document.getElementById('echartss');
var myChart = echarts.init(chartDom);
var option;
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: ['不良率', '累计不良率']
},
xAxis: {
type: 'category',
data: xData//['', '', '', '', '']
},
yAxis: [
{
type: 'value',
name: '不良率(%)',
min: 0,
max: 100,
interval: 5,
axisLabel: {
formatter: '{value} %'
}
},
{
type: 'value',
name: '累计不良率',
min: 0,
//max: 100,
interval: 20,
axisLabel: {
formatter: '{value} %'
}
}
],
series: [
{
name: '不良率',
type: 'bar',
data: yDataLeft, //[15, 10, 8, 5, 2],
label: {
show: true, //
position: 'top', // 'top', 'bottom', 'left', 'right'
formatter: '{c}%' // {c}
},
},
{
name: '累计不良率',
type: 'line',
yAxisIndex: 1,
data: yDdataRight //[15, 25, 33, 38, 40]
}
]
};
option && myChart.setOption(option);
},
//
indexMethod(index) {
return index + 1;
},
}
};
</script>
<style scoped>
.my-description-item1 {
width: 200px; /* 或者你想要的任何宽度 */
}
</style>

@ -0,0 +1,342 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="98px">
<el-form-item label="检验月份" prop="yearMonthDate">
<el-date-picker
v-model="queryParams.yearMonthDate"
type="month"
placeholder="选择月">
</el-date-picker>
</el-form-item>
<el-form-item label="白坯名称" prop="materialName">
<el-input
v-model="queryParams.materialName"
placeholder="请输入白坯名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
<span style="color:firebrick;font-size: small; text-align: center;padding-left:30px">说明空白处表示当日未生产</span>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
<el-tab-pane label="图表" name="first">
<el-form ref="form" :model="form" label-width="80px">
<el-row>
<el-col :span="24" style="text-align:center">
<h2>{{form.column080090}} {{form.column090100}} 黑蚊香白坯性能不良排列图</h2>
</el-col>
</el-row>
<el-descriptions title="" border :column="3" :contentStyle="content_style" :label-style="label_style">
<el-descriptions-item label="产品名称" class="my-description-item1">{{form.materialName}}</el-descriptions-item>
<el-descriptions-item label="抽检批次" class="my-description-item1">{{form.sampleQty}}</el-descriptions-item>
<el-descriptions-item label="生产车间" class="my-description-item1">{{form.workCenter}}</el-descriptions-item>
<el-descriptions-item label="不合格批次" class="my-description-item1">{{form.noOkQty}}</el-descriptions-item>
<el-descriptions-item label="批次不合格率" class="my-description-item1">{{form.noOkNumRate}}</el-descriptions-item>
<el-descriptions-item label="批次合格率" class="my-description-item1">{{form.okNumRate}}</el-descriptions-item>
</el-descriptions>
</el-form>
<div id="echartss" style="width:1200px;height:450px;"></div>
</el-tab-pane>
<el-tab-pane label="报表" name="second">
<el-table v-loading="loading" :data="itemProList" border>
<el-table-column label="序号" type="index" align="center" :index="indexMethod" fixed/>
<el-table-column label="项目" align="center" prop="dataType" min-width="100" fixed/>
<template v-for="(column, index) in showTitles">
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
</template>
<script>
import {getDefectItemTitle,getDefectItemDataPC,getDefectItemLinePC} from "@/api/quality/qcTable";
import moment from 'moment';
import * as echarts from "echarts";
export default {
name: "BpDefectItemPC",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
itemProList: [],
activeName: 'first',
showTitles:[],//
//
title: "",
//
open: false,
//
queryParams: {
yearMonthDate:null,
yearMonth:null,
productDateArray: [],
pageNum: 1,
pageSize: 10,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
prodType: null,
productName: null,
productSpc: null,
productDate: null,
equTypeCode: "equ_type_hf"
},
//
form: {},
// list
workShift: [],
equipmentTypeOption:[
{equipmentTypeCode:"equ_type_cxj",equipmentTypeName:"成型机"},
{equipmentTypeCode:"equ_type_hf",equipmentTypeName:"烘房"}
],
spanArr: [],
position: 0,
content_style: {
'text-align': 'center',
'min-width': '200px',
'word-break': 'break-all'
},
label_style: {
'color': '#000',
'text-align': 'center',
'font-weight': '600',
'height': '40px',
'background-color': '#d6dbe1',
'min-width': '100px',
'word-break': 'keep-all'
},
};
},
created() {
this.getDate();
this.getList();
},
methods: {
/**获取默认查询时间段**/
getDate() {
let start = this.Fungetdate (0);
this.queryParams.yearMonthDate = start;
},
Fungetdate (num) {
var dd = new Date();
dd.setDate(dd.getDate() + num);
var y = dd.getFullYear();
var m = dd.getMonth() + 1;//
return y + "-" + m ;
},
/** 查询设备小时产量列表 */
getList() {
if(this.queryParams.yearMonthDate!=null){
this.queryParams.yearMonth = moment(this.queryParams.yearMonthDate).format('YYYY-MM');
}else{
this.$message.error("请填写月份");
return
}
this.spanArr = [];
this.position = 0;
this.loading = true;
//Table
getDefectItemTitle(this.queryParams).then(response => {
this.showTitles = [];
for(let i=0;i<=response.length-1;i++){
var pobj={};
pobj.id="item"+i;
pobj.titleName = response[i];
this.showTitles.push(pobj)
}
});
//Table
getDefectItemDataPC(this.queryParams).then(response => {
this.itemProList = response;
this.getTbody();
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
prepareId: null,
workorderCode: null,
workorderName: null,
parentOrder: null,
orderId: null,
orderCode: null,
productId: null,
productCode: null,
prodType: null,
productName: null,
productSpc: null,
wetDetailPlanId: null,
productDate: null,
shiftId: null,
ancestors: null,
status: null,
remark: null,
attr1: null,
attr2: null,
attr3: null,
attr4: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
factoryCode: null
};
this.resetForm("form");
this.spanArr = [];
this.position = 0;
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
this.download('quality/staticTable/getDefectItemDataPCExport', {
...this.queryParams
}, `bpDefectItemPC_${new Date().getTime()}.xlsx`)
},
handleClick(){
this.$nextTick(()=>{
this.$refs.tables.doLayout()//table
})
},
async getTbody(){
this.loading=true
this.$nextTick(()=>{
this.$refs.tables.doLayout()//table
})
let _this = this
getDefectItemLinePC(this.queryParams).then(response => {
_this.form = response;
_this.getEcharts(response.supplierCodes,response.columns1,response.columns2)
});
},
getEcharts(xData,yDataLeft,yDdataRight){
var _this=this
var chartDom = document.getElementById('echartss');
var myChart = echarts.init(chartDom);
var option;
option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
crossStyle: {
color: '#999'
}
}
},
legend: {
data: ['不良率', '累计不良率']
},
xAxis: {
type: 'category',
data: xData//['', '', '', '', '']
},
yAxis: [
{
type: 'value',
name: '不良率(%)',
min: 0,
max: 100,
interval: 5,
axisLabel: {
formatter: '{value} %'
}
},
{
type: 'value',
name: '累计不良率',
min: 0,
//max: 100,
interval: 20,
axisLabel: {
formatter: '{value} %'
}
}
],
series: [
{
name: '不良率',
type: 'bar',
data: yDataLeft, //[15, 10, 8, 5, 2],
label: {
show: true, //
position: 'top', // 'top', 'bottom', 'left', 'right'
formatter: '{c}%' // {c}
},
},
{
name: '累计不良率',
type: 'line',
yAxisIndex: 1,
data: yDdataRight //[15, 25, 33, 38, 40]
}
]
};
option && myChart.setOption(option);
},
//
indexMethod(index) {
return index + 1;
},
}
};
</script>
<style scoped>
.my-description-item1 {
width: 200px; /* 或者你想要的任何宽度 */
}
</style>

@ -35,11 +35,11 @@
<el-table-column label="序号" type="index" align="center" :index="indexMethod" fixed/>
<el-table-column label="白坯名称" align="center" prop="materialName" min-width="100" fixed/>
<el-table-column label="日期" align="center" prop="dataType" min-width="100" fixed/>
<template v-for="(column, index) in showTitles">
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
</el-table>
</el-tab-pane>
<template v-for="(column, index) in showTitles">
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
</el-table>
</el-tab-pane>
<el-tab-pane label="图表" name="second">
<div id="echartss" style="width:1200px;height:450px;"></div>
</el-tab-pane>
@ -152,7 +152,7 @@ export default {
getMonthOfData(this.queryParams).then(response => {
this.hourProList = response;
this.rowspan();
this.loading = false;
});
//
@ -211,9 +211,9 @@ export default {
/** 导出按钮操作 */
handleExport() {
this.download('mes/reportWork/getHourProductionNewExport', {
this.download('quality/staticTable/getMonthOfDataExport', {
...this.queryParams
}, `hourProduction_${new Date().getTime()}.xlsx`)
}, `bpNoOkRate_${new Date().getTime()}.xlsx`)
},
@ -233,11 +233,11 @@ export default {
getMonthOfLine(this.queryParams).then(response => {
response.map((item,index)=>{
xData.push(item.ymdms),
yData.push(item.noOkBatchRate)
yData.push(item.noOkBatchRate)
})
_this.getEcharts(xData,yData)
});
},
getEcharts(xData,yData){
var _this=this
@ -267,7 +267,7 @@ export default {
rotate: 50,
fontSize:11
},
data: xData
},
yAxis: {
@ -282,7 +282,7 @@ export default {
}
},
series: [
{
{
name:'不良率%',
data: yData,
type: 'line',
@ -310,7 +310,7 @@ export default {
]
};
option && myChart.setOption(option);
option && myChart.setOption(option);
},
//

@ -39,7 +39,7 @@
<el-table-column align="center" min-width="120" :prop="column.id" :key="column.id" :label="column.titleName"/>
</template>
</el-table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane label="图表" name="second">
<div id="echartss" style="width:1200px;height:450px;"></div>
</el-tab-pane>
@ -152,7 +152,7 @@ export default {
getMonthOfDataRework(this.queryParams).then(response => {
this.hourProList = response;
this.rowspan();
this.loading = false;
});
//
@ -211,9 +211,9 @@ export default {
/** 导出按钮操作 */
handleExport() {
this.download('mes/reportWork/getHourProductionNewExport', {
this.download('quality/staticTable/getMonthOfDataReworkExport', {
...this.queryParams
}, `hourProduction_${new Date().getTime()}.xlsx`)
}, `bpReworkRate_${new Date().getTime()}.xlsx`)
},
@ -233,11 +233,11 @@ export default {
getMonthOfLineRework(this.queryParams).then(response => {
response.map((item,index)=>{
xData.push(item.ymdms),
yData.push(item.noOkBatchRate)
yData.push(item.noOkBatchRate)
})
_this.getEcharts(xData,yData)
});
},
getEcharts(xData,yData){
var _this=this
@ -267,7 +267,7 @@ export default {
rotate: 50,
fontSize:11
},
data: xData
},
yAxis: {
@ -282,7 +282,7 @@ export default {
}
},
series: [
{
{
name:'不良率%',
data: yData,
type: 'line',
@ -310,7 +310,7 @@ export default {
]
};
option && myChart.setOption(option);
option && myChart.setOption(option);
},
//

Loading…
Cancel
Save