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.

311 lines
11 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>
<script language="JavaScript" src="../../Comm/JScript.js" type="text/javascript"></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.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/gray/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<base target="_self" />
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<script src="../../Comm/Gener.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
closeWhileEscUp();
/* ESC Key Down */
function Esc() {
var event = window.event || arguments.callee.caller.arguments[0];
if (event.keyCode == 27)
window.close();
return true;
}
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitPage();
$("#Msg").html("");
});
//初始化数据.
function InitPage() {
var ens = new Entities("BP.Sys.SFTables");
ens.RetrieveAll();
var frmID = GetQueryString("FK_MapData");
//增加处理.
for (var i = 0; i < ens.length; i++) {
var en = ens[i];
var newRow = "";
var nameLink = "";
if (frmID != null) {
if (GetQueryString('From') != null)
nameLink = "<label for='RB" + en.No + "'> <input type=radio id='RB" + en.No + "' name='RB' value='" + en.No + "@" + en.Name + "@" + en.FK_Val + "' /> " + en.No + " </label>";
else
nameLink = "<a href=\"javascript:Adden('" + en.FK_Val + "','" + en.SrcType + "','" + en.No + "')\" class='cc-btn-tab btn-edit'> " + en.No + "</a>";
}
else
nameLink = en.No;
newRow = "<tr ><td class=Idx>" + i + "</td>";
newRow += "<td>" + nameLink + "</td>";
newRow += "<td>" + en.Name + "</td>";
newRow += "<td>" + en.FK_SFDBSrcText + "</td>";
newRow += "<td>" + en.SrcTypeText + "</td>";
if (en.CodeStruct == 1)
newRow += "<td>树结构</td>";
else
newRow += "<td>编号名称</td>";
newRow += "<td>";
newRow += "<a href=\"javascript:Edit('" + en.No + "','" + en.SrcType + "')\" class='cc-btn-tab btn-edit'>编辑</a>";
newRow += " - <a href=\"javascript:Del('" + en.No + "','" + en.Name + "','" + en.SrcType + "')\" class='cc-btn-tab btn-del'>删除</a>";
newRow += "</td>";
newRow += "</tr>";
if ($("#Table1 tr").length==0) {
$("#Table1 tbody").after(newRow);
} else {
$("#Table1 tr:last").after(newRow);
}
}
}
//传入父窗体
function GetFrmInfo() {
var val = $('input:radio[name="RB"]:checked').val();
var kv = val.split('@');
var enNo = kv[0];
var enName = kv[1];
var fk_val = kv[2];
if (fk_val == null || fk_val == "")
fk_val = enNo;
var str = prompt("在把外键数据[" + enName + "]加入表单之前您需要确定该数据字典的字典名称\t\n字段名(必须为字母开头、数字或者下划线组合):", fk_val);
if (str == null)
return;
return {
Name: enName,
KeyOfEn: str,
IsCreateLabel: true,
UIBindKey: enNo
};
}
function EditUIBindKeyOfAttr(keyOfEn, fk_mapData, en, srcType) {
if (fk_mapData == null || fk_mapData == undefined || fk_mapData == "") {
alert("字段" + keyOfEn + "绑定的表单获取到的字段为空")
}
var attr = new Entity("BP.Sys.MapAttr", fk_mapData + "_" + keyOfEn);
attr.UIContralType = 1;
attr.MyDataType = 1;
attr.UIBindKey = en;
if (srcType == "0" || srcType == "1" || srcType == "2")
attr.LGType = 2;
else
attr.LGType =0;
attr.Update();
if (attr.LGType==2)
SetHref("../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttren&PKVal=" + attr.MyPK);
else
SetHref("../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrSFSQL&PKVal=" + attr.MyPK);
}
function Adden(en,srcType,pkVal) {
var fk_mapData = GetQueryString("FK_MapData");
if (fk_mapData == '' || fk_mapData == null) {
SetHref('SFSQLDataView.htm?FK_en=' + en);
return;
}
var keyOfEn = GetQueryString("KeyOfEn");
keyOfEn = keyOfEn == null || keyOfEn == undefined ? "" : keyOfEn;
if (keyOfEn != "") {
EditUIBindKeyOfAttr(keyOfEn, fk_mapData, en, srcType);
return;
}
var defField = en.replace('.', "_");
defField = defField.replace('.', "_");
defField = defField.replace('.', "_");
var url = '';
var str = prompt("请输入字段名(必须为字母开头、数字或者下划线组合):", defField);
if (str == null)
return;
var groupID = GetQueryString("GroupField");
if (groupID == null || groupID == "null")
groupID = "0";
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
handler.AddPara("KeyOfEn", str);
handler.AddPara("FK_MapData", fk_mapData);
handler.AddPara("GroupField", groupID);
handler.AddPara("SFTable", pkVal);
var data = handler.DoMethodReturnString("SFList_SaveSFField");
if (data.indexOf("err@") >= 0) {
alert(data);
return;
}
SetHref(data);
return;
}
function AddSFSQL(mypk, idx, key) {
var url = 'Do.aspx?DoType=AddSFSQLAttr&MyPK=' + mypk + '&IDX=' + idx + '&RefNo=' + key;
var b = window.showModalDialog(url, 'ass', 'dialogHeight: 400px; dialogWidth: 500px;center: yes; help: no');
}
//删除.
function Del(no, name, SrcType) {
if (window.confirm('您确定要执行删除[' + name + ']吗?') == false)
return;
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
handler.AddPara("FK_SFTable", no);
var data = handler.DoMethodReturnString("SFList_Delete");
if (data.indexOf('err@') >= 0) {
alert(data);
return;
}
//删除系统字典表
if (SrcType == 7) {
var ens = new Entities("BP.Sys.SFTableDtls");
ens.Delete("FK_SFTable", no);
}
alert(data);
Reload(); //刷新页面.
}
//编辑.
function Edit(fk_en, sfType) {
var ensName = '';
ensName = "BP.Sys.SFTable";
if (fk_en.indexOf('.') != -1) {
ensName = 'BP.Sys.FrmUI.SFTableClass';
}
if (sfType == "3")
ensName = 'BP.Sys.SFTableSQL';
if (sfType == "7")
ensName = 'BP.Sys.SFTableDict';
var url = '../../Comm/En.htm?EnName=' + ensName + '&No=' + fk_en;
// SetHref(url);
//获取页面的大小
var W = document.body.clientWidth - 120;
var H = document.documentElement.clientHeight - 10;
//var H = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight-10 : document.documentElement.clientHeight-10;
//var H = parent.document.body.clientHeight -200;
OpenEasyUiDialog(url, "euiframeid", ' 数据外键' + fk_en, W, H, 'icon-edit');
}
function New() {
var url = './SFTable/Default.htm?DoType=New&FromApp=SL&s=' + Math.random();
var w = window.innerWidth * 2 / 3;
var h = window.innerHeight -80;
OpenEasyUiDialog(url, "eudlgframe", "新建字典表", w, h, "icon-edit", true, null, null, null, function () {
Reload();
});
}
$(document).keyup(function (event) {
switch (event.keyCode) {
case 27:
var dlg = dlg || $('#eudlg') || {};
if (typeof dlg.dialog === "function") {
//dlg.dialog('close');
}
}
});
//关键字查询
function Search() {
$('#Table1 tbody').empty();
$('#Table1 tr').empty();
InitPage();
}
</script>
</head>
<body onkeypress="Esc()">
<div class="container-full">
<div class="attrnode-bar-header">
<div class="pull-right">
<input type="text" placeholder="请输入编号或名称" id="TB_Key" /> <input type="button" class="cc-btn-tab" id="btn_search" onclick="Search()" value="查询" />
<a href="javascript:New()" class="cc-btn-tab btn-edit">创建字典表</a>
</div>
<strong>字典列表 </strong>
</div>
<table id="Table1" class="table">
<tr>
<th>
</th>
<th>
编号
</th>
<th>
名称
</th>
<th>
数据源
</th>
<th>
类型
</th>
<th>
格式
</th>
<th>
编辑
</th>
</tr>
</table>
<div id="Msg">
</div>
</div>
</body>
</html>