|
|
<!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 src="SFTable.js" type="text/javascript"></script>
|
|
|
<base target="_self" />
|
|
|
<style type="text/css">
|
|
|
.style1
|
|
|
{
|
|
|
width: 35%;
|
|
|
}
|
|
|
</style>
|
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
|
|
|
|
|
|
|
|
var CONST_STRUCTS = [{ No: '0', Name: '普通的编码表(具有No,Name)' }, { No: '1', Name: '树结构(具有No,Name,ParentNo)'}];
|
|
|
|
|
|
/**
|
|
|
* 数据格式切换
|
|
|
*/
|
|
|
function loadStructSet(value, text) {
|
|
|
if (value == CONST_STRUCTS[0].No) {
|
|
|
$("#parentTr").hide();
|
|
|
// $("#rootTr").hide();
|
|
|
//$("#DDL_ParentValue").val("");
|
|
|
//$("#TB_RootValue").val("");
|
|
|
} else {
|
|
|
$("#parentTr").show();
|
|
|
// $("#rootTr").show();
|
|
|
// 根节点值
|
|
|
$("#TB_RootValue").val("0");
|
|
|
}
|
|
|
SetColumns();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 加载表/视图
|
|
|
*/
|
|
|
function loadTableViews(src) {
|
|
|
|
|
|
if (src == null || src == "")
|
|
|
return;
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_SFTable");
|
|
|
handler.AddPara("src", src);
|
|
|
handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
|
|
|
var data = handler.DoMethodReturnString("SF2_GetTVs");
|
|
|
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert('获取表/视图列表出错:' + data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
//绑定数据源.
|
|
|
GenerBindDDL("DDL_SrcTable", data, "No", "Name");
|
|
|
SetColumns();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//页面启动函数.
|
|
|
$(function () {
|
|
|
|
|
|
$("#Msg").html("正在加载,请稍后......");
|
|
|
|
|
|
var mytb = document.getElementById("TB_Name");
|
|
|
mytb.focus();
|
|
|
$('#TB_Name').blur(function () //文本失去焦点时触发的事件
|
|
|
{
|
|
|
var tb = document.getElementById("TB_Name").value;
|
|
|
var val = $('input:radio[name="RB_QPJP"]:checked').val();
|
|
|
if (tb == "") {
|
|
|
document.getElementById("TB_No").value = "";
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (val == "ziduanquanpin") {
|
|
|
ParsePinYin(tb, true, "TB_No");
|
|
|
}
|
|
|
else {
|
|
|
ParsePinYin(tb, false, "TB_No");
|
|
|
}
|
|
|
|
|
|
});
|
|
|
//点击全拼
|
|
|
$('input[id=RB_QP]').change(function () {
|
|
|
var TB_Name = document.getElementById("TB_Name").value;
|
|
|
ParsePinYin(TB_Name, true, "TB_No");
|
|
|
});
|
|
|
|
|
|
//点击简拼
|
|
|
$('input[id=RB_JP]').change(function () {
|
|
|
var TB_Name = document.getElementById("TB_Name").value;
|
|
|
ParsePinYin(TB_Name, false, "TB_No");
|
|
|
});
|
|
|
|
|
|
|
|
|
var ens = new Entities("BP.Sys.SFDBSrcs");
|
|
|
ens.RetrieveAll();
|
|
|
|
|
|
//绑定数据源.
|
|
|
GenerBindDDL("DDL_FK_DBSrc", ens, "No", "Name", "local");
|
|
|
|
|
|
// 初始化加载表/视图
|
|
|
loadTableViews("local");
|
|
|
|
|
|
// 初始化加载数据格式
|
|
|
GenerBindDDL("DDL_CodeStruct", CONST_STRUCTS, "No", "Name", CONST_STRUCTS[0].No); // 动态值
|
|
|
//loadStructSet(); // 动态值
|
|
|
|
|
|
$("#Msg").html("");
|
|
|
});
|
|
|
|
|
|
function SetColumns() {
|
|
|
|
|
|
var src = $('#DDL_FK_DBSrc').val();
|
|
|
var table = $('#DDL_SrcTable').val();
|
|
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_SFTable");
|
|
|
handler.AddPara("SF2_GetCols", src);
|
|
|
handler.AddPara("table", table);
|
|
|
handler.AddPara("FK_MapData", GetQueryString("FK_MapData"));
|
|
|
var data = handler.DoMethodReturnString("SF2_GetCols");
|
|
|
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert('获取列信息出错:' + data);
|
|
|
} else {
|
|
|
data = JSON.parse(data);
|
|
|
//绑定数据源.
|
|
|
GenerBindDDL("DDL_ColumnValue", data, "No", "Name");
|
|
|
GenerBindDDL("DDL_ColumnText", data, "No", "Name");
|
|
|
if ($("#DDL_CodeStruct").val() == CONST_STRUCTS[1].No) {
|
|
|
GenerBindDDL("DDL_ParentValue", data, "No", "Name");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//怎么设置? @sly
|
|
|
var no = $("#DDL_SrcTable").val();
|
|
|
var str = $("#DDL_SrcTable option:selected").text();
|
|
|
var index = str.indexOf("-");
|
|
|
|
|
|
if (index < 0 || no == '') {
|
|
|
$("#TB_Name").val(no);
|
|
|
} else {
|
|
|
str = str.substring(index + 1, str.length);
|
|
|
$("#TB_Name").val(str);
|
|
|
}
|
|
|
|
|
|
$("#TB_No").val(no);
|
|
|
// alert(str);
|
|
|
}
|
|
|
|
|
|
// 保存
|
|
|
function Save() {
|
|
|
$("#Msg").html("正在加载,请稍后......");
|
|
|
|
|
|
var no = $("#TB_No").val() || "";
|
|
|
var name = $("#TB_Name").val() || "";
|
|
|
if (no == "" || name == "") {
|
|
|
alert('请输入编号名称.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var srcTable = $("#DDL_SrcTable").val() || "";
|
|
|
if (srcTable == "") {
|
|
|
alert("表/视图必须选择!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var columnValue = $("#DDL_ColumnValue").val() || "";
|
|
|
var columnText = $("#DDL_ColumnText").val() || "";
|
|
|
if (columnValue == "" || columnText == "") {
|
|
|
alert("编码列和标签列必须选择!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!CheckID(no)) {
|
|
|
alert("编号不符合规则");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if ($("#DDL_CodeStruct").val() == CONST_STRUCTS[1].No) {
|
|
|
|
|
|
var parentValue = $("#DDL_ParentValue").val() || "";
|
|
|
if (parentValue == "") {
|
|
|
alert("父节点列必须选择!");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var rootValue = $("#TB_RootValue").val() || "";
|
|
|
if (rootValue == "") {
|
|
|
alert("根节点值必须填写!");
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
// var frmData = $("#cc").serialize();
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner_SFTable");
|
|
|
handler.AddFormData();
|
|
|
var data = handler.DoMethodReturnString("SF2_Save");
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
return;
|
|
|
}
|
|
|
alert(data);
|
|
|
document.location.href = 'Default.htm?FK_MapData=' + GetQueryString("FK_MapData"); ;
|
|
|
|
|
|
$("#Msg").html("");
|
|
|
}
|
|
|
</script>
|
|
|
</head>
|
|
|
<body>
|
|
|
<form action="" id="cc">
|
|
|
<table style="width: 98%; margin: 5px; padding: 5px;">
|
|
|
<caption>
|
|
|
<a href="./Default.htm">返回</a> - 表或者视图
|
|
|
</caption>
|
|
|
|
|
|
<tr>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('选择字典表所属数据源');">数据源</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_FK_DBSrc" name="DDL_FK_DBSrc" onchange="loadTableViews(this.value)" />
|
|
|
</td>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('选择一个表或视图');">表/视图</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_SrcTable" name="DDL_SrcTable" onchange="SetColumns()" />
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('即No列');">编码列</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_ColumnValue" name="DDL_ColumnValue">
|
|
|
</select>
|
|
|
</td>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('即Name列');">标签列</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_ColumnText" name="DDL_ColumnText">
|
|
|
</select>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('选择具体有指定字段的格式');">数据格式</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_CodeStruct" name="DDL_CodeStruct" onchange="loadStructSet(this.value, this.options[this.selectedIndex].text)">
|
|
|
</select>
|
|
|
</td>
|
|
|
<td colspan='2'></td>
|
|
|
</tr>
|
|
|
<tr id="parentTr" style="display: none;">
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('即ParentNo列');">父节点列</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<select id="DDL_ParentValue" name="DDL_ParentValue">
|
|
|
</select>
|
|
|
</td>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('填写此树的根节点值');">根节点值</a>
|
|
|
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<input type="text" id="TB_RootValue" value="0" name="TB_RootValue" />
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>
|
|
|
<a >过滤SQL</a>
|
|
|
|
|
|
</td>
|
|
|
<td class="style1" colspan="3">
|
|
|
<input type="text" id="TB_SelectStatement" name="TB_SelectStatement"
|
|
|
style="width: 99%;" />
|
|
|
比如:XXX = '002' AND YYY = 3,支持参数表达式:@WebUser.No,@WebUser.Name,@WebUser.FK_Dept,@WebUser.FK_DeptName
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('创建字典表的中文名称');">字典名称</a>
|
|
|
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<input type="text" id="TB_Name" name="TB_Name" />
|
|
|
</td>
|
|
|
<td style="width:15%">
|
|
|
<a href="javascript:alert('创建字典表的英文名称,不要以数字开头否则创建表出错.');">字典编号</a>
|
|
|
</td>
|
|
|
<td class="style1">
|
|
|
<input type="text" id="TB_No" name="TB_No" />
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
<td colspan="4">
|
|
|
<a href="javascript:void(0)" id="Btn_Save" class="easyui-linkbutton" data-options="iconCls:'icon-save'"
|
|
|
onclick="Save()">保存</a>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</form>
|
|
|
</body>
|
|
|
</html>
|