| | |
| | | }, |
| | | created() { |
| | | this.getMasterList(); |
| | | this.getEcharts(); |
| | | // deleteChartId({btmname:'zxssaac',chartId:'3'}).then(res=>{ |
| | | // console.log('res',res) |
| | | // }) |
| | | }, |
| | | mounted() { |
| | | this.getEcharts(); |
| | | }, |
| | | methods: { |
| | | getMasterList() { |
| | |
| | | this.$message.error(error) |
| | | }) |
| | | }, |
| | | getEcharts() { |
| | | getBtmAndChart().then(firstResponse => { |
| | | console.log('btm', firstResponse) |
| | | async getEcharts() { |
| | | try { |
| | | const firstResponse = await getBtmAndChart(); |
| | | const typeList = { |
| | | "0": "lineList", |
| | | "1": "pieList", |
| | | "2": "columnarList", |
| | | "3": "mixList" |
| | | }; |
| | | |
| | | const btmNames = Object.keys(firstResponse.data.data).join(','); |
| | | const firstData = firstResponse.data.data; |
| | | Object.keys(firstData).forEach((item,index) => { |
| | | let firstIndex = firstData[item].split(','); |
| | | console.log('firstIndex',firstIndex); |
| | | }); |
| | | console.log('firstData',firstData) |
| | | if (btmNames) { |
| | | getStatisticAnalysis({btmNames}).then(secondResponse => { |
| | | console.log('getStatisticAnalysis', secondResponse) |
| | | const secondResponse = await getStatisticAnalysis({btmNames}); |
| | | const secondData = secondResponse.data.data; |
| | | console.log('secondData', secondData) |
| | | Object.keys(firstData).sort().forEach((key,index)=>{ |
| | | if (firstData[key]) { |
| | | const indexes = firstData[key].split(','); |
| | | for (const indexSec of indexes) { |
| | | const type = typeList[indexSec]; |
| | | const List = secondData.map(record => { |
| | | return { |
| | | menuData: record.menuData, |
| | | menuName: record.menuName |
| | | } |
| | | }) |
| | | List.forEach((i,j)=>{ |
| | | if(index === j ){ |
| | | this[type].push(i) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | } catch (error) { |
| | | console.error('Error:', error); |
| | | } |
| | | }, |
| | | //新增 |
| | | addHandler() { |
| | |
| | | const dataKey = typeList[item.codeType]; |
| | | if (dataKey) { |
| | | this[dataKey].push(item); |
| | | this[dataKey].forEach(res => { |
| | | }) |
| | | hasValidData = true; |
| | | } |
| | | }); |
| | |
| | | }, |
| | | //表格多选 |
| | | selectChange(selection) { |
| | | console.log('selection', selection) |
| | | this.selectData = selection; |
| | | }, |
| | | } |