.NET+MVC+ORACLE存储分页查询一前端实现

MemberList.cshtml

@{
    ViewBag.Title = "用户列表";
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title - 综合查询</title>
    <script src="~/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="~/Scripts/DatePicker/WdatePicker.js"></script>
<script src="~/Scripts/DatePicker/lang/zh-cn.js"></script>
<script src="~/Scripts/jquery.pagination.js"></script> <link href="~/Style/common.css" rel="stylesheet" /> <link href="~/Style/Pagination.css" rel="stylesheet" /> <script src="~/Scripts/layer-v3.1.0/layer/layer.js"></script> </head> <body style="padding-left: 5%; padding-right: 5%;"> <div class="topMenu"> 查询系统 </div>
 
  
 
<style>
 .dataLoad
    {
        border: 1px solid #e2e2e2;
        box-shadow: none;
        margin: 25px 0 15px;
        max-height: 100px;
        min-width: 1024px;
        overflow: hidden;
        padding: 24px 113px;
        color: #474747;
        font-family: microsoft yahei;
        font-size: 18px;
    }
</style>
<div class="PageMainBox">    
    <div class="selectBox">
        <div class="selectBoxLine">
            <span class="word">手机号码</span><input type="text" id="txtKeyWords" class="input_text" />
         <span class="word">用户状态</span> 
            <select id="ddlUserStatus" class="input_select" style="width:170px">
               <option value="">--全部--</option>
                <option value="0">已锁定</option>
                <option value="1">启用中</option>
               
               <option value="2">注销申请处理中</option>
               <option value="3">注销完成</option>
             </select>
        </div>
        <div class="selectBoxLine">
            <span class="word">注册日期</span><div class="date_picker">
                <input type="text" id="txtSTime" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'txtETime\',{d:0});}',readOnly:true})" class="Wdate" style="width: 160px">
            </div>
            <span class="word2" style="width:60px">~</span>
            <div class="date_picker">
                <input type="text" id="txtETime" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'txtSTime\',{d:0});}',readOnly:true})" class="Wdate" style="width: 160px">
            </div>
            <a id="btnSearch" class="search">查 询</a>
          
        </div>
    </div>
    <div id="divUserList">
        @{
            Html.RenderPartial("PartialPageUserList");
        }
    </div>
    <div id="Pagination" class="pagination"></div>
    <input type="hidden" id="hiddpage" />
    <input type="hidden" id="hiddpageIndex" value="0" />
