You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

209 lines
8.2 KiB
Plaintext

11 months ago
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>输出Table演示</title>
<title>驰骋工作流</title>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/jquery.min.js"></script>
<script src="../../WF/Scripts/QueryString.js" type="text/javascript"></script>
<link href="../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<link href="../../WF/Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../../WF/Scripts/config.js"></script>
<script type="text/javascript" src="../../WF/Comm/Gener.js"></script>
<script type="text/javascript" src="../../WF/Scripts/bootstrap/js/bootstrap.min.js"></script>
<script src="../../WF/Scripts/bootstrap/bootstrap-paginator/js/bootstrap-paginator.js" type="text/javascript"></script>
<style type="text/css">
th{background-color:#F2F2F2;border:1px solid #ddd;}
.pagination
{
margin: 8px 0;
display: block;
font-size: 13px;
}
.pagination .controls
{
float: left;
border: 0;
padding: 7px 0 0 15px;
color: #777;
}
</style>
<script type="text/javascript" language="javascript">
var pageIdx = 1;
var pageCount = 1;
var pageSize =15;
//页面启动函数.
$(function () {
pageIdx = GetQueryString("PageIdx");
if (pageIdx == null || pageIdx == undefined)
pageIdx = 1;
InitPage();
Paginator();
});
function InitPage() {
var handler = new HttpHandler("BP.Demo.HttpHandlerDemoPage");
handler.AddPara("PageIdx", pageIdx);
handler.AddPara("PageSize", pageSize);
var ens = handler.DoMethodReturnJSON("StudentList_Init");
$("#Table1").html("");
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
var html = "<tr>";
html += "<td>" + (i + 1) + "</td>";
html += "<td><label><input type=checkbox id='CB_" + en.No + "' name='checkboxCol'/>" + en.No + "-" + en.Name + "</label></td>";
html += "<td>" + en.Name + "</td>";
html += "<td>" + en.Email + "</td>";
html += "<td><a href=\"javascript:Del('" + en.No + "');\" ><img src='../../WF/Img/Btn/Delete.png' />删除</a></td>";
html += "<td><a href=\"javascript:Edit('" + en.No + "');\" ><img src='../../WF/Img/Btn/Edit.gif' />修改</a></td>";
html += "</tr>";
$("#Table1").append(html);
}
}
//分页功能
function Paginator(currentPage) {
//输出分页.
var hanler = new HttpHandler("BP.Demo.HttpHandlerDemoPage");
hanler.AddPara("PageIdx", pageIdx);
var data = hanler.DoMethodReturnString("StudentList_PageBar");
if (data.indexOf("err@") != -1) {
alert("获取数据失败");
return;
}
data = JSON.parse(data);
var dataSize = parseInt(data["Count"]); //取到总条数
if (dataSize%pageSize!=0)
pageCount = parseInt(dataSize / pageSize) + 1;
else
pageCount = parseInt(dataSize / pageSize);
if(pageCount == 0) pageCount =1;
var options = {
bootstrapMajorVersion: 3, //版本
currentPage: currentPage, //当前页数
totalPages: pageCount, //总页数
shouldShowPage: true, //是否显示该按钮
itemTexts: function (type, page, current) {
switch (type) {
case "first":
return "首页";
case "prev":
return "上一页";
case "next":
return "下一页";
case "last":
return "末页";
case "page":
return page;
}
}, //点击事件用于通过Ajax来刷新整个list列表
onPageClicked: function (event, originalEvent, type, page) {
pageIdx = page;
InitPage();
$('#page_info').html("").append("<li class='disabled controls'>当前第" + pageIdx + "页,总共" + pageCount +
"页,总共" + dataSize + "条记录。</li>");
}
};
$('#page_nav').bootstrapPaginator(options);
$('#page_info').html("").append("<li class='disabled controls'>当前第" + pageIdx + "页,总共" + pageCount +
"页,总共" + dataSize + "条记录。</li>");
}
///编辑.
function Edit(no) {
var url = 'Student.htm?No=' + no;
WinOpen(url);
}
//删除.
function Del(no) {
if (window.confirm('您确定要删除吗?') == false)
return;
var en = new Entity("BP.Demo.BPFramework.Student", no);
en.Delete();
alert("删除成功");
Reload();
}
function DelAll() {
if (window.confirm('您确定要删除选择的数据吗?') == false)
return;
//获取选中值
$('input:checkbox[name=checkboxCol]:checked').each(function (k) {
var no = this.id.replace("CB_", "");
var en = new Entity("BP.Demo.BPFramework.Student", no);
en.Delete();
});
Reload();
}
//选择与取消选择.
function CheckAll(checked) {
//获取type=checkbox的复选框 遍历输出复选框
var checkeds = $("input[type='checkbox']");
for (var i = 0; i < checkeds.length; i++) {
checkeds[i].checked = checked;
}
}
function New() {
var url = 'Student.htm';
WinOpen(url);
}
/**/</script>
</head>
<body>
<div class="wrapper wrapper-content animated fadeInRight" style="padding: 0px 10px 0px 10px">
<div class="ibox-content">
<div class="row">
<table class="table table-hover" style="word-wrap: break-word; word-break: break-all;width:98%;margin-left:10px;">
<caption >
列表输出演示... <a href="javascript:New()">新建</a>
</caption>
<thead>
<tr>
<th>
</th>
<th>
<label>
<input type="checkbox" id="SelectAll" onclick="CheckAll(this.checked);" />选择要操作的字段
</label>
</th>
<th>
名称
</th>
<th>
邮件
</th>
<th>
类型
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody id="Table1"></tbody>
</table>
</div>
<!-- 显示分页信息 -->
<div class="row" style="text-align: left;margin-top: -15px;">
<ul class="pagination" id="page_nav"></ul>
<ul class="pagination controls" id="page_info"></ul>
<div style="clear: both;"></div>
</div>
<input type="button" value="批量删除" onclick="DelAll();" />
</div>
</div>
</body>
</html>