fix:6、10车间看板图标数据调整

This commit is contained in:
shijing 2024-03-29 09:42:38 +08:00
parent e6488c51a5
commit 2d500e396d
2 changed files with 140 additions and 375 deletions

View File

@ -558,27 +558,35 @@ export default {
dept_name: "10车间",
},
};
let seriesData1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
xAxisData1 = [
"1月",
"2月",
"3月",
"4月",
"5月",
"6月",
"7月",
"8月",
"9月",
"10月",
"11月",
"12月",
];
that.$API.bi.dataset.exec.req("lineMonth", obj1).then((res1) => {
console.log("全年生产统计:", res1);
let list1 = res1.data2.ds0;
let seriesData1 = [],
xAxisData1 = [];
for (let i = 0; i < 12; i++) {
let day = i + 1;
let text = day + "月";
xAxisData1[i] = text;
seriesData1[i] = 0;
}
if (list1.length > 0) {
list1.forEach((item1) => {
let index1 = item1. - 1;
seriesData1[index1] = item1.合格数;
});
if (res1.data2.ds0) {
let list1 = res1.data2.ds0;
if (list1.length > 0) {
list1.forEach((item1) => {
let index1 = item1. - 1;
seriesData1[index1] += item1.合格数;
});
}
}
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 () {

View File

@ -1,18 +1,8 @@
<template>
<el-container class="dashboard">
<el-header class="header">
<div
style="
font-weight: bold;
font-family: 'myfont';
font-size: 32px;
"
>
6车间生产数据大看板
</div>
<div style="font-size: 14px; margin-top: 18px">
{{ currentDay }} {{ currentTime }}
</div>
<div class="title">6车间生产数据大看板</div>
<div class="timer">{{ currentDay }} {{ currentTime }}</div>
</el-header>
<el-main>
<el-row style="height: 60%" :gutter="10">
@ -30,32 +20,13 @@
<div
v-for="item in todayMtask"
:key="item.id"
style="
width: 50%;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 20px;
"
class="boxmainItem"
>
<div
style="
display: flex;
justify-content: space-between;
border-bottom: 1px dashed #eeeeee;
"
>
<div class="boxmainItemWrap">
<span style="font-size: 12px">{{
item.material_out_name
}}</span>
<span
style="
color: #fef000;
margin-left: 10px;
font-weight: bold;
font-family: electronicFont;
"
>
<span class="boxmainItemNumber">
{{ item.count }}
</span>
</div>
@ -149,52 +120,7 @@ export default {
legend: {
icon: "stack",
right: 0,
data: [
{
backgroundColor: "rgb(1,235,239)",
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,
color: "rgb(250,205,0)",
},
{
offset: 1,
color: "rgb(254,129,0)",
},
]),
},
data: [],
},
toolbox: {
feature: {
@ -269,125 +195,7 @@ export default {
},
},
],
series: [
{
name: "光纤预制棒",
type: "bar",
stack: "Total",
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)",
},
]
),
},
itemStyle: {
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",
},
data: [],
},
{
name: "光纤预制管",
type: "bar",
stack: "Total",
smooth: true,
lineStyle: {
width: 0,
color: "rgb(250,205,0)",
},
showSymbol: false,
areaStyle: {
opacity: 0.8,
color: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: "rgb(250,205,0)",
},
{
offset: 1,
color: "rgb(254,129,0)",
},
]
),
},
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)",
},
]
),
},
emphasis: {
focus: "series",
},
label: {
show: true,
position: "insideTop",
color: "#666",
font: "10",
},
data: [],
},
],
series: [],
},
containerHeight1: 100,
containerHeight2: 100,
@ -406,24 +214,7 @@ export default {
"完成进度",
"合格率",
],
todayMtask: [
{
material_out_name: "光纤预制棒|33*470|ZJ2|棒料成型",
count: 300,
},
{
material_out_name: "光纤预制棒|33*470|ZJ2|棒料成型",
count: 300,
},
{
material_out_name: "光纤预制棒|33*470|ZJ2|棒料成型",
count: 300,
},
{
material_out_name: "光纤预制棒|33*470|ZJ2|棒料成型",
count: 300,
},
],
todayMtask: [],
saleOutData: [],
processData: [],
time: null,
@ -545,11 +336,6 @@ export default {
that.todayMtask = res;
console.log("今日任务:", res);
});
// that.$API.pm.utask.list.req(obj).then((res) => {
// that.todayMtask = res;
// console.log(':', res);
// });
},
//
getMioItem() {
@ -649,170 +435,116 @@ export default {
this.processData = processData;
}
});
// let obj = {};
// obj.start_date = this.weekFirst;
// obj.end_date = this.weekLast;
// 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.round((item.count_ok / item.count) * 100);
// obj6.value = jindu;
// obj7.elType = 'primary';
// let rate = 0;
// if (item.count_real != 0) {
// rate = Math.round((item.count_ok / item.count_real) * 100);
// } else {
// rate = 0;
// }
// obj7.value = rate;
// arr.push(obj1);
// arr.push(obj2);
// arr.push(obj3);
// arr.push(obj4);
// arr.push(obj5);
// arr.push(obj6);
// arr.push(obj7);
// processData.push(arr);
// });
// console.log('processData', processData)
// this.processData = processData;
// }
// debugger;
// });
},
//&
getsaleOut() {
let that = this;
let that = this,
xAxisData = [],
seriesData = [],
seriesData2 = [],
legendArr = [],
legendArr2 = [];
let obj = {
query: {
start_date: this.start_date,
end_date: this.end_date,
dept_name: "6车间",
start_date: "2023-01-01",
end_date: "2023-12-31",
dept_name: "10车间",
},
};
let obj2 = {
query: {
start_date: this.start_date,
end_date: this.end_date,
start_date: "2023-01-01",
end_date: "2023-12-31",
mio_type: "sale_out",
material_id: "",
},
};
//X
for (let i = 0; i < that.days; i++) {
let day = i + 1;
let text = day + "日";
xAxisData[i] = text;
}
//
that.$API.bi.dataset.exec
.req("productStatistic", obj)
.then((res1) => {
console.log("生产车间按日统计:", res1);
let list1 = res1.data2.ds0;
let seriesData11 = [],
seriesData12 = [],
xAxisData1 = [],
bangArr = [],
guanArr = [];
for (let i = 0; i < that.days; i++) {
let day = i + 1;
let text = day + "日";
xAxisData1[i] = text;
seriesData11.push(0);
seriesData12.push(0);
if (res1.data2.ds0) {
let list1 = res1.data2.ds0;
if (list1.length > 0) {
list1.forEach((item) => {
if (legendArr.indexOf(item.物料名) == -1) {
legendArr.push(item.物料名);
}
});
legendArr.forEach((item0) => {
let seriesItem = {};
seriesItem.name = item0;
seriesItem.type = "bar";
seriesItem.data = [];
seriesItem.stack = "Ad";
seriesItem.label = {
show: true,
position: "top",
color: "#fff",
};
seriesData.push(seriesItem);
});
list1.forEach((item1) => {
let index0 = legendArr.indexOf(item1.物料名);
let index1 = item1. - 1;
seriesData[index0].data[index1] = item1.合格数;
});
}
}
if (list1.length > 0) {
list1.forEach((item1) => {
if (item1.name == "光纤预制管") {
guanArr.push(item1);
} else {
bangArr.push(item1);
}
});
}
if (bangArr.length > 0) {
bangArr.forEach((item11) => {
let index11 = item11. - 1;
seriesData11[index11] = item11.生产数;
});
}
if (guanArr.length > 0) {
guanArr.forEach((item12) => {
let index12 = item12. - 1;
seriesData12[index12] = item12.生产数;
});
}
console.log("00000000000000000000000");
console.log("seriesData:", seriesData);
let chart1Option = deepCopy(this.basicOption);
chart1Option.xAxis.data = xAxisData1;
chart1Option.series[0].data = seriesData11;
chart1Option.series[1].data = seriesData12;
chart1Option.legend.data = legendArr;
chart1Option.xAxis.data = xAxisData;
chart1Option.series = seriesData;
this.setChart("chart1", chart1Option);
});
//
that.$API.bi.dataset.exec
.req("saleOutDay", obj2)
.then((saleOutRes) => {
console.log("本月交付统计:", saleOutRes);
let seriesData21 = [],
seriesData22 = [],
xAxisData2 = [],
bangArr2 = [],
guanArr2 = [];
let list2 = saleOutRes.data2.ds0;
for (let i = 0; i < that.days; i++) {
let day = i + 1;
let text = day + "日";
xAxisData2[i] = text;
seriesData21.push(0);
seriesData22.push(0);
}
that.$API.bi.dataset.exec.req("saleOutDay", obj2).then((res2) => {
console.log("本月交付统计:", res2);
if (res2.data2.ds0) {
let list2 = res2.data2.ds0;
if (list2.length > 0) {
list2.forEach((item2) => {
if (item2.name == "光纤预制管") {
guanArr2.push(item2);
} else {
bangArr2.push(item2);
list2.forEach((item) => {
if (legendArr2.indexOf(item.物料名) == -1) {
legendArr2.push(item.物料名);
}
});
}
if (bangArr2.length > 0) {
bangArr2.forEach((item21) => {
let index21 = item21. - 1;
seriesData21[index21] = item21.生产数;
legendArr2.forEach((item0) => {
let seriesItem = {};
seriesItem.name = item0;
seriesItem.type = "bar";
seriesItem.data = [];
seriesItem.stack = "Ad2";
seriesItem.label = {
show: true,
position: "top",
color: "#fff",
};
seriesData2.push(seriesItem);
});
list2.forEach((item2) => {
let index0 = legendArr2.indexOf(item2.物料名);
let index1 = item2. - 1;
seriesData2[index0].data[index1] = item2.数量;
});
}
if (guanArr2.length > 0) {
guanArr2.forEach((item22) => {
let index22 = item22. - 1;
seriesData22[index22] = item22.生产数;
});
}
let chart2Option = deepCopy(this.basicOption);
chart2Option.series[0].type = "line";
chart2Option.series[1].type = "line";
chart2Option.xAxis.data = xAxisData2;
chart2Option.series[0].data = seriesData21;
chart2Option.series[0].label.position = "top";
chart2Option.series[1].data = seriesData22;
chart2Option.series[1].label.position = "top";
this.setChart("chart2", chart2Option);
});
}
console.log("11111111111111111111111111");
console.log("seriesData2:", seriesData2);
let chart2Option = deepCopy(this.basicOption);
chart2Option.legend.data = legendArr2;
chart2Option.xAxis.data = xAxisData;
chart2Option.series = seriesData2;
this.setChart("chart2", chart2Option);
});
},
},
};
@ -844,7 +576,15 @@ export default {
text-align: center;
padding: 12px 0px;
}
.header > .title {
font-weight: bold;
font-family: "myfont";
font-size: 32px;
}
.header > .timer {
font-size: 14px;
margin-top: 18px;
}
.box {
background: rgba(10, 63, 68, 0.5);
height: 100%;
@ -877,7 +617,24 @@ export default {
.boxmain {
height: calc(100% - 40px);
}
.boxmainItem {
width: 50%;
display: inline-block;
height: 40px;
line-height: 40px;
padding: 0 20px;
}
.boxmainItemWrap {
display: flex;
justify-content: space-between;
border-bottom: 1px dashed #eeeeee;
}
.boxmainItemNumber {
color: #fef000;
margin-left: 10px;
font-weight: bold;
font-family: electronicFont;
}
@media screen and (max-width: 800px) {
.boxmain {
height: 200px;