'改数据分析bug' #26

Merged
gtz217 merged 1 commits from fzq into develop 2023-03-23 17:09:53 +08:00
2 changed files with 88 additions and 25 deletions

View File

@ -446,6 +446,7 @@ export default {
//
getWorksetionList() {
// 线
// this.wsList = []
for (let i = 0; i < this.lineIds.length; i++) {
this.$http({
// url: this.$http.adornUrl('/monitoring/workshopSection/list'),
@ -582,6 +583,8 @@ export default {
// this.renderChart()
// })
}
}).catch((err) => {
// console.error(err)
})
},
setOptions(opts) {
@ -592,29 +595,29 @@ export default {
if (this.chart) this.chart.setOption(this.defaultOpts, true)
},
//
parseTableProps(nameData) {
const subProps = []
const labelNameMap = new Map()
// parseTableProps(nameData) {
// const subProps = []
// const labelNameMap = new Map()
// if (nameData.length) {
// /** nameData */
// nameData.forEach((item) => {
// if (!labelNameMap.get(item.name)) {
// labelNameMap.set(item.name, 1)
// subProps.push({ name: item.name, prop: item.name })
// }
// })
// }
// // if (nameData.length) {
// // /** nameData */
// // nameData.forEach((item) => {
// // if (!labelNameMap.get(item.name)) {
// // labelNameMap.set(item.name, 1)
// // subProps.push({ name: item.name, prop: item.name })
// // }
// // })
// // }
this.tableConfigDynamic = [
{ type: 'index', width: 100, name: i18n.t('index') },
{ name: i18n.t('pl.name'), prop: '0' },
...Array.from(new Set(res.data.data[0].records.map((item) => moment(item.recordTime).format('MM-DD')))).map((name) => ({ prop: String(++this.count), name }))
]
/** echarts related */
// this.echartCategories = subProps.map((item) => item.name)
this.echartCategories = this.dataListDynamic.map((item) => item.name)
},
// this.tableConfigDynamic = [
// { type: 'index', width: 100, name: i18n.t('index') },
// { name: i18n.t('pl.name'), prop: '0' },
// ...Array.from(new Set(res.data.data[0].records.map((item) => moment(item.recordTime).format('MM-DD')))).map((name) => ({ prop: String(++this.count), name }))
// ]
// /** echarts related */
// // this.echartCategories = subProps.map((item) => item.name)
// this.echartCategories = this.dataListDynamic.map((item) => item.name)
// },
// parseDynamicData(data) {
// this.echartCheckTypes.splice(0)
@ -740,9 +743,11 @@ export default {
//
this.keys = [...Object.keys(res.data),...this.keys]
// console.log('this.finalVal', this.finalVal)
// console.log('keys', this.keys)
console.log('keys', this.keys)
this.values = Object.values(res.data)
// console.log('values', this.values)
// values2
this.values2 = []
for (let c = 0; c < this.values.length; c++) {
this.values2.push(
this.values[c].map((item) => {
@ -750,8 +755,9 @@ export default {
})
)
}
console.log('values2', this.values2)
this.finalVal = [...this.values2,...this.finalVal]
// console.log('this.finalVal', this.finalVal)
console.log('this.finalVal', this.finalVal)
this.$message.success(this.$t('pl.success'))
this.$nextTick(() => {
this.dialogVisible = false

View File

@ -165,7 +165,64 @@ const FakeChart = {
},
toolbox: {
feature: {
dataView: { show: true, readOnly: false },
dataView: {
show: true,
readOnly: true,
optionToContent: function (opt) {
var axisData = opt.xAxis[0].data
var series = opt.series
//
var pattern = new RegExp('[\u4E00-\u9FA5]+')
if (pattern.test(series[0].name)) {
var table =
'<table class="layui-table" style="width:100%;text-align:center"><tbody><tr>' +
'<td>设备名称</td>' +
'<td>' +
series[0].name +
'</td>' +
'<td>' +
series[1].name +
'</td>' +
'<td>' +
series[2].name +
'</td>' +
'</tr>'
} else {
var table =
'<table class="layui-table" style="width:100%;text-align:center"><tbody><tr>' +
'<td>Equipment Name</td>' +
'<td>' +
series[0].name +
'</td>' +
'<td>' +
series[1].name +
'</td>' +
'<td>' +
series[2].name +
'</td>' +
'</tr>'
}
for (var i = 0, l = axisData.length; i < l; i++) {
table +=
'<tr>' +
'<td>' +
axisData[i] +
'</td>' +
'<td>' +
series[0].data[i] +
'</td>' +
'<td>' +
series[1].data[i] +
'</td>' +
'<td>' +
series[2].data[i] +
'</td>' +
'</tr>'
}
table += '</tbody></table>'
return table
}
},
restore: { show: true },
saveAsImage: { show: true }
}
@ -531,7 +588,7 @@ export default {
this.echartRealtime = this.echartCategories
// this.parseTableProps(res.data.nameData)
// console.log('this.dataListDynamic', this.dataListDynamic)
console.log('this.dataListDynamic', this.dataListDynamic)
this.buildGraphData()
})