对接报表

This commit is contained in:
朱菊兰 2024-06-19 16:01:13 +08:00
parent 45538e80c4
commit 9de0dfc639
9 changed files with 1238 additions and 652 deletions

View File

@ -14,6 +14,10 @@ VUE_APP_TITLE = 发电玻璃智能管控平台
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://192.168.1.70:30307' # VUE_APP_BASE_API = 'http://192.168.1.70:30307'
VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com' VUE_APP_BASE_API = 'http://glass.kszny.picaiba.com'
# 闫阳
# VUE_APP_BASE_API = 'http://192.168.1.81:48080'
# 徐
# VUE_APP_BASE_API = 'http://192.168.1.56:48080'
# 郭 # 郭
# VUE_APP_BASE_API = 'http://192.168.1.61:48080' # VUE_APP_BASE_API = 'http://192.168.1.61:48080'
# sara # sara

View File

@ -1,6 +1,59 @@
// 对标报表的接口 // 对标报表的接口
import request from '@/utils/request' import request from '@/utils/request'
// 产量对标FTO
export function fTOReportByDateRangePage(data) {
return request({
url: '/ip/prod-output/queryOBFTOReportByDateRange',
method: 'post',
data: data
})
}
// 产量对标FTO导出
export function fTOReportByDateRangeExport(data) {
return request({
url: '/ip/prod-output/queryOBFTOReportByDateRangeExcel',
method: 'post',
responseType: 'blob',
data: data
})
}
// 芯片产量对标
export function cPReportByDateRangePage(data) {
return request({
url: '/ip/prod-output/queryCPReportByDateRange',
method: 'post',
data: data
})
}
// 芯片产量对标导出
export function cPReportByDateRangeExport(data) {
return request({
url: '/ip/prod-output/queryCPReportByDateRangeExport',
method: 'post',
responseType: 'blob',
data: data
})
}
// 标准组件产量对标
export function sCPReportByDateRangePage(data) {
return request({
url: '/ip/prod-output/querySCPReportByDateRange',
method: 'post',
data: data
})
}
// 标准组件产量对标导出
export function sCPReportByDateRangeExport(data) {
return request({
url: '/ip/prod-output/querySCPReportByDateRangeExport',
method: 'post',
responseType: 'blob',
data: data
})
}
// 稼动率对标 // 稼动率对标
export function utilzationComparePage(data) { export function utilzationComparePage(data) {
return request({ return request({
@ -36,3 +89,39 @@ export function chipoeeCompareExport(data) {
data: data data: data
}) })
} }
// 封装OEE对标
export function componentOEEPage(data) {
return request({
url: '/ip/component-oee/page',
method: 'post',
data: data
})
}
// 封装OEE对标导出
export function componentOEEExport(data) {
return request({
url: '/ip/component-oee/export',
method: 'post',
responseType: 'blob',
data: data
})
}
// 芯片人均产量
export function chipAnnualAverageProductionPage(data) {
return request({
url: '/ip/chip-annual-average-production/page',
method: 'post',
data: data
})
}
// 芯片人均产量导出
export function chipAnnualAverageProductionExport(data) {
return request({
url: '/ip/chip-annual-average-production/export',
method: 'post',
responseType: 'blob',
data: data
})
}

View File

@ -4,7 +4,7 @@
<bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" />
</div> </div>
<div class="containerBottom"> <div class="containerBottom">
<div class="smallTitle">4芯片产量</div> <div class="smallTitle">芯片产量</div>
<bm-line-bar <bm-line-bar
:chartHeight="chartHeight" :chartHeight="chartHeight"
:legendList="legendList" :legendList="legendList"
@ -26,101 +26,61 @@
<script> <script>
import bmSearchBar from "../components/bmSearchBar.vue"; import bmSearchBar from "../components/bmSearchBar.vue";
import BmLineBar from "../components/bmLineBar.vue"; import BmLineBar from "../components/bmLineBar.vue";
const tableProps = [ import {
{ cPReportByDateRangePage,
prop: "factory", cPReportByDateRangeExport,
label: "工厂名称", } from "@/api/report/benchmarking.js";
// filter: (val) => factoryList[val], import moment from "moment";
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
name: "ChipOutputBM", name: "ChipOutputBM",
data() { data() {
return { return {
tableProps, factoryList: [
{ id: 0, name: "瑞昌" },
{ id: 1, name: "邯郸" },
],
tableProps: [],
tableProps1: [
{
prop: "factory",
label: "工厂名称",
filter: (val) => this.factoryList[val].name,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "item",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
],
listQuery: { listQuery: {
current: 1, current: 1,
size: 1000, size: 100,
}, },
tableData: [ tableData: [],
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(269) / 2, chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2, tableH: this.tableHeight(269) / 2,
legendList: [ legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" }, { id: 1, name: "", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" }, { id: 2, name: "", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" }, { id: 3, name: "", type: 1, color: "#288AFF" },
], ],
chartMsg: { chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"], color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"], xData: [],
yName: "单位/片", yName: "单位/片",
series: [ series: [
{ {
name: "2024年4月目标值", name: "1",
// data: [3000, 2000, 3000], data: [],
// data: [6800, 5000, 8900],
// data: [12000, 17000, 19000],
data: [560000, 540000, 600000],
type: "line", type: "line",
symbol: "circle", symbol: "circle",
symbolSize: 6, symbolSize: 6,
@ -130,28 +90,22 @@ export default {
}, },
}, },
{ {
name: "2023年4月", name: "2",
// data: [2100, 800, 1500], data: [],
// data: [9500, 7200, 9901],
// data: [14666, 15000, 17888],
data: [550000, 456666, 590000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
show: true, show: true,
// position: [-5, -16], // position: [-5, -16],
// position: [-5, -16], // position: [-5, -16],
// position: [-10, -16], position: [-10, -16],
position: [-17, -16], // position: [-17, -16],
color: "#68C483", color: "#68C483",
}, },
}, },
{ {
name: "2024年4月", name: "3",
// data: [2100, 900, 1300], data: [],
// data: [9100, 7300, 9700],
// data: [14666, 15300, 18000],
data: [556666, 456666, 650000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -188,6 +142,13 @@ export default {
this.chartHeight = this.tableHeight(269) / 2; this.chartHeight = this.tableHeight(269) / 2;
window.addEventListener("resize", this._setTableHeight); window.addEventListener("resize", this._setTableHeight);
}, },
mounted() {
this.tableProp = this.tableProp1;
this.listQuery.date = 2;
this.listQuery.queryTime = moment().format("yyyy-MM-DD");
this.listQuery.factorys = [];
this.getList();
},
destroyed() { destroyed() {
window.removeEventListener("resize", this._setTableHeight); window.removeEventListener("resize", this._setTableHeight);
}, },
@ -206,11 +167,156 @@ export default {
} }
}, },
getSearch(val) { getSearch(val) {
console.log(val); this.listQuery.date = val.type;
console.log("========================="); this.listQuery.queryTime = val.startDate;
this.listQuery.factorys = val.factory;
this.getList();
}, },
handleExport() { getList() {
console.log("导出"); this.tableProps = [];
cPReportByDateRangePage({ ...this.listQuery }).then((res) => {
if (res.data && res.data.length > 0) {
//
let msg = res.data[0];
let arr = [
{
prop: "lastone",
label: msg.lastone.reportTime,
minWidth: 150,
},
{
prop: "currentone",
label: msg.currentone.reportTime,
minWidth: 150,
},
{
prop: "targetone",
label: msg.targetone.reportTime,
minWidth: 150,
},
];
this.tableProps = this.tableProps1.concat(arr);
//
let tableArr = [];
res.data.forEach((item) => {
let obj = {};
obj.factory = item.factory;
obj.item = "FTO投入";
obj.unit = "片";
obj.lastone = item.lastone.total;
obj.currentone = item.currentone.total;
obj.targetone = item.targetone.total;
tableArr.push(obj);
});
this.tableData = tableArr;
//
this.legendList[0].name = msg.targetone.reportTime;
this.legendList[1].name = msg.lastone.reportTime;
this.legendList[2].name = msg.currentone.reportTime;
this.chartMsg.series[0].name = msg.targetone.reportTime;
this.chartMsg.series[1].name = msg.lastone.reportTime;
this.chartMsg.series[2].name = msg.currentone.reportTime;
//
switch (this.listQuery.type) {
case 0:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 1:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 2:
this.chartMsg.series[1].label.position = [-10, -16];
break;
default:
this.chartMsg.series[1].label.position = [-17, -16];
}
// chartMsgseries
this.setChartMsg(res.data);
} else {
//
this.resetMsg();
}
});
},
setChartMsg(val) {
let xData = [];
let lineData = [];
let barData1 = [];
let barData2 = [];
for (let i = 0; i < val.length; i++) {
this.factoryList.map((item) => {
if (item.id === val[i].factory) {
xData.push(item.name);
}
});
lineData.push(val[i].targetone.total || 0);
barData1.push(val[i].lastone.total || 0);
barData2.push(val[i].currentone.total || 0);
}
this.chartMsg.xData = xData;
this.chartMsg.series[0].data = lineData;
this.chartMsg.series[1].data = barData1;
this.chartMsg.series[2].data = barData2;
this.chartMsg.xData = xData;
},
resetMsg() {
this.tableProps = this.tableProps1;
this.tableData = [];
this.chartMsg = {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: [],
yName: "单位/片",
series: [
{
name: "1",
data: [],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
},
},
{
name: "2",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
// position: [-5, -16],
// position: [-5, -16],
position: [-10, -16],
// position: [-17, -16],
color: "#68C483",
},
},
{
name: "3",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
},
},
],
};
},
handleExport(val) {
this.listQuery.type = val.type;
this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
let fileName = "芯片产量.xls";
cPReportByDateRangeExport({ ...this.listQuery })
.then((response) => {
this.$download.excel(response, fileName);
this.$message.success("导出成功");
})
.catch(() => {});
}, },
}, },
}; };

