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.

242 lines
10 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>
<title></title>
<link href="../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" />
<link href="../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" />
<script src="../../Scripts/easyUI145/jquery.min.js"></script>
<script src="../../Scripts/easyUI145/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" />
<script src="../../Scripts/config.js" type="text/javascript"></script>
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui.min.js"></script>
<link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
<link href="../../Style/skin/css/Default.css" rel="stylesheet" />
<link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript">
$(document).ready(function () {
$("table tr:gt(0)").hover(
function () { $(this).addClass("tr_hover"); },
function () { $(this).removeClass("tr_hover"); });
});
//上移
function up(obj, idxTBColumnIdx) {
var objParentTR = $(obj).parent().parent();
var prevTR = objParentTR.prev();
var currTrId;
var prevTrId;
if (prevTR.length > 0 && !isNaN(prevTR.children(":eq(0)").text())) {
prevTR.insertAfter(objParentTR);
currTrId = Number(objParentTR.children(":eq(0)").text());
prevTrId = Number(prevTR.children(":eq(0)").text());
objParentTR.children(":eq(0)").text(prevTrId);
prevTR.children(":eq(0)").text(currTrId);
objParentTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(prevTrId);
prevTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(currTrId);
} else {
return;
}
}
//下移
function down(obj, idxTBColumnIdx) {
var objParentTR = $(obj).parent().parent();
var nextTR = objParentTR.next();
var currTrId;
var nextTrId;
if (nextTR.length > 0 && !isNaN(nextTR.children(":eq(0)").text())) {
nextTR.insertBefore(objParentTR);
currTrId = Number(objParentTR.children(":eq(0)").text());
nextTrId = Number(nextTR.children(":eq(0)").text());
objParentTR.children(":eq(0)").text(nextTrId);
nextTR.children(":eq(0)").text(currTrId);
objParentTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(nextTrId);
nextTR.children(":eq(" + idxTBColumnIdx + ")").children(":first").val(currTrId);
} else {
return;
}
}
</script>
<script language="javascript" type="text/javascript">
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitPage();
$("#Msg").html("");
});
function InitPage() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_RptDfine");
handler.AddPara("RptNo", GetQueryString("RptNo"));
handler.AddPara("FK_Flow", GetQueryString("FK_Flow"));
var data = handler.DoMethodReturnString("S3ColsLabel_Init");
if (data.indexOf("@") == 0) {
alert(data);
return;
}
var jsData = JSON.parse(data);
//var Sys_MapAttr = jsData["Sys_MapAttr"]; //所有的列.
//console.info(Sys_MapAttr);
//输出列.
for (var i = 0; i < jsData.length; i++) {
var attr = jsData[i];
if (attr.UIVisible == "0")
continue;
var str = "<tr >";
str += "<td class='Idx' nowrap>" + (i + 1) + "</td>";
//判断是否string
if (attr.MyDataType == 1 || attr.MyDataType == '1') {
str += "<td nowrap ><a href='javascript:void(0)' onclick=setWidth('" + attr.MyPK + "')>" + attr.KeyOfEn + "</a><input type='hidden' value='" + attr.KeyOfEn + "'/></td>";
} else {
str += "<td nowrap >" + attr.KeyOfEn + "<input type='hidden' value='" + attr.KeyOfEn + "'></input></td>";
}
str += "<td ><input name=\"TB_" + attr.KeyOfEn + "\" type=\"text\" value=\"" + jsData[i].Name + "\" id=\"TB_" + attr.KeyOfEn + "\" style='width:130px;' /><a href=\"javascript:Update('" + attr.MyPK + "','" + jsData[i].Name + "');\" >修改</a></td>";
str += "<td ><input name=\"TB_" + attr.KeyOfEn + "_Idx\" type=\"text\" value=\"" + (i + 1) + "\" id=\"TB_" + attr.KeyOfEn + "_Idx\" style='width:60px;' /></td>";
var del = "<a href=\"javascript:Delete('" + attr.MyPK + "');\" >移除</a>";
str += "<td><a href='javascript:void(0)' onclick='up(this, 3)' >上移</a> <a href='javascript:void(0)' onclick='down(this, 3)' >下移</a> - " + del;
str += "</td>";
str += "</tr>";
$("#sort").append(str);
}
$(".up").linkbutton({
iconCls: 'icon-up'
});
$(".down").linkbutton({
iconCls: 'icon-down'
});
//可拖动table
var fixHelperModified = function (e, tr) {
//children() 方法返回返回被选元素的所有直接子元素
var $originals = tr.children();
//clone() 方法生成被选元素的副本,包含子节点、文本和属性
var $helper = tr.clone();
//each() 方法规定为每个匹配元素规定运行的函数
$helper.children().each(function (index) {
//width() 方法返回或设置匹配元素的宽度
//eq() 方法将匹配元素集缩减值指定 index 上的一个
$(this).width($originals.eq(index).width())
});
return $helper;
},
updateIndex = function (e, ui) {
//ui.item - 表示当前拖拽的元素
//parent() 获得当前匹配元素集合中每个元素的父元素,使用选择器进行筛选是可选的
$('td.index', ui.item.parent()).each(function (i) {
//html() 方法返回或设置被选元素的内容 (inner HTML)
$(this).html(i + 1);
});
};
$("#sort tbody").sortable({
//设置是否在拖拽元素时,显示一个辅助的元素。可选值:'original', 'clone'
helper: fixHelperModified,
//当排序动作结束时触发此事件。
cancel: '.GroupTitle',//限制不能拖动分组
stop: updateIndex,
}).disableSelection();
}
function Delete(mypk) {
if (window.confirm('您确定要移除吗?移除之后您还可以在选择字段里添加进来。') == false)
return;
var attr = new Entity("BP.Sys.MapAttr");
attr.SetPKVal(mypk);
attr.Delete();
Reload();
}
function Update(mypk, name) {
var newName = prompt("输入新的名字", name);
if (newName == null)
return;
if (newName == "") {
alert("不可为空");
return;
}
var attr = new Entity("BP.Sys.MapAttr", mypk);
attr.Name = newName;
attr.Update();
window.location.reload();
}
function Save() {
$("#Btn_Save").text("正在保存请稍候....");
var fk_flow = GetQueryString("FK_Flow");
var rptNo = GetQueryString("RptNo");
var str = "";
var i = 0;
//获取数据列表
$("#sort").find("tr").each(function () {
var tdArr = $(this).children();
if (i > 0) {//第一是标题
var history_income_type = tdArr.eq(2).find('input').val();
var history_income_money = tdArr.eq(3).find('input').val();
str = str + "@" + tdArr.eq(1).find('input').val() + "," + tdArr.eq(2).find('input').val() + "," + tdArr.eq(3).find('input').val();
}
i++;
});
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_RptDfine");
handler.AddPara("RptNo", rptNo);
handler.AddPara("FK_Flow", fk_flow);
handler.AddPara("Orders", str);
var data = handler.DoMethodReturnString("S3ColsLabel_Save");
Reload();
}
//设置字段宽度
function setWidth(url) {
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrString&PKVal=" + url;
//window.open(url);
//return;
OpenEasyUiDialog(url, "eudlgframe", '设置字段属性', 700, 470, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function Cancel() {
window.close();
}
</script>
<base target="_self" />
</head>
<body class="easyui-layout">
<div data-options="region:'center',title:'3. 设置报表显示列次序',border:false" style="padding:5px;height:auto">
<table id='sort' class='table' border='0' cellpadding='0'
cellspacing='0' style='width: 100%;border:none'>
<TR>
<TD class='Sum' style='text-align:center;width:50px'>序</TD>
<TD class='Sum'>字段</TD>
<TD class='Sum'>标签</TD>
<TD class='Sum'>显示顺序号</TD>
<TD class='Sum'>调整</TD>
</TR>
</table>
<center>
<button id="Btn_Save" onclick="Save()" class="cc-btn-tab"> 保存 </button>
</center>
</div>
</body>
</html>