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.

399 lines
18 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>
<base target="_self" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="renderer" content="webkit" />
<link rel="stylesheet" type="text/css" href="../../../../Scripts/easyUI/themes/default/easyui.css" />
<link rel="stylesheet" type="text/css" href="../../../../Scripts/easyUI/themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../../../../Comm/Style/CommStyle.css" />
<link rel='stylesheet' type='text/css' href='../../../../Comm/Style/Table0.css' />
<script type="text/javascript" src="../../../../Scripts/easyUI/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../../../Scripts/easyUI/jquery.easyui.min.js"></script>
<script type="text/javascript" src="../../../../Comm/JScript.js"></script>
<script src="../../../../Scripts/config.js" type="text/javascript"></script>
<script src="../../../../Comm/Gener.js" type="text/javascript"></script>
<script type="text/javascript" src="../../../../Co../../../../Calendar/WdatePicker.js"></script>
<script type="text/javascript" src="../../../../Scripts/QueryString.js"></script>
<script type="text/javascript" src="../../../../Scripts/EasyUIUtility.js"></script>
<script src="../../../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../../../Scripts/config.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="../../../../Comm/Style/Table0.css" rel="stylesheet" type="text/css" />
<link href="../../../../Comm/Style/Tabs.css" rel="stylesheet" type="text/css" />
<link href="../../../../Comm/Style/CommStyle.css" rel="stylesheet" type="text/css" />
<script src="../../../../Comm/JScript.js" type="text/javascript"></script>
<script type="text/javascript">
function OpenSelectBindKey(ctl) {
OpenEasyUiDialog("ImpTableFieldSelectBindKey.htm?ctl_id=" + ctl.id, "bindKey", "绑定值", 950, 550, "icon-property", true);
return;
var url = 'ImpTableFieldSelectBindKey.aspx';
var str = window.showModalDialog(url, '', 'dialogHeight: 550px; dialogWidth:950px; dialogTop: 100px; dialogLeft: 100px; center: no; help: no');
if (str == undefined)
return;
if (str == null)
return;
ctl.value = str;
return;
}
//上移
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);
}
}
//下移
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);
}
}
function CheckAll(checked) {
$.each($(":checkbox"), function () {
if ($(this).attr("disabled") !== "disabled") {
this.checked = checked;
}
});
}
function doShow(step) {
$.each(["step1", "step2", "step3"], function (i, o) {
if (step == o) {
$("#" + o).show();
} else {
$("#" + o).hide();
}
});
}
function step1() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
var json = handler.DoMethodReturnString("ImpTableField_Step1");
if (json.indexOf('err@') == 0) {
alert(json);
return;
}
json = JSON.parse(json);
var html = "";
$.each(json['SFDBSrcs'], function (i, o) {
html += "<li>";
html += " <div>";
html += " <a href='javascript:step2(\"" + GetQueryString("FK_MapData") + "\", \"" + o.No + "\");'>";
html += " <span class='nav'>" + o.No + "&nbsp;-&nbsp;" + o.Name + "</span>";
html += " </a>";
html += " </div>"
html += "</li>";
});
$(".navlist").html(html);
doShow("step1");
}
$(function () {
step2();
});
function step2() {
//获取api路径
var api = GetQueryString("API");
api = decodeURIComponent(api);
var columns = [];
//使用ajax请求数据
$.ajax({
type: 'post',
async: false,
xhrFields: {
withCredentials: true
},
crossDomain:true,
url: api,
dataType: 'html',
contentType: false,
processData: false,
success: function (data) {
try {
columns = JSON.parse(data);
} catch {
console.log(data);
return;
}
jsonString = data;
}
});
html = "";
$.each(columns, function (i, o) {
var checkboxAttributes = "";
$.each(json.attrs, function (attrIndex, attr) {
if (attr.KeyOfEn == o.No) {
checkboxAttributes = " disabled='disabled' onclick='return false' ";
return false;
}
});
html += "<tr>";
html += " <td nowrap>" + o.colid + "</td>";
html += " <td nowrap>";
html += " <input type='checkbox' id='CB_Col_" + o.No + "' name='CB_Col_" + o.No + "' no='" + o.No + "' " + checkboxAttributes + ">";
html += " <label for='CB_Col_" + o.No + "'>" + o.No + "</label>";
html += " </td>";
html += " <td nowrap>" + o.Name + "</td>";
html += " <td nowrap>" + o.DBType + "</td>";
if (o.DBLength == null || o.DBLength == "null")
o.DBLength = 20;
html += " <td nowrap>" + o.DBLength + "</td>";
html += "</tr>";
});
$("#all_columns").html(html);
$("#chooseColumn").text(STable || json.STable || "");
$("#step2ToStep3").html("<a href='javascript:void(0);' class='easyui-linkbutton' onclick='step3(\"" + FK_MapData + "\", \"" + FK_SFDBSrc + "\", \"" + (STable || json.STable) + "\")'>下一步</a>");
$.parser.parse("#step2ToStep3");
doShow("step2");
}
function step3(FK_MapData, FK_SFDBSrc, STable) {
$("#step3BackToStep2").html("<a href='javascript:void(0);' class='easyui-linkbutton' onclick='step2(\"" + FK_MapData + "\", \"" + FK_SFDBSrc + "\", \"" + STable + "\")'>上一步</a>");
$.parser.parse("#step3BackToStep2");
var no = [];
$("input:checkbox:checked").each(function () {
if ($(this).attr("id") != "CB_CheckAll") {
no.push($(this).attr("no"));
}
});
$("#FK_MapData").val(FK_MapData);
$("#FK_SFDBSrc").val(FK_SFDBSrc);
$("#STable").val(STable);
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
handler.AddPara("FK_MapData", FK_MapData);
handler.AddPara("FK_SFDBSrc", FK_SFDBSrc);
handler.AddPara("STable", (STable || ""));
handler.AddPara("SColumns", no.join(","));
var json = handler.DoMethodReturnString("ImpTableField_Step3");
if (json.indexOf('err@') == 0) {
alert(json);
return;
}
json = JSON.parse(json);
var html = "";
$.each(json.selectedColumns, function (i, o) {
var typeString = o.DBType.toLowerCase();
var dataType = "1";
if (typeString.indexOf("int") != -1) {
dataType = "2";
} else if (typeString.indexOf("float") != -1) {
dataType = "3";
} else if (typeString.indexOf("double") != -1) {
dataType = "5";
}
html += "<tr>";
html += " <td nowrap class='Idx'>" + (i + 1) + "</td>";
html += " <td nowrap>" + o.No + "</td>";
html += " <td nowrap>";
html += " <input type='text' id='TB_Desc_" + o.No + "' name='TB_Desc_" + o.No + "' value='" + o.Name + "' size='20'>";
html += " </td>";
html += " <td nowrap>";
html += " <select id='DDL_DBType_" + o.No + "' name='DDL_DBType_" + o.No + "' style='min-width:90px;'>";
$.each(json.MyDataType, function (enumIndex, enum_) {
html += " <option value='" + enum_.IntKey + "' " + ((enum_.IntKey == dataType) ? "selected='selected'" : "") + ">" + enum_.Lab + "</option>";
});
html += " </select>";
html += " </td>";
html += " <td nowrap>";
html += " <select id='DDL_LogicType_" + o.No + "' name='DDL_LogicType_" + o.No + "' style='min-width:90px;'>";
$.each(json.LGType, function (enumIndex, enum_) {
html += " <option value='" + enum_.IntKey + "'>" + enum_.Lab + "</option>";
});
html += " </select>";
html += " </td>";
html += " <td nowrap>";
html += " <input type='text' id='TB_BindKey_" + o.No + "' name='TB_BindKey_" + o.No + "' ondblclick='OpenSelectBindKey(this)' size='30'>";
html += " </td>";
html += " <td nowrap>";
if (o.DBLength == null || o.DBLength == "null")
o.DBLength = 20;
html += " <input type='text' id='TB_Len_" + o.No + "' name='TB_Len_" + o.No + "' value='" + o.DBLength + "' size='5'>";
html += " </td>";
html += " <td nowrap style='style=\"text-align:center\"'>";
html += " <input type='hidden' id='HID_Idx_" + o.No + "' name='HID_Idx_" + o.No + "' value='" + (i + 1) + "'>";
html += " <a href='javascript:void(0);' onclick='up(this, 7)' class='easyui-linkbutton' data-options=\"iconCls:'icon-up'\"></a>";
html += " &nbsp;";
html += " <a href='javascript:void(0)' onclick='down(this, 7)' class='easyui-linkbutton' data-options=\"iconCls:'icon-down'\"></a>";
html += " </td>";
html += "</tr>";
});
$("#selected_columns").html(html);
$.parser.parse($(".easyui-linkbutton").parent());
doShow("step3");
}
function btn_Save_Click() {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
handler.AddFormData();
handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
var json = handler.DoMethodReturnString("ImpTableField_Save");
/* json = JSON.parse(json);
alert(json.msg);
return; */
alert(json);
if (GetQueryString("reset") == "true") {
findFn(window, "ResetFrm", "请手动重置表单");
}
window.close();
}
function findFn(window_, fn, failMsg, index) {
if (isNaN(parseInt(index)) || parseInt(index) < 1) {
index = 1;
}
if (index >= 9) {
alert(failMsg);
} else if (window_) {
if (typeof window_[fn] === "function") {
window_[fn].call();
} else if (window_.opener) {
findFn(window_.opener, fn, failMsg, ++index);
} else if (window_.parent) {
findFn(window_.parent, fn, failMsg, ++index);
} else {
alert(failMsg);
}
} else {
alert(failMsg);
}
}
</script>
</head>
<body>
<!--<table id="step1" class="Table" cellspacing="0" cellpadding="0" border="0" style="width: 100%;
display: none;">
<tr>
<td nowrap class="GroupTitle">
第1步请选择数据源
</td>
</tr>
<tr>
<td>
<ul class="navlist">
</ul>
</td>
</tr>
</table>-->
<div id="step2" class="easyui-layout" style="height: 100%; display: none;" data-options="fit:true">
<!-- <div id="tree" data-options="region:'west',split:true,title:'选择 <span id=\'chooseTableOrView\'></span> 数据表/视图'"
style="width: 200px; heigh: 100%">
</div>-->
<div data-options="region:'center',title:'第1步请选择要导入的数据列'"
style="padding: 5px; height: 100%">
<table class="Table" style="width: 100%" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td nowrap class="GroupTitle">
</td>
<td nowrap class="GroupTitle">
<input type="checkbox" id="CB_CheckAll" name="CB_CheckAll" onclick="CheckAll(this.checked)">
<label for="CB_CheckAll">
字段名
</label>
</td>
<td nowrap class="GroupTitle">
中文描述
</td>
<td nowrap class="GroupTitle" style="width: 80px; text-align: center">
类型
</td>
<td nowrap class="GroupTitle" style="width: 50px; text-align: center">
最大长度
</td>
</tr>
</thead>
<tbody id="all_columns">
</tbody>
</table>
<a href="javascript:void(0);" onclick="step1()" class="easyui-linkbutton">上一步</a>
<span id="step2ToStep3"></span>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</div>
<div id="step3" class="easyui-layout" style="height: 800px; display: none;" data-options="fit:true">
<div data-options="region:'center',title:'第2步导入字段生成表单'" style="padding: 5px; height: 1000px">
<form id="frm">
<table class="Table" style="width: 100%;" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td nowrap class="GroupTitle">
</td>
<td nowrap class="GroupTitle">
字段名
</td>
<td nowrap class="GroupTitle">
中文描述
</td>
<td nowrap class="GroupTitle">
数据类型
</td>
<td nowrap class="GroupTitle">
逻辑类型
</td>
<td nowrap class="GroupTitle">
绑定值(双击选择)
</td>
<td nowrap class="GroupTitle">
最大长度
</td>
<td nowrap class="GroupTitle">
顺序
</td>
</tr>
</thead>
<tbody id="selected_columns">
</tbody>
</table>
<input type="hidden" id="FK_MapData" name="FK_MapData">
<input type="hidden" id="FK_SFDBSrc" name="FK_SFDBSrc">
<input type="hidden" id="STable" name="STable">
</form>
<span id="step3BackToStep2"></span><a href="javascript:void(0);" onclick="btn_Save_Click();"
class="easyui-linkbutton" data-options="plain:false,iconCls:'icon-save'">导入字段,生成表单</a>
<br>
<br>
</div>
</div>
</body>
</html>