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.

183 lines
7.4 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="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<link href="../../../WF/Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../../WF/Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../../../WF/Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../../WF/Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../../WF/Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../../WF/Scripts/config.js" type="text/javascript"></script>
<script src="../../../WF/Scripts/PinYin.js" type="text/javascript"></script>
<script src="../../../WF/Comm/Gener.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
// 负责人:史连雨
var maxIndx = 0;//定义新增之后的最大序号
$(function () {
InitPage();
});
function InitPage() {
var fk_sftable = GetQueryString("FK_SFTable");
var sfTable = new Entity("BP.Cloud.Sys.SFTable", fk_sftable);
var ens = sfTable.DoMethodReturnJSON("GenerDataOfJson");
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].No + "' type='checkbox' name='IDX_" + ens[i].No + "' /><label for='IDX_" + ens[i].No + "'>" + (i + 1) + "</label></td>";
html += "<td><input name='TB_No_" + (i + 1) + "' id='TB_No_" + (i + 1) + "' type='text' disabled='disabled' value='" + ens[i].No + "'/></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.Cloud.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='" + generNewNo + "' /></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 SFTable = new Entity("BP.Sys.SFTable", fk_sftable);
var ens = SFTable.DoMethodReturnJSON("GenerDataOfJson");
for (var i = 0; i < ens.length; i++) {
var No = ens[i].No;
if (QueryType == "Dict") {
No = ens[i].No;
}
var newName = $("#TB_Name_" + (i + 1)).val();
SFTable.DoMethodReturnString("UpdateData", No, newName, fk_sftable);
}
//保存新增
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) {
SFTable.DoMethodReturnString("InsertData", No, Name, fk_sftable);
}
}
isSave = true;
InitPage(); //刷新.
}
//删除
function Delete() {
if (window.confirm('您确定要删除吗?') == false)
return;
var SFTable = new Entity("BP.Sys.SFTable", fk_sftable);
//获得选中的所有.
var cbs = $("input[type='checkbox']:checked");
var str = "";
cbs.each(function () {
if (this.id.indexOf('IDX_') == -1)
return true;
str = this.id.substring(4);
SFTable.DoMethodReturnString("DeleteData", str, fk_sftable);
});
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>