This commit is contained in:
caoqianming 2023-12-23 17:30:46 +08:00
commit e4658ea882
3 changed files with 522 additions and 272 deletions

View File

@ -8,15 +8,19 @@
<el-row style="height: 60%" :gutter="10">
<el-col :xs="24" :md="10" style="height: 100%;">
<el-row style="height: 38%;" :gutter="10">
<el-col :xs="8" :md="8">
<el-col :xs="8" :md="8" style="height: 100%;">
<div class="box">
<div class="boxtitle bgimg">
<div class="boxlabel">今日任务</div>
</div>
<div style="height: 4px;"></div>
<div class="boxmain flex_center bigdata border">
<span>ZB2</span>
<span style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont">130</span>
<div class="boxmain bigdata border" style="overflow:scroll">
<div v-for="item in todayMtask" :key="item.id" style="height: 40px;">
<span style="font-size:12px">{{item.material_out_name}}</span>
<span style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont">
{{item.count}}
</span>
</div>
</div>
</div>
</el-col>
@ -135,29 +139,9 @@ export default {
right: 0,
data: [{
backgroundColor: 'rgb(1,235,239)',
name: '',
name: '生产数',
itemStyle: {
// color:'rgb(1,235,239)',
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(1,235,239)'
},
{
offset: 1,
color: 'rgb(5, 158, 163)'
}])
},
textStyle: {
color: '#fff'
}
}, {
name: '管',
textStyle: {
color: '#fff'
}
}],
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
@ -166,9 +150,24 @@ export default {
{
offset: 1,
color: 'rgb(254,129,0)'
}])
},
textStyle: {
color: '#fff'
}
])
}
}],
// itemStyle: {
// color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
// {
// offset: 0,
// color: 'rgb(250,205,0)'
// },
// {
// offset: 1,
// color: 'rgb(254,129,0)'
// }
// ])
// }
},
toolbox: {
feature: {
@ -193,7 +192,7 @@ export default {
},
},
yAxis: {
name: "生产数",
name: "",
type: 'value',
nameTextStyle: {
color: '#ffffff'
@ -212,7 +211,7 @@ export default {
},
series: [
{
name: '',
name: '生产数',
type: 'bar',
stack: 'Ad',
barWidth: 30,
@ -257,14 +256,7 @@ export default {
borderRadius: 2
},
center: ['50%', '45%'],
data: [
{ value: 1, name: '椭圆弯曲' },
{ value: 3, name: '大小头' },
{ value: 0, name: '偏壁' },
{ value: 5, name: '结石' },
{ value: 5, name: '气线' },
{ value: 200, name: '合格' },
],
data: [],
emphasis: {
itemStyle: {
shadowBlur: 10,
@ -284,6 +276,7 @@ export default {
attendanceData:[],
liData2: ['序号','产品名称', '型号', '计划开始时间', '计划结束时间','完成进度', '产量','状态'],
processData: [],
todayMtask:[],
speed: 2000,
myScroll: null,
iliHeight: 30,
@ -302,6 +295,7 @@ export default {
},
currentTime:'',
currentDay:'',
today:'',
todayObjet:{},
yesterdayObjet:{},
@ -438,11 +432,13 @@ export default {
this.currentDay = day;
this.start_date =year+'-'+month+'-01';
this.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
this.today = year+'-'+month+'-'+day;
let yesterday = new Date(date.getTime()-24*60*60*1000);
this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate();
this.getMtask();
this.getAttendance();
this.getProductLine();
this.getTodayMtask();
},
methods: {
showTime(){
@ -503,6 +499,7 @@ export default {
let obj ={};
obj.start_date__gte = this.start_date;
obj.end_date__lte = this.end_date;
obj.belong_dept__name='10车间';
obj.page=0;
that.$API.pm.utask.list.req(obj).then((res) => {
console.log('任务进度:',res);
@ -558,6 +555,7 @@ export default {
let chart1Option = deepCopy(this.basicOption)
chart1Option.xAxis.data = xAxisData1;
chart1Option.series[0].data = seriesData1;
chart1Option.yAxis.name='生产数';
let chart1 = this.setChart("chart1", chart1Option);
let index1 = 0
this.chartInterval1 = setInterval(function () {
@ -588,13 +586,14 @@ export default {
}
if(list2.length>0){
list2.forEach(item2=>{
let index2 = item.-1;
let index2 = item2.-1;
seriesData2[index2] = item2.合格率;
})
}
console.log('xAxisData2',xAxisData2)
let chart2Option = deepCopy(this.basicOption);
chart2Option.xAxis.data = xAxisData2;
chart2Option.yAxis.name='合格率';
chart2Option.legend = {
icon: "stack",
right: 0,
@ -705,7 +704,7 @@ export default {
let chart3 = this.setChart("chart3", that.chart3Option);
let index3 = 0
this.chartInterval3 = setInterval(function () {
if (index3 < chart3Option.series[0].data.length) {
if (index3 < that.chart3Option.series[0].data.length) {
chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 });
chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 });
@ -718,6 +717,34 @@ export default {
});
},
//
getUtask(){
let that = this;
let obj = {};
let date = that.currentYear+'-'+that.currentMonth+'-'+that.currentDay;
obj.start_date =date;
obj.end_date =date;
obj.page = 0;
obj.belong_dept__name = '10车间';
that.$API.pm.utask.list.req(obj).then(res=>{
let list = res;
})
},
//
getTodayMtask(){
let that = this;
let obj ={};
obj.start_date = this.today;
obj.end_date = this.today;
obj.belong_dept__name='10车间';
obj.page=0;
that.$API.pm.mtask.list.req(obj).then((res) => {
that.todayMtask=res;
console.log('今日任务:',res);
});
},
//
}
}
</script>

View File

@ -7,37 +7,21 @@
<el-main>
<el-row style="height: 60%" :gutter="10">
<el-col :xs="24" :md="10" style="height: 100%;">
<el-row style="height: 29%" :gutter="10">
<el-col :xs="24" :md="24">
<div class="box">
<el-row style="height: 29%;width:100%" :gutter="10">
<div class="box" style="width: 100%;">
<div class="boxtitle">
<div class="boxlabel">今日任务</div>
</div>
<div style="height: 4px;"></div>
<div class="boxmain bigdata border">
<el-row>
<el-col :span="12">
<div
style="display:flex;align-items:center;justify-content:space-around;border: 1px solid transparent;margin-top:6%;">
<div>ZB2</div>
<div
style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont;">
130</div>
</div>
</el-col>
<el-col :span="12">
<div
style="display:flex;align-items:center;justify-content:space-around;border: 1px solid transparent;margin-top:6%">
<div>ZJ2</div>
<div
style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont;">
130</div>
</div>
</el-col>
</el-row>
<div class="boxmain bigdata border" style="overflow:scroll">
<div v-for="item in todayMtask" :key="item.id" style="width:50%;display:inline-block; height: 40px;">
<span style="font-size:12px">{{item.material_out_name}}</span>
<span style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont">
{{item.count}}
</span>
</div>
</div>
</div>
</el-col>
</el-row>
<div style="height: 1%;"></div>
<el-row style="height:70%">
@ -49,7 +33,7 @@
<div style="height: 4px;"></div>
<div class="boxmain" id="scrollContainer1">
<scScrollTavle v-if="table1Visible" :tableHeight="containerHeight1"
:rowData="listData1test" :titleData="liData1" :refValue="refValue1"
:rowData="saleOutData" :titleData="liData1" :refValue="refValue1"
></scScrollTavle>
</div>
</div>
@ -64,7 +48,7 @@
<div style="height: 4px;"></div>
<div class="boxmain" id="scrollContainer2">
<scScrollTavle v-if="table2Visible" :tableHeight="containerHeight2"
:rowData="listData2test" :titleData="liData2" :refValue="refValue2"
:rowData="processData" :titleData="liData2" :refValue="refValue2"
></scScrollTavle>
</div>
</div>
@ -320,6 +304,9 @@ export default {
[{elType:'primary',value:"开凿"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"}, {elType:'primary',value:368},{elType:'primary',value:320},{elType:'progress',value:99},{elType:'primary',value:'60%'},{elType:'primary',value:'周欸'}],
[{elType:'primary',value:"配管"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"}, {elType:'primary',value:368},{elType:'primary',value:330},{elType:'progress',value:99},{elType:'primary',value:'60%'},{elType:'primary',value:'吴思'}],
],
todayMtask:[],
saleOutData:[],
processData:[],
time: null,
start_date:'',
end_date:'',
@ -327,6 +314,7 @@ export default {
dayInterval:null,
currentTime:'',
currentDay:'',
}
},
mounted() {
@ -338,13 +326,21 @@ export default {
this.table2Visible = true;
const ondDayTime = 86400000;
let cDate = new Date();
let month = cDate.getMonth()+1;
let start_date = cDate.getFullYear()+'-'+month+'-01';
let lastDay = new Date(cDate.getFullYear(), cDate.getMonth(), 0).getDate();
let end_date = cDate.getFullYear()+'-'+month+'-'+lastDay;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let day = date.getDate();
let days = new Date(year, month, 0).getDate();
this.days = days;
let start_date = year+'-'+month+'-01';
let lastDay = new Date(year, month, 0).getDate();
let end_date = year+'-'+month+'-'+lastDay;
this.start_date = start_date;
this.end_date = end_date;
this.today = year+'-'+month+'-'+day;
let yesterday = new Date(date.getTime()-24*60*60*1000);
this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate();
this.getsaleOut();
let chart1Option = deepCopy(this.basicOption)
this.setChart("chart1", chart1Option);
@ -354,7 +350,10 @@ export default {
chart2Option.series[0].type = 'line';
chart2Option.series[1].type = 'line';
this.setChart("chart2", chart2Option)
this.getMioItem();//
this.getTodayMtask();//
//
this.getMtask();
//
this.showTime()
this.dayInterval = setInterval(()=>{
@ -381,21 +380,98 @@ export default {
} catch (error) { }
}, 500)
},
//
getTodayMtask(){
let that = this;
let obj ={};
obj.start_date = this.today;
obj.end_date = this.today;
obj.belong_dept__name='6车间';
obj.page=0;
that.$API.pm.mtask.list.req(obj).then((res) => {
that.todayMtask=res;
console.log('今日任务:',res);
});
},
//
getMioItem(){
let that = this;
let obj ={};
that.$API.inm.mioitem.list.req(obj).then((res) => {
obj.mio__type = 'sale_out';
obj.page=0;
that.$API.inm.mio.list.req(obj).then((res) => {
console.log(res);
debugger;
let saleOutData = [];
res.forEach(item => {
let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {};
obj1.elType = 'primary';
obj1.value = item.inout_date;
obj2.elType = 'primary';
obj2.value = item.inout_date;
obj3.elType = 'primary';
obj3.value = item.inout_date;
obj4.elType = 'primary';
obj4.value = item.inout_date;
arr.push(obj1);
arr.push(obj2);
arr.push(obj3);
arr.push(obj4);
saleOutData.push(arr);
});
this.saleOutData = saleOutData;
});
},
//
getMtask(){
let that = this;
let obj ={};
obj.start_date = this.today;
obj.end_date = this.today;
obj.mgroup__belong_dept__name='6车间';
obj.page=0;
that.$API.pm.mtask.list.req(obj).then((res) => {
console.log(res);
if(res.length>0){
let processData = [];
res.forEach(item => {
let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {},obj6 = {},obj7 = {},obj8 = {};
obj1.elType = 'primary';
obj1.value = item.mgroup_name;//
obj2.elType = 'primary';
obj2.value = item.material_out_.name;
obj3.elType = 'primary';
obj3.value = item.material_out_.specification;
obj4.elType = 'primary';
obj4.value = item.count;
obj5.elType = 'primary';
obj5.value = item.count_ok;
obj6.elType = 'progress';
let jindu = Math.floor((item.count_ok/item.count)*100);
obj6.value = jindu;
obj7.elType = 'primary';
let rate = 0;
if(item.count_real!=0){
rate = Math.floor((item.count_ok/item.count_real)*100);
}else{
rate = 0;
}
obj7.value = rate;
obj8.elType = 'primary';
obj8.value = item.submit_user;
arr.push(obj1);
arr.push(obj2);
arr.push(obj3);
arr.push(obj4);
arr.push(obj5);
arr.push(obj6);
arr.push(obj7);
arr.push(obj8);
processData.push(arr);
});
console.log('processData',processData)
this.processData = processData;
}
debugger;
});
},
@ -419,6 +495,7 @@ export default {
debugger;
});
},
},
}
@ -431,6 +508,7 @@ export default {
.dashboard {
background-image: url("/public/img/photon_bg.png");
color: #fff;
background-size:cover;
font-family: "Microsoft Yahei" !important;
}
.header {

View File

@ -7,21 +7,21 @@
<el-main>
<el-row style="height: 60%" :gutter="10">
<el-col :xs="24" :md="10" style="height: 100%;">
<el-row style="height: 29%">
<el-col>
<div class="box">
<div class="box" style="height: 29%">
<div class="boxtitle">
<div class="boxlabel">今日任务</div>
</div>
<div style="height: 4px;"></div>
<div class="boxmain flex_center bigdata border">
<span>ZJ2</span>
<span
style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont">600</span>
<div class="boxmain bigdata border" style="overflow:scroll">
<div v-for="item in todayMtask" :key="item.id" style="width:50%;display:inline-block; height: 40px;">
<span style="font-size:12px">{{item.material_out_name}}</span>
<span style="color: #fef000;margin-left: 10px;font-weight:bold;font-family:electronicFont">
{{item.count}}
</span>
</div>
</div>
</div>
</el-col>
</el-row>
<div style="height: 1%;"></div>
<el-row style="height:70%">
<el-col style="height: 100%;">
@ -32,7 +32,7 @@
<div style="height: 4px;"></div>
<div class="boxmain" id="scrollContainer1">
<scScrollTavle v-if="table1Visible" :tableHeight="containerHeight1"
:rowData="listData1test" :titleData="liData1" :refValue="refValue1"></scScrollTavle>
:rowData="processData" :titleData="liData1" :refValue="refValue1"></scScrollTavle>
</div>
</div>
</el-col>
@ -46,7 +46,7 @@
<div style="height: 4px;"></div>
<div class="boxmain" id="scrollContainer2">
<scScrollTavle v-if="table2Visible" :tableHeight="containerHeight2"
:rowData="listData2test" :titleData="liData2" :refValue="refValue2"></scScrollTavle>
:rowData="lineData" :titleData="liData2" :refValue="refValue2"></scScrollTavle>
</div>
</div>
</el-col>
@ -97,6 +97,7 @@ export default {
return {
basicOption: {
backgroundColor: '',
tooltip: {
trigger: 'axis',
axisPointer: {
@ -110,9 +111,10 @@ export default {
icon: "stack",
right: 0,
data: [{
backgroundColor: 'rgb(250,205,0)',
name: '合格率',
backgroundColor: 'rgb(1,235,239)',
name: '生产数',
itemStyle: {
// color:'rgb(1,235,239)',
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
@ -121,8 +123,7 @@ export default {
{
offset: 1,
color: 'rgb(254,129,0)'
}
])
}])
},
textStyle: {
color: '#fff'
@ -207,6 +208,39 @@ export default {
data: [140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250,140, 232, 101, 264, 90, 340, 250, 340, 250]
}]
},
chart3Option:{
backgroundColor: '',
tooltip: {
trigger: 'item'
},
legend: {
top:'bottom',
},
series: {
name: '完成率',
type: 'pie',
radius: '50%',
itemStyle: {
borderRadius: 2
},
center: ['50%', '45%'],
data: [
{ value: 0, name: '炸纹' },
{ value: 0, name: '条纹' },
{ value: 0, name: '气泡' },
{ value: 0, name: '弯曲' },
{ value: 0, name: '其他' },
{ value: 0, name: '合格' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
},
containerHeight1:100,
containerHeight2:100,
table1Visible:false,
@ -214,46 +248,20 @@ export default {
refValue1:'moocBox1',
refValue2:'moocBox2',
liData1: ['序号', '型号', '完成进度', '产量', '状态'],
listData1test: [
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:90},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:100},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:40}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
[{elType:'primary',value:"ZJ2"}, {elType:'progress',value:80},{elType:'primary',value:368},{elType:'tag',value:30}],
],
processData:[],
liData2: ['序号', '炉号','产品名称', '型号', '规格', '最近产量','锅数','设备状态'],
listData2test:[
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
[{elType:'primary',value:"1"},{elType:'primary',value:"光纤预制管"},{elType:'primary',value:"ZJ2"},{elType:'primary',value:"30/268"},{elType:'primary',value:"100"},{elType:'primary',value:"30"},{elType:'tag',value:"40"}],
],
lineData:[],
todayMtask:[],
time: null,
delay: 20,
dayInterval:null,
stateOption:{
30:'生产中',
40:'已完成'
},
days:30,
today:'',
start_date:'',
end_date:'',
currentTime:'',
currentDay:'',
yesterday:'',
chartInterval1: null,
chartInterval2: null,
chartInterval3: null,
@ -266,115 +274,24 @@ export default {
//table2
this.containerHeight2 = document.getElementById('scrollContainer2').clientHeight;
this.table2Visible = true;
let chart1Option = deepCopy(this.basicOption)
let chart1 = this.setChart("chart1", chart1Option);
let index1 = 0
this.chartInterval1 = setInterval(function () {
if (index1 < chart1Option.series[0].data.length) {
chart1.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart1.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index1 });
chart1.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index1 });
} else {
index1 = 0;
}
}, 3000);
let chart2Option = deepCopy(this.basicOption)
chart2Option.legend = {
icon: "stack",
right: 0,
data: [{
backgroundColor: 'rgb(250,205,0)',
name: '合格率',
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(1,235,239)'
},
{
offset: 1,
color: 'rgb(5, 158, 163)'
}
])
},
textStyle: {
color: '#fff'
}
}],
};
chart2Option.xAxis.data= ['1日','2日', '3日', '4日', '5日', '6日', '7日', '8日','9日','10日', '11日', '12日', '13日', '14日', '15日', '16日', '17日', '18日','19日','20日', '21日', '22日', '23日', '24日', '25日', '26日', '27日', '28日', '29日', '30日'];
chart2Option.yAxis[0].name = '合格率(%)';
chart2Option.series[0].type = 'line';
chart2Option.series[0].data = ['40','60','70','56','49','69','50','60','70','56','30','69','50','60','70','56','49','69','50','60','40','56','49','69','50','70','56','49','80','50'];
let chart2 = this.setChart("chart2", chart2Option)
let index2 = 0
this.chartInterval2 = setInterval(function () {
if (index2 < chart2Option.series[0].data.length) {
chart2.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart2.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index2 });
chart2.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index2 });
index2++;
} else {
index2 = 0;
}
}, 3000);
let chart3Option ={
backgroundColor: '',
tooltip: {
trigger: 'item'
},
legend: {
top:'bottom'
},
series: [
{
name: '完成率',
type: 'pie',
radius: '50%',
itemStyle: {
borderRadius: 2
},
center: ['50%', '45%'],
data: [
{ value: 1, name: '椭圆弯曲' },
{ value: 3, name: '大小头' },
{ value: 0, name: '偏壁' },
{ value: 5, name: '结石' },
{ value: 5, name: '气线' },
{ value: 200, name: '合格' },
],
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
let chart3 = this.setChart("chart3", chart3Option);
let index3 = 0
this.chartInterval3 = setInterval(function () {
if (index3 < chart3Option.series[0].data.length) {
chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 });
chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 });
index3++;
} else {
index3 = 0;
}
}, 3000);
const ondDayTime = 86400000;
let cDate = new Date();
let month = cDate.getMonth()+1;
let start_date = cDate.getFullYear()+'-'+month+'-01';
let lastDay = new Date(cDate.getFullYear(), cDate.getMonth(), 0).getDate();
let end_date = cDate.getFullYear()+'-'+month+'-'+lastDay;
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth()+1;
let day = date.getDate();
let days = new Date(year, month, 0).getDate();
this.days = days;
let start_date = year+'-'+month+'-01';
let lastDay = new Date(year, month, 0).getDate();
let end_date = year+'-'+month+'-'+lastDay;
this.start_date = start_date;
this.end_date = end_date;
this.today = year+'-'+month+'-'+day;
let yesterday = new Date(date.getTime()-24*60*60*1000);
this.yesterday = yesterday.getFullYear()+"-" + (yesterday.getMonth()+1) + "-" + yesterday.getDate();
this.getProductLine();
this.getUtask();
this.getTodayMtask();
this.getLineData();
//
this.showTime()
this.dayInterval = setInterval(()=>{
@ -402,36 +319,263 @@ export default {
}, 500)
},
//
getMtask(){
getUtask(){
let that = this;
let obj ={};
that.$API.pm.mtask.list.req(obj).then((res) => {
obj.start_date__gte = this.start_date;
obj.end_date__lte = this.end_date;
obj.belong_dept__name='7车间';
obj.page=0;
that.$API.pm.utask.list.req(obj).then((res) => {
console.log('任务进度:',res);
debugger;
let processData = [];
res.forEach(item => {
let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {};
obj1.elType = 'primary';
obj1.value = item.material_.specification;
obj2.elType = 'progress';
let process = Math.floor((item.count_ok/item.count)*100)
obj2.value = process;
obj3.elType = 'primary';
obj3.value = item.count_ok;
obj4.elType = 'tag';
obj4.value = item.state;
arr.push(obj1);
arr.push(obj2);
arr.push(obj3);
arr.push(obj4);
processData.push(arr);
});
this.processData = processData;
});
},
//7
getLineData(){
let that = this;
that.$API.bi.dataset.exec.req('linedept7', {}).then((res) => {
console.log('7车间生产线:',res);
let list = res.data2.ds0;
if(list.length>0){
let lineData = [];
list.forEach(item => {
let arr = [],obj1 = {},obj2 = {},obj3 = {},obj4 = {},obj5 = {},obj6 = {},obj7 = {};
obj1.elType = 'primary';
obj1.value = item.equip_name;//
obj2.elType = 'primary';
obj2.value = item.material_name;
obj3.elType = 'primary';
obj3.value = item.material_specification;
obj4.elType = 'primary';
obj4.value = item.material_model;
obj5.elType = 'primary';
let process = item.count_real
obj5.value = process;
obj6.elType = 'primary';
obj6.value = item.index;
obj7.elType = 'tag';
obj7.value = item.equip_state;
arr.push(obj1);
arr.push(obj2);
arr.push(obj3);
arr.push(obj4);
arr.push(obj5);
arr.push(obj6);
arr.push(obj7);
lineData.push(arr);
});
this.lineData = lineData;
}
});
},
//线
getProductLine(){
let that = this;
let obj ={
query: {start_date:this.start_date,end_date:this.end_date,dept_name: "7车间"},
};
//
let obj1 ={
query: {start_date:this.start_date,end_date:this.end_date},
query: {start_date:that.start_date,end_date:that.end_date},
};
//7线
that.$API.bi.dataset.exec.req('linedept7', obj).then((res1) => {
console.log('7车间生产线:',res1);
that.$API.bi.dataset.exec.req('stoveStatics', obj1).then((res1) => {
console.log('本月生产统计:',res1);
let list1 = res1.data2.ds0;
let seriesData1 = [],xAxisData1=[];
if(list1.length>0){
list1.forEach(item1=>{
xAxisData1.push(item1.equip_name);
seriesData1.push(item1.count_real);
})
}
let chart1Option = deepCopy(this.basicOption)
chart1Option.xAxis.data = xAxisData1;
chart1Option.series[0].data = seriesData1;
chart1Option.yAxis.name='生产数';
let chart1 = this.setChart("chart1", chart1Option);
let index1 = 0
this.chartInterval1 = setInterval(function () {
if (index1 < chart1Option.series[0].data.length) {
chart1.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart1.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index1 });
chart1.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index1 });
index1++;
} else {
index1 = 0;
}
}, 3000);
});
//7
that.$API.bi.dataset.exec.req('stoveStatics', obj1).then((res2) => {
console.log('7车间生产按炉统计:',res2);
debugger;
//
let obj2 ={
query: {start_date:that.start_date,end_date:that.end_date,dept_name: "7车间"},
};
that.$API.bi.dataset.exec.req('lineDay', obj2).then((res2) => {
console.log('本月合格率统计:',res2);
let list2 = res2.data2.ds0;
let seriesData2 = [],xAxisData2=[];
for (let i = 0; i < that.days; i++) {
let day = i+1;
let text = day+'日';
xAxisData2[i]=text;
}
if(list2.length>0){
list2.forEach(item2=>{
let index2 = item2.-1;
seriesData2[index2] = item2.合格率;
})
}
console.log('xAxisData2',xAxisData2)
let chart2Option = deepCopy(this.basicOption);
chart2Option.xAxis.data = xAxisData2;
chart2Option.yAxis.name='合格率';
chart2Option.legend = {
icon: "stack",
right: 0,
data: [{
backgroundColor: 'rgb(250,205,0)',
name: '合格率',
itemStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(1,235,239)'
},
{
offset: 1,
color: 'rgb(5, 158, 163)'
}
])
},
textStyle: {
color: '#fff'
}
}],
};
let series2=[{
name: '合格率',
type: 'line',
smooth: true,
lineStyle: {
width: 1, color: 'rgb(1,235,239)'
},
showSymbol: false,
areaStyle: {
opacity: 0.8,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(1,235,239)'
},
{
offset: 1,
color: 'rgb(5, 158, 163)'
}
])
},
emphasis: {
focus: 'series'
},
label: {
show: true,
position: 'top',
color:'#fff'
},
itemStyle: {
borderRadius: [2, 2, 0, 0],
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: 'rgb(250,205,0)'
},
{
offset: 1,
color: 'rgb(254,129,0)'
}
])
},
data: seriesData2
}];
chart2Option.series=series2;
let chart2 = this.setChart("chart2", chart2Option);
let index2 = 0
this.chartInterval2 = setInterval(function () {
if (index2 < chart2Option.series[0].data.length) {
chart2.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart2.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index2 });
chart2.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index2 });
index2++;
} else {
index2 = 0;
}
}, 3000);
});
// &
that.$API.bi.dataset.exec.req('lineDay', obj).then((res3) => {
console.log('生产车间按日统计:',res3);
debugger;
// 121
let obj3 ={
query: {start_date:that.yesterday,end_date:that.yesterday,dept_name: "7车间"},
};
that.$API.bi.dataset.exec.req('lineDay', obj3).then((res3) => {
console.log('车间生产昨日统计:',res3);
let seriesData3 = [
{ value: 0, name: '炸纹' },
{ value: 0, name: '条纹' },
{ value: 0, name: '气泡' },
{ value: 0, name: '弯曲' },
{ value: 0, name: '其他' },
{ value: 0, name: '合格' },
]
if(res3.data2.ds0.length>0){
let item3 = res3.data2.ds0[0];
that.yesterdayObjet = item
seriesData3[0].value=item3.炸纹;
seriesData3[1].value=item3.条纹;
seriesData3[2].value=item3.气泡;
seriesData3[3].value=item3.弯曲;
seriesData3[4].value=item3.其他;
seriesData3[5].value=item3.合格数;
}
that.chart3Option.series.data = seriesData3;
let chart3 = this.setChart("chart3", that.chart3Option);
let index3 = 0
this.chartInterval3 = setInterval(function () {
if (index3 < that.chart3Option.series.data.length) {
chart3.dispatchAction({ type: 'downplay', seriesIndex: 0 });
chart3.dispatchAction({ type: 'highlight', seriesIndex: 0, dataIndex: index3 });
chart3.dispatchAction({ type: 'showTip', seriesIndex: 0, dataIndex: index3 });
index3++;
} else {
index3 = 0;
}
}, 3000);
});
},
//
getTodayMtask(){
let that = this;
let obj ={};
obj.start_date = this.today;
obj.end_date = this.today;
obj.belong_dept__name='7车间';
obj.page=0;
that.$API.pm.mtask.list.req(obj).then((res) => {
that.todayMtask=res;
console.log('今日任务:',res);
});
},
},
@ -447,6 +591,7 @@ export default {
background-image: url("/public/img/photon_bg.png");
color: #fff;
font-family: "Microsoft Yahei" !important;
background-size: cover;
}
.header {
background: url("/public/img/photon_header.png");