Pārlūkot izejas kodu

'改报表分析'

魏志佳 4 gadi atpakaļ
vecāks
revīzija
70ad370927
1 mainītis faili ar 90 papildinājumiem un 41 dzēšanām
  1. 90 41
      src/views/modules/autoLaunch/autoLaunchReport.vue

+ 90 - 41
src/views/modules/autoLaunch/autoLaunchReport.vue

@@ -966,6 +966,7 @@ const publicColumns = [
                             }      
                             });
                             // console.log(this.treeData)
+                            this.directionalId=[this.treeData[0].children[0].value]
                             
                         }
                     }
@@ -1003,7 +1004,7 @@ const publicColumns = [
                             }      
                             });
                             // console.log(this.treeData)
-                            
+                            this.materialId=[this.materialTreeData[0].children[0].value]
                         }
                     }
                 })
@@ -1127,7 +1128,7 @@ const publicColumns = [
                     this.columns=[...ageColumns,...publicColumns]
                     this.tableData=this.age
                 }
-                this.getDetailTableData()
+                // this.getEchartData()
 
                 
             },
@@ -1452,7 +1453,7 @@ const publicColumns = [
 
             getEchartData(){
                 this.spinning=true;
-                 this.loading=true
+                this.loading=true
                 let params=this.handlerParams();
                 params.dataType=this.value
                 postAction('/ai/analyze/chart/targetOrMaterial',params).then(res=>{
@@ -1768,56 +1769,104 @@ const publicColumns = [
 
         
         mounted() {
-            this.$nextTick(()=>{
-                var province = ['北京', '广东', '浙江', '湖南', '河南', '安徽', '重庆', '山东', '江西', '四川', '江苏', '湖北', '福建', '上海', '广西', '河北', '陕西', '云南', '海南', '黑龙江', '辽宁', '山西', '天津', '甘肃', '内蒙古', '新疆', '宁夏', '吉林', '贵州', '青海', '西藏', '澳门', '香港', '台湾'];
-                var data = [3554, 241, 296, 221, 206, 152, 147, 121, 109, 108, 99, 91, 80, 80, 58, 48, 56, 51, 43, 37, 34, 27, 24, 24, 16, 13, 12, 9, 9, 6, 0, 7, 8, 8]
-                this.initEchart('mapEchart',this.handlerMapEchartOption(province,data))
+            // this.$nextTick(()=>{
+            //     var province = ['北京', '广东', '浙江', '湖南', '河南', '安徽', '重庆', '山东', '江西', '四川', '江苏', '湖北', '福建', '上海', '广西', '河北', '陕西', '云南', '海南', '黑龙江', '辽宁', '山西', '天津', '甘肃', '内蒙古', '新疆', '宁夏', '吉林', '贵州', '青海', '西藏', '澳门', '香港', '台湾'];
+            //     var data = [3554, 241, 296, 221, 206, 152, 147, 121, 109, 108, 99, 91, 80, 80, 58, 48, 56, 51, 43, 37, 34, 27, 24, 24, 16, 13, 12, 9, 9, 6, 0, 7, 8, 8]
+            //     this.initEchart('mapEchart',this.handlerMapEchartOption(province,data))
 
-                var data1=[
-                    {value:20, name:'男'},
-                    {value:30, name:'女'},
-                    {value:25, name:'其他'},
+            //     var data1=[
+            //         {value:20, name:'男'},
+            //         {value:30, name:'女'},
+            //         {value:25, name:'其他'},
                     
-                ]
+            //     ]
 
-                this.initEchart('sexEchart',this.handlerSexOption(data1))
+            //     this.initEchart('sexEchart',this.handlerSexOption(data1))
 
-                var data2= [
-                    {
-                        name: 'first',
-                        value: 1
-                    }, {
-                        name: 'second',
-                        value: 2
-                    }, {
-                        name: 'third',
-                        value: 3
-                    }, {
-                        name: 'fourth',
-                        value: 4
-                    }, {
-                        name: 'fifth',
-                        value: 5
-                    }, {
-                        name: 'sixth',
-                        value: 6
-                    }]
-                this.initEchart('ageEchart',this.handlerAgeOption(data2))
+            //     var data2= [
+            //         {
+            //             name: 'first',
+            //             value: 1
+            //         }, {
+            //             name: 'second',
+            //             value: 2
+            //         }, {
+            //             name: 'third',
+            //             value: 3
+            //         }, {
+            //             name: 'fourth',
+            //             value: 4
+            //         }, {
+            //             name: 'fifth',
+            //             value: 5
+            //         }, {
+            //             name: 'sixth',
+            //             value: 6
+            //         }]
+            //     this.initEchart('ageEchart',this.handlerAgeOption(data2))
 
-            })
+            // })
             let userInfo=localStorage.getItem('pro__Login_Userinfo');
             let userId=''
             if(userInfo){
                 this.userId=JSON.parse(userInfo).value.id
             }
-            getAction('/ctop/userAllocation/getAccountIdsByUserId',{
-                userId:this.userId,
+            new Promise((resolve,reject)=>{
+                getAction('/ctop/userAllocation/getAccountIdsByUserId',{
+                    userId:this.userId,
+                }).then(res=>{
+                    console.log(res)
+                    if(res.success){
+                        this.accountList=res.result
+                        this.accountIds=res.result[0].account_id;
+                        
+                        this.treeData=[];
+                        this.directionalId=[];
+                        getAction('/ai/analyze/getStrategyAndTarget', {
+                            accountId:this.accountIds
+                        }).then(res => {
+                            if(res.success){
+                                // console.log(res);
+                                if(res.result){
+                                    res.result.forEach((element,index) => {
+                                    if(element){                  
+                                        this.treeData.push({});                    
+                                        this.treeData[index].title=element.strategy_name +'_('+ element.id +')';
+                                        this.treeData[index].value='strategy'+element.id;
+                                        this.treeData[index].key=element.id;
+                                    
+                                        this.treeData[index].children=[];
+                                                            
+                                        if(element.targets.length&&element.targets[0]){
+                                            element.targets.forEach((ele,i)=>{
+                                                this.treeData[index].children.push({});
+                                                this.treeData[index].children[i].title=ele.target_type+'_'+ele.target_content
+                                                this.treeData[index].children[i].value=element.id+'_'+ele.id;
+                                                this.treeData[index].children[i].key=element.id+'_'+ele.id;
+                                            })
+                                            
+                                        }                           
+                                    }      
+                                    });
+                                    // console.log(this.treeData)
+                                    this.directionalId=[this.treeData[0].children[0].value]
+                                    resolve()
+                                }
+                            }
+                        })
+                        
+                    }else{
+                        this.$message.error('账户信息获取错误!')
+                    }
+                   
+                })
             }).then(res=>{
-                console.log(res)
-                if(res.success){
-                    this.accountList=res.result
-                }
+                this.search()
+                
             })
+            
+
+
         },
         filters: {
             toPercentage(val) {