<template>
    <div class="workBench">
        <div class="topBody">
            <p class="breadcrumb">工作台</p>
            <div class="bottom">
                <div class="touxiang">
                    <img src="@/assets/touxiang.png"  alt="">
                </div>  
                <div class='tip'>
                    <p class="greet">早安，{{userInfo.username}}，祝你开心每一天！</p>
                    <p class="descPosition">
                        <span>运营经理</span>
                        <a-divider type="vertical" />
                        <span>华北地区-头条事业部</span>
                    </p>
                </div>
                <a-button type='primary' class="mybtn" @click="sendOrder">
                    <a-icon type="plus" />
                    发起订单
                </a-button>
            </div>
        </div>
        <div class="section">
            <div class="sectionBody">
                <div class="sectionLeftBox">
                    <div class="leftTop">
                        <div class="sectionHead">
                            我的工作内容
                        </div>
                        <div class="zhanshiBox">
                           
                            <div class="item" @click="goOrderList(1)">                               
                                <div class="title">
                                    <img src="@/assets/work.png" alt="" class="iconImg">
                                    <span>我发起的订单</span>
                                </div>
                                <div class="itemBody">
                                    <p class="count">60 <span>个</span></p>
                                </div>
                            </div>
                            <div class="item" @click="goMaterialList(1)">                                
                                <div class="title">
                                    <img src="@/assets/work.png" alt="" class="iconImg">
                                    <span>待审核的物料</span>
                                </div>
                                <div class="itemBody">
                                    <p class="count">60 <span>个</span></p>
                                </div>                              
                            </div>
                           
                            <div class="item" @click="goOrderList(2)">                               
                                <div class="title">                                   
                                    <img src="@/assets/work.png" alt="" class="iconImg">
                                    <span>已完成的订单</span>
                                </div>
                                <div class="itemBody">
                                    <p class="count">60 <span>个</span></p>
                                </div>
                            </div>
                            <div class="item" @click="goOrderList(3)">                                
                                <div class="title">                                   
                                    <img src="@/assets/work.png" alt="" class="iconImg">
                                    <span>被驳回的订单</span>
                                </div>
                                <div class="itemBody">
                                    <p class="count">60 <span>个</span></p>
                                </div>
                            </div>
                            <div class="item" @click="goOrderList(4)">                                
                                <div class="title">
                                    <img src="@/assets/work.png" alt="" class="iconImg">
                                    <span>全部订单</span>
                                </div>
                                <div class="itemBody">
                                    <p class="count">60 <span>个</span></p>
                                </div>                                
                            </div>
                        </div>  
                    </div>
                    <div class="leftBottom">
                        <div class="sectionHead">
                            订单进度
                             <a-button type="link" class="allOrder" @click="goOrderList(4)">全部订单</a-button>
                        </div>
                        <div class="orderProgress">
                            <ul class="orderProgress-list">
                                <li v-for="(item,index) in orderProgressList" :key="index"  >
                                    <!-- <span  style="display:block;width:100%"> -->
                                    <div style="display:flex;align-items: center;" class="orderProgress-list-item" @click="orderDetail(item)">
                                        <div style="display:flex;width:80%; align-items: center;" >
                                            <span class="item-icon"></span>
                                            <div class="content">
                                                <p class="name">{{item.orderTitle}}</p>
                                                <p class="desc">{{item.orderRemark}}</p>
                                            </div>
                                        </div>
                                        
                                        <div class="progress">
                                            <a-progress type="circle" :percent="75" :width='30' :showInfo='false'  :strokeWidth='10' />
                                            <span style="margin-left:15px">75%</span>
                                        </div>
                                    </div>
                                    <!-- </span> -->
                                </li>
                            </ul>
                            <!-- hideOnSinglePage -->
                            <a-pagination size="small" :total="totalPage" :current='currentPage' class="fenye" :change='pageChange'  show-size-changer show-quick-jumper hideOnSinglePage />
                        </div>
                    </div>
                </div>
                <div class="sectionRightBox">
                    <div class="rightTop">
                        <div class="sectionHead">
                            操作记录
                        </div>
                        <div class="optionRecordList">
                            <a-timeline>
                                <a-timeline-item color='#F0F2F5' style="height:30px">
                                   <p style="margin-bottom:0px">
                                    <span class="content-item">Create a services site 2015-09-01</span> 
                                    <span class="time">1分钟前</span>
                                   </p>
                                </a-timeline-item>
                                <a-timeline-item color='#F0F2F5' style="height:30px">
                                   <p style="margin-bottom:0px">
                                    <span class="content-item">Create a services site 2015-09-01</span> 
                                    <span class="time">1分钟前</span>
                                   </p>
                                </a-timeline-item>
                                <a-timeline-item color='#F0F2F5' style="height:30px">
                                   <p style="margin-bottom:0px">
                                    <span class="content-item">Create a services site 2015-09-01</span> 
                                    <span class="time">1分钟前</span>
                                   </p>
                                </a-timeline-item>
                                <a-timeline-item color='#F0F2F5' style="height:30px">
                                   <p style="margin-bottom:0px">
                                    <span class="content-item">Create a services site 2015-09-01</span> 
                                    <span class="time">1分钟前</span>
                                   </p>
                                </a-timeline-item>
                                
                            </a-timeline>
                        </div>
                    </div>
                    <div class="rightBottom">
                        <div class="sectionHead">
                            本周项目燃尽图
                        </div>
                        <div class="burnDown">
                             <a-progress type="circle" :percent="75"  :width='150' :strokeWidth='6' />
                             <div class="tip">
                                <p class="done">
                                    <span class="item-icon"></span>
                                    <span>已完成订单：{{}}个</span>
                                </p>
                                <p class="all">
                                    <span class="item-icon"></span>
                                    <span>未完成订单：{{}}个</span>
                                </p>
                             </div>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
    </div>
