'改数据分析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
Showing only changes of commit e0d4e5327f - Show all commits

View File

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

View File

@ -165,7 +165,64 @@ const FakeChart = {
}, },
toolbox: { toolbox: {
feature: { 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 }, restore: { show: true },
saveAsImage: { show: true } saveAsImage: { show: true }
} }
@ -531,7 +588,7 @@ export default {
this.echartRealtime = this.echartCategories this.echartRealtime = this.echartCategories
// this.parseTableProps(res.data.nameData) // this.parseTableProps(res.data.nameData)
// console.log('this.dataListDynamic', this.dataListDynamic) console.log('this.dataListDynamic', this.dataListDynamic)
this.buildGraphData() this.buildGraphData()
}) })