|
|
|
@ -34,7 +34,7 @@ const lineAndBar = `
|
|
|
|
|
});
|
|
|
|
|
return obj`
|
|
|
|
|
|
|
|
|
|
const pie = `
|
|
|
|
|
const pie = `
|
|
|
|
|
const obj = {
|
|
|
|
|
dimensions: ['product', '数据'],
|
|
|
|
|
source:[]
|
|
|
|
@ -48,14 +48,65 @@ const lineAndBar = `
|
|
|
|
|
return obj
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const TableList = `
|
|
|
|
|
|
|
|
|
|
let list = []
|
|
|
|
|
|
|
|
|
|
if(res.data.length <= 0) return list
|
|
|
|
|
|
|
|
|
|
const lableList = res.data[0].list
|
|
|
|
|
const valueList = res.data[1].list
|
|
|
|
|
|
|
|
|
|
lableList.forEach((item,index)=>{
|
|
|
|
|
list.push({
|
|
|
|
|
name:item,
|
|
|
|
|
value:valueList[index]
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
console.log(list,'过滤')
|
|
|
|
|
return list
|
|
|
|
|
`
|
|
|
|
|
const TablesBasic = `
|
|
|
|
|
|
|
|
|
|
const dimensions = [];
|
|
|
|
|
const source = [];
|
|
|
|
|
|
|
|
|
|
// 生成 dimensions
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
dimensions.push({
|
|
|
|
|
title: item.column.trim(),
|
|
|
|
|
key: "key" + (index+1),
|
|
|
|
|
align: "center"
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 生成 source
|
|
|
|
|
const maxLength = Math.max(...data.map(item => item.list.length));
|
|
|
|
|
for (let i = 0; i < maxLength; i++) {
|
|
|
|
|
const row = { key: i };
|
|
|
|
|
data.forEach((item, index) => {
|
|
|
|
|
row["key" + (index+1)] = item.list[i] || null;
|
|
|
|
|
});
|
|
|
|
|
source.push(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
dimensions,
|
|
|
|
|
source
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
const filterData = {
|
|
|
|
|
LineCommon: lineAndBar,
|
|
|
|
|
LineLinearSingle: lineAndBar,
|
|
|
|
|
BarCommon:lineAndBar,
|
|
|
|
|
BarCrossrange:lineAndBar,
|
|
|
|
|
PieCommon:pie,
|
|
|
|
|
PieCircle:'return res.data',
|
|
|
|
|
Dial:'return res.data'
|
|
|
|
|
BarCommon: lineAndBar,
|
|
|
|
|
BarCrossrange: lineAndBar,
|
|
|
|
|
PieCommon: pie,
|
|
|
|
|
PieCircle: 'return res.data',
|
|
|
|
|
Dial: 'return res.data',
|
|
|
|
|
TableList: TableList,
|
|
|
|
|
TablesBasic: TablesBasic
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { filterData }
|
|
|
|
|