生产统计数据调试
This commit is contained in:
parent
8e5fca3daf
commit
d741746c7f
|
@ -2,7 +2,7 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select v-model="queryType" clearable @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"
|
:key="item"
|
||||||
:label="item"
|
:label="item"
|
||||||
|
@ -36,18 +36,77 @@
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<scEcharts height="300px" :option="option"></scEcharts>
|
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option"></scEcharts> -->
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData">
|
<el-table :data="tableData7">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="物料名" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="name">
|
<el-table-column label="月份" prop="月" v-if="queryType=='年'">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="name">
|
<el-table-column label="周" prop="周" v-else>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="合格数">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div id="bachart2" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<el-table :data="tableData10">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="物料名" prop="物料名">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="月份" prop="月" v-if="queryType=='年'">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="周" prop="周" v-else>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规格" prop="规格">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="型号" prop="型号">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="合格数" prop="合格数">
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-card>
|
||||||
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
|
<el-row :gutter="10">
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<div id="bachart3" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option3"></scEcharts> -->
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :lg="12">
|
||||||
|
<el-card shadow="never">
|
||||||
|
<el-table :data="tableDataAVG">
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="物料名" prop="物料名">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="月份" prop="月" v-if="queryType=='年'">
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="周" prop="周" v-else>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="合格数" prop="count_ok">
|
<el-table-column label="合格数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -60,62 +119,19 @@
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<scEcharts height="300px" :option="option2"></scEcharts>
|
<div id="bachart4" style="width:100%;height:300px;"></div>
|
||||||
|
<!-- <scEcharts height="300px" :option="option4"></scEcharts> -->
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData">
|
<el-table :data="tableData6">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="物料名" prop="物料名">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="name">
|
<el-table-column label="月份" prop="月" v-if="queryType=='年'">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="型号" prop="name">
|
<el-table-column label="周" prop="周" v-else>
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="合格数" prop="count_ok">
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<scEcharts height="300px" :option="option3"></scEcharts>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<el-table :data="tableData">
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="日期" prop="date">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="规格" prop="name">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="型号" prop="name">
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="合格数" prop="count_ok">
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
</el-card>
|
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
|
||||||
<el-row :gutter="10">
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<scEcharts height="300px" :option="option4"></scEcharts>
|
|
||||||
</el-card>
|
|
||||||
</el-col>
|
|
||||||
<el-col :lg="12">
|
|
||||||
<el-card shadow="never">
|
|
||||||
<el-table :data="tableData">
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="日期" prop="date">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="name">
|
<el-table-column label="规格" prop="name">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -132,8 +148,13 @@
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import * as echarts from "echarts";
|
||||||
|
import T from '@/components/scEcharts/echarts-theme-T.js';
|
||||||
|
echarts.registerTheme('T', T);
|
||||||
import scEcharts from '@/components/scEcharts';
|
import scEcharts from '@/components/scEcharts';
|
||||||
const xAxisData = ['第一周','第二周','第三周','第四周'];
|
function deepCopy(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'chart',
|
name: 'chart',
|
||||||
components: {
|
components: {
|
||||||
|
@ -147,11 +168,13 @@
|
||||||
end_date:'',
|
end_date:'',
|
||||||
currentYear:'',
|
currentYear:'',
|
||||||
currentMonth:'',
|
currentMonth:'',
|
||||||
xAxisData:['第一周','第二周','第三周','第四周'],
|
xAxisOrigin:[],
|
||||||
|
xAxisData:[],
|
||||||
typeOptions:['月','年'],
|
typeOptions:['月','年'],
|
||||||
option: {
|
basicOption: {
|
||||||
|
backgroundColor: 'transparent',
|
||||||
title: {
|
title: {
|
||||||
text: '预制棒(7车间)',
|
text: '',
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
top: '80px'
|
top: '80px'
|
||||||
|
@ -161,222 +184,301 @@
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: xAxisData
|
data: []
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
},
|
},
|
||||||
lenged:[],
|
lenged:[],
|
||||||
// toolbox: {
|
|
||||||
// show: true,
|
|
||||||
// orient: 'vertical',
|
|
||||||
// left: 'right',
|
|
||||||
// top: 'center',
|
|
||||||
// feature: {
|
|
||||||
// mark: { show: true },
|
|
||||||
// dataView: { show: true, readOnly: false },
|
|
||||||
// magicType: { show: true, type: ['line', 'bar', 'stack'] },
|
|
||||||
// restore: { show: true },
|
|
||||||
// saveAsImage: { show: true }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
series: [{
|
series: [{
|
||||||
data: [120, 200, 150, 80, 70, 110, 130, 200, 150, 80, 70, 110],
|
data: [0, 0, 0, 0, 0, 0, 0],
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: [110, 180, 120, 120, 60, 90, 110, 120, 120, 60, 90, 110],
|
|
||||||
stack: 'Ad',
|
stack: 'Ad',
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
option2: {
|
tableData6:[],
|
||||||
title: {
|
tableData7:[],
|
||||||
text: '预制管(10车间)',
|
tableData10:[],
|
||||||
},
|
tableDataAVG:[],
|
||||||
grid: {
|
firstWeekNum:1,
|
||||||
top: '80px'
|
endWeekNum:4,
|
||||||
},
|
monthList:['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis'
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: xAxisData
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
data: [120, 200, 150, 80, 70, 110, 130],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: [110, 180, 120, 120, 60, 90, 110],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
option3: {
|
|
||||||
title: {
|
|
||||||
text: 'AVG',
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: '80px'
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis'
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: xAxisData
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
data: [120, 200, 150, 80, 70, 110, 130],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: [110, 180, 120, 120, 60, 90, 110],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
option4: {
|
|
||||||
title: {
|
|
||||||
text: '6车间',
|
|
||||||
},
|
|
||||||
grid: {
|
|
||||||
top: '80px'
|
|
||||||
},
|
|
||||||
tooltip: {
|
|
||||||
trigger: 'axis'
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: xAxisData
|
|
||||||
},
|
|
||||||
yAxis: {
|
|
||||||
type: 'value'
|
|
||||||
},
|
|
||||||
series: [{
|
|
||||||
data: [120, 200, 150, 80, 70, 110, 130],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: [110, 180, 120, 120, 60, 90, 110],
|
|
||||||
stack: 'Ad',
|
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
tableData:[
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-1',count_ok:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-2',count_ok:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-3',count_ok:200},
|
|
||||||
{id:1,date:'2023-12-11',name:'ZJ2-4',count_ok:200},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
let that =this;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth()+1;
|
let month = date.getMonth()+1;
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
this.currentYear = year;
|
that.currentYear = year;
|
||||||
this.currentMonth = month;
|
that.currentMonth = month;
|
||||||
this.start_date =year+'-'+month+'-01';
|
that.start_date =year+'-'+month+'-01';
|
||||||
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.queryDate = year+'-'+month;
|
let month1=month;
|
||||||
this.getData6();
|
if(month1<10){month1='0'+month1}
|
||||||
this.getData7();
|
that.queryDate = year+'-'+month1;
|
||||||
this.getData10();
|
that.firstWeekNum = that.getWeekOfYear(new Date('2024-1-01'));
|
||||||
|
that.endWeekNum = that.getWeekOfYear(new Date('2024-1-31'));
|
||||||
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
|
for(let i =1;i<=duration;i++ ){
|
||||||
|
that.xAxisOrigin.push('第'+i+'周');
|
||||||
|
}
|
||||||
|
that.xAxisData = that.xAxisOrigin;
|
||||||
|
that.getData6();
|
||||||
|
that.getData7();
|
||||||
|
that.getData10();
|
||||||
|
that.getDataDAVG();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
setChart(name, option = null) {
|
||||||
|
// 根据name 渲染数据, option需填写,否则option为模拟数据
|
||||||
|
var myChart = echarts.getInstanceByDom(document.getElementById(name));
|
||||||
|
if (myChart == undefined) {
|
||||||
|
myChart = echarts.init(document.getElementById(name), 'T');
|
||||||
|
}
|
||||||
|
if (option == null) {
|
||||||
|
option = Object.assign({}, this.basicOption)
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
try {
|
||||||
|
myChart.setOption(option);
|
||||||
|
} catch (error) { }
|
||||||
|
}, 500)
|
||||||
|
},
|
||||||
queryTypeChange(value){
|
queryTypeChange(value){
|
||||||
console.log(value)
|
console.log(value)
|
||||||
this.queryDate = '';
|
this.queryDate = '';
|
||||||
if(value=='月'){
|
},
|
||||||
this.xAxisData = ['第一周','第二周','第三周','第四周'];
|
getWeekOfYear(date) {
|
||||||
|
var target = new Date(date.getFullYear(), date.getMonth(), date.getDate()); // 创建目标日期对象
|
||||||
|
var firstDayOfYear = new Date(target.getFullYear(), 0, 1); // 创建当前年份第一天的日期对象
|
||||||
|
if(target.getTime()==firstDayOfYear.getTime()){
|
||||||
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
return Math.ceil((target - firstDayOfYear + 8 * (firstDayOfYear.getTimezoneOffset() / 480)) / 604800000);
|
||||||
}
|
}
|
||||||
this.option.xAxis.data = this.xAxisData;
|
// 计算两者之间相隔的周数并返回结果
|
||||||
this.option2.xAxis.data = this.xAxisData;
|
|
||||||
this.option3.xAxis.data = this.xAxisData;
|
|
||||||
this.option4.xAxis.data = this.xAxisData;
|
|
||||||
},
|
},
|
||||||
getData6(){
|
getData6(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = '6车间';
|
||||||
|
let exec = that.queryType=='月'?'productStatisticWeek':'productStatisticYear';
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
|
query: { start_date: that.start_date, end_date: that.end_date, dept_name: "6车间" },
|
||||||
};
|
};
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('6生产车间统计:',doInRes);
|
// console.log('6生产车间统计:',res);
|
||||||
debugger;
|
let tableData6 = res.data2.ds0;
|
||||||
|
if(tableData6.length>0){
|
||||||
|
option.series = [];
|
||||||
|
let seriesData = [],nameList = [];
|
||||||
|
tableData6.forEach(ite=>{
|
||||||
|
if(nameList.indexOf(ite.物料名)>-1){}else{
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
seriesData.push([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
tableData6.forEach(item => {
|
||||||
|
let indexX = nameList.indexOf(item.物料名);
|
||||||
|
let indexY = item.周-that.firstWeekNum;
|
||||||
|
seriesData[indexX][indexY]=item.合格数;
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
tableData6.forEach(item => {
|
||||||
|
let indexX = nameList.indexOf(item.物料名);
|
||||||
|
let indexY = item.month-1;
|
||||||
|
seriesData[indexX][indexY]=item.合格数;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for(let n=0;n<seriesData.length;n++){
|
||||||
|
let obj = {};
|
||||||
|
obj.name= nameList[n];
|
||||||
|
obj.stack= 'Ad';
|
||||||
|
obj.type= 'bar';
|
||||||
|
obj.barWidth= '15px';
|
||||||
|
obj.data= seriesData[n];
|
||||||
|
option.series.push(obj)
|
||||||
|
}
|
||||||
|
that.setChart("bachart3", option);
|
||||||
|
}else{
|
||||||
|
that.setChart("bachart3", option);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData7(){
|
getData7(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
|
query: { start_date: that.start_date, end_date: that.end_date, dept_name: "7车间" },
|
||||||
};
|
};
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = '预制棒(7车间)';
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('7生产车间统计:',doInRes);
|
console.log('7生产车间统计:',res);
|
||||||
|
let tableData7 = res.data2.ds0;
|
||||||
|
that.tableData7 = tableData7;
|
||||||
debugger;
|
debugger;
|
||||||
|
if(tableData7.length>0){
|
||||||
|
debugger;
|
||||||
|
option.series = [];
|
||||||
|
let seriesData = [],nameList = [];
|
||||||
|
tableData7.forEach(ite=>{
|
||||||
|
if(nameList.indexOf(ite.物料名)>-1){}else{
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
seriesData.push([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tableData7.forEach(item => {
|
||||||
|
let indexX=0,indexY=0;
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.周-that.firstWeekNum;
|
||||||
|
}else{
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.月-1;
|
||||||
|
}
|
||||||
|
seriesData[indexX][indexY]=item.合格数;
|
||||||
|
});
|
||||||
|
for(let n=0;n<seriesData.length;n++){
|
||||||
|
let obj = {};
|
||||||
|
obj.name= nameList[n];
|
||||||
|
obj.stack= 'Ad';
|
||||||
|
obj.type= 'bar';
|
||||||
|
obj.barWidth= '15px';
|
||||||
|
obj.data= seriesData[n];
|
||||||
|
option.series.push(obj)
|
||||||
|
}
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
}else{
|
||||||
|
that.setChart("bachart1", option);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData10(){
|
getData10(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = '预制管(10车间)';
|
||||||
let obj = {
|
let obj = {
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
|
query: { start_date: that.start_date, end_date: that.end_date, dept_name: "10车间" },
|
||||||
};
|
};
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('10生产车间统计:',doInRes);
|
// console.log('10生产车间统计:',res);
|
||||||
debugger;
|
let tableData10 = res.data2.ds0;
|
||||||
|
that.tableData10 = tableData10;
|
||||||
|
if(tableData10.length>0){
|
||||||
|
option.series = [];
|
||||||
|
let seriesData = [],nameList = [];
|
||||||
|
tableData10.forEach(ite=>{
|
||||||
|
if(nameList.indexOf(ite.物料名)>-1){}else{
|
||||||
|
nameList.push(ite.物料名);
|
||||||
|
seriesData.push([])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
tableData10.forEach(item => {
|
||||||
|
let indexX=0,indexY=0;
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.周-that.firstWeekNum;
|
||||||
|
}else{
|
||||||
|
indexX = nameList.indexOf(item.物料名);
|
||||||
|
indexY = item.月-1;
|
||||||
|
}
|
||||||
|
seriesData[indexX][indexY]=item.合格数;
|
||||||
|
});
|
||||||
|
for(let n=0;n<seriesData.length;n++){
|
||||||
|
let obj = {};
|
||||||
|
obj.name= nameList[n];
|
||||||
|
obj.stack= 'Ad';
|
||||||
|
obj.type= 'bar';
|
||||||
|
obj.barWidth= '15px';
|
||||||
|
obj.data= seriesData[n];
|
||||||
|
option.series.push(obj)
|
||||||
|
}
|
||||||
|
that.setChart("bachart2", option);
|
||||||
|
}else{
|
||||||
|
that.setChart("bachart2", option);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getDataDAVG(){
|
||||||
|
let that = this;
|
||||||
|
let option = deepCopy(that.basicOption);
|
||||||
|
option.xAxis.data = that.xAxisData;
|
||||||
|
option.title.text = 'AVG';
|
||||||
|
let obj = {
|
||||||
|
query: { start_date: that.start_date, end_date: that.end_date},
|
||||||
|
};
|
||||||
|
let exec = that.queryType=='月'?'AVGWeek':'AVGMonth';
|
||||||
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
// console.log('AVG统计:',res);
|
||||||
|
let tableDataAVG = res.data2.ds0;
|
||||||
|
let seriesData = [];
|
||||||
|
if(tableDataAVG.length>0){
|
||||||
|
tableDataAVG.forEach(item => {
|
||||||
|
let index=0;
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
index = item.month-1;
|
||||||
|
}else{
|
||||||
|
index = item.周-that.firstWeekNum;
|
||||||
|
}
|
||||||
|
seriesData[index]=item.合格数;
|
||||||
|
});
|
||||||
|
let obj = {};
|
||||||
|
obj.name= 'AVG';
|
||||||
|
obj.type= 'bar';
|
||||||
|
obj.barWidth= '15px';
|
||||||
|
obj.data= seriesData;
|
||||||
|
option.series.push(obj)
|
||||||
|
that.setChart("bachart4", option);
|
||||||
|
}else{
|
||||||
|
that.setChart("bachart4", option);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
if(this.queryDate!==''){
|
let that = this;
|
||||||
if(this.queryType=='月'){
|
if(this.queryType=='月'){
|
||||||
|
if(this.queryDate!==''&&this.queryDate!==null){
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date =this.queryDate+'-01';
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split('-');
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
this.firstWeekNum = this.getWeekOfYear(new Date(this.start_date));
|
||||||
|
this.endWeekNum = this.getWeekOfYear(new Date(this.end_date));
|
||||||
|
let duration = this.endWeekNum - this.firstWeekNum + 1;
|
||||||
|
let xAxisData = [];
|
||||||
|
for(let i =1;i<=duration;i++ ){
|
||||||
|
xAxisData.push('第'+i+'周');
|
||||||
|
}
|
||||||
|
that.xAxisData = xAxisData;
|
||||||
}else{
|
}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.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
|
let date = new Date(this.start_date);
|
||||||
|
this.firstWeekNum = this.getWeekOfYear(date);
|
||||||
|
this.xAxisData = this.xAxisOrigin;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(this.queryDate!==''&&this.queryDate!==null){
|
||||||
|
this.start_date = this.queryDate+'-01-01';
|
||||||
|
this.end_date = this.queryDate+'-12-31';
|
||||||
}else{
|
}else{
|
||||||
this.start_date = this.currentYear+'-01-01';
|
this.start_date = this.currentYear+'-01-01';
|
||||||
this.end_date = this.currentYear+'-12-31';
|
this.end_date = this.currentYear+'-12-31';
|
||||||
}
|
}
|
||||||
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
debugger;
|
|
||||||
console.log(this.query)
|
|
||||||
this.getData6();
|
this.getData6();
|
||||||
this.getData7();
|
this.getData7();
|
||||||
this.getData10();
|
this.getData10();
|
||||||
|
this.getDataDAVG();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select v-model="queryType" clearable @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"
|
:key="item"
|
||||||
:label="item"
|
:label="item"
|
||||||
|
@ -31,8 +31,7 @@
|
||||||
<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>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main id="elMain">
|
||||||
<!-- <el-alert title="生产统计" type="success" style="margin-bottom:20px;"></el-alert> -->
|
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
|
@ -41,18 +40,22 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData">
|
<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="process">
|
<el-table-column label="工序" prop="mgroup_name">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="规格" prop="name">
|
<el-table-column label="规格" prop="name">
|
||||||
|
<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="name">
|
||||||
|
<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="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column label="产品编号" prop="number">
|
|
||||||
</el-table-column> -->
|
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -63,7 +66,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import scEcharts from '@/components/scEcharts';
|
import scEcharts from '@/components/scEcharts';
|
||||||
const xAxisData = ['平头','粘头','粗磨','中磨','细磨','抛光','开槽','配管'];
|
|
||||||
export default {
|
export default {
|
||||||
name: 'chart',
|
name: 'chart',
|
||||||
components: {
|
components: {
|
||||||
|
@ -71,6 +73,7 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tableHeight:0,
|
||||||
queryType:'月',
|
queryType:'月',
|
||||||
queryDate:'',
|
queryDate:'',
|
||||||
start_date:'',
|
start_date:'',
|
||||||
|
@ -90,45 +93,47 @@
|
||||||
},
|
},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data:xAxisData
|
data:[]
|
||||||
},
|
},
|
||||||
yAxis: {
|
yAxis: {
|
||||||
type: 'value'
|
type: 'value'
|
||||||
},
|
},
|
||||||
series: [{
|
series: [{
|
||||||
data: [120, 200, 150, 80, 70, 110, 130],
|
data: [0,0,0,0,0,0,0,0],
|
||||||
type: 'bar',
|
|
||||||
barWidth: '15px',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
data: [110, 180, 120, 120, 60, 90, 110],
|
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
barWidth: '15px',
|
barWidth: '15px',
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
tableData:[
|
processData:[],
|
||||||
{id:1,process:'平头',date:'2023-12-11',name:'ZJ2-1',count_ok:200},
|
xAxisData:[],
|
||||||
{id:1,process:'粘头',date:'2023-12-11',name:'ZJ2-2',count_ok:200},
|
tableData:[],
|
||||||
{id:1,process:'粗磨',date:'2023-12-11',name:'ZJ2-3',count_ok:200},
|
|
||||||
{id:1,process:'中磨',date:'2023-12-11',name:'ZJ2-4',count_ok:200},
|
|
||||||
{id:1,process:'细磨',date:'2023-12-11',name:'ZJ2-1',count_ok:200},
|
|
||||||
{id:1,process:'抛光',date:'2023-12-11',name:'ZJ2-2',count_ok:200},
|
|
||||||
{id:1,process:'开槽',date:'2023-12-11',name:'ZJ2-3',count_ok:200},
|
|
||||||
{id:1,process:'配管',date:'2023-12-11',name:'ZJ2-4',count_ok:200},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
|
||||||
|
let that = this;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth()+1;
|
let month = date.getMonth()+1;
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
this.currentYear = year;
|
that.currentYear = year;
|
||||||
this.currentMonth = month;
|
that.currentMonth = month>9?month:'0'+month;
|
||||||
this.start_date =year+'-'+month+'-01';
|
that.start_date =year+'-'+month+'-01';
|
||||||
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.queryDate = year+'-'+month;
|
let month1 = month>9?month:'0'+month;
|
||||||
this.getData6();
|
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:{
|
methods:{
|
||||||
queryTypeChange(value){
|
queryTypeChange(value){
|
||||||
|
@ -137,19 +142,50 @@
|
||||||
},
|
},
|
||||||
getData6(){
|
getData6(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
console.log('xAxisData:',that.xAxisData);
|
||||||
let obj = {
|
that.option.xAxis.data = that.xAxisData;
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "6车间" },
|
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) => {
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.tableData = res;
|
||||||
console.log('6生产车间统计:',doInRes);
|
let xAxisData=that.xAxisData;
|
||||||
debugger;
|
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!==''){
|
if(this.queryDate!==''&&this.queryDate!==null){
|
||||||
if(this.queryType=='月'){
|
if(this.queryType=='月'){
|
||||||
|
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date =this.queryDate+'-01';
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split('-');
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<el-select v-model="queryType" clearable @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"
|
:key="item"
|
||||||
:label="item"
|
:label="item"
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
<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>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-main>
|
<el-main id="elMain">
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10" id="elCol">
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<scEcharts height="300px" :option="option1"></scEcharts>
|
<scEcharts height="300px" :option="option1"></scEcharts>
|
||||||
|
@ -48,9 +48,11 @@
|
||||||
<scEcharts height="300px" :option="option3"></scEcharts>
|
<scEcharts height="300px" :option="option3"></scEcharts>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="10">
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData1">
|
<el-table :data="tableData1" :height="tableHeight">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="任务编号" prop="number">
|
<el-table-column label="任务编号" prop="number">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -58,17 +60,14 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成数" prop="count_ok">
|
<el-table-column label="完成数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成率">
|
<el-table-column label="完成率" prop="rate">
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.count_ok/scope.row.count*100}}%
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData2">
|
<el-table :data="tableData2" :height="tableHeight">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="任务编号" prop="number">
|
<el-table-column label="任务编号" prop="number">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -76,17 +75,14 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成数" prop="count_ok">
|
<el-table-column label="完成数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成率">
|
<el-table-column label="完成率" prop="rate">
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.count_ok/scope.row.count*100}}%
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="8">
|
<el-col :lg="8">
|
||||||
<el-card shadow="never">
|
<el-card shadow="never">
|
||||||
<el-table :data="tableData3">
|
<el-table :data="tableData3" :height="tableHeight">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="任务编号" prop="number">
|
<el-table-column label="任务编号" prop="number">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -94,10 +90,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成数" prop="count_ok">
|
<el-table-column label="完成数" prop="count_ok">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="完成率">
|
<el-table-column label="完成率" prop="rate">
|
||||||
<template #default="scope">
|
|
||||||
{{ scope.row.count_ok/scope.row.count*100}}%
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
@ -115,13 +108,13 @@
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
tableHeight:0,
|
||||||
queryType:'月',
|
queryType:'月',
|
||||||
queryDate:'',
|
queryDate:'',
|
||||||
start_date:'',
|
start_date:'',
|
||||||
end_date:'',
|
end_date:'',
|
||||||
currentYear:'',
|
currentYear:'',
|
||||||
currentMonth:'',
|
currentMonth:'',
|
||||||
xAxisData:['第一周','第二周','第三周','第四周'],
|
|
||||||
typeOptions:['月','年'],
|
typeOptions:['月','年'],
|
||||||
option1: {
|
option1: {
|
||||||
title: {
|
title: {
|
||||||
|
@ -138,8 +131,8 @@
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
label: false,
|
label: false,
|
||||||
data: [
|
data: [
|
||||||
{value: 20, name: '已完成'},
|
{value: 0, name: '已完成'},
|
||||||
{value: 3, name: '未完成'},
|
{value: 0, name: '未完成'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -159,8 +152,8 @@
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
label: false,
|
label: false,
|
||||||
data: [
|
data: [
|
||||||
{value: 10, name: '已完成'},
|
{value: 0, name: '已完成'},
|
||||||
{value: 3, name: '未完成'},
|
{value: 0, name: '未完成'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -179,32 +172,31 @@
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
label: false,
|
label: false,
|
||||||
data: [
|
data: [
|
||||||
{value: 15, name: '已完成'},
|
{value: 0, name: '已完成'},
|
||||||
{value: 3, name: '未完成'},
|
{value: 0, name: '未完成'},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// tableData:[
|
|
||||||
// {id:1,number:'20231210',count:300,count_rate:83,count_ok:250},
|
|
||||||
// {id:1,number:'20231211',count:300,count_rate:66,count_ok:200},
|
|
||||||
// {id:1,number:'20231212',count:300,count_rate:93,count_ok:280},
|
|
||||||
// {id:1,number:'20231213',count:300,count_rate:0,count_ok:0},
|
|
||||||
// ],
|
|
||||||
tableData1:[],
|
tableData1:[],
|
||||||
tableData2:[],
|
tableData2:[],
|
||||||
tableData3:[],
|
tableData3:[],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
let that = this;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth()+1;
|
let month = date.getMonth()+1;
|
||||||
let days = new Date(year, month, 0).getDate();
|
let days = new Date(year, month, 0).getDate();
|
||||||
this.currentYear = year;
|
this.currentYear = year;
|
||||||
this.currentMonth = month;
|
this.currentMonth = month>9?month:'0'+month;
|
||||||
this.start_date =year+'-'+month+'-01';
|
this.start_date =year+'-'+month+'-01';
|
||||||
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
this.queryDate = year+'-'+month;
|
let month1 = month>9?month:'0'+month;
|
||||||
|
this.queryDate = year+'-'+month1;
|
||||||
|
let height= document.getElementById('elMain').clientHeight-40;
|
||||||
|
let chartheight= document.getElementById('elCol').clientHeight;
|
||||||
|
that.tableHeight = height-chartheight;
|
||||||
this.getData6();
|
this.getData6();
|
||||||
this.getData7();
|
this.getData7();
|
||||||
this.getData10();
|
this.getData10();
|
||||||
|
@ -213,97 +205,123 @@
|
||||||
queryTypeChange(){
|
queryTypeChange(){
|
||||||
this.queryDate = '';
|
this.queryDate = '';
|
||||||
},
|
},
|
||||||
getData6(){
|
|
||||||
let that = this;
|
|
||||||
let obj={};
|
|
||||||
obj.belong_dept__name = '6车间';
|
|
||||||
obj.start_date__gte = this.start_date;
|
|
||||||
obj.end_date__lte = this.end_date;
|
|
||||||
that.$API.pm.utask.list.req( obj).then((res) => {
|
|
||||||
console.log('utask:',res);
|
|
||||||
this.tableData1 = res.results;
|
|
||||||
let count_ok1 = 0;
|
|
||||||
let count_notok1 = 0;
|
|
||||||
res.results.forEach(item => {
|
|
||||||
if(item.count_ok>=item.count){
|
|
||||||
count_ok1++;
|
|
||||||
}else{
|
|
||||||
count_notok1++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.option1.series.data[0].value = count_ok1;
|
|
||||||
this.option1.series.data[1].value = count_notok1;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
getData7(){
|
getData7(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.tableData1=[];
|
||||||
|
that.option1.series.data[0].value = 0;
|
||||||
|
that.option1.series.data[1].value = 0;
|
||||||
let obj={};
|
let obj={};
|
||||||
obj.belong_dept__name = '7车间';
|
obj.page = 0;
|
||||||
|
obj.mgroup__belong_dept__name = '7车间';
|
||||||
obj.start_date__gte = this.start_date;
|
obj.start_date__gte = this.start_date;
|
||||||
obj.end_date__lte = this.end_date;
|
obj.end_date__lte = this.end_date;
|
||||||
that.$API.pm.utask.list.req( obj).then((res) => {
|
that.$API.pm.utask.list.req( obj).then((res) => {
|
||||||
console.log('utask:',res);
|
console.log('utask:',res);
|
||||||
this.tableData2 = res.results;
|
let data = [];
|
||||||
let count_ok2 = 0;
|
let count_ok1 = 0;
|
||||||
let count_notok2 = 0;
|
let count_notok1 = 0;
|
||||||
res.results.forEach(item => {
|
if(res.length>0){
|
||||||
if(item.count_ok>=item.count){
|
res.forEach(item => {
|
||||||
count_ok2++;
|
let obj = item;
|
||||||
}else{
|
obj.rate = (item.count_ok/item.count*100).toFixed(2)+'%';
|
||||||
count_notok2++;
|
if(item.count_ok>=item.count){
|
||||||
}
|
count_ok1++;
|
||||||
});
|
}else{
|
||||||
this.option2.series.data[0].value = count_ok2;
|
count_notok1++;
|
||||||
this.option2.series.data[1].value = count_notok2;
|
}
|
||||||
|
data.push(obj);
|
||||||
|
});
|
||||||
|
that.tableData1 = data
|
||||||
|
that.option1.series.data[0].value = count_ok1;
|
||||||
|
}
|
||||||
|
this.option1.series.data[0].value = count_ok1;
|
||||||
|
this.option1.series.data[1].value = count_notok1;
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getData10(){
|
async getData10(){
|
||||||
let that = this;
|
let that = this;
|
||||||
|
that.tableData2=[];
|
||||||
|
that.option2.series.data[0].value = 0;
|
||||||
|
that.option2.series.data[1].value = 0;
|
||||||
let obj={};
|
let obj={};
|
||||||
obj.belong_dept__name = '10车间';
|
obj.page = 0;
|
||||||
|
obj.mgroup__belong_dept__name = '10车间';
|
||||||
obj.start_date__gte = this.start_date;
|
obj.start_date__gte = this.start_date;
|
||||||
obj.end_date__lte = this.end_date;
|
obj.end_date__lte = this.end_date;
|
||||||
that.$API.pm.utask.list.req( obj).then((res) => {
|
await that.$API.pm.utask.list.req( obj).then((res) => {
|
||||||
console.log('utask:',res);
|
console.log('utask:',res);
|
||||||
this.tableData3 = res.results;
|
let data = [];
|
||||||
|
let count_ok2 = 0;
|
||||||
|
let count_notok2 = 0;
|
||||||
|
if(res.length>0){
|
||||||
|
res.forEach(item => {
|
||||||
|
let obj = item;
|
||||||
|
obj.rate = (item.count_ok/item.count*100).toFixed(2)+'%';
|
||||||
|
if(item.count_ok>=item.count){
|
||||||
|
count_ok2++;
|
||||||
|
}else{
|
||||||
|
count_notok2++;
|
||||||
|
}
|
||||||
|
data.push(obj);
|
||||||
|
});
|
||||||
|
that.tableData2 = data;
|
||||||
|
that.option2.series.data[0].value = count_ok2;
|
||||||
|
that.option2.series.data[1].value = count_notok2;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async getData6(){
|
||||||
|
let that = this;
|
||||||
|
that.tableData3=[];
|
||||||
|
that.option3.series.data[0].value = 0;
|
||||||
|
that.option3.series.data[1].value = 0;
|
||||||
|
let obj={};
|
||||||
|
obj.page = 0;
|
||||||
|
obj.mgroup__belong_dept__name = '6车间';
|
||||||
|
obj.start_date__gte = this.start_date;
|
||||||
|
obj.end_date__lte = this.end_date;
|
||||||
|
await that.$API.pm.utask.list.req( obj).then((res) => {
|
||||||
|
console.log('utask:',res);
|
||||||
|
let data = [];
|
||||||
let count_ok3 = 0;
|
let count_ok3 = 0;
|
||||||
let count_notok3 = 0;
|
let count_notok3 = 0;
|
||||||
res.results.forEach(item => {
|
if(res.length>0){
|
||||||
if(item.count_ok>=item.count){
|
res.forEach(item => {
|
||||||
count_ok3++;
|
let obj = item;
|
||||||
}else{
|
obj.rate = (item.count_ok/item.count*100).toFixed(2)+'%';
|
||||||
count_notok3++;
|
if(item.count_ok>=item.count){
|
||||||
}
|
count_ok3++;
|
||||||
});
|
}else{
|
||||||
this.option3.series.data[0].value = count_ok3;
|
count_notok3++;
|
||||||
this.option3.series.data[1].value = count_notok3;
|
}
|
||||||
|
data.push(obj);
|
||||||
|
});
|
||||||
|
that.tableData3= data
|
||||||
|
that.option3.series.data[0].value = count_ok3;
|
||||||
|
that.option3.series.data[1].value = count_notok3;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
if(this.queryDate!==''){
|
if(this.queryDate!==''&&this.queryDate!==null){
|
||||||
if(this.queryType=='月'){
|
if(this.queryType=='月'){
|
||||||
this.xAxisData = ['第一周','第二周','第三周','第四周'];
|
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date =this.queryDate+'-01';
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split('-');
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
}else{
|
}else{
|
||||||
this.start_date = this.queryDate+'-01-01';
|
this.start_date = this.queryDate+'-01-01';
|
||||||
this.end_date = this.queryDate+'-12-31';
|
this.end_date = this.queryDate+'-12-31';
|
||||||
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(this.queryType=='月'){
|
if(this.queryType=='月'){
|
||||||
this.xAxisData = ['第一周','第二周','第三周','第四周'];
|
|
||||||
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
this.start_date =this.currentYear+'-'+this.currentMonth+'-01';
|
||||||
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
this.end_date = this.currentYear+'-'+this.currentMonth+'-'+new Date(this.currentYear, this.currentMonth, 0).getDate();
|
||||||
}else{
|
}else{
|
||||||
this.start_date = this.currentYear+'-01-01';
|
this.start_date = this.currentYear+'-01-01';
|
||||||
this.end_date = this.currentYear+'-12-31';
|
this.end_date = this.currentYear+'-12-31';
|
||||||
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debugger;
|
|
||||||
console.log(this.query)
|
|
||||||
this.getData6();
|
this.getData6();
|
||||||
this.getData7();
|
this.getData7();
|
||||||
this.getData10();
|
this.getData10();
|
||||||
|
|
Loading…
Reference in New Issue