<template>
    <div  class="el-col el-col-21" style="padding-right:10px ">
        <div id='pro_tend' >
            <div style="margin-top: 10px;">
                <b  class="pro_item">增长趋势分析</b>  <span class="update_time">数据更新时间：</span>  <span style="font-size: 12px;">{{lastUpdatedTime}}&nbsp/&nbsp从{{recordBeginTime}}开始统计</span>   
            </div>
            <div style="margin-top:20px">
                <el-row>
                    <el-col :span='1' class ='item_list_first'>
                        <el-row class="item_title_h">
                            &nbsp;
                        </el-row>
                        <el-row class="item_h">
                            昨天
                        </el-row>
                        <el-row class="item_h"> 
                            累计
                        </el-row>
                    </el-col>
                    <el-col span='23' >
                        <el-col :span='3' class ='item_list'>
                            <el-row class="item_title_h">
                                项目
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numReposAdd}}
                            </el-row>
                            <el-row class="item_h">
                                {{ tableDataSummary.numRepos}}
                            </el-row>
                        </el-col>
                        <el-col :span='3' > 
                            <el-row class ='item_list_p item_title_h'>
                                公开
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoPublicAdd}}
                            </el-row >
                            <el-row class="item_h">
                                {{tableDataSummary.numRepoPublic}}
                            </el-row>
                        
                        </el-col>
                        <el-col :span='3' class ='item_list'>
                            <el-row class="item_title_h"> 
                                私有
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoPrivateAdd}}
                            </el-row>
                            <el-row class="item_h"> 
                                {{tableDataSummary.numRepoPrivate}}
                            </el-row>
                        </el-col>
                        <el-col :span='3'>
                            <el-row class ='item_list_p item_title_h'>
                                自建
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoSelfAdd}}
                            </el-row >
                            <el-row class="item_h">
                                {{tableDataSummary.numRepoSelf}}
                            </el-row>
                        
                        </el-col>
                        <el-col :span='3' >
                            <el-row class ='item_list_p item_title_h'>
                                派生
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoForkAdd}}
                            </el-row >
                            <el-row class="item_h"> 
                                {{tableDataSummary.numRepoFork}}
                            </el-row>
                        </el-col>
                        <el-col :span='3' class ='item_list '>
                            <el-row class="item_title_h">
                                镜像
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoMirrorAdd}}
                            </el-row>
                            <el-row class="item_h">
                                {{tableDataSummary.numRepoMirror}}
                            </el-row>
                        
                        </el-col>
                        <el-col :span='3'>
                            <el-row class ='item_list_p item_title_h'>
                                组织
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoOrgAdd}}
                            </el-row>
                            <el-row class="item_h">
                                {{tableDataSummary.numRepoOrg}}
                            </el-row>
                        </el-col>
                        <el-col :span='2'>
                            <el-row class="item_title_h"> 
                            个人
                            </el-row>
                            <el-row class="item_h num_color">
                                {{tableDataSummary.numRepoNotOrgAdd}}
                            </el-row>
                            <el-row class="item_h">
                                {{tableDataSummary.numRepoNotOrg}}
                            </el-row>
                        
                        </el-col>
                    </el-col>
                </el-row>
            </div>
            <div style="margin-top: 20px;">
                <span  class="sta_iterm">统计周期：</span> 
                <!-- <button type="button" class='btnFirst' id ="yesterday" v-bind:class="{colorChange:1==dynamic}"  @click="resetPage(),getPeriodProList('yesterday',1)">昨天</button> -->
                <button type="button" class='btn' id = "current_week" v-bind:class="{colorChange:1==dynamic}"  @click="resetPage(),getPeriodProList('current_week',1)">本周</button>
                <button type="button" class='btn' id = "current_month" v-bind:class="{colorChange:2==dynamic}"  @click="resetPage(),getPeriodProList('current_month',2)">本月</button>
                <button type="button" class='btn' id = "last_month" v-bind:class="{colorChange:3==dynamic}"  @click="resetPage(),getPeriodProList('last_month',3)">上月</button>
                <button type="button" class='btn' id = "monthly" v-bind:class="{colorChange:4==dynamic}"  @click="resetPage(),getPeriodProList('monthly',4)">近30天</button>
                <button type="button" class='btn' id = "current_year" v-bind:class="{colorChange:5==dynamic}" @click="resetPage(),getPeriodProList('current_year',5)">今年</button>
                <button type="button" class='btnLast' id = "all"  v-bind:class="{colorChange:6==dynamic}" @click="resetPage(),getPeriodProList('all',6)">所有</button>
                <span style="margin-left: 20px;">
                    <el-date-picker
                        v-model="value_time"
                        prefix-icon="el-icon-time"
                        @change="resetPage(),getPeriodProList('',0)"
                        type="daterange"
                        size='small'
                        range-separator="至"
                        start-placeholder="开始日期"
                        end-placeholder="结束日期">   
                    </el-date-picker>
                </span>
                <span style="float:right; margin-right: 20px;">
                    <div style="display:inline-block;margin-left: 20px; ">
                        <a class="el-icon-download" v-if="tableData!=''" :href= "'../../api/v1/projectboard/downloadAll/?type='+this.params.type+'&beginTime='+this.params.beginTime+'&endTime='+this.params.endTime+'&q='+this.params.q+'&sort=openi'" ></a>
                        <i class="el-icon-download" v-else="tableData=''" href="#" style="color:rgba(187, 187, 187, 100);" @click='popMark()'></i>
                        <!-- <span ><a id = "download_file" :href= "'../api/v1/projectboard/downloadAll/?type='+this.params.type+'&beginTime='+this.params.beginTime+'&endTime='+this.params.endTime+'&q='+this.params.q+'&sort=openi'"   >下载报告</a> </span> -->
                        <span >
                            <a id = "download_file"  v-if="tableData!=''" :href= "'../../api/v1/projectboard/summary/download?type='+this.params.type+'&beginTime='+this.params.beginTime+'&endTime='+this.params.endTime">下载报告</a>
                            <a id = "download_file"  v-else="tableData=''"  href= "#" style="color:rgba(187, 187, 187, 100);" @click='popMark()'>下载报告</a> 
                        </span>
                    </div>  
                </span>
            </div>
            <div class="item_echart" id ='linecharts'>
                <div style="margin: 15px 10px 30px;">
                    <label for="label" @change='clickCheckBox'>
                        <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增项目"/> 新增项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增公开项目"/>新增公开项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart" checked="checked" value="新增私有项目"/>新增私有项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart"  value="新增自建项目"/>新增自建项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart"  value="新增派生项目"/>新增派生项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart"  value="新增镜像项目"/>新增镜像项目
                        <input type="checkbox" class="checkboxchart" name="checkboxchart"  value="累计项目"/>累计项目
                    </label>
                </div>              
                <div id ="selectData" style="height: 300px;">

                </div>

            </div>
            <div style="margin-top: 30px;"> 
                <el-table
                    :data="tableData.slice((page-1)*pageSize,page*pageSize)"
                    style="width: 100%"
                    :header-cell-style="tableHeaderStyle"
                    :cell-style='cellStyle'>
                    <el-table-column
                        label="日期"
                        align="left"
                        prop="creatTime"
                        >
                    </el-table-column>
                    <el-table-column
                        label="新增项目"
                        align="center"
                        prop="numReposAdd"
                        >
                    </el-table-column>
                        <el-table-column
                        label="累计项目"
                        align="center"
                        prop="numRepos"
                        >
                    </el-table-column>
                    <el-table-column
                        prop="numRepoPublicAdd" 
                        label="新增公开项目"
                        align="center">
                    </el-table-column>
                    <el-table-column
                        prop="numRepoPrivateAdd"
                        label="新增私有项目"
                        align="center">
                    </el-table-column>
                    <el-table-column
                        prop="numRepoSelfAdd"
                        label="新增自建项目"
                        align="center">
                </el-table-column>
                <el-table-column
                        prop="numRepoForkAdd"
                        label="新增派生项目"
                        align="center">
                    </el-table-column>
                    <el-table-column
                        prop="numRepoMirrorAdd"
                        label="新增镜像项目"
                        align="center">
                    </el-table-column>
                                
                </el-table>
            </div>
            <div style="margin-top:50px;text-align:center">
                <el-pagination
                background
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="page"
                :page-size="pageSize" 
                :page-sizes="[5,10,20]"
                layout="total, sizes,prev, pager, next,jumper"
                :total="tableData.length">
                </el-pagination>
            </div>
        </div>
    </div>
