<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="icon" type="image/x-icon" href="{{ url_for('static', filename='favicon.ico') }}"/>
    <link rel="stylesheet" href="{{ url_for('static', filename='lib/easyui/themes/bootstrap/easyui.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='lib/easyui/themes/icon.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/auto.css') }}">
    <title>执行统计报告</title>
    <!-- 引入 echarts.js -->
    <script type="text/javascript" src="{{ url_for('static', filename='lib/echarts.min.js') }}"></script>
    <script src="{{ url_for('static', filename='lib/easyui/jquery.min.js') }}"></script>
    <script src="{{ url_for('static', filename='lib/easyui/jquery.easyui.min.js') }}"></script>
    <!-- 自定义js库 -->
    <script type="text/javascript" src="{{ url_for('static', filename='lib/auto.js') }}"></script>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'north',split:true" style="height:300px">
        <div class="easyui-layout" data-options="fit:true">
            <div data-options="region:'west',split:true" style="width:40%;padding:10px">
                <h2>整体执行统计</h2>
                <h3>进度：{{grossinfo.totalratio}}%，({{grossinfo.total[1]+grossinfo.total[2]}}/{{grossinfo.total[0]}})</h3>
                <h3>自动化用例进度：{{grossinfo.autoratio}}%，({{grossinfo.auto[1]+grossinfo.auto[2]}}/{{grossinfo.auto[0]}})</h3>
                <h3>手工用例进度：{{grossinfo.handratio}}%，({{grossinfo.hand[1]+grossinfo.hand[2]}}/{{grossinfo.hand[0]}})</h3>
            </div>
            <div data-options="region:'center'">
                <div id="submodule" style="width:700px;height:290px;margin: 0 auto; padding:10px"></div>
            </div>
        </div>

    </div>
    <div data-options="region:'center',split:true">
        <div class="easyui-layout" data-options="fit:true">
            <div data-options="region:'west',split:true" style="width:40%">
                <div class="easyui-tabs" data-options="plain:true, pill:true,justified:true">
                    <div title="今天" style="padding:10px">
                        <table id="dayly_list" class="easyui-datagrid" style="width:100%;height:auto;"
                               data-options="singleSelect:true,
                               fitColumns:true,
                               url:'/api/v1/report?key={{dir}}&request=excuteinfo&method=day',
                               method:'get' "
                        >
                            <thead>
                            <tr>
                                <th data-options="field:'category',align:'center' , halign: 'center'">分类</th>
                                <th data-options="field:'passed',align:'center' , halign: 'center'">成功</th>
                                <th data-options="field:'failed',align:'center' , halign: 'center'">失败</th>
                                <th data-options="field:'unknown',align:'center' , halign: 'center'">未执行</th>
                                <th data-options="field:'percent',align:'center' , halign: 'center'">进度</th>
                                <th data-options="field:'time',align:'center' , halign: 'center'">时间</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div title="本周" style="padding:10px">
                        <table id="weekly_list" class="easyui-datagrid" style="width:100%;height:auto;"
                               data-options="singleSelect:true,
                               fitColumns:true,
                               url:'/api/v1/report?key={{dir}}&request=excuteinfo&method=week',
                               method:'get' "
                        >
                            <thead>
                            <tr>
                                <th data-options="field:'category',align:'center' , halign: 'center'">分类</th>
                                <th data-options="field:'passed',align:'center' , halign: 'center'">成功</th>
                                <th data-options="field:'failed',align:'center' , halign: 'center'">失败</th>
                                <th data-options="field:'unknown',align:'center' , halign: 'center'">未执行</th>
                                <th data-options="field:'percent',align:'center' , halign: 'center'">进度</th>
                                <th data-options="field:'time',align:'center' , halign: 'center'">时间</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                    <div title="总计" style="padding:10px">
                        <table id="total_list" class="easyui-datagrid" style="width:100%;height:auto;"
                               data-options="singleSelect:true,
                               fitColumns:true,
                               url:'/api/v1/report?key={{dir}}&request=excuteinfo&method=total',
                               method:'get' "
                        >
                            <thead>
                            <tr>
                                <th data-options="field:'category',align:'center' , halign: 'center'">分类</th>
                                <th data-options="field:'passed',align:'center' , halign: 'center'">成功</th>
                                <th data-options="field:'failed',align:'center' , halign: 'center'">失败</th>
                                <th data-options="field:'unknown',align:'center' , halign: 'center'">未执行</th>
                                <th data-options="field:'percent',align:'center' , halign: 'center'">进度</th>
                                <th data-options="field:'time',align:'center' , halign: 'center'">时间</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <div data-options="region:'center'">
                <table id="user_list" class="easyui-datagrid" title="测试人员执行统计" style="width:100%;height:auto;"
                               data-options="singleSelect:true,
                               fitColumns:true,
                               url:'/api/v1/report?key={{dir}}&request=userexcinfo&method=day',
                               method:'get' "
                        >
                            <thead>
                            <tr>
                                <th data-options="field:'username',align:'center' , halign: 'center'">执行人</th>
                                <th data-options="field:'createcase',align:'center' , halign: 'center'">创建用例</th>
                                <th data-options="field:'excutecase',align:'center' , halign: 'center'">运行用例</th>
                                <th data-options="field:'createsuite',align:'center' , halign: 'center'">创建场景</th>
                                <th data-options="field:'excutesuite',align:'center' , halign: 'center'">运行场景</th>
                                <th data-options="field:'editsuite',align:'center' , halign: 'center'">编辑场景</th>
                                <th data-options="field:'deletesuite',align:'center' , halign: 'center'">删除场景</th>
                                <th data-options="field:'usetime',align:'center' , halign: 'center'">投入时间(参考)</th>
                            </tr>
                            </thead>
                </table>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">

    var submoduleChart = echarts.init(document.getElementById('submodule'));
    // 指定图表的配置项和数据


        var    submodule = {
            title : {
                text: '子模块执行进度',
                x:'center'
            },
            tooltip : {
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            legend: {
                orient : 'vertical',
                x : 'left',
                data:['Pass', 'Fail','Unknown']
            },
            toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            calculable : true,
            xAxis : [
                {
                    type : 'value'
                }
            ],
            yAxis : [
                {
                    type : 'category',
                    data : {{moduleinfo.modules|safe}}
                }
            ],
            series : [
                {
                    name:'Pass',
                    type:'bar',
                    stack: 'Total',
                    itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
                    data: {{moduleinfo.passed|safe}}
                },
                {
                    name:'Fail',
                    type:'bar',
                    stack: 'Total',
                    itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
                    data: {{moduleinfo.failed|safe}}
                },
                {
                    name:'Unknown',
                    type:'bar',
                    stack: 'Total',
                    itemStyle : { normal: {label : {show: true, position: 'insideRight'}}},
                    data: {{moduleinfo.unknown|safe}}
                }
            ]
        };

    submoduleChart.setOption(submodule);

</script>
</body>
</html>