</div>
</body>
</html> <script type="text/javascript"> window.onload = function () { window.onkeyup = keyUp; } function keyUp(e) { var e = e || event; var key = e.keyCode; var keyName = String.fromCharCode(key); if (key === 13) { //表示按的是enter键 $("#btnSearch").click(); } } $("#btnAddMember").click(function () { openNewWindow('/Member/MemberEdit', '', 455, 335); }); //分页 function loadPage(pageIndex) { $("#btnSearch").attr("disabled", "disabled"); if (pageIndex == -1) pageIndex = parseInt($("#hiddpageIndex").val()); var userName = $.trim($("#txtKeyWords").val()); var userStatus = $.trim($("#ddlUserStatus").val()); var stime = $.trim($("#txtSTime").val()); var etime = $.trim($("#txtETime").val()); var pageSize = $.trim($("#hiddpage").val()) == "" ? 10 : $.trim($("#hiddpage").val()); pageIndex = parseInt(pageIndex); //临时存在当前页数 $("#hiddpageIndex").val(pageIndex); $("#divUserList").load( "/Member/MemberList", { "keyWords": userName, "userStatus": userStatus, "pageIndex": pageIndex + 1, "pageSize": pageSize, "Stime": stime, "Etime": etime }, function (result) { $("#Pagination").pagination($("#hiddTotalCount").val(), { current_page: pageIndex, items_per_page: pageSize, callback: loadPage }); $("#btnSearch").attr("disabled", false); }); } $(function () { //分页 $("#Pagination").pagination("@ViewBag.TotalCount", { callback: loadPage }); //查询用户列表 $("#btnSearch").click(function () { $("#divUserList").html("<div class='dataLoad'>数据加载中,请稍候....</div>"); $("#Pagination").pagination("0", { callback: loadPage }); loadPage(0); }); }); function openDetailWindow(puserid) { openNewWindow('/Member/MemberDetailsInfo?userid=' + puserid, 'b', screen.availWidth, screen.availHeight); return false; } function DeleteDetailWindow(userId) { if (!confirm("提示:您确定要删除该用户")) { return false; } $.ajax({ type: "POST", url: "/Member/DeleteMember", data: { "userId": userId }, success: function (result) { if (result > 0) { alert("提示:删除用户操作成功!"); loadPage(-1); } else { alert("提示:删除用户操作失败!"); } } }) } function EditDetailWindow(puserid) { openNewWindow('/Member/MemberEdit?userid=' + puserid, '', 455, 335); } function updateIsSpecial(userId, PrimaryisSpecial, isSpecial) { if (isSpecial == 1) { if (!confirm("提示:您确定要将该用户移出【 " + (PrimaryisSpecial == 2 ? "" : "") + "名单】")) { return false; } } if (isSpecial == 2) { if (!confirm("提示:您确定要将该用户移入【黑名单】")) { return false; } } if (isSpecial == 3) { if (!confirm("提示:您确定要将该用户移入【白名单】")) { return false; } } $.ajax({ type: "POST", url: "/Member/updateIsSpecial", data: { "userId": userId, "isSpecial": isSpecial }, success: function (result) { if (result > 0) { alert("提示:修改用户名单类型操作成功"); loadPage(-1); } else { alert("提示:修改用户名单类型操作失败!"); } } }) } </script>

 PartialPageUserList.cshtml:


@using System.Data;

<table cellpadding="0" cellspacing="0" class="dataTable">
    <tr>
        <th style="width: 60px;">手机号码</th>
        <th style="width: 60px;">会员号</th>
        <th style="width: 60px;">注册方式</th>
        <th style="width: 60px; text-align: right">用户余额(元)</th>
        <th style="text-align: center; width: 120px;">注册日期</th>
        <th style="width: 60px; text-align: center;">用户状态</th>
        <th style="width: 50px;" class="end">操作</th>
    </tr>
    @if ((DataTable)ViewBag.userList != null && ((DataTable)ViewBag.userList).Rows.Count > 0)
    {
        bool SpecialAdd = userBLL.IsExistAuthority("SpecialAdd");
        foreach (DataRow user in ((DataTable)ViewBag.userList).Rows)
        {
        <tr class="trbg">            
            <td>@user["MobileNo"]</td>
            <td>@user["PUserId"]</td>
            <td>@user["UserType"]</td>
            <td style="text-align: right">@if (@user["OveragePrice"].ToString() != "")
                                          {
                <span>@Convert.ToDouble(user["OveragePrice"].ToString()).ToString("N2")</span>
                                          } </td>
            <td style="text-align: center;">@Convert.ToDateTime(user["AddTime"].ToString()).ToString("yyyy-MM-dd HH:mm:ss")</td>
            <td style="text-align: center;">
                @if (int.Parse(user["UserStatus"].ToString()) == (int)UserStatus.启用中)
                {
                    <span style="color: Green">@GetEnumString(typeof(UserStatus), user["UserStatus"].ToString())</span>
                }
                else
                {
                    <span style="color: red">@GetEnumString(typeof(UserStatus), user["UserStatus"].ToString())</span>
                }
            </td>
            <td class="end">
                <ul class="operate"> 

                   <li><a class="find" title="查看用户详情" onclick="openDetailWindow('@user["PUserId"]')"></a></li>

              
                    @if (SpecialAdd)
                    {
                        if (user["IsSpecial"].ToInt32() == 1)
                        {
                        <li><a class="InBlackList" title="移入黑名单" onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],2)"></a></li>
                        <li><a class="InWhiteList" title="移入白名单" onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],3)"></a></li>                       
                        }
                        if (user["IsSpecial"].ToInt32() == 2)
                        {
                        <li><a class="InBlackList" title="移出黑名单" onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],1)"></a></li>
                        <li><a class="InWhiteList" title="移入白名单" onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],3)"></a></li>
                        }
                        if (user["IsSpecial"].ToInt32() == 3)
                        {
                        <li><a class="InBlackList" title="移入黑名单"onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],2)"></a></li>
                        <li><a class="InWhiteList" title="移出白名单" onclick ="updateIsSpecial('@user["UserId"]',@user["IsSpecial"],1)"></a></li>
                        }
                    }
                </ul>
            </td>
        </tr>
        }
    }
    else
    {
        <tr>
            <td colspan="6" class="end">
                <div class="nodata">
                    <img src="~/Images/main/nodata.png" />Sorry,无法查到符合您要求的数据,建议您重新查询。
                </div>
            </td>
        </tr>
    }
    @Html.Hidden("hiddTotalCount", (int)ViewBag.TotalCount)
</table>

猜你喜欢

转载自www.cnblogs.com/Warmsunshine/p/9653057.html
今日推荐