</template>

<script>
    // import barLabel from './basic/barLabel.vue';
    const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;

    import { export2Excel } from '../excel/util.js'
    export default{
        name:'ProAnalysis',
        components: {
            // barLabel,
        },
        data() {
            return {
                recordBeginTime:'',
                lastUpdatedTime:'',
                page:1,
                pageSize:10,
                params:{type:'monthly',page:1,pagesize:10,beginTime:'',endTime:''},
                tableData: [],
                tableDataSummary:{},
                totalPage:0,
                totalNum:0,
                pickerOptions: {
                },
                value_time: '',
                dynamic:4,
                echartsSelectData:'',
                option:'',
            };
         },
        methods: {
            // download_file(){
            //     this.params.type='all'
            // },
            popMark(){
                alert("数据为空时，不能下载！")
            },
            exportData(){
                
                // this.getOneProList(this.pro_id,'all',true,7)
                // this.getOneProList(this.pro_id,'all',false,7)
                // this.fileName()
                if (this.tableData!=''){
                    this.page=1
                    var saveFileName = this.getFileName()
                    export2Excel(this.columns,this.tableData,saveFileName)
                }else{
                    alert("数据为空时，不能下载！")
                }
           
            },
            getFileName(){

                var now = new Date(); // 当前日期
                var nowDayOfWeek = now.getDay(); // 今天本周的第几天
                var nowDay = now.getDate(); // 当前日
                var nowMonth = now.getMonth(); // 当前月
                var nowYear = now.getFullYear(); // 当前年     
                var today = this.saveFormatDate(nowYear,nowMonth+1,nowDay);
                var tmp = new Date(now.setTime(now.getTime()-24*60*60*1000));
                var yesterday = this.saveFormatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate());
                var yesterday_tmp = this.formatDate(tmp.getFullYear(),tmp.getMonth()+1,tmp.getDate())

               
                var startDate=''
                var endDate=''
                var saveFileName = ''
                
                if (typeof this.paramsID.type=="undefined" || this.paramsID.type=="null" || this.paramsID.type==""){
                    
                    // startDate=  this.saveFormatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate());
                    endDate = this.saveFormatDate(this.create_time_pro[1].getFullYear(),this.create_time_pro[1].getMonth() + 1,this.create_time_pro[1].getDate());
                    
                    var tmp = this.formatDate(this.create_time_pro[0].getFullYear(),this.create_time_pro[0].getMonth() + 1,this.create_time_pro[0].getDate())
                    startDate = this.comparedate(tmp,this.recordBeginTime)

                    console.log("comparedate:"+startDate)
                    saveFileName = this.alias+"_"+startDate+'_'+endDate
                }else{
                    switch(this.paramsID.type){
                        case "yesterday":{
                            
                            startDate = this.comparedate(yesterday_tmp,this.recordBeginTime)
                            endDate = startDate

                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "current_week":{
                            var now = new Date(); // 当前日期
                            var nowDayOfWeek = now.getDay(); // 今天本周的第几天
                            var day = nowDayOfWeek || 7;
                            startDate = this.formatDate(now.getFullYear(), nowMonth+1, nowDay + 1 - day);
                            startDate = this.comparedate(startDate,this.recordBeginTime)
    

                            endDate = yesterday
                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "current_month":{
                           
                            startDate =  this.formatDate(nowYear,nowMonth+1,1);
                            startDate = this.comparedate(startDate,this.recordBeginTime)

                            endDate = yesterday
                            
                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "last_month":{

                            let lastMonthDate = new Date();  // 上月日期
                            lastMonthDate.setDate(1);
                            lastMonthDate.setMonth(lastMonthDate.getMonth()-1);
                            let lastYear = lastMonthDate.getFullYear();
                            let lastMonth = lastMonthDate.getMonth();

                            startDate=this.formatDate(lastYear, lastMonth+1, 1);
                            startDate = this.comparedate(startDate,this.recordBeginTime)


                            var monthStartDate = new Date(lastYear, lastMonth, 1);
                            var monthEndDate = new Date(lastYear, lastMonth+1, 1);
                            var days = (monthEndDate - monthStartDate) / (1000 * 60 * 60 * 24)

                            endDate=this.saveFormatDate(lastYear, lastMonth+1, days);  //月份从0开始，所以+1保存月份 
                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "monthly":{
                            var temp=new Date(now - 1000 * 60 * 60 * 24 * 30)
                            startDate = this.formatDate(temp.getFullYear(),temp.getMonth()+1,temp.getDate());
                            startDate = this.comparedate(startDate,this.recordBeginTime)

                            endDate = yesterday
                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "current_year":{
                            startDate = this.formatDate(now.getFullYear(), 1, 1);
                            startDate = this.comparedate(startDate,this.recordBeginTime)

                            endDate = yesterday
                            saveFileName = this.alias+"_"+startDate+'_'+ endDate
                            break
                        }
                        case "all":{
                            console.log("e:"+today)
                            startDate = 'all'
                            endDate = yesterday
                            saveFileName = this.alias+'_所有'
                            break
                        }
                    }
                }
                return saveFileName

            },
            resetPage(){
                this.page=1
                this.params.page = 1
            },
            resetCurrentPage(){
                this.page=1
            },
            handleSizeChange(val){
                this.pageSize = val
            },
            handleCurrentChange(val){
                this.page = val;
            },
            saveFormatDate(myyear,mymonth,myweekday) {
                // var myyear = this.date.getFullYear();
                // var mymonth = this.date.getMonth() + 1;
                // var myweekday = this.date.getDate();
        
                if (mymonth < 10) {
                    mymonth = "0" + mymonth;
                }
                if (myweekday < 10) {
                    myweekday = "0" + myweekday;
                }
                console.log((myyear +''+ mymonth  +''+ myweekday))
                return (myyear +''+ mymonth  +''+ myweekday);
            },
            formatDate(myyear,mymonth,myweekday) {
                // var myyear = this.date.getFullYear();
                // var mymonth = this.date.getMonth() + 1;
                // var myweekday = this.date.getDate();
        
                if (mymonth < 10) {
                    mymonth = "0" + mymonth;
                }
                if (myweekday < 10) {
                    myweekday = "0" + myweekday;
                }
                return (myyear +'-'+ mymonth  +'-'+ myweekday);
            },
            //获得某月的天数
                       
            getPeriodProList(type_val,index){
                console.log("类型："+type_val)
                this.dynamic = index
                if (typeof type_val=="undefined" || type_val=="null" || type_val==""){
                    this.params.type=''
                    this.params.beginTime=this.formatDate(this.value_time[0].getFullYear(),this.value_time[0].getMonth() + 1,this.value_time[0].getDate())
                    this.params.endTime=this.formatDate(this.value_time[1].getFullYear(),this.value_time[1].getMonth() + 1,this.value_time[1].getDate())
                }else{
                    this.params.type=type_val
                    this.params.beginTime=''
                    this.params.endTime=''
                    this.value_time=[]
                }
                console.log("params:",this.params)
                this.$axios.get('../../api/v1/projectboard/summary/period',{
                    params:this.params
                }).then((res)=>{
                    this.recordBeginTime=res.data.recordBeginTime
                    // this.lastUpdatedTime=res.data.creatTime
                    this.tableData = res.data.pageRecords
                    this.totalPage=res.data.totalPage
                    // this.totalNum = res.data.totalCount//this.totalPage*this.params.pagesize
                    // console.log("res.data:"+res.data)
                    this.drawSelectData()

                })
            },
            getSummaryPro(){
                this.$axios.get('../../api/v1/projectboard/summary',{
                }).then((res)=>{
                this.tableDataSummary = res.data
                this.lastUpdatedTime = res.data.creatTime    
                })
            },
            tableHeaderStyle({row,column,rowIndex,columnIndex}){
        
                if(rowIndex===0){
                    return 'background:#f5f5f6;color:#606266'
                }       
            },
            cellStyle({row,column,rowIndex,columnIndex}){
        
                if(rowIndex%2 === 1){
                    return 'background:#f5f5f6;color:#606266'
                }       
            },
            drawSelectData(){
                
                // $("#selectData").removeAttr("selectData").empty();
                var xdata=[]
                var ydata_add_pro=[]
                var ydata_add_public_pro=[]
                var ydata_add_private_pro=[]
                var ydata_add_self=[]
                var ydata_add_fork=[]
                var ydata_add_mirror=[]
                var ydata_cumulative_pro=[]
           
                // if ()
                for(var i =0;i<this.tableData.length;i++){
                    xdata.push(this.tableData[this.tableData.length-1-i].creatTime);
                    ydata_add_pro.push(this.tableData[this.tableData.length-1-i].numReposAdd)
                    ydata_add_public_pro.push(this.tableData[this.tableData.length-1-i].numRepoPublicAdd)
                    ydata_add_private_pro.push(this.tableData[this.tableData.length-1-i].numRepoPrivateAdd)
                    ydata_add_self.push(this.tableData[this.tableData.length-1-i].numRepoSelfAdd)
                    ydata_add_fork.push(this.tableData[this.tableData.length-1-i].numRepoForkAdd)
                    ydata_add_mirror.push(this.tableData[this.tableData.length-1-i].numRepoMirrorAdd)
                    ydata_cumulative_pro.push(this.tableData[this.tableData.length-1-i].numRepos)
                }
                console.log("ydata_openI:"+ydata_add_pro)
                console.log(xdata)
                 this.option = {
                        title : {
                            text: '',


                            textStyle: {
                                    fontSize: 12,
                                },
                            left:'center',
                            top:'bottom',

                            subtext: '',

                        },
                        tooltip : {
                            trigger: 'axis',
                            backgroundColor:'rgba(255,255,255,0.8)',
                            color:'black',
                            borderWidth:'1',
                            borderColor:'gray',
                            textStyle:{
                                color:'black'
                            },
                      
                        },
                        legend: {
                            data:['新增项目','新增公开项目','新增私有项目','新增自建项目','新增派生项目','新增镜像项目','累计项目'],
                              selected:{
                                '新增自建项目':false,
                                '新增派生项目':false,
                                '新增镜像项目':false,
                                '累计项目':false
                            }
                            // orient: 'vertical',
                            // top:'top',　　
                        },
                        toolbox: {
                            show : false,
                            feature : {
                                mark : {show: true},
                                dataView : {show: false, readOnly: false},
                                magicType : {show: true, type: ['line', 'bar']},
                                restore : {show: false},
                                saveAsImage : {show: true}
                            }
                        },
                        calculable : true,
                        xAxis : [
                            {
                                type : 'category',
                                data : xdata,
                                axisLine: {
                                    show: false, //x轴线消失
                                }, 
                                axisTick:{
                                    show:false//刻度隐藏
                                }
                                
                            }
                        ],
                        yAxis : [
                            {
                                type : 'value', 
                                axisLine: {
                                    show: false, //y轴线消失
                                }, 
                                axisTick:{
                                    show:false//刻度隐藏
                                }  
                            }
                        ],
                        series : [
                            {   name:"新增项目",
                                data: ydata_add_pro,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#3894FF",
                                        },
                                        color:"#3894FF",
                                    }
                                },
                            },
                            {
                                name:"新增公开项目",
                                data: ydata_add_public_pro,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#67B3BB",
                                        },
                                        color:"#67B3BB",
                                    }
                                },
                            },
                            {
                                name:"新增私有项目",
                                data: ydata_add_private_pro,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#58A55C",
                                        },
                                        color:"#58A55C",
                                    }
                                },
                            }, 
                            {
                                name:"新增自建项目",
                                data: ydata_add_self,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#F2BD42",
                                        },
                                        color:"#F2BD42",
                                    }
                                },
                            },
                            {
                                name:"新增派生项目",
                                data: ydata_add_fork,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#DAA67B",
                                        },
                                        color:"#DAA67B",
                                    }
                                },
                            },  
                            {
                                name:"新增镜像项目",
                                data: ydata_add_mirror,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#2E4552",
                                        },
                                        color:"#2E4552",
                                    }
                                },
                            },
                            {
                                name:"累计项目",
                                data: ydata_cumulative_pro,
                                type: 'line',
                                areaStyle: {},
                                itemStyle:{
                                    normal:{
                                        lineStyle:{
                                            color:"#4786B4",
                                        },
                                        color:"#4786B4",
                                    }
                                },
                            },

                        ]
                }; 
                // this.echartsSelectData.resize()
                this.echartsSelectData.setOption(this.option)
                // setTimeout(function (){
                //     window.onresize = function () {
                //         this.echartsSelectData.resize;
                //     }
                // },200)

                // // 使用刚指定的选择项数据显示图表。
                // var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
                // var checkboxs=document.getElementsByName('checkboxchart'); 
                // $(".checkboxchart").click(function(){
                //     var obj = {};
                //     for(var i=0; i<checkboxs.length; i++){
                //         if(checkboxs[i].checked){
                //             obj[selectArr[i]] = true;
                //         }else{
                //             obj[selectArr[i]] = false;
                //         }
                //     } 
                //     option.legend.selected = obj;
                //     this.echartsSelectData.setOption(option);
                // });
                


            },
            clickCheckBox(){
                // 使用刚指定的选择项数据显示图表。
                var selectArr = this.echartsSelectData.getOption().legend[0].data;//legend所有值
                var checkboxs=document.getElementsByName('checkboxchart'); 
                // $(".checkboxchart").click(function(){
                    var obj = {};
                    for(var i=0; i<checkboxs.length; i++){
                        if(checkboxs[i].checked){
                            obj[selectArr[i]] = true;
                        }else{
                            obj[selectArr[i]] = false;
                        }
                    } 
                    this.option.legend.selected = obj;
                    this.echartsSelectData.setOption(this.option);
                // });

            },
            comparedate(date1,date2){
                // console.log("date1:"+date1)
                // console.log("date1:"+date2)
                var oDate1 = new Date(date1);
                var oDate2 = new Date(date2);
                if(oDate1.getTime() < oDate2.getTime()){
                    var data = date2.split('-')
                    return data[0]+''+data[1]+''+data[2]
                } else {
                    var data = date1.split('-')
                    return data[0]+''+data[1]+''+data[2]
                }
            },

        },
        filters:{
             
        },


        mounted() {   

            this.getPeriodProList("monthly",4);
            this.getSummaryPro();
            document.getElementById('selectData').style.width  = document.getElementById('pro_tend').offsetWidth*0.8+'px' 
            this.echartsSelectData = this.$echarts.init(document.getElementById('selectData'))
        },

        watch:{
        },

        created() {
            this.getSummaryPro();
            this.getPeriodProList("monthly",4);
        },
        updated(){
            if(document.querySelectorAll('img[avatar]').length!==0){
                window.LetterAvatar.transform()
            }
        }
    }