</template>

<script>
import moment from 'moment';
import { getAction, postAction, downFile, downFilePost } from '@/api/manage';

export default {
    name:'operator-platform',
    data() {
        return {
            touxiang:'@/assets/touxiang.png',
            // 订单进度
            orderProgressList:[
                
            ],

            // 操作记录
            optionRecord:[],

            // 本周项目燃尽图
            burnDownChart:[],

            // 分页参数
            totalPage:0,
            currentPage:1,
            userInfo:{},
            roleCode:''
        }
    },
    methods: {
        goOrderList(val){
            console.log(val);
            // console.log(this.$parent)
            this.$parent.currentTabComponent='orderList';
            this.$parent.orderStatus=val
            
        },
        goMaterialList(val){
            this.$parent.currentTabComponent='materialList';
            this.$parent.materialStatus=val
        },
        orderDetail(item){
            console.log(item)
            this.$parent.currentTabComponent='orderDetail';
            this.$parent.orderId=item.id
        },
        // 分页页码改变
        pageChange(page, pageSize){
            this.currentPage=page;
            this.getOrderList()
        },
        
        // 发起订单
        sendOrder(){
            this.$parent.currentTabComponent='placeOrder';
            
        },
        // 获取订单列表
        getOrderList(){
          
            let params={
                createBy:this.userInfo.id,
                pageNo:this.currentPage,
                pageSize:10,
            }
            getAction('/platform/order/listByCreatorOrDesignLeader',params).then(res=>{
                console.log(res);
                this.loading=false;
                if(res.success){
                    this.orderProgressList=res.result.records;
                    this.totalPage=res.result.total;

                }
            })
        },
    },
    mounted(){
        let userInfo=localStorage.getItem('pro__Login_Userinfo');
        if(userInfo){
            this.userInfo=JSON.parse(userInfo).value
        }
        this.roleCode=localStorage.getItem('roleCode')
        this.getOrderList()
        
    }
}

</script>

