24h,设备
This commit is contained in:
@@ -150,48 +150,37 @@ export default {
|
||||
getData() {
|
||||
this.urlOptions.getDataListURL(this.listQuery).then(res => {
|
||||
//构造数据
|
||||
if (res.data) {
|
||||
this.tableData = []
|
||||
if (Object.values(res.data.coreProductionLineMonthVOS).length > 0) {
|
||||
this.setHeader()
|
||||
res.data.forEach(item => {
|
||||
console.log('111', item.recordTime, moment(item.recordTime).format('DD'))
|
||||
this.tableData.push({
|
||||
proName: item.proName,
|
||||
specifications: item.specifications
|
||||
let yAllData = [], proNameList = []
|
||||
Object.values(res.data.coreProductionLineMonthVOS).forEach(pro => {
|
||||
// 一条产品的数据
|
||||
let yData = []
|
||||
const tempData = {
|
||||
proName: pro[0].proName,
|
||||
specifications: pro[0].specifications,
|
||||
sum: 0
|
||||
}
|
||||
proNameList.push(pro[0].proName)
|
||||
pro.forEach(item => {
|
||||
// 产品下的各时间点的数据
|
||||
// 截取日
|
||||
const day = parseTime(item.recordTime).slice(8, 10) < 10 ? parseTime(item.recordTime).slice(9, 10) : parseTime(item.recordTime).slice(8, 10)
|
||||
// console.log('!1', day < 10)
|
||||
tempData['value' + day] = item.countSum
|
||||
tempData.sum += item.countSum
|
||||
yData[day] = item.countSum
|
||||
// yData.push(item.countSum)
|
||||
})
|
||||
this.tableData.push(tempData)
|
||||
yAllData.push(yData)
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.$refs.lineChart.initChart(this.xData, yAllData, proNameList)
|
||||
})
|
||||
}
|
||||
console.log('饿', this.tableData)
|
||||
// res.data.data.forEach(item => {
|
||||
// let yData = []
|
||||
// lineName.push(item.lineName)
|
||||
// // let obj = {}
|
||||
// // obj.lineName = item.lineName,
|
||||
// // obj.sum = item.sum,
|
||||
// item.data.forEach((ele, index) => {
|
||||
// // console.log(ele)
|
||||
// ele.children.forEach((e) => {
|
||||
// // let yData = []
|
||||
// yData.push(e.dynamicValue)
|
||||
// })
|
||||
// })
|
||||
// yAllData.push(yData)
|
||||
// });
|
||||
// console.log(lineName)
|
||||
// } else {
|
||||
// this.tableProps = arr
|
||||
// this.tableData = []
|
||||
// xData = []
|
||||
// yAllData = []
|
||||
// lineName = []
|
||||
// }
|
||||
// res.data.data[0].data[0].children.forEach((item, index) => {
|
||||
// // console.log(item)
|
||||
// yData.push(item.dynamicValue)
|
||||
// // let data = 'data' + Number(index+1)
|
||||
// // obj['' + item.dynamicName + ''] = item.dynamicValue
|
||||
// })
|
||||
// console.log(this.yData)
|
||||
// this.$refs.lineChart.initChart(this.xData, yAllData, lineName)
|
||||
|
||||
// this.total = response.data.total;
|
||||
// this.dataListLoading = false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user