</script>

<style scoped>
    .item_list_first{
        border-right: 1px solid rgba(219,219,219,100);
        padding-right: 10px;
    }

    .item_list{
        border-right: 1px solid rgba(219,219,219,100);
        padding:0px 10px;
    }
    .item_list_p{
        border-right: 1px solid rgba(219,219,219,100);
        padding:0px 10px;
    }
    .item_h{
        line-height: 40px;
        text-align: center;
    }
    .item_title_h{
        line-height: 28px;
        text-align: center;
    }
    .num_color{
        color: #0366D6;
        font-weight: bold;
    }

    .pro_item{
        font-size: 16px;
        color:  rgba(16, 16, 16, 100);
        font-family: SourceHanSansSC-bold;
    }
    .sta_item{
        font-size: 14px;
        color: rgb(0 0 0);
        font-family: SourceHanSansSC-bold;
    }
    .update_time{
        line-height: 17px;
        font-size: 12px;
        color:rgba(187, 187, 187, 100);
        margin-left: 10px;
    }
    .btnFirst{ 
        line-height: 1.5;
        margin: -3.5px;
        border:  1px solid rgba(22, 132, 252, 100);
        border-right: none;
        background: #FFFF;
        color: #1684FC;
        width: 60px;
        height: 30px;
        border-radius:4px 0px 0px 4px;
    }
    .btn{ 
        line-height: 1.5;
        margin: -3.5px;
        border:  1px solid rgba(22, 132, 252, 100);
        border-right: none;
        background: #FFFF;
        color: #1684FC;
        width: 60px;
        height: 30px;
    }
    .btnLast{ 
        line-height: 1.5;
        margin: -3.5px;
        border: 1px solid rgba(22, 132, 252, 100);
        /* border-right: none; */
        background: #FFFF;
        color: #1684FC;
        width: 60px;
        height: 30px;
        border-radius:0px 4px 4px 0px;
    }
    .btnFirst, .btn, .btnLast {
        cursor: pointer;
    }

    /deep/ .el-table tbody tr:hover>td { 
        background-color:#D3D3D3!important;
        opacity:1
    }
    /deep/ .el-table {
        font-size: 12px;
    }
 
    /deep/ .el-range-separator{
        width: 20% !important;
    }
    /deep/ .el-pagination {
        padding-bottom: 30px;
    }
    .colorChange {
        background-color: #1684FC;
        color: #FFFF;
        cursor: default;
    }
    .items{
        text-align: center;
        border-right:1px solid rgba(219, 219, 219, 100);
    }  
    .item_l{
        margin-right: 5px;
        border:1px solid rgba(219, 219, 219, 100);
        height: 370px;
        width: 100%;
    }
    .item_r{
        margin-right:5px;
        border:1px solid rgba(219, 219, 219, 100);
        height: 370px;
        overflow:auto
    }
    .item_echart{
        margin-top: 10px;
        margin-right: 5px;
        border:1px solid rgba(219, 219, 219, 100);
        height: 350px;
        width: 100%;
    }
    .item_content{
        color:#0366D6;
        margin-top: 10px;
        font-weight:bold;
    }
</style>