master
黄欣 4 years ago
parent f3f0bf1284
commit 773093114c

@ -151,7 +151,6 @@ export default {
}, },
created() { created() {
this.init() this.init()
console.log('init')
// //
eventBus.$on('resizing', (componentId) => { eventBus.$on('resizing', (componentId) => {
this.chartResize() this.chartResize()
@ -224,7 +223,6 @@ export default {
let fields = this.fields.filter((e) => let fields = this.fields.filter((e) =>
xaxisFieldId.includes(e.dataeaseName) xaxisFieldId.includes(e.dataeaseName)
) )
console.log(fields)
let rowSum = 0 let rowSum = 0
let columnValue = [] let columnValue = []
let rowName = [] let rowName = []
@ -312,10 +310,8 @@ export default {
yaxisExtFieldId[0] + yaxisExtFieldId[0] +
subEle[yaxisExtFieldId[0]] subEle[yaxisExtFieldId[0]]
ele[key] = subEle[fieldValueName].toFixed(2) ele[key] = subEle[fieldValueName].toFixed(2)
console.log(1, ele[key])
if (this.fields[findValueIndex].summary === 'ratio') { if (this.fields[findValueIndex].summary === 'ratio') {
ele[key] += '%' ele[key] += '%'
console.log(2, ele[key])
} }
rowSum += subEle[fieldValueName] rowSum += subEle[fieldValueName]
} }
@ -332,7 +328,6 @@ export default {
if (this.fields[findValueIndex].summary === 'ratio') { if (this.fields[findValueIndex].summary === 'ratio') {
ele[key] += '%' ele[key] += '%'
} }
rowSum += subEle[fieldValueName] rowSum += subEle[fieldValueName]
} }
}) })
@ -372,7 +367,6 @@ export default {
if (this.fields[findValueIndex].summary === 'ratio') { if (this.fields[findValueIndex].summary === 'ratio') {
ele[key] += '%' ele[key] += '%'
} }
rowSum += subEle[fieldValueName] rowSum += subEle[fieldValueName]
} }
}) })
@ -384,9 +378,7 @@ export default {
if (this.fields[findValueIndex].summary === 'ratio') { if (this.fields[findValueIndex].summary === 'ratio') {
ele[key] += '%' ele[key] += '%'
} }
rowSum += subEle[fieldValueName] rowSum += subEle[fieldValueName]
console.log(3, subEle)
} }
}) })
} }
@ -394,21 +386,34 @@ export default {
if (this.fields[findValueIndex].summary === 'ratio') { if (this.fields[findValueIndex].summary === 'ratio') {
rowSum += '%' rowSum += '%'
} }
ele.rowTotal = rowSum ele.rowTotal = rowSum
rowSum = 0 rowSum = 0
}) })
} }
fields = fields.concat(rowName) fields = fields.concat(rowName)
fields.push({ fields.push({
dataeaseName: 'rowTotal', dataeaseName: 'rowTotal',
name: `合计(${this.fields[findValueIndex].name})` name: `合计(${this.fields[findValueIndex].name})`
}) })
for (let i = columnValue.length - 1; i >= 0; i--) {
const element = columnValue[i]
if (element.rowTotal === '0.00%') {
for (let j = this.mergeCells.length - 1; j >= 0; j--) {
if (this.mergeCells[j].row > i) {
this.mergeCells[j].row -= 1
} else if (this.mergeCells[j].row <= i) {
this.mergeCells[j].rowspan -= 1
if (this.mergeCells[j].rowspan === 0) {
this.mergeCells.splice(j, 1)
}
break
}
}
columnValue.splice(i, 1)
}
}
datas = columnValue datas = columnValue
this.fields = fields this.fields = fields
console.log(columnValue)
console.log(fields)
} }
} else { } else {
this.fields = [] this.fields = []

Loading…
Cancel
Save