@page "/"

<PageContainer Breadcrumb="MyRender">
    <div style="background-color: #ececec; padding: 20px;">
        <Tabs Type="@TabType.Card" OnChange="OnTabChange">
            <TabPane Key="1" Tab="当期绩效数据">
                <AntDesign.Table @ref="table"
                                 TItem="wispro.sp.entity.PerformanceItem"
                                 Loading="_loading"
                                 DataSource="@pfList"
                                 Total="_total"
                                 @bind-SelectedRows="selectedRows"
                                 Bordered=@true
                                 Size=@TableSize.Middle>
                    <RowTemplate>
                        <Selection Key="@(context.Id.ToString())" />
                        <AntDesign.Column Title="我方文号" @bind-Field="@context.CaseNo">

                        </AntDesign.Column>
                        <AntDesign.Column Title="申请类型" @bind-Field="@context.ApplicationType" Sortable Filterable />
                        <AntDesign.Column Title="处理事项" @bind-Field="@context.DoItem" Sortable Filterable />
                        <AntDesign.Column Title="备注" @bind-Field="@context.AgentFeedbackMemo" Sortable Filterable />
                        <AntDesign.Column Title="核稿人" @bind-Field="@context.Reviewer.Name" Sortable Filterable />
                        <ActionColumn>
                            <Space>
                                <SpaceItem><Button Danger OnClick="()=>Complain(context.Id)">申诉</Button></SpaceItem>
                            </Space>
                        </ActionColumn>
                    </RowTemplate>
                    <ExpandTemplate>
                        <div>
                            <Row>
                                <Col Span="12">客户:</Col>
                                <Col Span="12">@context.Data.Customer.Name</Col>
                            </Row>
                            <Row>
                                <Col Span="12">申请人：</Col>
                                <Col Span="12">@context.Data.ApplicationName</Col>
                            </Row>
                            
                        </div>
                         
                    </ExpandTemplate>
                </AntDesign.Table>
            </TabPane>
            <TabPane Key="2" Tab="历史绩效数据">
                Content of Tab Pane 2
            </TabPane>
            <TabPane Key="3" Tab="我的申诉">
                Content of Tab Pane 3
            </TabPane>
        </Tabs>

    </div>



</PageContainer>

