|
|
|
@ -5,136 +5,160 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import Chart from './chart.vue'
|
|
|
|
|
import { request } from '@/utils/request.js'
|
|
|
|
|
import Chart from "./chart.vue";
|
|
|
|
|
import { formatTime } from "../../../../utils/index";
|
|
|
|
|
import { request } from "@/utils/request.js";
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
Chart
|
|
|
|
|
Chart,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
id: '',
|
|
|
|
|
today: null,
|
|
|
|
|
id: "",
|
|
|
|
|
cdata: {
|
|
|
|
|
'xAxis': {
|
|
|
|
|
'data': [
|
|
|
|
|
'03-09',
|
|
|
|
|
'03-10',
|
|
|
|
|
'03-11',
|
|
|
|
|
'03-12',
|
|
|
|
|
'03-13',
|
|
|
|
|
'03-14',
|
|
|
|
|
'03-15'
|
|
|
|
|
]
|
|
|
|
|
xAxis: {
|
|
|
|
|
data: ["", "", "", "", "", "", ""],
|
|
|
|
|
},
|
|
|
|
|
'series': [
|
|
|
|
|
{
|
|
|
|
|
'name': '门套',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
142, 121, 114, 150, 180, 124, 110
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': '门扇',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
120, 170, 135, 156, 234, 180, 158
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': '横头',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
147, 181, 163, 134, 145, 167, 151
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': '延长套',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
100, 101, 102, 103, 104, 105, 106
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': '移门',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
80, 85, 93, 83, 89, 100, 82
|
|
|
|
|
]
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'name': '窄玻璃门',
|
|
|
|
|
'type': 'bar',
|
|
|
|
|
'emphasis': {
|
|
|
|
|
'focus': 'series'
|
|
|
|
|
},
|
|
|
|
|
'data': [
|
|
|
|
|
210, 200, 230, 240, 217, 218, 208
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.setData()
|
|
|
|
|
this.startInterval()
|
|
|
|
|
series: [
|
|
|
|
|
// {
|
|
|
|
|
// name: "门套",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [142, 121, 114, 150, 180, 124, 110],
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// name: "门扇",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [120, 170, 135, 156, 234, 180, 158],
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// name: "横头",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [147, 181, 163, 134, 145, 167, 151],
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// name: "延长套",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [100, 101, 102, 103, 104, 105, 106],
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// name: "移门",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [80, 85, 93, 83, 89, 100, 82],
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// name: "窄玻璃门",
|
|
|
|
|
// type: "bar",
|
|
|
|
|
// emphasis: {
|
|
|
|
|
// focus: "series",
|
|
|
|
|
// },
|
|
|
|
|
// data: [210, 200, 230, 240, 217, 218, 208],
|
|
|
|
|
// },
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 开启定时器
|
|
|
|
|
startInterval() {
|
|
|
|
|
const _this = this
|
|
|
|
|
// 应通过接口获取配置时间,暂时写死10s
|
|
|
|
|
const time = 10 * 60 * 1000
|
|
|
|
|
if (this.intervalId !== null) {
|
|
|
|
|
clearInterval(this.intervalId)
|
|
|
|
|
}
|
|
|
|
|
this.intervalId = setInterval(() => {
|
|
|
|
|
_this.setData()
|
|
|
|
|
}, time)
|
|
|
|
|
},
|
|
|
|
|
// 根据自己的业务情况修改
|
|
|
|
|
setData() {
|
|
|
|
|
const _this = this
|
|
|
|
|
// request({
|
|
|
|
|
// // 各产品生产数量api路径
|
|
|
|
|
// url: '/api/BigScreen/getMonthData',
|
|
|
|
|
// method: 'get'
|
|
|
|
|
// }).then(r => {
|
|
|
|
|
// // debugger
|
|
|
|
|
// // console.log(r.data.ProductQty)
|
|
|
|
|
// // if (r) {
|
|
|
|
|
// // _this.cdata = r.data.ProductQty
|
|
|
|
|
created() {
|
|
|
|
|
this.cdata.xAxis.data = [
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 6), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 5), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 4), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 3), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 2), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 1), "MM-dd"),
|
|
|
|
|
formatTime(new Date(), "MM-dd"),
|
|
|
|
|
];
|
|
|
|
|
this.timing = setInterval(() => {
|
|
|
|
|
this.cdata.xAxis.data = [
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 6), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 5), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 4), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 3), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 2), "MM-dd"),
|
|
|
|
|
formatTime(new Date().setDate(new Date().getDate() - 1), "MM-dd"),
|
|
|
|
|
formatTime(new Date(), "MM-dd"),
|
|
|
|
|
];
|
|
|
|
|
}, 1000);
|
|
|
|
|
|
|
|
|
|
// 使用 localStorage.getItem 通过键名获取存储的值
|
|
|
|
|
const storedString = localStorage.getItem("myStoredArray");
|
|
|
|
|
// 检查存储的值是否存在
|
|
|
|
|
if (storedString !== null) {
|
|
|
|
|
// 使用 JSON.parse 将字符串反序列化回数组
|
|
|
|
|
this.retrievedArray = JSON.parse(storedString);
|
|
|
|
|
this.retrievedArray.filter((item) => {
|
|
|
|
|
if (item.type == "QuantityOfEachProductProduced") {
|
|
|
|
|
if (item.openMock == 1) {
|
|
|
|
|
var datalist = JSON.parse(item.mockData);
|
|
|
|
|
|
|
|
|
|
const Producedmock = [];
|
|
|
|
|
for (let i = 0; i < datalist[0].length; i++) {
|
|
|
|
|
const newRowmk = [];
|
|
|
|
|
for (let j = 0; j < datalist.length; j++) {
|
|
|
|
|
newRowmk.push(datalist[j][i]);
|
|
|
|
|
}
|
|
|
|
|
Producedmock.push(newRowmk);
|
|
|
|
|
}
|
|
|
|
|
this.cdata.series = [];
|
|
|
|
|
|
|
|
|
|
// // }
|
|
|
|
|
// if (r) {
|
|
|
|
|
// _this.cdata = r.data.ProductQty
|
|
|
|
|
// this.cdata.series.forEach(i => {
|
|
|
|
|
// i.type = 'bar'
|
|
|
|
|
// i.emphasis = {
|
|
|
|
|
// focus: 'series'
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
Producedmock.forEach((item) => {
|
|
|
|
|
var mewitem = {
|
|
|
|
|
name: item[0],
|
|
|
|
|
type: "bar",
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: "series",
|
|
|
|
|
},
|
|
|
|
|
data: item.slice(1),
|
|
|
|
|
};
|
|
|
|
|
this.cdata.series.push(mewitem);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
var datalist = JSON.parse(item.data);
|
|
|
|
|
|
|
|
|
|
const Produceddata = [];
|
|
|
|
|
for (let i = 0; i < datalist[0].length; i++) {
|
|
|
|
|
const newRowmk = [];
|
|
|
|
|
for (let j = 0; j < datalist.length; j++) {
|
|
|
|
|
newRowmk.push(datalist[j][i]);
|
|
|
|
|
}
|
|
|
|
|
Produceddata.push(newRowmk);
|
|
|
|
|
}
|
|
|
|
|
this.cdata.series = [];
|
|
|
|
|
|
|
|
|
|
Produceddata.forEach((item) => {
|
|
|
|
|
var newitem = {
|
|
|
|
|
name: item[0],
|
|
|
|
|
type: "bar",
|
|
|
|
|
emphasis: {
|
|
|
|
|
focus: "series",
|
|
|
|
|
},
|
|
|
|
|
data: item.slice(1),
|
|
|
|
|
};
|
|
|
|
|
this.cdata.series.push(newitem);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
mounted() {},
|
|
|
|
|
methods: {},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|