View File

@ -4,7 +4,7 @@
<bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" />
</div> </div>
<div class="containerBottom"> <div class="containerBottom">
<div class="smallTitle">4芯片人均产量</div> <div class="smallTitle">芯片人均产量</div>
<bm-line-bar <bm-line-bar
:chartHeight="chartHeight" :chartHeight="chartHeight"
:legendList="legendList" :legendList="legendList"
@ -26,101 +26,61 @@
<script> <script>
import bmSearchBar from "../components/bmSearchBar.vue"; import bmSearchBar from "../components/bmSearchBar.vue";
import BmLineBar from "../components/bmLineBar.vue"; import BmLineBar from "../components/bmLineBar.vue";
const tableProps = [ import {
{ chipAnnualAverageProductionPage,
prop: "factory", chipAnnualAverageProductionExport,
label: "工厂名称", } from "@/api/report/benchmarking.js";
// filter: (val) => factoryList[val], import moment from "moment";
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
name: "ChipPerCapitaBM", name: "ChipPerCapitaBM",
data() { data() {
return { return {
tableProps, factoryList: [
{ id: 0, name: "瑞昌" },
{ id: 1, name: "邯郸" },
],
tableProps: [],
tableProps1: [
{
prop: "factory",
label: "工厂名称",
filter: (val) => this.factoryList[val].name,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "item",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
],
listQuery: { listQuery: {
current: 1, current: 1,
size: 1000, size: 100,
}, },
tableData: [ tableData: [],
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(269) / 2, chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2, tableH: this.tableHeight(269) / 2,
legendList: [ legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" }, { id: 1, name: "", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" }, { id: 2, name: "", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" }, { id: 3, name: "", type: 1, color: "#288AFF" },
], ],
chartMsg: { chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"], color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"], xData: [],
yName: "单位/片", yName: "单位/片",
series: [ series: [
{ {
name: "2024年4月目标值", name: "1",
// data: [3000, 2000, 3000], data: [],
// data: [6800, 5000, 8900],
// data: [12000, 17000, 19000],
data: [560000, 540000, 600000],
type: "line", type: "line",
symbol: "circle", symbol: "circle",
symbolSize: 6, symbolSize: 6,
@ -130,28 +90,22 @@ export default {
}, },
}, },
{ {
name: "2023年4月", name: "2",
// data: [2100, 800, 1500], data: [],
// data: [9500, 7200, 9901],
// data: [14666, 15000, 17888],
data: [550000, 456666, 590000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
show: true, show: true,
// position: [-5, -16], // position: [-5, -16],
// position: [-5, -16], // position: [-5, -16],
// position: [-10, -16], position: [-10, -16],
position: [-17, -16], // position: [-17, -16],
color: "#68C483", color: "#68C483",
}, },
}, },
{ {
name: "2024年4月", name: "3",
// data: [2100, 900, 1300], data: [],
// data: [9100, 7300, 9700],
// data: [14666, 15300, 18000],
data: [556666, 456666, 650000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -188,6 +142,13 @@ export default {
this.chartHeight = this.tableHeight(269) / 2; this.chartHeight = this.tableHeight(269) / 2;
window.addEventListener("resize", this._setTableHeight); window.addEventListener("resize", this._setTableHeight);
}, },
mounted() {
this.tableProp = this.tableProp1;
this.listQuery.type = 2;
this.listQuery.startDate = moment().format("yyyy-MM-DD");
this.listQuery.factory = [];
this.getList();
},
destroyed() { destroyed() {
window.removeEventListener("resize", this._setTableHeight); window.removeEventListener("resize", this._setTableHeight);
}, },
@ -206,11 +167,143 @@ export default {
} }
}, },
getSearch(val) { getSearch(val) {
console.log(val); this.listQuery.type = val.type;
console.log("========================="); this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
this.getList();
}, },
handleExport() { getList() {
console.log("导出"); this.tableProps = [];
chipAnnualAverageProductionPage({ ...this.listQuery }).then((res) => {
if (res.data && res.data.records.length > 0) {
let msg = res.data.records[0];
let arr = [
{
prop: "yoy",
label: msg.yoyColumn,
minWidth: 150,
},
{
prop: "queryValue",
label: msg.queryColumn,
minWidth: 150,
},
{
prop: "target",
label: msg.targetColumn,
minWidth: 150,
},
];
this.tableProps = this.tableProps1.concat(arr);
this.tableData = res.data.records;
//
this.legendList[0].name = msg.targetColumn;
this.legendList[1].name = msg.yoyColumn;
this.legendList[2].name = msg.queryColumn;
this.chartMsg.series[0].name = msg.targetColumn;
this.chartMsg.series[1].name = msg.yoyColumn;
this.chartMsg.series[2].name = msg.queryColumn;
//
switch (this.listQuery.type) {
case 0:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 1:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 2:
this.chartMsg.series[1].label.position = [-10, -16];
break;
default:
this.chartMsg.series[1].label.position = [-17, -16];
}
// chartMsgseries
this.setChartMsg(res.data.records);
} else {
//
this.resetMsg();
}
});
},
setChartMsg(val) {
let xData = [];
let lineData = [];
let barData1 = [];
let barData2 = [];
for (let i = 0; i < val.length; i++) {
this.factoryList.map((item) => {
if (item.id === val[i].factory) {
xData.push(item.name);
}
});
lineData.push(val[i].target || 0);
barData1.push(val[i].yoy || 0);
barData2.push(val[i].queryValue || 0);
}
this.chartMsg.xData = xData;
this.chartMsg.series[0].data = lineData;
this.chartMsg.series[1].data = barData1;
this.chartMsg.series[2].data = barData2;
this.chartMsg.xData = xData;
},
resetMsg() {
this.tableProps = this.tableProps1;
this.tableData = [];
this.chartMsg = {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: [],
yName: "单位/片",
series: [
{
name: "1",
data: [],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
},
},
{
name: "2",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
// position: [-5, -16],
// position: [-5, -16],
position: [-10, -16],
// position: [-17, -16],
color: "#68C483",
},
},
{
name: "3",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
},
},
],
};
},
handleExport(val) {
this.listQuery.type = val.type;
this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
let fileName = "芯片人均产量对标.xls";
chipAnnualAverageProductionExport({ ...this.listQuery })
.then((response) => {
this.$download.excel(response, fileName);
this.$message.success("导出成功");
})
.catch(() => {});
}, },
}, },
}; };

