DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> 關於HTML >> 修改,批量刪除,查詢升降,分頁代碼實現
修改,批量刪除,查詢升降,分頁代碼實現
編輯:關於HTML     
修改,批量刪除,查詢升降,分頁代碼實現 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/bootstrap-3.3.7-dist/css/bootstrap.css">  <script src="${pageContext.request.contextPath }/js/jquery-3.2.1.min.js"></script> <script src="${pageContext.request.contextPath }/bootstrap-3.3.7-dist/js/bootstrap.js"></script> <script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script> </head> <script type="text/javascript"> var pages; var currentPage=1; var app = angular.module('myApp', []); var rea=""; var orde=""; app.controller('personCtrl', function($scope,$http) {     $scope.toPage=function(num){   $http({        url:"${pageContext.request.contextPath }/user/selectEmail.do?pageno="+num+"&zt="+rea+"&orde="+orde,        method:"GET"    }).then(function successCallback(response) {        console.log(response.data);       $scope.pageInfo=response.data;     $scope.empList=response.data.list;     currentPage=response.data.pageNum;    });        }; $scope.toPage(1);    $scope.checkAll = function(){ $scope.flag = !$scope.flag; angular.element(".common").prop("checked",$scope.flag); };   //校驗全選狀態 $scope.validate = function(){ //普通復選框的個數 var num = angular.element(".common").length; //普通復選框被選中的個數 var checkedNum = angular.element(".common:checked") .length; //通過判斷復選框的個數是否與被選中的個數一致來決定全選框的狀態 $scope.flag = (num == checkedNum); };   $scope.shanchu=function(){   angular.element("#myModal").modal('show'); }; $scope.deleteqb=function(){ var ids=""; var comArr=angular.element(".common:checked"); for(var i=0;i<comArr.length;i++){ var eid=$(comArr[i]).val(); if(i==0){   ids+=eid; }else{   ids+=","+eid; } } $http({        url:"${pageContext.request.contextPath }/user/deleteEmail.do?ids="+ids,        method:"GET"    }).then(function successCallback(response) {     angular.element("#myModal").modal("hide"); //跳轉到當前頁 $scope.toPage(currentPage);              }); };   $scope.xiugai=function(){   angular.element("#dumodal").modal('show'); }; $scope.du=function(){ var ids=""; var comArr=angular.element(".common:checked"); for(var i=0;i<comArr.length;i++){ var eid=$(comArr[i]).val(); if(i==0){   ids+=eid; }else{   ids+=","+eid; } } alert(ids);   $http({        url:"${pageContext.request.contextPath }/user/duEmail.do?ids="+ids,        method:"GET"    }).then(function successCallback(response) {     angular.element("#dumodal").modal("hide"); //跳轉到當前頁 $scope.toPage(currentPage);              }); };   $scope.read=function(){ rea=angular.element("#rea").val(); if(rea==2){ rea=""   } $scope.toPage(currentPage); };   $scope.sheng=function(){ orde="asc"; $scope.toPage(currentPage); };     $scope.jiang=function(){ orde="desc"; $scope.toPage(currentPage); };       });     </script>     <body ng-app="myApp" ng-controller="personCtrl" class="container">     <h1 align="center">我的郵箱頁面</h1> <select class="form-control" onchange="angular.element(this).scope().read()" id="rea"> <option value="2">全部</option> <option value="0">已讀郵件</option> <option value="1">未讀郵件</option> </select> <br><br><br><br><br> <table class="table"> <tr><td><span class="glyphicon glyphicon-user" aria-hidden="true"></span></td>  <td><button type="button" class="btn btn-success" ng-click="xiugai()">批量設為已讀</button></td>   <td><button type="button" class="btn btn-danger" ng-click="shanchu()">批量刪除</button></td>    <td><button type="button" class="btn btn-primary" ng-click="sheng()">按時間升序排列</button></td>     <td><button type="button" class="btn btn-info" ng-click="jiang()">按時間降序排列</button></td></tr>   <tr><td><input type="checkbox" id="special" ng-checked="flag" ng-click="checkAll()"></td>   <td>發件人</td>  <td>閱讀狀態</td>     <td>發送時間</td></tr>      <tr ng-repeat="emp in empList"><td><input type="checkbox" class="common" value="{{emp.id }}"  ng-click="validate()" ></td>   <td>{{emp.man}}</td>  <td>   <div ng-if="emp.zt == 0"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span></div>   <div ng-if="emp.zt == 1"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span></div>     </td>   <td>{{emp.yjbt}}</td>  <td>{{emp.sj}}</td>     </tr> </table>      <!-- 分頁條 -->     <div class="row">     <div class="col-md-6">共有{{pageInfo.total}}條數據,共有{{pageInfo.pages}}頁</div>          <nav aria-label="Page navigation">  <ul class="pagination">   <li ng-show="pageInfo.hasPreviousPage"><a href="#" ng-click="toPage(1)">首頁</a></li>   <li ng-hide="pageInfo.hasPreviousPage" class="disabled"><a href="#" >首頁</a></li>    <li>      <a ng-show="pageInfo.hasPreviousPage" href="#" ng-click="toPage(pageInfo.pageNum-1)" aria-label="Previous">        <span aria-hidden="true">&laquo;</span>      </a>    </li>    <li>      <a ng-hide="pageInfo.hasPreviousPage" href="#"  aria-label="Previous" class="disabled">        <span aria-hidden="true">&laquo;</span>      </a>    </li>    <li ng-repeat="num in pageInfo.navigatepageNums" ng-class="num==pageInfo.pageNum?'active':''">     <a href="#" ng-click="toPage(num)">{{num}}</a>    </li>    <li>      <a href="#" ng-click="toPage(pageInfo.pageNum+1)" aria-label="Next">        <span aria-hidden="true">&raquo;</span>      </a>    </li>    <li><a href="#" ng-click="toPage(pageInfo.pages)">尾頁</a></li>  </ul> </nav>     </div>               <!-- 模態框(Modal) --> <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">     <div class="modal-dialog">         <div class="modal-content">             <div class="modal-header">                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>                 <h4 class="modal-title" id="myModalLabel">確認框</h4>             </div>             <div class="modal-body">是否確認刪除?</div>             <div class="modal-footer">                 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>                 <button type="button" class="btn btn-primary" ng-click="deleteqb()">確認</button>             </div>         </div><!-- /.modal-content -->     </div><!-- /.modal --> </div>           <!-- 模態框(Modal) --> <div class="modal fade" id="dumodal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">     <div class="modal-dialog">         <div class="modal-content">             <div class="modal-header">                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>                 <h4 class="modal-title" id="myModalLabel">確認框</h4>             </div>             <div class="modal-body">是否已讀?</div>             <div class="modal-footer">                 <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>                 <button type="button" class="btn btn-primary" ng-click="du()">確認</button>             </div>         </div><!-- /.modal-content -->     </div><!-- /.modal --> </div>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved