田源
2023-12-20 d437a2e4733066e9815b8091e4d2444c291d22db
统计分析数据列表渲染
已修改1个文件
52 ■■■■ 文件已修改
Source/UBCS-WEB/src/views/statistic/statisticPage.vue 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -100,10 +100,12 @@
  },
  created() {
    this.getMasterList();
    this.getEcharts();
    // deleteChartId({btmname:'zxssaac',chartId:'3'}).then(res=>{
    //   console.log('res',res)
    // })
  },
  mounted() {
    this.getEcharts();
  },
  methods: {
    getMasterList() {
@@ -114,21 +116,46 @@
        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() {
@@ -179,8 +206,6 @@
        const dataKey = typeList[item.codeType];
        if (dataKey) {
          this[dataKey].push(item);
          this[dataKey].forEach(res => {
          })
          hasValidData = true;
        }
      });
@@ -192,6 +217,7 @@
    },
    //表格多选
    selectChange(selection) {
      console.log('selection', selection)
      this.selectData = selection;
    },
  }