View File

@ -0,0 +1,157 @@
<template>
<div
:id="chartId"
:style="{ width: '100%', height: chartHeight + 'px' }"
></div>
</template>
<script>
import * as echarts from "echarts";
import { debounce } from "@/utils/debounce";
export default {
name: "BaseChart",
data() {
return {
myChart: "",
option: {
color: [],
// color: ["#8EF0AB", "#63BDFF", "#288AFF"],
grid: {
left: 70,
right: 10,
bottom: 30,
top: 30,
},
tooltip: {
trigger: "axis",
axisPointer: {
// type: "cross",
crossStyle: {
color: "rgba(237,237,237,0.5)",
},
},
formatter: function (params) {
var res = `<span style='color:rgba(0,0,0,0.8)'>${params[0].axisValueLabel}</span>`;
for (var i = 0, l = params.length; i < l; i++) {
res +=
"<br/>" +
`${
params[i].seriesType === "line"
? '<img width="10" height="10" style="margin-right:4px;" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTIuNzIxNjM5NXB4IiBoZWlnaHQ9IjhweCIgdmlld0JveD0iMCAwIDEyLjcyMTYzOTUgOCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT7nvJbnu4QgNjwvdGl0bGU+CiAgICA8ZyBpZD0iMDTmiqXooajnrqHnkIYiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSLmjIfmoIflrozmiJDmg4XlhrUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMDUxLjYzOTE4MCwgLTQyNS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9Iue8lue7hC025aSH5Lu9LTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMjEuNTAwMDAwLCAzNDQuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0i57yW57uELTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI5LjUwMDAwMCwgNzguMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgeD0iMCIgeT0iMCIgd2lkdGg9IjE0IiBoZWlnaHQ9IjE0Ij48L3JlY3Q+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTcuMTM5MTgwMjYsMyBDOS4wMDMxMDczNywzIDEwLjU2OTI2NzMsNC4yNzQ4OTI3MiAxMS4wMTMyMjU0LDYuMDAwMjQzNDcgTDEyLjM2MDgxOTcsNiBDMTIuOTEzMTA0NSw2IDEzLjM2MDgxOTcsNi40NDc3MTUyNSAxMy4zNjA4MTk3LDcgQzEzLjM2MDgxOTcsNy41NTIyODQ3NSAxMi45MTMxMDQ1LDggMTIuMzYwODE5Nyw4IEwxMS4wMTI5NjY3LDguMDAwNzYxMzQgQzEwLjU2ODY1OTIsOS43MjU2MDIyNCA5LjAwMjc0NTUxLDExIDcuMTM5MTgwMjYsMTEgQzUuMjc1NjE1MDEsMTEgMy43MDk3MDEzMSw5LjcyNTYwMjI0IDMuMjY1MzkzNzgsOC4wMDA3NjEzNCBMMS42MzkxODAyNiw4IEMxLjA4Njg5NTUxLDggMC42MzkxODAyNTgsNy41NTIyODQ3NSAwLjYzOTE4MDI1OCw3IEMwLjYzOTE4MDI1OCw2LjQ0NzcxNTI1IDEuMDg2ODk1NTEsNiAxLjYzOTE4MDI2LDYgTDMuMjY1MTM1MDksNi4wMDAyNDM0NyBDMy43MDkwOTMyLDQuMjc0ODkyNzIgNS4yNzUyNTMxNSwzIDcuMTM5MTgwMjYsMyBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjRkZDRTZBIiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+" />'
: `<span style="display:inline-block;margin-right:4px;border-radius:2px;width:10px;height:10px;background-color:${params[i].color}"></span>`
}` +
`<span style='display:inline-block;width:180px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${
params[i].name === "%"
? (params[i].value ? params[i].value.toFixed(2) : "0.00") +
params[i].name
: String(params[i].value).replace(
/\B(?=(\d{3})+(?!\d))/g,
","
)
}</span>`;
}
return res;
},
},
xAxis: {
type: "category",
data: [],
axisTick: {
show: false,
},
axisPointer: {
type: "shadow",
},
},
yAxis: {
type: "value",
name: "",
nameTextStyle: {
fontSize: 12,
align: "right",
},
axisLabel: {},
},
series: [],
},
};
},
props: {
chartHeight: {
type: Number,
default: 300,
},
legendList: {
type: Array,
default: () => [],
},
chartMsg: {
type: Object,
default: () => {},
},
chartId: {
type: String,
default: "bmChart",
},
chartNum: {
type: Number,
default: 1,
},
},
watch: {
chartHeight: {
handler(newVal) {
this.chartHeight = newVal;
},
},
chartNum(val) {
this.canvasReset();
},
chartMsg: {
handler(newVal) {
this.canvasReset();
},
deep: true,
},
},
mounted() {
this.canvasReset();
},
methods: {
canvasReset() {
debounce(() => {
this.getMes();
}, 500)();
},
getMes() {
if (this.myChart) {
this.myChart.dispose();
}
var chartDom = document.getElementById(this.chartId);
this.myChart = echarts.init(chartDom);
this.option.color = this.chartMsg.color;
this.option.xAxis.data = this.chartMsg.xData;
this.option.yAxis.name = this.chartMsg.yName;
if (
this.chartMsg.series.length > 0 &&
this.chartMsg.series[0].data[0].name === "%"
) {
this.option.yAxis.axisLabel = {
formatter: function (value) {
return value + ".00%";
},
};
} else {
this.option.yAxis.axisLabel = {
formatter: function (value) {
return value;
},
};
}
// this.option.yAxis.axisLabel = this.chartMsg.yAxisLabel;
this.option.series = this.chartMsg.series;
this.myChart.setOption(this.option);
},
},
};
</script>

