<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-table
                :data="tableData"
                style="width: 100%">
                <el-table-column
                    prop="item_unitname"
                    show-overflow-tooltip
                    label="单位名称">
                </el-table-column>               
                <el-table-column                   
                    prop="item_name"
                    label="姓名"
                    min-width="80">
                </el-table-column>
                  <el-table-column
                    prop="item_phone"
                    min-width="120"
                    label="电话">
                </el-table-column>
                  <el-table-column
                    prop="item_departname"
                     min-width="100"
                    label="所属部门">
                </el-table-column>
                <el-table-column
                    prop="item_duty"
                    label="职责"
                    width="200">
                </el-table-column>
               
                 </el-table>
            </div>

            <div class="tableContent" v-if="type==2"> 
                 <el-table
                :data="tableData2"
                style="width: 100%">
                <el-table-column                   
                    prop="item_name"
                    label="人员姓名"
                    width="120">
                </el-table-column>               
                <el-table-column
                    width="250"
                    prop="item_company_name"
                    label="所属单位">
                </el-table-column>
                 <el-table-column
                    prop="item_duty"
                    label="岗位"
                    width="250">
                </el-table-column>
                <el-table-column
                    prop="item_phone"
                    label="联系电话"
                    width="120"
                    >
                </el-table-column>
                 </el-table>
            </div>
        </div>
    </section>
</template>
<script>
export default {
    data(){
        return{
          titleArr:[
              {name:'信息化专职人员',type:1},
              {name:'协建人员管理',type:2},
          ],
          inx:0,
          params:{//搜索条件
            pageIndex:1,
            pageSize:3,
            total:0
          },
          type:1,
          tableData:[],
          tableData2:[],
        }
    },
    mounted() {
        this.xxhzzrylist()
        this.xjrygllist()
    },
    methods: {
        titleClick(item,index){
           this.inx=index
           this.type=item.type
        },
        xxhzzrylist(){
            this.$api.xxhzzrylistApi(this.params,{
                onSucess: response => {
                    console.log(response)
                    this.tableData=response.data.data
                }
            })            
        },
        xjrygllist(){
            this.$api.xjrygllistApi(this.params,{
                onSucess: response => {
                    console.log(response)
                    this.tableData2=response.data.data
                }
            })            
        },
        more(){
            if(this.type==1){
                 let appId='__XGrhLpoaDCJAKb9fVJI'
                let name='信息化专职人员'
                let flag=1
                this.$store.dispatch("loadMenus", {appId, name,flag});
            }else if(this.type==2){
                let appId='__R2rwvGVEoP2sn49nGLi'
                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;
                   }
                }
            }
        }
    }
}
</style>