wangcahngsheng 11 місяців тому
батько
коміт
3987f3ac45
1 змінених файлів з 83 додано та 66 видалено
  1. 83 66
      src/components/gatewaynNewPage.vue

+ 83 - 66
src/components/gatewaynNewPage.vue

@@ -515,80 +515,97 @@
                     if (datas && datas.data) {
                         let secArr = ['HD', 'SD', 'XNYFG', 'GJYW', 'MDYTH']
                         secArr.forEach(item => {
-                            for (let i in datas.data.year) {
-                                let it = datas.data.year[i]
-                                if (item === i && i !== 'MDYTH') {
-                                    let gradeA = 0
-                                    let gradeB = 0
-                                    let gradeC = 0
-                                    let gradeD = 0
-                                    let tableData = []
-                                    it.forEach((iv, index) => {
-                                        if (index < 3) {
-                                            let obj = iv
-                                            if (index === 0) {
-                                                obj.img = cup1
-                                            } else if (index === 1) {
-                                                obj.img = cup2
-                                            } else if (index === 2) {
-                                                obj.img = cup3
+                            if (Object.keys(datas.data.year).length>0) {
+                                for (let i in datas.data.year) {
+                                    let it = datas.data.year[i]
+                                    if (item === i && i !== 'MDYTH') {
+                                        let gradeA = 0
+                                        let gradeB = 0
+                                        let gradeC = 0
+                                        let gradeD = 0
+                                        let tableData = []
+                                        it.forEach((iv, index) => {
+                                            if (index < 3) {
+                                                let obj = iv
+                                                if (index === 0) {
+                                                    obj.img = cup1
+                                                } else if (index === 1) {
+                                                    obj.img = cup2
+                                                } else if (index === 2) {
+                                                    obj.img = cup3
+                                                }
+                                                tableData.push(iv)
                                             }
-                                            tableData.push(iv)
-                                        }
-                                        if (iv.grade === 'A') {
-                                            gradeA++
-                                        } else if (iv.grade === 'B') {
-                                            gradeB++
-                                        } else if (iv.grade === 'C') {
-                                            gradeC++
-                                        } else if (iv.grade === 'D') {
-                                            gradeD++
+                                            if (iv.grade === 'A') {
+                                                gradeA++
+                                            } else if (iv.grade === 'B') {
+                                                gradeB++
+                                            } else if (iv.grade === 'C') {
+                                                gradeC++
+                                            } else if (iv.grade === 'D') {
+                                                gradeD++
+                                            }
+                                        })
+                                        let obj = {
+                                            name: item === 'HD' ? '火电板块' : item === 'SD' ? '水电板块' :
+                                                item === 'XNYFG' ? '新能源' : '海外业务',
+                                            nameEn: item,
+                                            echartsData: {
+                                                allNum: it.length,
+                                                echarts: [{
+                                                        value: gradeA,
+                                                        name: 'A类'
+                                                    },
+                                                    {
+                                                        value: gradeB,
+                                                        name: 'B类'
+                                                    },
+                                                    {
+                                                        value: gradeC,
+                                                        name: 'C类'
+                                                    },
+                                                    {
+                                                        value: gradeD,
+                                                        name: 'D类'
+                                                    }
+                                                ]
+                                            },
+                                            tableDatas: tableData,
+                                            allTableData: it,
+                                            section: [],
+                                            sectionAll: []
                                         }
-                                    })
-                                    let obj = {
-                                        name: item === 'HD' ? '火电板块' : item === 'SD' ? '水电板块' :
-                                            item === 'XNYFG' ? '新能源' : '海外业务',
-                                        nameEn: item,
-                                        echartsData: {
-                                            allNum: it.length,
-                                            echarts: [{
-                                                    value: gradeA,
-                                                    name: 'A类'
-                                                },
-                                                {
-                                                    value: gradeB,
-                                                    name: 'B类'
-                                                },
-                                                {
-                                                    value: gradeC,
-                                                    name: 'C类'
-                                                },
-                                                {
-                                                    value: gradeD,
-                                                    name: 'D类'
+                                        that.cupDataYearArr.section.push(obj)
+                                    } else if (item === i && i === 'MDYTH') {
+                                        it.forEach((iv, index) => {
+                                            if (index < 2) {
+                                                if (index === 0) {
+                                                    iv.img = cup1
+                                                } else if (index === 1) {
+                                                    iv.img = cup2
                                                 }
-                                            ]
-                                        },
-                                        tableDatas: tableData,
-                                        allTableData: it,
-                                        section: [],
-                                        sectionAll: []
-                                    }
-                                    that.cupDataYearArr.section.push(obj)
-                                } else if (item === i && i === 'MDYTH') {
-                                    it.forEach((iv, index) => {
-                                        if (index < 2) {
-                                            if (index === 0) {
-                                                iv.img = cup1
-                                            } else if (index === 1) {
-                                                iv.img = cup2
+                                                that.cupDataYearArr.integration.push(iv)
                                             }
-                                            that.cupDataYearArr.integration.push(iv)
+                                        })
+                                    }
+                                }
+                            } else {
+                                for (let i in datas.data.season) {
+                                    let it = datas.data.season[i]
+                                    if (item === i && i !== 'MDYTH') {
+                                        let obj = {
+                                            name: item === 'HD' ? '火电板块' : item === 'SD' ? '水电板块' :
+                                                item === 'XNYFG' ? '新能源' : '海外业务',
+                                            nameEn: item,
+                                            section: [],
                                         }
-                                    })
+                                        that.cupDataYearArr.section.push(obj)
+                                    }
                                 }
                             }
                         })
+                        debugger
+
                         that.cupDataYearArr.section.forEach(item => {
                             for (let i in datas.data.season) {
                                 let it = datas.data.season[i]