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.

227 lines
7.3 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html >
<html>
<head>
<meta charset="UTF-8" />
<title>字段同步</title>
<link href="../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../Comm/JScript.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../Scripts/QueryString.js"></script>
<script type="text/javascript" src="../../Scripts/config.js"></script>
<script type="text/javascript" src="../../Comm/Gener.js"></script>
<base target="_self" />
<script type="text/javascript">
//! TODO: 1.显示流程名称? 2.JS方法中的页面路径
/* ESC Key Down */
function Esc() {
if (event.keyCode === 27)
window.close();
return true;
}
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitPage();
$("#Msg").html("");
});
//初始化数据.
function InitPage() {
var flowNo = GetQueryString("FK_Flow");
var dbSrc = GetQueryString("FK_DBSrc");
var tableName = GetQueryString("TableName");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_AttrFlow");
handler.AddUrlData();
var data = handler.DoMethodReturnString("DTSBTableExt_Init");
if (data.indexOf("err@") == 0) {
alert(data);
return;
}
data = JSON.parse(data);
//属性.
var mapAttrs = data["Sys_MapAttr"];
var cols = data["Cols"]; //表的列名.
var flow = data["Flow"][0];
var DTSFields = flow.DTSFields;
var Fields = "";
var field = "";
//把OID锁定第1行.
var newRow;
for (var i in mapAttrs) {
var attr = mapAttrs[i];
var keyOfEn = mapAttrs[i].KeyOfEn;
field = keyOfEn;
if (keyOfEn != "OID")
continue;
var lgType = mapAttrs[i].LGType;
newRow = "<tr >";
newRow += "<td class=Idx>" + i + "</td>";
var rb = "<input type=radio value=0 id='PKModel_0' name='PKModel' checked='checked' /> <label for=PKModel_0 >OID是主键 </label>";
newRow += "<td>" + rb + "</td>";
newRow += "<td>主键<img src='../../Img/PRI/2.png' /></td>";
if (DTSFields != "" && DTSFields != undefined) {
Fields = DTSFields.split("OID=")[1];
field = Fields.split('@')[0];
}
var ddl = "<select name='DDL_OID' >" + InitDDLOperation(cols, field) + "</select>";
newRow += "<td>" + ddl + "</td>";
newRow += "</tr>";
$("#Table1 tr:last").after(newRow);
}
//增加处理.
for (var i in mapAttrs) {
var attr = mapAttrs[i];
if (attr.KeyOfEn == "OID")
continue;
var keyOfEn = attr.KeyOfEn;
field = keyOfEn;
newRow = "";
newRow = "<tr><td class=Idx>" + i + "</td>";
if (DTSFields != "" || DTSFields != undefined) {
if (DTSFields.indexOf(keyOfEn + "=") >= 0) {
newRow += "<td><input type='checkbox' checked='checked' name='CB_" + attr.KeyOfEn + "' />";
Fields = DTSFields.split(keyOfEn + "=")[1];
field = Fields.split('@')[0];
}
else {
newRow += "<td><input type='checkbox' name='CB_" + attr.KeyOfEn + "' />";
}
}
newRow += '<label for="CB_' + attr.KeyOfEn + '\" >' + attr.KeyOfEn + ' - ' + attr.Name + '</label></td>';
newRow += "<td>" + GetDataTypeDesc(mapAttrs[i].MyDataType) + "</td>";
var ddl = "<select name='DDL_" + keyOfEn + "' >" + InitDDLOperation(cols, field) + "</select>";
newRow += "<td>" + ddl + "</td>";
newRow += "</tr>";
$("#Table1 tr:last").after(newRow);
}
}
//初始化下拉列表框的OPERATION
function InitDDLOperation(cols, defVal) {
var operations = '';
$.each(cols, function (i, obj) {
//operations += "<option value='" + obj.No + "'>" + obj.Name + "</option>";
operations += "<option " + (obj.No == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.No + obj.Name + "</option>";
});
return operations;
}
function GetDataTypeDesc(datatype) {
switch (datatype) {
case "4":
return "布尔(Int)";
case "6":
return "日期nvarchar";
case "7":
return "日期时间nvarchar";
case "5":
return "双精度(double)";
case "3":
return "浮点(float)";
case "2":
return "整型(int)";
case "8":
return "货币(float)";
case "1":
return "字符(nvarchar)";
default:
return "字符(nvarchar)" + datatype;
}
}
//执行保存.
function Save() {
var fk_flow = GetQueryString("FK_Flow");
var checkBoxIDs = GenerCheckIDs(); //获得所有的 checkBox ID传入到后台去,用于解决checkbox控件在没有被选择的时候没有值的问题。
// alert(CheckBoxIDs);
var frmData = $("#cc").serialize();
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_AttrFlow");
handler.AddUrlData();
handler.AddFormData();
handler.AddPara("CheckBoxIDs", checkBoxIDs);
var data = handler.DoMethodReturnString("DTSBTableExt_Save");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
$("#Msg").html(data);
}
function Close() {
window.close();
}
</script>
</head>
<body onkeypress="Esc()">
<form id="cc">
<table id="Table1" style="width: 80%;">
<caption>
请设置流程字段与业务表字段的同步映射
</caption>
<tr>
<th>
</th>
<th>
是否同步
</th>
<th>
类型
</th>
<th>
业务表
</th>
</tr>
</table>
<input type="button" value="Save" id="Btn_Save" onclick="Save();" />
<input type="button" value="Cancel" id="Button1" onclick="Close()" />
<div id="Msg">
</div>
</form>
</body>
</html>