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.

165 lines
5.8 KiB
Plaintext

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>设置tab键顺序</title>
<link href="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script language="JavaScript" src="../../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"
defer="defer"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../../Scripts/config.js"></script>
<script type="text/javascript" src="../../Comm/Gener.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<style type="text/css">
body
{
margin: 0 auto; /*color: #000;
line-height: 20px;
font-family: 宋体;
text-align: center;
width: 90%;*/
}
</style>
<base target="_self" />
<script type="text/javascript">
//页面启动函数
var ens = null;
$(function () {
ens = new Entities("BP.Sys.MapAttrs", "FK_MapData", GetQueryString("FK_MapData"), "UIVisible", "1", "Idx");
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
var addRow = "";
var rowNo = i + 1;
addRow = "<tr class=" + rowNo + "><td>" + rowNo + "</td>";
addRow += "<td>" + en.KeyOfEn + "</td>";
addRow += "<td>" + en.Name + "</td>";
addRow += "<td><input type=text value='"+en.Idx+"'id='TB_"+en.KeyOfEn+"' /></td>";
addRow += "<td><a href='javascript:void(0);' onclick='doUp(parseInt(this.id))' id='" + rowNo + "'><img src='../../Img/Btn/Up.GIF' border=0></a></td>";
addRow += "<td><a href='javascript:void(0);' onclick = 'doDown(parseInt(this.id))' id='" + rowNo + "'><img src='../../Img/Btn/Down.gif' border=0></a></td>";
addRow += "</tr>";
$("#Table1 tr:last").after(addRow);
}
});
//获取行对象的函数
function getRowEn(paramNo) {
var KeyOfEn = $("table tr:eq(" + paramNo + ") td:eq(1)").text();
var mypk = GetQueryString("FK_MapData") + "_" + KeyOfEn;
var en = new Entity("BP.Sys.MapAttr", mypk);
return en;
}
//向上移动
function doUp(paramNo) {
//最顶端,直接返回
if (paramNo == 1) {
return;
}
//获取当前行对象
var nowRowEn = getRowEn(paramNo);
var nowIdx = nowRowEn.Idx;
//获取上一行对象
var lastRowEn = getRowEn(paramNo - 1);
//将当前行上移
nowRowEn.Idx = lastRowEn.Idx;
nowRowEn.Update();
//将上一行下移
lastRowEn.Idx = nowIdx;
lastRowEn.Update();
Reload();
}
//向下移动
function doDown(paramNo) {
//获取表的总行数(-1去掉表头)
allRowNums = $("#Table1").find("tr").length - 1;
//最底端,直接返回
if (paramNo == allRowNums) {
return;
}
//alert(Number.isInteger(paramNo));
//获取当前行对象
var nowRowEn = getRowEn(paramNo);
var nowIdx = nowRowEn.Idx;
//获取下一行对象
var nextRowEn = getRowEn(paramNo + 1);
//将当前行下移
nowRowEn.Idx = nextRowEn.Idx;
nowRowEn.Update();
//将下一行上移
nextRowEn.Idx = nowIdx;
nextRowEn.Update();
Reload();
}
//保存.
function Save() {
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
var idx = $("#TB_" + en.KeyOfEn).val();
en = new Entity("BP.Sys.MapAttr", en.MyPK);
en.Idx = idx;
en.Update();
}
ens = new Entities("BP.Sys.MapAttrs", "FK_MapData", GetQueryString("FK_MapData"), "UIVisible", "1", "Idx");
//重新排序.
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
en = new Entity("BP.Sys.MapAttr", en.MyPK);
en.Idx = i*10;
en.Update();
}
Reload();
}
</script>
</head>
<body onkeypress="Esc();">
<form method="post" action="" id="form1">
<div style="right:10px; position:absolute; z-index:100; ">
<input type="button" value=" 保 存 " onclick="Save();" />
</div>
<table id="Table1" width='100%'>
<caption>
正确的调整好Tab键的顺序,可以方便用户数据录入.
</caption>
<tr>
<th>
Idx
</th>
<th>
字段
</th>
<th>
描述
</th>
<th>
顺序号
</th>
<th>
移动
</th>
<th>
移动
</th>
</tr>
</table>
</form>
</body>
</html>