View File

@ -33,84 +33,23 @@
{{ item.name }}</span {{ item.name }}</span
> >
</div> </div>
<div
:id="chartId"
:style="{ width: '100%', height: chartHeight + 'px' }"
></div>
</div> </div>
<!-- -->
<base-chart
:chartHeight="chartHeight"
:legendList="legendList"
:chartMsg="chartMsg"
:chartId="chartId"
:chartNum="chartNum"
/>
</div> </div>
</template> </template>
<script> <script>
import * as echarts from "echarts"; import baseChart from "./baseChart.vue";
import { debounce } from "@/utils/debounce";
export default { export default {
name: "bmBarComplete", name: "bmBarComplete",
data() { data() {
return { return;
myChart: "",
option: {
color: [],
// color: ["#8EF0AB", "#63BDFF", "#288AFF"],
grid: {
left: 70,
right: 10,
bottom: 30,
top: 30,
},
tooltip: {
trigger: "axis",
axisPointer: {
// type: "cross",
crossStyle: {
color: "rgba(237,237,237,0.5)",
},
},
formatter: function (params) {
var res = `<span style='color:rgba(0,0,0,0.8)'>${params[0].axisValueLabel}</span>`;
for (var i = 0, l = params.length; i < l; i++) {
res +=
"<br/>" +
`${
params[i].seriesType === "line"
? '<img width="10" height="10" style="margin-right:4px;" src="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMTIuNzIxNjM5NXB4IiBoZWlnaHQ9IjhweCIgdmlld0JveD0iMCAwIDEyLjcyMTYzOTUgOCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDx0aXRsZT7nvJbnu4QgNjwvdGl0bGU+CiAgICA8ZyBpZD0iMDTmiqXooajnrqHnkIYiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSLmjIfmoIflrozmiJDmg4XlhrUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0xMDUxLjYzOTE4MCwgLTQyNS4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9Iue8lue7hC025aSH5Lu9LTQiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEwMjEuNTAwMDAwLCAzNDQuMDAwMDAwKSI+CiAgICAgICAgICAgICAgICA8ZyBpZD0i57yW57uELTYiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI5LjUwMDAwMCwgNzguMDAwMDAwKSI+CiAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IuefqeW9oiIgeD0iMCIgeT0iMCIgd2lkdGg9IjE0IiBoZWlnaHQ9IjE0Ij48L3JlY3Q+CiAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTcuMTM5MTgwMjYsMyBDOS4wMDMxMDczNywzIDEwLjU2OTI2NzMsNC4yNzQ4OTI3MiAxMS4wMTMyMjU0LDYuMDAwMjQzNDcgTDEyLjM2MDgxOTcsNiBDMTIuOTEzMTA0NSw2IDEzLjM2MDgxOTcsNi40NDc3MTUyNSAxMy4zNjA4MTk3LDcgQzEzLjM2MDgxOTcsNy41NTIyODQ3NSAxMi45MTMxMDQ1LDggMTIuMzYwODE5Nyw4IEwxMS4wMTI5NjY3LDguMDAwNzYxMzQgQzEwLjU2ODY1OTIsOS43MjU2MDIyNCA5LjAwMjc0NTUxLDExIDcuMTM5MTgwMjYsMTEgQzUuMjc1NjE1MDEsMTEgMy43MDk3MDEzMSw5LjcyNTYwMjI0IDMuMjY1MzkzNzgsOC4wMDA3NjEzNCBMMS42MzkxODAyNiw4IEMxLjA4Njg5NTUxLDggMC42MzkxODAyNTgsNy41NTIyODQ3NSAwLjYzOTE4MDI1OCw3IEMwLjYzOTE4MDI1OCw2LjQ0NzcxNTI1IDEuMDg2ODk1NTEsNiAxLjYzOTE4MDI2LDYgTDMuMjY1MTM1MDksNi4wMDAyNDM0NyBDMy43MDkwOTMyLDQuMjc0ODkyNzIgNS4yNzUyNTMxNSwzIDcuMTM5MTgwMjYsMyBaIiBpZD0i5b2i54q257uT5ZCIIiBmaWxsPSIjRkZDRTZBIiBmaWxsLXJ1bGU9Im5vbnplcm8iPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+" />'
: `<span style="display:inline-block;margin-right:4px;border-radius:2px;width:10px;height:10px;background-color:${params[i].color}"></span>`
}` +
`<span style='display:inline-block;width:180px;color:rgba(0,0,0,0.8);font-size:14px;'>${params[i].seriesName}</span>` +
`<span style='color:rgba(0,0,0,0.48);font-size:14px;'>${
params[i].name === "%"
? (params[i].value ? params[i].value.toFixed(2) : "0.00") +
params[i].name
: String(params[i].value).replace(
/\B(?=(\d{3})+(?!\d))/g,
","
)
}</span>`;
}
return res;
},
},
xAxis: {
type: "category",
data: [],
axisTick: {
show: false,
},
axisPointer: {
type: "shadow",
},
},
yAxis: {
type: "value",
name: "",
nameTextStyle: {
fontSize: 12,
align: "right",
},
axisLabel: {},
},
series: [],
},
};
}, },
props: { props: {
chartHeight: { chartHeight: {
@ -134,61 +73,7 @@ export default {
default: 1, default: 1,
}, },
}, },
watch: { components: { baseChart },
chartHeight: {
handler(newVal) {
this.chartHeight = newVal;
},
},
chartNum(val) {
this.canvasReset();
},
chartMsg: {
handler(newVal) {
this.canvasReset();
},
deep: true,
},
},
mounted() {
this.canvasReset();
},
methods: {
canvasReset() {
debounce(() => {
this.getMes();
}, 500)();
},
getMes() {
if (this.myChart) {
this.myChart.dispose();
}
var chartDom = document.getElementById(this.chartId);
this.myChart = echarts.init(chartDom);
this.option.color = this.chartMsg.color;
this.option.xAxis.data = this.chartMsg.xData;
this.option.yAxis.name = this.chartMsg.yName;
if (
this.chartMsg.series.length > 0 &&
this.chartMsg.series[0].data[0].name === "%"
) {
this.option.yAxis.axisLabel = {
formatter: function (value) {
return value + ".00%";
},
};
} else {
this.option.yAxis.axisLabel = {
formatter: function (value) {
return value;
},
};
}
// this.option.yAxis.axisLabel = this.chartMsg.yAxisLabel;
this.option.series = this.chartMsg.series;
this.myChart.setOption(this.option);
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -4,7 +4,7 @@
<bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" />
</div> </div>
<div class="containerBottom"> <div class="containerBottom">
<div class="smallTitle">4FTO/基片投入</div> <div class="smallTitle">FTO/基片投入</div>
<bm-line-bar <bm-line-bar
:chartHeight="chartHeight" :chartHeight="chartHeight"
:legendList="legendList" :legendList="legendList"
@ -26,101 +26,61 @@
<script> <script>
import bmSearchBar from "../components/bmSearchBar.vue"; import bmSearchBar from "../components/bmSearchBar.vue";
import BmLineBar from "../components/bmLineBar.vue"; import BmLineBar from "../components/bmLineBar.vue";
const tableProps = [ import {
{ fTOReportByDateRangePage,
prop: "factory", fTOReportByDateRangeExport,
label: "工厂名称", } from "@/api/report/benchmarking.js";
// filter: (val) => factoryList[val], import moment from "moment";
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
name: "FtoOutputBM", name: "FtoOutputBM",
data() { data() {
return { return {
tableProps, factoryList: [
{ id: 0, name: "瑞昌" },
{ id: 1, name: "邯郸" },
],
tableProps: [],
tableProps1: [
{
prop: "factory",
label: "工厂名称",
filter: (val) => this.factoryList[val].name,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "item",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
],
listQuery: { listQuery: {
current: 1, current: 1,
size: 1000, size: 100,
}, },
tableData: [ tableData: [],
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(269) / 2, chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2, tableH: this.tableHeight(269) / 2,
legendList: [ legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" }, { id: 1, name: "", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" }, { id: 2, name: "", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" }, { id: 3, name: "", type: 1, color: "#288AFF" },
], ],
chartMsg: { chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"], color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"], xData: [],
yName: "单位/片", yName: "单位/片",
series: [ series: [
{ {
name: "2024年4月目标值", name: "1",
// data: [3000, 2000, 3000], data: [],
// data: [6800, 5000, 8900],
// data: [12000, 17000, 19000],
data: [560000, 540000, 600000],
type: "line", type: "line",
symbol: "circle", symbol: "circle",
symbolSize: 6, symbolSize: 6,
@ -130,28 +90,22 @@ export default {
}, },
}, },
{ {
name: "2023年4月", name: "2",
// data: [2100, 800, 1500], data: [],
// data: [9500, 7200, 9901],
// data: [14666, 15000, 17888],
data: [550000, 456666, 590000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
show: true, show: true,
// position: [-5, -16], // position: [-5, -16],
// position: [-5, -16], // position: [-5, -16],
// position: [-10, -16], position: [-10, -16],
position: [-17, -16], // position: [-17, -16],
color: "#68C483", color: "#68C483",
}, },
}, },
{ {
name: "2024年4月", name: "3",
// data: [2100, 900, 1300], data: [],
// data: [9100, 7300, 9700],
// data: [14666, 15300, 18000],
data: [556666, 456666, 650000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -188,6 +142,13 @@ export default {
this.chartHeight = this.tableHeight(269) / 2; this.chartHeight = this.tableHeight(269) / 2;
window.addEventListener("resize", this._setTableHeight); window.addEventListener("resize", this._setTableHeight);
}, },
mounted() {
this.tableProp = this.tableProp1;
this.listQuery.date = 2;
this.listQuery.queryTime = moment().format("yyyy-MM-DD");
this.listQuery.factorys = [];
this.getList();
},
destroyed() { destroyed() {
window.removeEventListener("resize", this._setTableHeight); window.removeEventListener("resize", this._setTableHeight);
}, },
@ -206,59 +167,156 @@ export default {
} }
}, },
getSearch(val) { getSearch(val) {
console.log(val); this.listQuery.date = val.type;
console.log("==========下面是测试代码,需删除"); this.listQuery.queryTime = val.startDate;
this.chartMsg.series = []; this.listQuery.factorys = val.factory;
this.getList();
}, },
handleExport() { getList() {
console.log("导出=====下面是测试代码,需删除"); this.tableProps = [];
this.chartMsg.series = [ fTOReportByDateRangePage({ ...this.listQuery }).then((res) => {
{ if (res.data && res.data.length > 0) {
name: "2024年4月目标值1", //
// data: [3000, 2000, 3000], let msg = res.data[0];
// data: [6800, 5000, 8900], let arr = [
// data: [12000, 17000, 19000], {
data: [560000, 540000, 600000], prop: "lastone",
type: "line", label: msg.lastone.reportTime,
symbol: "circle", minWidth: 150,
symbolSize: 6, },
label: { {
show: true, prop: "currentone",
color: "#FFAE17", label: msg.currentone.reportTime,
minWidth: 150,
},
{
prop: "targetone",
label: msg.targetone.reportTime,
minWidth: 150,
},
];
this.tableProps = this.tableProps1.concat(arr);
//
let tableArr = [];
res.data.forEach((item) => {
let obj = {};
obj.factory = item.factory;
obj.item = "FTO投入";
obj.unit = "片";
obj.lastone = item.lastone.total;
obj.currentone = item.currentone.total;
obj.targetone = item.targetone.total;
tableArr.push(obj);
});
this.tableData = tableArr;
//
this.legendList[0].name = msg.targetone.reportTime;
this.legendList[1].name = msg.lastone.reportTime;
this.legendList[2].name = msg.currentone.reportTime;
this.chartMsg.series[0].name = msg.targetone.reportTime;
this.chartMsg.series[1].name = msg.lastone.reportTime;
this.chartMsg.series[2].name = msg.currentone.reportTime;
//
switch (this.listQuery.type) {
case 0:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 1:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 2:
this.chartMsg.series[1].label.position = [-10, -16];
break;
default:
this.chartMsg.series[1].label.position = [-17, -16];
}
// chartMsgseries
this.setChartMsg(res.data);
} else {
//
this.resetMsg();
}
});
},
setChartMsg(val) {
let xData = [];
let lineData = [];
let barData1 = [];
let barData2 = [];
for (let i = 0; i < val.length; i++) {
this.factoryList.map((item) => {
if (item.id === val[i].factory) {
xData.push(item.name);
}
});
lineData.push(val[i].targetone.total || 0);
barData1.push(val[i].lastone.total || 0);
barData2.push(val[i].currentone.total || 0);
}
this.chartMsg.xData = xData;
this.chartMsg.series[0].data = lineData;
this.chartMsg.series[1].data = barData1;
this.chartMsg.series[2].data = barData2;
this.chartMsg.xData = xData;
},
resetMsg() {
this.tableProps = this.tableProps1;
this.tableData = [];
this.chartMsg = {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: [],
yName: "单位/片",
series: [
{
name: "1",
data: [],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
},
}, },
}, {
{ name: "2",
name: "2023年4月", data: [],
// data: [2100, 800, 1500], type: "bar",
// data: [9500, 7200, 9901], barWidth: 20,
// data: [14666, 15000, 17888], label: {
data: [550000, 456666, 590000], show: true,
type: "bar", // position: [-5, -16],
barWidth: 20, // position: [-5, -16],
label: { position: [-10, -16],
show: true, // position: [-17, -16],
// position: [-5, -16], color: "#68C483",
// position: [-5, -16], },
// position: [-10, -16],
position: [-17, -16],
color: "#68C483",
}, },
}, {
{ name: "3",
name: "2024年4月", data: [],
// data: [2100, 900, 1300], type: "bar",
// data: [9100, 7300, 9700], barWidth: 20,
// data: [14666, 15300, 18000], label: {
data: [556666, 456666, 650000], show: true,
type: "bar", position: [0, -16],
barWidth: 20, color: "#288AFF",
label: { },
show: true,
position: [0, -16],
color: "#288AFF",
}, },
}, ],
]; };
},
handleExport(val) {
this.listQuery.type = val.type;
this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
let fileName = "产量对标FTO.xls";
fTOReportByDateRangeExport({ ...this.listQuery })
.then((response) => {
this.$download.excel(response, fileName);
this.$message.success("导出成功");
})
.catch(() => {});
}, },
}, },
}; };

View File

@ -4,7 +4,7 @@
<bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" />
</div> </div>
<div class="containerBottom"> <div class="containerBottom">
<div class="smallTitle">4封装OEE</div> <div class="smallTitle">封装OEE</div>
<bm-line-bar <bm-line-bar
:chartHeight="chartHeight" :chartHeight="chartHeight"
:legendList="legendList" :legendList="legendList"
@ -26,102 +26,61 @@
<script> <script>
import bmSearchBar from "../components/bmSearchBar.vue"; import bmSearchBar from "../components/bmSearchBar.vue";
import BmLineBar from "../components/bmLineBar.vue"; import BmLineBar from "../components/bmLineBar.vue";
const tableProps = [ import {
{ componentOEEPage,
prop: "factory", componentOEEExport,
label: "工厂名称", } from "@/api/report/benchmarking.js";
// filter: (val) => factoryList[val], import moment from "moment";
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
name: "PackageOEEBM", name: "PackageOEEBM",
data() { data() {
return { return {
tableProps, factoryList: [
{ id: 0, name: "瑞昌" },
{ id: 1, name: "邯郸" },
],
tableProps: [],
tableProps1: [
{
prop: "factory",
label: "工厂名称",
filter: (val) => this.factoryList[val].name,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "item",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
],
listQuery: { listQuery: {
current: 1, current: 1,
size: 1000, size: 100,
}, },
tableData: [ tableData: [],
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(269) / 2, chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2, tableH: this.tableHeight(269) / 2,
legendList: [ legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" }, { id: 1, name: "", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" }, { id: 2, name: "", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" }, { id: 3, name: "", type: 1, color: "#288AFF" },
], ],
chartMsg: { chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"], color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"], xData: [],
yName: "单位/%", yName: "单位/%",
series: [ series: [
{ {
name: "2024年4月目标值", name: "1",
data: [ data: [],
{ name: "%", value: 85 },
{ name: "%", value: 85 },
{ name: "%", value: 85 },
],
type: "line", type: "line",
symbol: "circle", symbol: "circle",
symbolSize: 6, symbolSize: 6,
@ -134,12 +93,8 @@ export default {
}, },
}, },
{ {
name: "2023年4月", name: "2",
data: [ data: [],
{ name: "%", value: 57.5 },
{ name: "%", value: 21.66 },
{ name: "%", value: 18.4 },
],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -152,12 +107,8 @@ export default {
}, },
}, },
{ {
name: "2024年4月", name: "3",
data: [ data: [],
{ name: "%", value: 23.33 },
{ name: "%", value: 7.02 },
{ name: "%", value: 80.2 },
],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -197,6 +148,13 @@ export default {
this.chartHeight = this.tableHeight(269) / 2; this.chartHeight = this.tableHeight(269) / 2;
window.addEventListener("resize", this._setTableHeight); window.addEventListener("resize", this._setTableHeight);
}, },
mounted() {
this.tableProp = this.tableProp1;
this.listQuery.type = 2;
this.listQuery.startDate = moment().format("yyyy-MM-DD");
this.listQuery.factory = [];
this.getList();
},
destroyed() { destroyed() {
window.removeEventListener("resize", this._setTableHeight); window.removeEventListener("resize", this._setTableHeight);
}, },
@ -215,11 +173,141 @@ export default {
} }
}, },
getSearch(val) { getSearch(val) {
console.log(val); this.listQuery.type = val.type;
console.log("========================="); this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
this.getList();
}, },
handleExport() { getList() {
console.log("导出"); this.tableProps = [];
componentOEEPage({ ...this.listQuery }).then((res) => {
if (res.data && res.data.records.length > 0) {
let msg = res.data.records[0];
let arr = [
{
prop: "yoy",
label: msg.yoyColumn,
minWidth: 150,
},
{
prop: "queryValue",
label: msg.queryColumn,
minWidth: 150,
},
{
prop: "target",
label: msg.targetColumn,
minWidth: 150,
},
];
this.tableProps = this.tableProps1.concat(arr);
this.tableData = res.data.records;
//
this.legendList[0].name = msg.targetColumn;
this.legendList[1].name = msg.yoyColumn;
this.legendList[2].name = msg.queryColumn;
this.chartMsg.series[0].name = msg.targetColumn;
this.chartMsg.series[1].name = msg.yoyColumn;
this.chartMsg.series[2].name = msg.queryColumn;
// chartMsgseries
this.setChartMsg(res.data.records);
} else {
//
this.resetMsg();
}
});
},
setChartMsg(val) {
let xData = [];
let lineData = [];
let barData1 = [];
let barData2 = [];
for (let i = 0; i < val.length; i++) {
this.factoryList.map((item) => {
if (item.id === val[i].factory) {
xData.push(item.name);
}
});
lineData.push({
name: "%",
value: val[i].target || 0,
});
barData1.push({ name: "%", value: val[i].yoy || 0 });
barData2.push({
name: "%",
value: val[i].queryValue || 0,
});
}
this.chartMsg.xData = xData;
this.chartMsg.series[0].data = lineData;
this.chartMsg.series[1].data = barData1;
this.chartMsg.series[2].data = barData2;
this.chartMsg.xData = xData;
},
resetMsg() {
this.tableProps = this.tableProps1;
this.tableData = [];
this.chartMsg = {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: [],
yName: "单位/%",
series: [
{
name: "1",
data: [],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "2",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [-18, -16],
color: "#68C483",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
{
name: "3",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
formatter: function (params) {
return params.value.toFixed(2) + "%";
},
},
},
],
};
},
handleExport(val) {
this.listQuery.type = val.type;
this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
let fileName = "封装OEE对标.xls";
componentOEEExport({ ...this.listQuery })
.then((response) => {
this.$download.excel(response, fileName);
this.$message.success("导出成功");
})
.catch(() => {});
}, },
}, },
}; };

View File

@ -4,7 +4,7 @@
<bmSearchBar @getSearch="getSearch" @handleExport="handleExport" /> <bmSearchBar @getSearch="getSearch" @handleExport="handleExport" />
</div> </div>
<div class="containerBottom"> <div class="containerBottom">
<div class="smallTitle">4标准组件产量</div> <div class="smallTitle">标准组件产量</div>
<bm-line-bar <bm-line-bar
:chartHeight="chartHeight" :chartHeight="chartHeight"
:legendList="legendList" :legendList="legendList"
@ -26,101 +26,61 @@
<script> <script>
import bmSearchBar from "../components/bmSearchBar.vue"; import bmSearchBar from "../components/bmSearchBar.vue";
import BmLineBar from "../components/bmLineBar.vue"; import BmLineBar from "../components/bmLineBar.vue";
const tableProps = [ import {
{ sCPReportByDateRangePage,
prop: "factory", sCPReportByDateRangeExport,
label: "工厂名称", } from "@/api/report/benchmarking.js";
// filter: (val) => factoryList[val], import moment from "moment";
minWidth: 200,
showOverflowtooltip: true,
},
{
prop: "name",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
{
prop: "time1",
label: "时间1",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "time2",
label: "时间2",
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "mubiao",
label: "目标值",
minWidth: 150,
showOverflowtooltip: true,
},
];
export default { export default {
name: "SCOutputBM", name: "SCOutputBM",
data() { data() {
return { return {
tableProps, factoryList: [
{ id: 0, name: "瑞昌" },
{ id: 1, name: "邯郸" },
],
tableProps: [],
tableProps1: [
{
prop: "factory",
label: "工厂名称",
filter: (val) => this.factoryList[val].name,
minWidth: 150,
showOverflowtooltip: true,
},
{
prop: "item",
label: "科目",
minWidth: 120,
showOverflowtooltip: true,
},
{
prop: "unit",
label: "单位",
minWidth: 80,
showOverflowtooltip: true,
},
],
listQuery: { listQuery: {
current: 1, current: 1,
size: 1000, size: 100,
}, },
tableData: [ tableData: [],
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
{ factory: "工厂1" },
],
chartHeight: this.tableHeight(269) / 2, chartHeight: this.tableHeight(269) / 2,
tableH: this.tableHeight(269) / 2, tableH: this.tableHeight(269) / 2,
legendList: [ legendList: [
{ id: 1, name: "2024年4月目标值", type: 2, color: "#FFCE6A" }, { id: 1, name: "", type: 2, color: "#FFCE6A" },
{ id: 2, name: "2023年4月", type: 1, color: "#8EF0AB" }, { id: 2, name: "", type: 1, color: "#8EF0AB" },
{ id: 3, name: "2024年4月", type: 1, color: "#288AFF" }, { id: 3, name: "", type: 1, color: "#288AFF" },
], ],
chartMsg: { chartMsg: {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"], color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: ["成都", "邯郸", "瑞昌"], xData: [],
yName: "单位/片", yName: "单位/片",
series: [ series: [
{ {
name: "2024年4月目标值", name: "1",
// data: [3000, 2000, 3000], data: [],
// data: [6800, 5000, 8900],
// data: [12000, 17000, 19000],
data: [560000, 540000, 600000],
type: "line", type: "line",
symbol: "circle", symbol: "circle",
symbolSize: 6, symbolSize: 6,
@ -130,28 +90,22 @@ export default {
}, },
}, },
{ {
name: "2023年4月", name: "2",
// data: [2100, 800, 1500], data: [],
// data: [9500, 7200, 9901],
// data: [14666, 15000, 17888],
data: [550000, 456666, 590000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
show: true, show: true,
// position: [-5, -16], // position: [-5, -16],
// position: [-5, -16], // position: [-5, -16],
// position: [-10, -16], position: [-10, -16],
position: [-17, -16], // position: [-17, -16],
color: "#68C483", color: "#68C483",
}, },
}, },
{ {
name: "2024年4月", name: "3",
// data: [2100, 900, 1300], data: [],
// data: [9100, 7300, 9700],
// data: [14666, 15300, 18000],
data: [556666, 456666, 650000],
type: "bar", type: "bar",
barWidth: 20, barWidth: 20,
label: { label: {
@ -188,6 +142,13 @@ export default {
this.chartHeight = this.tableHeight(269) / 2; this.chartHeight = this.tableHeight(269) / 2;
window.addEventListener("resize", this._setTableHeight); window.addEventListener("resize", this._setTableHeight);
}, },
mounted() {
this.tableProp = this.tableProp1;
this.listQuery.date = 2;
this.listQuery.queryTime = moment().format("yyyy-MM-DD");
this.listQuery.factorys = [];
this.getList();
},
destroyed() { destroyed() {
window.removeEventListener("resize", this._setTableHeight); window.removeEventListener("resize", this._setTableHeight);
}, },
@ -206,11 +167,156 @@ export default {
} }
}, },
getSearch(val) { getSearch(val) {
console.log(val); this.listQuery.date = val.type;
console.log("========================="); this.listQuery.queryTime = val.startDate;
this.listQuery.factorys = val.factory;
this.getList();
}, },
handleExport() { getList() {
console.log("导出"); this.tableProps = [];
sCPReportByDateRangePage({ ...this.listQuery }).then((res) => {
if (res.data && res.data.length > 0) {
//
let msg = res.data[0];
let arr = [
{
prop: "lastone",
label: msg.lastone.reportTime,
minWidth: 150,
},
{
prop: "currentone",
label: msg.currentone.reportTime,
minWidth: 150,
},
{
prop: "targetone",
label: msg.targetone.reportTime,
minWidth: 150,
},
];
this.tableProps = this.tableProps1.concat(arr);
//
let tableArr = [];
res.data.forEach((item) => {
let obj = {};
obj.factory = item.factory;
obj.item = "FTO投入";
obj.unit = "片";
obj.lastone = item.lastone.total;
obj.currentone = item.currentone.total;
obj.targetone = item.targetone.total;
tableArr.push(obj);
});
this.tableData = tableArr;
//
this.legendList[0].name = msg.targetone.reportTime;
this.legendList[1].name = msg.lastone.reportTime;
this.legendList[2].name = msg.currentone.reportTime;
this.chartMsg.series[0].name = msg.targetone.reportTime;
this.chartMsg.series[1].name = msg.lastone.reportTime;
this.chartMsg.series[2].name = msg.currentone.reportTime;
//
switch (this.listQuery.type) {
case 0:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 1:
this.chartMsg.series[1].label.position = [-5, -16];
break;
case 2:
this.chartMsg.series[1].label.position = [-10, -16];
break;
default:
this.chartMsg.series[1].label.position = [-17, -16];
}
// chartMsgseries
this.setChartMsg(res.data);
} else {
//
this.resetMsg();
}
});
},
setChartMsg(val) {
let xData = [];
let lineData = [];
let barData1 = [];
let barData2 = [];
for (let i = 0; i < val.length; i++) {
this.factoryList.map((item) => {
if (item.id === val[i].factory) {
xData.push(item.name);
}
});
lineData.push(val[i].targetone.total || 0);
barData1.push(val[i].lastone.total || 0);
barData2.push(val[i].currentone.total || 0);
}
this.chartMsg.xData = xData;
this.chartMsg.series[0].data = lineData;
this.chartMsg.series[1].data = barData1;
this.chartMsg.series[2].data = barData2;
this.chartMsg.xData = xData;
},
resetMsg() {
this.tableProps = this.tableProps1;
this.tableData = [];
this.chartMsg = {
color: ["#FFCE6A", "#8EF0AB", "#288AFF"],
xData: [],
yName: "单位/片",
series: [
{
name: "1",
data: [],
type: "line",
symbol: "circle",
symbolSize: 6,
label: {
show: true,
color: "#FFAE17",
},
},
{
name: "2",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
// position: [-5, -16],
// position: [-5, -16],
position: [-10, -16],
// position: [-17, -16],
color: "#68C483",
},
},
{
name: "3",
data: [],
type: "bar",
barWidth: 20,
label: {
show: true,
position: [0, -16],
color: "#288AFF",
},
},
],
};
},
handleExport(val) {
this.listQuery.type = val.type;
this.listQuery.startDate = val.startDate;
this.listQuery.factory = val.factory;
let fileName = "标准组件产量.xls";
sCPReportByDateRangeExport({ ...this.listQuery })
.then((response) => {
this.$download.excel(response, fileName);
this.$message.success("导出成功");
})
.catch(() => {});
}, },
}, },
}; };