@code{
    private List<wispro.sp.entity.PerformanceItem> pfList;
    IEnumerable<wispro.sp.entity.PerformanceItem> selectedRows;
    ITable table;

    int _total = 0;
    bool _loading = false;

    RenderFragment MyRender =
    (builder) => builder.AddMarkupContent(0, "<Icon Type='home'></Icon><span>首页/</span>");

    protected override async Task OnInitializedAsync()
    {

        _loading = true;

        pfList = new List<PerformanceItem>
        {
            new PerformanceItem()
            {
                CaseNo = "PAIN1914950",
                ApplicationType="发明",
                BusinessType="PCT国家阶段",
                AgentFeedbackMemo="",
                DoItem="处理审查意见",
                CaseStage="",
                CaseCoefficient="B",
                DoItemCoefficient ="实质",
                PreOastaff = new Staff(){Name =""},
                BasePoint = 1.5,
                ItemStaffs = new List<ItemStaff>()
                {
                    new ItemStaff(){ DoPerson = new Staff(){ Name="汤明娟"}, PerformancePoint = 1.5 }
                },
                Reviewer = new Staff(){ Name="孔丽霞"},
                Customer = new Customer(){ Name ="OPPO广东移动通信有限公司"},
                ApplicationName="OPPO广东移动通信有限公司",
                FinishedDate=DateTime.Parse("2021-8-16"),
                FinalizationDate= DateTime.Parse("2021-7-26"),
                ReturnDate= DateTime.Parse("2021-5-28"),
                CaseType= "专利",
                CaseState="一通",
                DoItemMemo ="1OA；延期1次。分析",
                DoItemState="完成",
                CaseName="对焦控制方法、装置、计算机可存储介质和移动终端",
                EntrustingDate = DateTime.Parse("2019/8/23"),
                InternalDate = DateTime.Parse("2021/5/29"),
                CustomerLimitDate= DateTime.Parse("2019/8/23"),
                FirstDraftDate=DateTime.Parse("2021/5/28"),
                OverDueMemo="",
                Status=0
            },
            new PerformanceItem()
            {
                CaseNo = "PAIN1914950",
                ApplicationType="发明",
                BusinessType="PCT国家阶段",
                AgentFeedbackMemo="",
                DoItem="处理审查意见",
                CaseStage="",
                CaseCoefficient="B",
                DoItemCoefficient ="实质",
                PreOastaff = new Staff(){Name =""},
                BasePoint = 1.5,
                ItemStaffs = new List<ItemStaff>()
                {
                    new ItemStaff(){ DoPerson = new Staff(){ Name="汤明娟"}, PerformancePoint = 1.5 }
                },
                Reviewer = new Staff(){ Name="孔丽霞"},
                Customer = new Customer(){ Name ="OPPO广东移动通信有限公司"},
                ApplicationName="OPPO广东移动通信有限公司",
                FinishedDate=DateTime.Parse("2021-8-16"),
                FinalizationDate= DateTime.Parse("2021-7-26"),
                ReturnDate= DateTime.Parse("2021-5-28"),
                CaseType= "专利",
                CaseState="一通",
                DoItemMemo ="1OA；延期1次。分析",
                DoItemState="完成",
                CaseName="对焦控制方法、装置、计算机可存储介质和移动终端",
                EntrustingDate = DateTime.Parse("2019/8/23"),
                InternalDate = DateTime.Parse("2021/5/29"),
                CustomerLimitDate= DateTime.Parse("2019/8/23"),
                FirstDraftDate=DateTime.Parse("2021/5/28"),
                OverDueMemo="",
                Status=0
            },
            new PerformanceItem()
            {
                CaseNo = "PAIN1914950",
                ApplicationType="发明",
                BusinessType="PCT国家阶段",
                AgentFeedbackMemo="",
                DoItem="处理审查意见",
                CaseStage="",
                CaseCoefficient="B",
                DoItemCoefficient ="实质",
                PreOastaff = new Staff(){Name =""},
                BasePoint = 1.5,
                ItemStaffs = new List<ItemStaff>()
                {
                    new ItemStaff(){ DoPerson = new Staff(){ Name="汤明娟"}, PerformancePoint = 1.5 }
                },
                Reviewer = new Staff(){ Name="孔丽霞"},
                Customer = new Customer(){ Name ="OPPO广东移动通信有限公司"},
                ApplicationName="OPPO广东移动通信有限公司",
                FinishedDate=DateTime.Parse("2021-8-16"),
                FinalizationDate= DateTime.Parse("2021-7-26"),
                ReturnDate= DateTime.Parse("2021-5-28"),
                CaseType= "专利",
                CaseState="一通",
                DoItemMemo ="1OA；延期1次。分析",
                DoItemState="完成",
                CaseName="对焦控制方法、装置、计算机可存储介质和移动终端",
                EntrustingDate = DateTime.Parse("2019/8/23"),
                InternalDate = DateTime.Parse("2021/5/29"),
                CustomerLimitDate= DateTime.Parse("2019/8/23"),
                FirstDraftDate=DateTime.Parse("2021/5/28"),
                OverDueMemo="",
                Status=0
            },
            new PerformanceItem()
            {
                CaseNo = "PAIN1914950",
                ApplicationType="发明",
                BusinessType="PCT国家阶段",
                AgentFeedbackMemo="",
                DoItem="处理审查意见",
                CaseStage="",
                CaseCoefficient="B",
                DoItemCoefficient ="实质",
                PreOastaff = new Staff(){Name =""},
                BasePoint = 1.5,
                ItemStaffs = new List<ItemStaff>()
                {
                    new ItemStaff(){ DoPerson = new Staff(){ Name="汤明娟"}, PerformancePoint = 1.5 }
                },
                Reviewer = new Staff(){ Name="孔丽霞"},
                Customer = new Customer(){ Name ="OPPO广东移动通信有限公司"},
                ApplicationName="OPPO广东移动通信有限公司",
                FinishedDate=DateTime.Parse("2021-8-16"),
                FinalizationDate= DateTime.Parse("2021-7-26"),
                ReturnDate= DateTime.Parse("2021-5-28"),
                CaseType= "专利",
                CaseState="一通",
                DoItemMemo ="1OA；延期1次。分析",
                DoItemState="完成",
                CaseName="对焦控制方法、装置、计算机可存储介质和移动终端",
                EntrustingDate = DateTime.Parse("2019/8/23"),
                InternalDate = DateTime.Parse("2021/5/29"),
                CustomerLimitDate= DateTime.Parse("2019/8/23"),
                FirstDraftDate=DateTime.Parse("2021/5/28"),
                OverDueMemo="",
                Status=0
            }
        };

        _loading = false;

        _total = pfList.Count;

    }
    void OnTabChange(string key)
    {
        Console.WriteLine($"tab change:{key}");
    }

    void Complain(int Id)
    {

    }
}
