<template>
    <section class="homeGT">
        <div class="htaTitle"><span class="TitleTab"><em v-for='(item,index) in titleArr' :key='index' @click='titleClick(item,index)' :class='inx==index?"active":""'>{{item.name}}</em></span><span class="more" @click='more'>查看更多>></span></div>
        <div class="htaBox">
            <div class="tableContent" v-if='type==1'>
                <el-scrollbar class="scrollbarClass">
                 <el-table
                :data="tableData"
                style="width: 100%">   
                 <el-table-column
                    prop="item_num"
                    label="序号"
                     width="50"
                    >
                </el-table-column>     
                <el-table-column
                    prop="item_task_name"
                    label="任务名称"
                    show-overflow-tooltip
                    >
                </el-table-column>
                <el-table-column
                    prop="item_person_name"
                    label="责任人"
                    width="80">
                </el-table-column>
                <el-table-column
                    prop="item_depart_com_name"
                    width='100'
                    label="责任部门">
                </el-table-column>
                <el-table-column
                    prop="item_priority"
                    width='80'
                    label="优先级">
                </el-table-column>
                 <el-table-column
                    prop="granttime"
                    width='100'
                    label="发放时间">
                </el-table-column>
                 <el-table-column
                    prop="completetime"
                    width='100'
                    label="完成时限">
                </el-table-column>
                 <el-table-column
                    prop="item_progress"
                    width='100'
                    label="任务进度">
                    <template slot-scope="scope">
                        <span><el-progress :percentage="scope.row.item_progress"></el-progress></span>
                    </template>
                </el-table-column>
                 <el-table-column
                    show-overflow-tooltip
                    prop="item_remark"
                    width='200'
                    label="备注">
                </el-table-column>
                 </el-table>
                 </el-scrollbar>
            </div>

            <div class="tableContent" v-if='type==2'>
                <el-table
                :data="tableData2"
                style="width: 100%">     
                <el-table-column
                    prop="item_search_num"
                    label="序号"
                    width="50"
                > 
                </el-table-column>
                <el-table-column                  
                    prop="item_projectname"
                    label="项目名称"
                    width="300">
                </el-table-column>
                <el-table-column
                    prop="item_departname"
                    label="承建单位"
                    width="250">
                </el-table-column>
                 <el-table-column
                    prop="item_lagging_matters"
                    width="250"
                    label="滞后事项">
                </el-table-column> 
                <el-table-column
                    prop="item_work_time"
                    label="计划完成时间"
                     width="120"
                    >
                </el-table-column>
                <el-table-column
                    prop="item_actual_time"
                    label="实际完成时间"
                    width="120"
                    >
                </el-table-column>
                 <el-table-column
                   show-overflow-tooltip
                    prop="item_reason_delay"
                    label="延期原因">
                </el-table-column>
                               
                 </el-table>
            </div>

            <div class="tableContent" v-if='type==3'>
                 <el-table
                :data="tableData3"
                style="width: 100%">
                <el-table-column
                    prop="item_time"
                    label="日期"
                    width="200"
                    >
                </el-table-column> 
                <el-table-column      
                   show-overflow-tooltip             
                    prop="item_filename"
                    label="文件名称"
                    >
                </el-table-column>                
                              
                 </el-table>
            </div>
        </div>
    </section>
</template>
<script>
export default {
    data(){
        return{
          titleArr:[
              {name:'挂图作战',type:1},
              {name:'进度滞后预警',type:2},
            //   {name:'联合专班日报',type:3}
          ],
          inx:0,
          params:{//搜索条件
            pageIndex:1,
            pageSize:3,
            total:0
          },
          type:1,
          tableData:[],
          tableData2:[],
          tableData3:[]
        }
    },
    mounted() {
        this.gtlist()
        this.jdzhyjlist()
        this.lhzbrblist()
    },
    methods: {
        titleClick(item,index){
           this.inx=index
           this.type=item.type
        },
        gtlist(){
            this.$api.gtlistApi(this.params,{
                onSucess: response => {
                    console.log(response)
                    this.tableData=response.data.data
                }
            })            
        },
        jdzhyjlist(){
            this.$api.jdzhyjlistApi(this.params,{
                onSucess: response => {
                    console.log(response)
                    this.tableData2=response.data.data
                }
            })            
        },
        lhzbrblist(){
            this.$api.lhzbrblistApi(this.params,{
                onSucess: response => {
                    console.log(response)
                    this.tableData3=response.data.data
                }
            })            
        },
        more(){
            if(this.type==1){
                 let appId='__Hab04s0VNDPrjFZ3Xlo'
                let name='挂图作战'
                let flag=1
                this.$store.dispatch("loadMenus", {appId, name,flag});
            }else if(this.type==2){
                let appId='__l8yB8fdHv3OmXOrHfyF'
                let name='进度滞后预警'
                let flag=1
                this.$store.dispatch("loadMenus", {appId, name,flag});
            }else if(this.type==3){
                let appId='__u1xGyTCVhsSaWrgdBed'
                let name='联合专班日报'
                let flag=1
                this.$store.dispatch("loadMenus", {appId, name,flag});
            }            
        },
    },
}
</script>
<style lang="scss" scoped>
.homeGT{
    display: flex; 
    flex-direction: column;
    .htaTitle{
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        font-size: 18px;
        color: rgba(0, 0, 0, 0.85);
        padding: 16px;
        display: flex;
        align-items: center;
        .TitleTab{
          flex:1;
          em{
              margin-right: 15px;
              font-size: 16px;
              padding-bottom:16px;
              cursor: pointer;
              &.active{
                 border-bottom: 1px solid #0076f6;  
                 color: #0076f6;
              }
          }
        }
        .more{
            flex-wrap: 150px;
            font-size: 14px;
            cursor: pointer;
        }
    }
    .htaBox{
        padding: 16px 0 16px 16px;
        ul{
            display: flex;
            flex-wrap: wrap;
            align-content: flex-start;
            
            li{
                background: #fff;
                width: 140px;
                height: 100px;
                border-radius: 4px;
                display: flex;
                flex-direction: column;
                padding: 16px;
                margin-right:16px;
                margin-bottom: 16px;
                align-items: center;
                text-align: center;
                span{
                  margin-bottom: 8px;  
                   img{
                     width: 48px;
                     height:48px;
                   }
                   strong{                      
                       color: rgba(0, 0, 0, 0.85);
                       font-size: 14px;
                       font-weight: normal;
                   }
                }
            }
        }
    }
    .scrollbarClass{
        .el-scrollbar__wrap{
            overflow: scroll!important;
            height: calc(100% + 20px)!important; //多出来的20px是横向滚动条默认的样式       
        }
        .el-table--scrollable-x .el-table__body-wrapper{overflow-x: hidden!important;;}
    }
}
</style>