<style lang="scss" scoped>
.workBench{
    ul,li{
        margin: 0;
        padding: 0;
    }
    width: 100%;
    .topBody{
        width: 100%;
        height: 146px;
        background: #FFFFFF;
        margin-bottom: 12px;
        padding: 20px;
        box-sizing: border-box;
        .breadcrumb{
            width: 42px;
            height: 22px;
            font-size: 12px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #000000;
            line-height: 22px;
        }
        .bottom{
            display: flex;
            position: relative;
            // padding: 20px;
            .touxiang{
                width: 72px;
                height: 72px;
                margin-right: 20px;
                border-radius: 50%;
                overflow: hidden;
                img{
                    width: 100%;
                    height: 100%;
                    border-radius: 50%;
                }
            }
            .tip{
                .greet{
                    height: 28px;
                    font-size: 20px;
                    font-family: PingFangSC-Medium, PingFang SC;
                    font-weight: 500;
                    color: rgba(0, 0, 0, 0.85);
                    line-height: 28px;
                }
                .descPosition{
                    height: 22px;
                    font-size: 14px;
                    font-family: PingFangSC-Regular, PingFang SC;
                    font-weight: 400;
                    color: rgba(0, 0, 0, 0.45);
                    line-height: 22px;
                }

            }
            .mybtn{
                position: absolute;
                // top: 50%;
                // margin-left: -18px;
                right: 0;
            }
        }

    }
    .section{
        .sectionBody{
            display: flex;
            .sectionHead{
                padding: 15px 20px;
                // height: 24px;
                font-size: 16px;
                font-family: PingFangSC-Medium, PingFang SC;
                font-weight: 500;
                color: rgba(0, 0, 0, 0.85);
                line-height: 24px;
                border-bottom: 1px solid  #E9E9E9;;
                position: relative;
                .allOrder{
                    position: absolute;
                    right: 5px;
                }
            }
            .sectionLeftBox{
                width: 70%;
               
                .leftTop{
                    overflow: hidden;
                    background: white;
                }
                .zhanshiBox{
                    display: flex;
                    flex-wrap: wrap;
                    .item{
                        width: 33.33%;
                        // background: brown;
                        padding: 20px ;
                        border-right: 1px solid #E9E9E9;
                        border-bottom: 1px solid #E9E9E9;
                        .title{
                            padding-bottom: 34px;
                            color: #000000;
                            .iconImg{
                                width: 24px;
                                margin-right: 8px;
                            }
                        }
                        .itemBody{
                            text-align: center;
                            .count{
                                
                                font-size: 24px;
                                font-family: PingFangSC-Medium, PingFang SC;
                                font-weight: 500;
                                color: #000000;
                                line-height: 32px;
                                cursor: pointer;
                                span{
                                    font-size: 16px;
                                    cursor: pointer;
                                }
                            }
                            .count:hover{                                
                                color: #1890FF;
                            }
                        }
                    }
                    .item:nth-child(3n){
                        border-right: 0;
                    }
                }
                .leftBottom{
                    margin-top: 12px;
                    background: white;
                    .orderProgress{
                        padding: 0 20px;
                        .orderProgress-list-item{
                            padding: 10px 0;
                            display: flex;
                            align-items: center;
                            border-bottom: 1px solid  #E9E9E9;;
                            justify-content:space-between;
                            cursor: pointer;
                            .item-icon{
                                width: 8px;
                                height: 8px;
                                background: #3BA0FF;
                                margin-right: 15px;
                                display: inline-block;
                                border-radius: 50%;
                            }
                            .content{
                                width: 70%;
                                overflow: hidden;
                                font-size: 14px;
                                font-family: PingFangSC-Regular, PingFang SC;
                                font-weight: 400;
                                .name{
                                    height: 22px;                                    
                                    color: rgba(0, 0, 0, 0.65);
                                    line-height: 22px;
                                    text-overflow: ellipsis;
                                    white-space: nowrap;
                                    overflow: hidden;
                                    margin-bottom: 0px;
                                }
                                .desc{
                                    height: 22px;
                                    color: rgba(0, 0, 0, 0.25);
                                    line-height: 22px;
                                    text-overflow: ellipsis;
                                    white-space: nowrap;
                                    overflow: hidden;
                                     margin-bottom: 0px;
                                }
                            }
                            .progress{
                                float: right;
                            }
                        }
                        .fenye{
                            padding: 20px 0;
                            text-align: right;
                        }
                    }
                }
            }
            .sectionRightBox{
                width: 29.5%;
                // background: white;
                margin-left: 12px;
                .rightTop{
                    height: 370px;
                     background: white;
                     .optionRecordList{
                         padding: 20px;
                         p{
                             width: 100%;
                         }
                        .content-item{
                            width: 80%;
                            display: inline-block;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                        }
                        .time{
                            width: 20%;
                            display: inline-block;
                            overflow: hidden;
                            text-overflow: ellipsis;
                            white-space: nowrap;
                        }
                     }
                }
                .rightBottom{
                    margin-top: 12px;
                     background: white;
                    .burnDown{
                         padding: 30px 20px;
                         text-align: center;
                         .tip{
                            margin-top: 40px;
                            display: flex;
                            justify-content: space-around;
                             
                            height: 22px;
                            font-size: 14px;
                            font-family: PingFangSC-Regular, PingFang SC;
                            font-weight: 400;
                            color: rgba(0, 0, 0, 0.65);
                            line-height: 22px;
                             .done{
                                .item-icon{
                                     width: 8px;
                                    height: 8px;
                                    background: #3BA0FF;
                                    margin-right: 15px;
                                    display: inline-block;
                                    border-radius: 50%;
                                }
                             }
                             .all{
                                .item-icon{
                                    width: 8px;
                                    height: 8px;
                                    background: #F0F2F5;
                                    margin-right: 15px;
                                    display: inline-block;
                                    border-radius: 50%;
                                } 
                             }
                         }
                    }

                }
            }
        }
    }
}
</style>

<style lang="less">
    .workBench{
        .ant-timeline-item-head{
            background: rgb(240,242,245);
        }
    }
</style>