fix: 修复部分曲线图的tab取值混乱的问题

This commit is contained in:
刘洪洪
2023-09-26 15:57:28 +08:00
parent 0a9c5e2fcf
commit 6eca699141
2 changed files with 34 additions and 2 deletions

View File

@@ -449,8 +449,24 @@ export default {
},
initData (data, val, active, show, n) {
let lineData = []
const newData = [] // 接口数据的新构造排序数据
if (data && data.length > 0) {
data.forEach(item => {
const obj = {}
// 模板数据,按此进行排序
const templateList = ['type', 'total', 'inbound', 'outbound', 'internal', 'through', 'other']
for (const key in templateList) {
const code = Object.keys(item).find(d => d.indexOf(templateList[key]) > -1)
if (code) {
obj[code] = _.clone(item[code])
}
}
newData.push(obj)
})
}
if (data !== undefined && data.length > 0) {
data.forEach((item) => {
newData.forEach((item) => {
item.type = getLineType(item.type)
if (item.type === val) {
lineData = Object.keys(item).map(t => {