
@{
    ViewData["Title"] = "资产负债表任务运行情况";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "报表管理", "资产负债表","任务运行情况" };
}

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <input id="day" name="day" class="form-control" style="width:130px" value="@DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd")" placeholder="请选择日期" />
                    </div>
                    <div class="form-group">
                        <button type="button" class="btn btn-primary" onclick="list;">查询</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="ibox-content m-b-sm border-bottom">
            <table id="tb" class="table table-hover table-bordered" style="width:100%;">
                <thead>
                    <tr>
                        <th>任务名称</th>
                        <th>启动时间</th>
                        <th>结果状态</th>
                    </tr>
                </thead>
                <tbody id="tbody">

                </tbody>
            </table>
        </div>
    </div>
</div>

@section scripts{ 

    <script>
        $(document).ready(function () {
            laydate.render({ elem: '#day' });

            list();
        })

        function list() {

            var day = $('#day').val();
            if (day == '') {
                alert("请选择日期。");
                return false;
            }

            $.submit({
                url: '@Url.Content("~/Reports/Finance/BalanceSheetTaskJson")',
                type: "POST",
                paramData: 'day=' + day,
                func: function (result) {
                    $('#tbody').html('');
                    if (result.success) {
                        for (var i in result.list) {
                            var obj = result.list[i];
                            var s = '<tr><td>' + obj.name + '</td><td>' + obj.runtime + '</td><td>' + obj.status + '</td></tr>';

                            $('#tbody').append(s);
                        }
                    }
                    else {
                        alert(result.msg);
                    }
                }

            })
        }
    </script>

}

