工序合格数统计

This commit is contained in:
shijing 2024-02-22 11:03:45 +08:00
parent fa87c5fdce
commit a57fa2f750
1 changed files with 130 additions and 168 deletions

View File

@ -3,30 +3,14 @@
<el-header> <el-header>
<div class="right-panel"> <div class="right-panel">
<el-select v-model="queryType" @change="queryTypeChange"> <el-select v-model="queryType" @change="queryTypeChange">
<el-option v-for="item in typeOptions" <el-option v-for="item in typeOptions" :key="item" :label="item" :value="item">
:key="item"
:label="item"
:value="item"
>
</el-option> </el-option>
</el-select> </el-select>
<el-date-picker <el-date-picker v-if="queryType == ''" v-model="queryDate" type="month" placeholder="查询月期"
v-if="queryType=='月'" value-format="YYYY-MM" style="width:100%">
v-model="queryDate"
type="month"
placeholder="查询月期"
value-format="YYYY-MM"
style="width:100%"
>
</el-date-picker> </el-date-picker>
<el-date-picker <el-date-picker v-if="queryType == ''" v-model="queryDate" type="year" placeholder="查询年份"
v-if="queryType=='年'" value-format="YYYY" style="width:100%">
v-model="queryDate"
type="year"
placeholder="查询年份"
value-format="YYYY"
style="width:100%"
>
</el-date-picker> </el-date-picker>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button> <el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
</div> </div>
@ -42,19 +26,13 @@
<el-card shadow="never"> <el-card shadow="never">
<el-table :data="tableData" :height="tableHeight"> <el-table :data="tableData" :height="tableHeight">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="工序" prop="mgroup_name"> <el-table-column label="工段" prop="工段">
</el-table-column> </el-table-column>
<el-table-column label="规格" prop="name"> <el-table-column label="物料名称" prop="物料名称">
<template #default="scope">
<span v-if="scope.row.material_out_">{{ scope.row.material_out_.specification }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="型号" prop="name"> <el-table-column label="计划数" prop="计划数">
<template #default="scope">
<span v-if="scope.row.material_out_">{{ scope.row.material_out_.model }}</span>
</template>
</el-table-column> </el-table-column>
<el-table-column label="合格数" prop="count_ok"> <el-table-column label="合格数" prop="合格数">
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
@ -83,7 +61,7 @@
typeOptions: ['月', '年'], typeOptions: ['月', '年'],
option: { option: {
title: { title: {
text: '本周生产数量', text: '生产数量',
}, },
grid: { grid: {
top: '80px' top: '80px'
@ -98,11 +76,19 @@
yAxis: { yAxis: {
type: 'value' type: 'value'
}, },
series: [{ series: [
{
name: '光纤预制棒',
data: [0, 0, 0, 0, 0, 0, 0, 0], data: [0, 0, 0, 0, 0, 0, 0, 0],
type: 'bar', type: 'bar',
barWidth: '15px', barWidth: '15px',
}] }, {
name: '光纤预制管',
data: [0, 0, 0, 0, 0, 0, 0, 0],
type: 'bar',
barWidth: '15px',
}
]
}, },
processData: [], processData: [],
xAxisData: [], xAxisData: [],
@ -123,16 +109,7 @@
let month1 = month > 9 ? month : '0' + month; let month1 = month > 9 ? month : '0' + month;
that.queryDate = year + '-' + month1; that.queryDate = year + '-' + month1;
that.tableHeight = document.getElementById('elMain').clientHeight - 40; that.tableHeight = document.getElementById('elMain').clientHeight - 40;
that.$API.mtm.process.list.req( {page:0,cate:'粗加工'}).then((res) => {
console.log('6车间process:',res)
that.processData = res;
let xAxisData=[];
res.forEach(item => {
xAxisData.push(item.name);
});
that.xAxisData = xAxisData;
that.getData6(); that.getData6();
})
}, },
methods: { methods: {
@ -142,46 +119,32 @@
}, },
getData6() { getData6() {
let that = this; let that = this;
let obj = {
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
};
let xAxisData = [], data1 = [], data0 = [];
that.$API.bi.dataset.exec.req('mgroupWeek', obj).then((res) => {
let data = res.data2.ds0;
that.tableData = data;
data.forEach(item => {
if (xAxisData.indexOf(item.工段) > -1) { } else {
xAxisData.push(item.工段);
}
let index = xAxisData.indexOf(item.工段);
if (item.物料名称.indexOf('棒') > -1) {
data0[index] = item.合格数;
} else {
data1[index] = item.合格数;
}
})
that.xAxisData = xAxisData;
})
console.log('xAxisData:', that.xAxisData); console.log('xAxisData:', that.xAxisData);
that.option.xAxis.data = that.xAxisData; that.option.xAxis.data = that.xAxisData;
let obj = {page:0,start_date__gte: this.start_date, end_date__lte: this.end_date, mgroup__belong_dept__name: "6车间"}; that.option.series[0].data = data0;
that.$API.pm.mtask.list.req( obj).then((res) => { that.option.series[1].data = data1;
that.tableData = res; // that.chart.setOption(that.option);
let xAxisData=that.xAxisData;
if(res.length>0){
let arr = [],nameList=[],seriesData=[];
xAxisData.forEach(ite=>{
arr.push([]);
})
for (let i = 0; i < res.length; i++) {
if(nameList.indexOf(res[i].material_out_.name)>-1){}else{
nameList.push(res[i].material_out_.name);
}
}
that.lengedData = nameList;
res.forEach(item => {
let indexRow = nameList.indexOf(item.material_out_.name);
let indexCol = xAxisData.indexOf(item.mgroup_name);
if(arr[indexRow][indexCol]>0){
arr[indexRow][indexCol] = arr[indexRow][indexCol]+item.count_ok;
}else{
arr[indexRow][indexCol] = item.count_ok;
}
});
console.log('arr:',arr)
arr.forEach((arritem,index) => {
let obj = {};
obj.name= nameList[index];
obj.type= 'bar';
obj.barWidth= '15px';
obj.data= arritem;
seriesData.push(obj)
});
that.option.series = seriesData;
}else{
that.lengedData = [];
}
})
}, },
handleQuery() { handleQuery() {
if (this.queryDate !== '' && this.queryDate !== null) { if (this.queryDate !== '' && this.queryDate !== null) {
@ -208,5 +171,4 @@
} }
</script> </script>
<style> <style></style>
</style>