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.

195 lines
7.9 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>
<script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript" ></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<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 src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<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" />
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<!--<link href="../../../DataUser/Style/table0.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" language="javascript" >
var maxIndx = 0;//定义新增之后的最大序号
$(function () {
InitPage();
});
var fk_sftable = GetQueryString("FK_SFTable");
function InitPage() {
var ens = new Entities("BP.Sys.SFTableDtls");
ens.Retrieve("FK_SFTable", fk_sftable);
maxIndx = ens.length;
var html = "<table border=0 cellpadding='0' style='border-collapse: collapse;width:100%' cellspacing='0' >";
html += "<tr>";
html += "<th class='GroupTitle' nowrap=''style='width:10%;text-align:center'><input id='checkedAll' onclick='SelectAll(this)' type='checkbox' name='checkedAll'></th>";
html += "<th class='GroupTitle' nowrap='' style='width:30%'>编号</th>";
html += "<th class='GroupTitle' nowrap='' style='width:60%'>名称</th>";
html += "</tr>";
//绑定数据.
for (var i = 0; i < ens.length; i++) {
html += "<tr>";
html += "<td class='Idx' nowrap style='width:70px'><input id='IDX_" + ens[i].BH + "' type='checkbox' name='IDX_" + ens[i].BH + "' /><label for='IDX_" + ens[i].BH + "'>" + (i + 1) + "</label></td>";
html += "<td><input name='TB_No_" + (i + 1) + "' id='TB_No_" + (i + 1) + "' type='text' disabled='disabled' value='" + ens[i].BH + "'/></td>";
html += "<td><input name='TB_Name_" + (i + 1) + "' id='TB_Name_" + (i + 1) + "' type='text' value='" + ens[i].Name + "' style='width:98%;'/></td>";
html += "</tr>";
}
html += "</tble>";
$('#mytable').html("").append(html);
}
//是否保存过了.
var isSave = true;
var currNewNo = "";
//新建.
function New() {
maxIndx++;
var html = "";
//if (isSave == true) {
// var fk_sftable = GetQueryString("FK_SFTable");
// var sfTable = new Entity("BP.Sys.SFTable", fk_sftable);
// var generNewNo = sfTable.DoMethodReturnString("GenerSFTableNewNo");
// if (generNewNo.indexOf('err@') == 0)
// generNewNo = "";
// currNewNo = generNewNo;
//}
//if (isSave == false) {
// if (currNewNo != "") {
// generNewNo = parseInt(currNewNo) + 1;
// if (generNewNo >= 10) {
// generNewNo = "0" + generNewNo;
// }
// if (generNewNo > 0 && generNewNo < 10) {
// generNewNo = "00" + generNewNo;
// }
// currNewNo++;
// } else {
// generNewNo = "";
// }
//}
html += "<tr>";
html += "<td class='Idx'><font color=red>*</font></td>";
html += "<td ><input name='TB_No_" + maxIndx + "' id='TB_No_" + maxIndx + "' type='text' value='' /></td>";
html += "<td ><input name='TB_Name_" + maxIndx + "' id='TB_Name_" + maxIndx + "' type='text' style='width:98%;' /></td>";
html += "</tr>";
$("#mytable tbody:last").append(html);
isSave = false;
}
//更新.
function Save() {
//保存更新
//var FK_SFTable = GetQueryString("FK_SFTable");
var ens = new Entities("BP.Sys.SFTableDtls");
ens.Retrieve("FK_SFTable", fk_sftable);
for (var i = 0; i < ens.length; i++) {
var bh = $("#TB_No_" + (i + 1)).val();
var newName = $("#TB_Name_" + (i + 1)).val();
var en = new Entity("BP.Sys.SFTableDtl", fk_sftable + "_" + bh);
en.Name = newName;
en.Update();
}
//保存新增
for (var j = ens.length; j < maxIndx; j++) {
var No = $("#TB_No_" + (j + 1)).val();
if (No == '' || No == null) {
alert("编号不能为空!");
return;
}
var Name = $("#TB_Name_" + (j + 1)).val();
if (No != undefined || Name != undefined) {
var en = new Entity("BP.Sys.SFTableDtl");
en.BH = No;
en.Name = Name;
en.FK_SFTable = fk_sftable;
en.MyPK = fk_sftable + "_" + No;
//en.OrgNo = WebUser.OrgNo;
en.Insert();
}
}
isSave = true;
alert("保存成功!");
InitPage(); //刷新.
}
//删除
function Delete() {
if (window.confirm('您确定要删除吗?') == false)
return;
//获得存储的值.
var cbs = $("input[type='checkbox']:checked");
var str = "";
cbs.each(function () {
if (this.id.indexOf('IDX_') == -1)
return true;
str = this.id.substring(4);
var en = new Entity("BP.Sys.SFTableDtl", fk_sftable + "_" + str);
en.Delete();
});
InitPage(); //刷新.
}
//选中所有
function SelectAll(obj) {
var checkeds = $("input[type='checkbox']");
if (obj.checked == true) {
//获取name=box的复选框 遍历输出复选框
for (var i = 0; i < checkeds.length; i++) {
checkeds[i].checked = true;
}
} else {
for (var i = 0; i < checkeds.length; i++) {
checkeds[i].checked = false;
}
}
}
</script>
</head>
<body >
<form id="divCCForm">
<div data-options="region:'center'" style="padding: 0px;" border="false" style="overflow: hidden;">
<div class="easyui-panel" >
<div id="Btns" class="ToolBar" style="width:auto">
<a href="#" class="easyui-linkbutton l-btn l-btn-plain" data-options="plain:true,iconCls:'icon-save'" onclick="Save()">保存</a>
<a id="newbtn" href="#" class="easyui-linkbutton l-btn l-btn-plain" data-options="plain:true,iconCls:'icon-new'" onclick="New()">新增</a>
<a id="delbtn" href="#" class="easyui-linkbutton l-btn l-btn-plain" data-options="plain:true,iconCls:'icon-delete'" onclick="Delete()">删除</a>
</div>
<div id="mytable"> </div>
</div>
</div>
<div id="Msg"></div>
</form>
</body>
</html>