修正查看权限无法查看数据明细的BUG
大石头 编写于 2018-04-02 11:28:56
X
@using NewLife;
@using NewLife.Web;
@using XCode;
@using XCode.Configuration;
@{
    var fact = ViewBag.Factory as IEntityOperate;
    var page = ViewBag.Page as Pager;
    var fields = ViewBag.Fields as IList<FieldItem>;
    var fk = fact.Unique;
    var enableSelect = this.EnableSelect();

    var hasUser = fields.Any(f => f.Name.EqualIgnoreCase("CreateUserID", "UpdateUserID"));
    if (hasUser && !ViewData.ContainsKey("")) { ViewData["Provider"] = ManageProvider.Provider; }
}
<table class="table table-bordered table-hover table-striped table-condensed table-data-list">
    <thead>
        <tr>
            @if (enableSelect)
            {
                <th class="text-center" style="width:10px;"><input type="checkbox" id="chkAll" title="全选" /></th>
            }
            @foreach (var item in fields)
            {
                var sortUrl = item.OriField != null ? page.GetSortUrl(item.OriField.Name) : page.GetSortUrl(item.Name);
                if (item.Type == typeof(DateTime))
                {
                    <th class="text-center" style="min-width:134px;" title="@item.Description"><a href="@Html.Raw(sortUrl)">@item.DisplayName</a></th>
                }
                else
                {
                    <th class="text-center" title="@item.Description"><a href="@Html.Raw(sortUrl)">@item.DisplayName</a></th>
                }
            }
            @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
            {
                <th class="text-center" style="min-width:100px;">操作</th>
            }
        </tr>
    </thead>
    <tbody>
        @foreach (var entity in Model)
        {
            <tr>
                @if (enableSelect)
                {
                    <td class="text-center"><input type="checkbox" name="keys" value="@entity[fk.Name]" /></td>
                }
                @foreach (var item in fields)
                {
                    @Html.Partial("_List_Data_Item", new Pair(entity, item))
                }
                @if (this.Has(PermissionFlags.Detail, PermissionFlags.Update, PermissionFlags.Delete))
                {
                    <td class="text-center">
                        @Html.Partial("_List_Data_Action", (Object)entity)
                    </td>
                }
            </tr>
        }
    </tbody>
</table>