|
|
<!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" />
|
|
|
<script src="../../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
|
|
|
<script src="../../../Scripts/easyUI145/jquery.easyui.min.js" type="text/javascript"></script>
|
|
|
|
|
|
<script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
|
|
|
<script src="../../../Scripts/config.js" type="text/javascript"></script>
|
|
|
<script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
|
|
|
<script src="../../../Comm/Gener.js" type="text/javascript"></script>
|
|
|
<script src="DDLBar.js" type="text/javascript"></script>
|
|
|
<script src="../../CCFlowEnum.js" type="text/javascript"></script>
|
|
|
<script src="../../Admin.js"></script>
|
|
|
<script type="text/javascript">
|
|
|
var extType = "";
|
|
|
$(function () {
|
|
|
|
|
|
extType = GetQueryString("ExtType");
|
|
|
extType = extType == null || extType == undefined ? "" : extType;
|
|
|
|
|
|
InitBar("Dtls");
|
|
|
|
|
|
//查询出来数据.
|
|
|
//更新节点表单类型.
|
|
|
var frmID = GetQueryString("FK_MapData");
|
|
|
var refPK = GetQueryString("RefPK");
|
|
|
|
|
|
|
|
|
|
|
|
var thisPK = refPK + "_FullData";
|
|
|
if (extType == "PageLoadFull")
|
|
|
thisPK = refPK;
|
|
|
|
|
|
var en = new Entity("BP.Sys.MapExt");
|
|
|
en.MyPK = thisPK;
|
|
|
en.SetPKVal(en.MyPK);
|
|
|
var n = en.RetrieveFromDBSources();
|
|
|
|
|
|
var tag1 = en.Tag1;
|
|
|
|
|
|
|
|
|
//获得从表.
|
|
|
var mapDtls = new Entities("BP.Sys.MapDtls");
|
|
|
mapDtls.Retrieve("FK_MapData", frmID);
|
|
|
|
|
|
if (mapDtls.length == 0) {
|
|
|
$("#doc").html("<h3>该表单没有从表.</h3>");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var html = "<table style='width:99%;'>";
|
|
|
for (var i = 0; i < mapDtls.length; i++) {
|
|
|
var dtl = mapDtls[i];
|
|
|
var sql = "";
|
|
|
if (tag1 != "" && tag1 != null) {
|
|
|
//第二批创建从表No是否在第一批创建从表的填充SQL里
|
|
|
if (tag1.indexOf(dtl.No) != -1)
|
|
|
sql = tag1.split("$")[i + 1].split(":")[1]; //分割字符串,获取sql语句
|
|
|
else
|
|
|
sql = "";
|
|
|
}
|
|
|
|
|
|
html += "<tr>";
|
|
|
html += "<td>" + dtl.No + " - " + dtl.Name + "</td>";
|
|
|
html += "</tr>";
|
|
|
|
|
|
html += "<tr>";
|
|
|
html += "<td>";
|
|
|
html += "<textarea id='" + dtl.No + "' style='width:98%;' >" + FormatSQL(sql) + "</textarea>";
|
|
|
html += "</td>";
|
|
|
html += "</tr>";
|
|
|
}
|
|
|
|
|
|
$("#doc").html(html);
|
|
|
|
|
|
});
|
|
|
|
|
|
function Save() {
|
|
|
|
|
|
//更新节点表单类型.
|
|
|
var frmID = GetQueryString("FK_MapData");
|
|
|
var refPK = GetQueryString("RefPK");
|
|
|
|
|
|
var thisPK = refPK + "_FullData";
|
|
|
if (extType == "PageLoadFull")
|
|
|
thisPK = refPK;
|
|
|
|
|
|
var en = new Entity("BP.Sys.MapExt");
|
|
|
en.MyPK = thisPK;
|
|
|
en.SetPKVal(en.MyPK);
|
|
|
var n = en.RetrieveFromDBSources();
|
|
|
en.FK_MapData = frmID;
|
|
|
if (extType == "PageLoadFull") {
|
|
|
en.AttrOfOper = "";
|
|
|
en.ExtType = "PageLoadFull";
|
|
|
}
|
|
|
else {
|
|
|
en.AttrOfOper = GetQueryString("KeyOfEn");
|
|
|
en.ExtType = "FullData";
|
|
|
en.DoWay = "1";
|
|
|
//en.DBType = "1";
|
|
|
}
|
|
|
|
|
|
//生成SQL, 执行保存.
|
|
|
//格式为: #ND101$ SELECT * FROM SXX WHERE AA='11';
|
|
|
|
|
|
//获得从表.
|
|
|
var mapDtls = new Entities("BP.Sys.MapDtls");
|
|
|
mapDtls.Retrieve("FK_MapData", frmID);
|
|
|
|
|
|
|
|
|
var tag1 = "";
|
|
|
for (var i = 0; i < mapDtls.length; i++) {
|
|
|
|
|
|
var dtl = mapDtls[i];
|
|
|
|
|
|
var sql = $("#" + dtl.No).val();
|
|
|
tag1 += "$" + dtl.No + ":" + sql;
|
|
|
}
|
|
|
en.Tag1 = tag1;
|
|
|
|
|
|
|
|
|
if (n == 0)
|
|
|
en.Insert();
|
|
|
else
|
|
|
en.Update();
|
|
|
|
|
|
Reload();
|
|
|
}
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<form id="cc">
|
|
|
|
|
|
<div id="bar"> </div>
|
|
|
<div id="doc"></div>
|
|
|
|
|
|
</form>
|
|
|
|
|
|
|
|
|
<fieldset>
|
|
|
<legend>帮助.</legend>
|
|
|
<ul>
|
|
|
<li>填充从表的SQL </li>
|
|
|
<li>返回一个数据源,该数据源的列,需要与从表的列匹配,对于匹配上的数据自动填充.</li>
|
|
|
<li>实例:<font color="green">SELECT * FROM Demo_Resume WHERE RefPK='@Key' </font></li>
|
|
|
<li>@Key 是系统约定的标记,就是选择的编号或者ID. </li>
|
|
|
<li>这个数据源就会清空的方式复制到从表里面去. </li>
|
|
|
</ul>
|
|
|
</fieldset>
|
|
|
|
|
|
</body>
|
|
|
</html>
|