beta
大石头 编写于 2024-06-20 19:38:10 大石头 提交于 2024-06-20 19:38:25
AntJob
@model IList<AntJob.Data.Entity.JobTask>
@using NewLife;
@using NewLife.Cube.Extensions
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@using AntJob.Data.Entity;
@using AntJob;
@using AntJob.Data;
@{
    var fact = ViewBag.Factory as IEntityFactory;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as List<FieldItem>;
    var fk = fact.Unique;
    var set = ViewBag.PageSetting as PageSetting;
}
<table class="table table-bordered table-hover table-striped table-condensed">
    <thead>
        <tr>
            @if (set.EnableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            <th class="text-center hidden-md hidden-sm hidden-xs"><a href="@Html.Raw(page.GetSortUrl("ID"))">编号</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("TaskID"))">任务</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Start"))" title="@JobTask._.Start.Description">开始</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("End"))" title="@JobTask._.End.Description">结束</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Client"))" title="@JobTask._.Client.Description">客户端</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("BatchSize"))" title="@JobTask._.BatchSize.Description">批大小</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Total"))" title="@JobTask._.Total.Description">总数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Success"))" title="@JobTask._.Success.Description">成功</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Error"))" title="@JobTask._.Error.Description">错误</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Times"))" title="@JobTask._.Times.Description">次数</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Speed"))" title="@JobTask._.Speed.Description">速度</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Cost"))" title="@JobTask._.Cost.Description">耗时</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("FullCost"))" title="@JobTask._.FullCost.Description">全耗时</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Status"))">状态</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("Key"))">最后键</a></th>
            <th class="text-center"><a href="@Html.Raw(page.GetSortUrl("TraceId"))">追踪</a></th>
            <th class="text-center" style="min-width:134px;"><a href="@Html.Raw(page.GetSortUrl("UpdateTime"))">更新时间</a></th>
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            var cls = "";
            switch (entity.Status)
            {
                case JobStatus.就绪:
                    break;
                case JobStatus.抽取中:
                    cls = "warning";
                    break;
                case JobStatus.处理中:
                    cls = "info";
                    break;
                case JobStatus.错误:
                    cls = "danger";
                    break;
                case JobStatus.完成:
                    cls = "success";
                    break;
                case JobStatus.取消:
                    cls = "active";
                    break;
                default:
                    break;
            }
            <tr>
                @if (set.EnableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity[fk.Name]" /></td>
                }
                <td class="text-center hidden-md hidden-sm hidden-xs">@entity.ID</td>
                <td class="text-center"><a href="Job?ID=@entity.JobID">@entity.JobName</a></td>
                <td>@entity.Start.ToFullString("")</td>
                <td>@entity.End.ToString("HH:mm:ss")</td>
                <td>@entity.Client</td>
                <td class="text-right">@entity.BatchSize.ToString("n0")</td>
                <td class="text-right">@entity.Total.ToString("n0")</td>
                <td class="text-right" style="color:forestgreen"><b>@entity.Success.ToString("n0")</b></td>
                <td class="text-right" style="color:red">@entity.Error.ToString("n0")</td>
                <td class="text-right">@entity.Times.ToString("n0")</td>
                <td class="text-right">@entity.Speed.ToString("n0")</td>
                <td class="text-right">@TimeSpan.FromSeconds(entity.Cost)</td>
                <td class="text-right">@TimeSpan.FromSeconds(entity.FullCost)</td>
                <td class="text-center @cls">@entity.Status</td>
                <td>@entity.Key</td>
                <td>
                    @if (!entity.TraceId.IsNullOrEmpty())
                    {
                        <a href="@StarHelper.BuildUrl(entity.TraceId)">追踪</a>
                    }
                </td>
                <td>@entity.UpdateTime.ToFullString("")</td>
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @await Html.PartialAsync("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>