工序合格数统计
This commit is contained in:
parent
fa87c5fdce
commit
a57fa2f750
|
@ -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>
|
||||||
|
@ -65,148 +43,132 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import scEcharts from '@/components/scEcharts';
|
import scEcharts from '@/components/scEcharts';
|
||||||
export default {
|
export default {
|
||||||
name: 'chart',
|
name: 'chart',
|
||||||
components: {
|
components: {
|
||||||
scEcharts
|
scEcharts
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableHeight:0,
|
tableHeight: 0,
|
||||||
queryType:'月',
|
queryType: '月',
|
||||||
queryDate:'',
|
queryDate: '',
|
||||||
start_date:'',
|
start_date: '',
|
||||||
end_date:'',
|
end_date: '',
|
||||||
currentYear:'',
|
currentYear: '',
|
||||||
currentMonth:'',
|
currentMonth: '',
|
||||||
typeOptions:['月','年'],
|
typeOptions: ['月', '年'],
|
||||||
option: {
|
option: {
|
||||||
title: {
|
title: {
|
||||||
text: '本周生产数量',
|
text: '生产数量',
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: '80px'
|
top: '80px'
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis'
|
trigger: 'axis'
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data:[]
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
},
|
},
|
||||||
series: [{
|
series: [
|
||||||
data: [0,0,0,0,0,0,0,0],
|
{
|
||||||
|
name: '光纤预制棒',
|
||||||
|
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}]
|
}, {
|
||||||
},
|
name: '光纤预制管',
|
||||||
processData:[],
|
data: [0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
xAxisData:[],
|
type: 'bar',
|
||||||
tableData:[],
|
barWidth: '15px',
|
||||||
}
|
}
|
||||||
},
|
]
|
||||||
mounted(){
|
|
||||||
|
|
||||||
let that = this;
|
|
||||||
let date = new Date();
|
|
||||||
let year = date.getFullYear();
|
|
||||||
let month = date.getMonth()+1;
|
|
||||||
let days = new Date(year, month, 0).getDate();
|
|
||||||
that.currentYear = year;
|
|
||||||
that.currentMonth = month>9?month:'0'+month;
|
|
||||||
that.start_date =year+'-'+month+'-01';
|
|
||||||
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
|
||||||
let month1 = month>9?month:'0'+month;
|
|
||||||
that.queryDate = year+'-'+month1;
|
|
||||||
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();
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
queryTypeChange(value){
|
|
||||||
console.log(value)
|
|
||||||
this.queryDate = '';
|
|
||||||
},
|
},
|
||||||
getData6(){
|
processData: [],
|
||||||
let that = this;
|
xAxisData: [],
|
||||||
console.log('xAxisData:',that.xAxisData);
|
tableData: [],
|
||||||
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.$API.pm.mtask.list.req( obj).then((res) => {
|
mounted() {
|
||||||
that.tableData = res;
|
|
||||||
let xAxisData=that.xAxisData;
|
let that = this;
|
||||||
if(res.length>0){
|
let date = new Date();
|
||||||
let arr = [],nameList=[],seriesData=[];
|
let year = date.getFullYear();
|
||||||
xAxisData.forEach(ite=>{
|
let month = date.getMonth() + 1;
|
||||||
arr.push([]);
|
let days = new Date(year, month, 0).getDate();
|
||||||
})
|
that.currentYear = year;
|
||||||
for (let i = 0; i < res.length; i++) {
|
that.currentMonth = month > 9 ? month : '0' + month;
|
||||||
if(nameList.indexOf(res[i].material_out_.name)>-1){}else{
|
that.start_date = year + '-' + month + '-01';
|
||||||
nameList.push(res[i].material_out_.name);
|
that.end_date = year + '-' + month + '-' + new Date(year, month, 0).getDate();
|
||||||
}
|
let month1 = month > 9 ? month : '0' + month;
|
||||||
}
|
that.queryDate = year + '-' + month1;
|
||||||
that.lengedData = nameList;
|
that.tableHeight = document.getElementById('elMain').clientHeight - 40;
|
||||||
res.forEach(item => {
|
that.getData6();
|
||||||
let indexRow = nameList.indexOf(item.material_out_.name);
|
|
||||||
let indexCol = xAxisData.indexOf(item.mgroup_name);
|
},
|
||||||
if(arr[indexRow][indexCol]>0){
|
methods: {
|
||||||
arr[indexRow][indexCol] = arr[indexRow][indexCol]+item.count_ok;
|
queryTypeChange(value) {
|
||||||
}else{
|
console.log(value)
|
||||||
arr[indexRow][indexCol] = item.count_ok;
|
this.queryDate = '';
|
||||||
}
|
},
|
||||||
});
|
getData6() {
|
||||||
console.log('arr:',arr)
|
let that = this;
|
||||||
arr.forEach((arritem,index) => {
|
let obj = {
|
||||||
let obj = {};
|
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
|
||||||
obj.name= nameList[index];
|
};
|
||||||
obj.type= 'bar';
|
let xAxisData = [], data1 = [], data0 = [];
|
||||||
obj.barWidth= '15px';
|
that.$API.bi.dataset.exec.req('mgroupWeek', obj).then((res) => {
|
||||||
obj.data= arritem;
|
let data = res.data2.ds0;
|
||||||
seriesData.push(obj)
|
that.tableData = data;
|
||||||
});
|
data.forEach(item => {
|
||||||
that.option.series = seriesData;
|
if (xAxisData.indexOf(item.工段) > -1) { } else {
|
||||||
}else{
|
xAxisData.push(item.工段);
|
||||||
that.lengedData = [];
|
}
|
||||||
|
let index = xAxisData.indexOf(item.工段);
|
||||||
|
if (item.物料名称.indexOf('棒') > -1) {
|
||||||
|
data0[index] = item.合格数;
|
||||||
|
} else {
|
||||||
|
data1[index] = item.合格数;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
that.xAxisData = xAxisData;
|
||||||
handleQuery(){
|
|
||||||
if(this.queryDate!==''&&this.queryDate!==null){
|
})
|
||||||
if(this.queryType=='月'){
|
console.log('xAxisData:', that.xAxisData);
|
||||||
this.start_date =this.queryDate+'-01';
|
that.option.xAxis.data = that.xAxisData;
|
||||||
let arr = this.queryDate.split('-');
|
that.option.series[0].data = data0;
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
that.option.series[1].data = data1;
|
||||||
}else{
|
// that.chart.setOption(that.option);
|
||||||
this.start_date = this.queryDate+'-01-01';
|
|
||||||
this.end_date = this.queryDate+'-12-31';
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(this.queryType=='月'){
|
|
||||||
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
|
||||||
}else{
|
|
||||||
this.start_date = this.currentYear+'-01-01';
|
|
||||||
this.end_date = this.currentYear+'-12-31';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.getData6();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
handleQuery() {
|
||||||
|
if (this.queryDate !== '' && this.queryDate !== null) {
|
||||||
|
if (this.queryType == '月') {
|
||||||
|
this.start_date = this.queryDate + '-01';
|
||||||
|
let arr = this.queryDate.split('-');
|
||||||
|
this.end_date = this.queryDate + '-' + new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
} else {
|
||||||
|
this.start_date = this.queryDate + '-01-01';
|
||||||
|
this.end_date = this.queryDate + '-12-31';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.queryType == '月') {
|
||||||
|
this.start_date = this.currentYear + '-' + this.currentMonth + '-01';
|
||||||
|
this.end_date = this.currentYear + '-' + this.currentMonth + '-' + new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
|
} else {
|
||||||
|
this.start_date = this.currentYear + '-01-01';
|
||||||
|
this.end_date = this.currentYear + '-12-31';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getData6();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue