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.

351 lines
14 KiB
Plaintext

11 months ago
<!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="../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<script src="../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../Scripts/QueryString.js" type="text/javascript"></script>
<link href="../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../../Comm/JScript.js"></script>
<script src="../../Scripts/EasyUIUtility.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" src="MapDef.js"></script>
<script language="JavaScript" type="text/javascript" src="../../Style/Verify.js"></script>
<script language="JavaScript" type="text/javascript" src="../../Comm/JS/Calendar/WdatePicker.js" defer="defer"></script>
<base target="_self" />
<script src="../Admin.js"></script>
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../../Scripts/config.js"></script>
<script type="text/javascript" src="../../Comm/Gener.js"></script>
<style>
.table > thead > tr > th {
border-top: 1px solid #dbe3e6 !important
}
.table-striped > tbody > tr:nth-of-type(odd) {
background: #f9f9f9
}
</style>
<script language="javascript" type="text/javascript">
closeWhileEscUp();
var fk_mapData = GetQueryString("FK_MapData");
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../Img/loading.gif />&nbsp;正在加载,请稍后......");
var sysEnumMains = new Entities("BP.Sys.SysEnumMains");
sysEnumMains.RetrieveAll();
var fields = null; // = data["Fields"];
var numEnum = 0;
//增加处理.
for (var i = 0; i < sysEnumMains.length; i++) {
var sysEnumMain = sysEnumMains[i];
var atPara = sysEnumMain.AtPara;
atPara = atPara == null || atPara == undefined ? "" : atPara;
var idx = atPara.indexOf("ParentKey");
if (idx == 0 || idx == -1) {
} else {
continue;
}
//如果需要字段从集合里选择,排除没有的字段.
if (fields != null) {
var isHave = false; //是否存在.
for (var idx = 0; idx < fields.length; idx++) {
var field = fields[idx];
if (field.FType.indexOf('int') == -1) {
continue;
}
if (field.FName != sysEnumMain.No) {
continue;
}
isHave = true;
break;
}
if (isHave == false)
continue;
}
numEnum++;
var newRow = "";
newRow += "<tr>";
newRow += "<td style='width:50px;' class=Idx>" + i + "</td>";
if (fk_mapData != null)
newRow += "<td style='width:100px;'><a href=\"javascript:AddFrm('" + sysEnumMain.No + "','" + fk_mapData + "','" + sysEnumMain.Name + "'," + sysEnumMain.IsHaveDtl + ");\" >" + sysEnumMain.No + "</a></td>";
else
newRow += "<td style='width:100px;'>" + sysEnumMain.No + "</td>";
newRow += "<td style='width:100px;'>" + sysEnumMain.Name + "</td>";
newRow += "<td><a href=\"javascript:Edit('" + sysEnumMain.No + "','" + sysEnumMain.Name + "','" + sysEnumMain.CfgVal + "')\" >" + sysEnumMain.CfgVal + "</a></td>";
if (sysEnumMain.IsHaveDtl === 1) {
newRow += "<td><a href=\"javascript:EditDtl('" + sysEnumMain.No + "','" + sysEnumMain.Name + "','" + sysEnumMain.CfgVal + "')\" >编辑</a></td>";
}
else {
newRow += "<td><a href=\"javascript:CreateDtl('" + sysEnumMain.No + "','" + sysEnumMain.Name + "','" + sysEnumMain.CfgVal + "')\" >+创建子项</a></td>";
}
newRow += "<td style='width:50px;'><a href=\"javascript:Del('" + sysEnumMain.No + "','" + sysEnumMain.Name + "');\" >删除</a></td>";
newRow += "</tr>";
$("#Table1 tr:last").after(newRow);
}
$("#Msg").html("");
});
function CreateDtl(enumNo, enumName) {
var no = promptGener("枚举子项编号:", enumNo + "Dtl");
if (no == null || no == undefined) return;
var name = promptGener("枚举子项名称:", enumName + "Dtl");
if (name == null || name == undefined) return;
//插入数据.
var en = new Entity("BP.Sys.SysEnumMain");
en.EnumKey = no;
en.No = no;
en.Name = name;
en.IsHaveDtl = 0;
en.SetPara("ParentKey", enumNo);
en.SetPara("ParentName", enumName);
try {
en.Insert();
} catch (e) {
alert("编号已经存在");
return;
}
//更新main信息.
var en = new Entity("BP.Sys.SysEnumMain", enumNo);
en.IsHaveDtl = 1;
en.SetPara("DtlEnumKey", no);
en.SetPara("DtlName", name);
en.Update();
//调用转向.
EditDtl(en.No, enumNo)
}
function EditDtl(parentKey, enumKey) {
var en = new Entity("BP.Sys.SysEnumMain", parentKey);
var url = "SysEnumDtl.htm?ParentKey=" + en.No + "&EnumKey=" + en.GetPara("DtlEnumKey");
url += "&DoType=" + GetQueryString("DoType");
url += "&FK_MapData=" + GetQueryString("FK_MapData");
url += "&KeyOfEn=" + GetQueryString("KeyOfEn");
url += "&Type=" + GetQueryString("Type");
SetHref(url);
}
function EditUIBindKeyOfAttr(enumID, keyOfEn, fk_mapData) {
if (fk_mapData == null || fk_mapData == undefined || fk_mapData == "") {
alert("字段" + keyOfEn + "绑定的表单获取到的字段为空")
}
var attr = new Entity("BP.Sys.MapAttr", fk_mapData + "_" + keyOfEn);
attr.LGType = 1;
attr.UIContralType = 1;
attr.MyDataType = 2;
attr.UIBindKey = enumID;
attr.RBShowModel = 3; //横向展示.
attr.Update();
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrEnum&PKVal=" + attr.MyPK;
SetHref(url);
}
function AddFrm(enumID, fk_mapdata, enumName, isHaveDtl) {
var keyOfEn = GetQueryString("KeyOfEn");
keyOfEn = keyOfEn == null || keyOfEn == undefined ? "" : keyOfEn;
if (keyOfEn != "") {
EditUIBindKeyOfAttr(enumID, keyOfEn, fk_mapData);
return;
}
var url = '';
var str = prompt("请输入字段名(必须为字母开头、数字或者下划线组合):", enumID);
if (str == null) return;
var dtlKey = ""
if (isHaveDtl == 1) {
var v = window.confirm("您需要创建枚举值[" + enumName + "]的关联枚举字段吗?");
if (v == false)
dtlKey = "";
else {
dtlKey = prompt("请输入字段名(必须为字母开头、数字或者下划线组合):", enumID + "dtl");
if (dtlKey == null)
return;
}
}
var groupField = GetQueryString("GroupField");
if (groupField == null)
groupField = "0";
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
handler.AddPara("KeyOfEn", str);
handler.AddPara("DtlKeyOfEn", dtlKey);
handler.AddPara("FK_MapData", fk_mapdata);
handler.AddPara("GroupFeid", groupField);
handler.AddPara("EnumKey", enumID);
handler.AddPara("UIContralType", GetQueryString("Type"))
var data = handler.DoMethodReturnString("SysEnumList_SaveEnumField");
if (data.indexOf("err@") >= 0) {
alert(data);
return;
}
url = "../../Comm/En.htm?EnName=BP.Sys.FrmUI.MapAttrEnum&PKVal=" + data;
SetHref(url);
}
function NewEnum() {
var url = '../CCFormDesigner/DialogCtr/EnumerationNew.htm?s=' + Math.random();
var W = document.body.clientWidth - 120;
var H = document.documentElement.clientHeight - 10;
OpenEasyUiDialog(url, "eudlgframe", "新建枚举", W, H, "icon-edit", true, null, null, null, function () {
Reload();
});
}
//查询枚举
function SelectEnum() {
var EnumName = document.getElementById("EnumValue").value;
var sysEnumMains = new Entities("BP.Sys.SysEnumMains");
//sysEnumMains.Retrieve("Name", EnumName);
sysEnumMains.RetrieveCond("Name", "like", "%" + EnumName + "%");
var newRow = "";
for (var i = 0; i < sysEnumMains.length; i++) {
sysEnumMain = sysEnumMains[i];
newRow += "<tr>";
newRow += "<td style='width:50px;' class=Idx>" + i + "</td>";
if (fk_mapData != null)
newRow += "<td style='width:100px;'><a href=\"javascript:AddFrm('" + sysEnumMain.No + "','" + fk_mapData + "','" + sysEnumMains.Name + "'," + sysEnumMain.IsHaveDtl + ");\" >" + sysEnumMain.No + "</a></td>";
else
newRow += "<td style='width:100px;'>" + sysEnumMain.No + "</td>";
newRow += "<td style='width:100px;'>" + sysEnumMain.Name + "</td>";
newRow += "<td><a href=\"javascript:Edit('" + sysEnumMain.No + "','" + sysEnumMain.Name + "','" + sysEnumMain.CfgVal + "')\" >" + sysEnumMain.CfgVal + "</a></td>";
if (sysEnumMain.IsHaveDtl === 1)
newRow += "<td style='width:50px;'>有</td>";
else
newRow += "<td style='width:50px;'>无</td>";
newRow += "<td style='width:50px;'><a href=\"javascript:Del('" + sysEnumMain.No + "','" + sysEnumMain.Name + "');\" ><img src='../../Img/Btn/Delete.gif' alt='删除' ></a></td>";
newRow += "</tr>";
}
$("#Table1").html(newRow);
}
function Edit(enumKey, name, cfgKeys) {
var url = '../CCFormDesigner/DialogCtr/EnumerationNew.htm?EnumKey=' + enumKey + '&Name=' + name + '&DoType=FrmEnumeration_SaveEnum&s=' + Math.random();
var W = document.body.clientWidth - 120;
var H = document.documentElement.clientHeight - 10;
OpenEasyUiDialog(url, "eudlgframe", "编辑"+name, W, H, "icon-edit", true, null, null, null, function () {
Reload();
});
}
function Del(key, name) {
if (key == null || key == "") {
alert('您没有选择行.');
return;
}
var v = window.confirm("您确定要删除枚举值[" + name + " " + key + "]吗?");
if (v == false)
return;
//检查该枚举值是否被其他表单字段引用.
var mapAttrs = new Entities("BP.Sys.MapAttrs");
mapAttrs.Retrieve("UIBindKey", key);
var info = '';
for (var i = 0; i < mapAttrs.length; i++) {
var attr = mapAttrs[i];
info += "\t\n" + i + ",表单编号:" + attr.FK_MapData + " , 字段:" + attr.KeyOfEn + ", 名称:" + attr.Name;
}
if (info != '') {
info = "如下表单引用了该字段您不能删除:" + info;
alert(info);
return;
}
//执行删除.
var enumMain = new Entity("BP.Sys.SysEnumMain", key);
enumMain.Delete();
Reload();
}
function Ref(key) {
alert('查看该枚举值,被那些表单字段引用功能尚未完成.');
}
</script>
</head>
<body onkeypress="Esc()">
<div class="container-full">
<div class="attrnode-bar-header">
<div class="pull-right" style="padding-top:5px;">
枚举值名称: <input id="EnumValue" class="cc-input" />&nbsp;&nbsp;<button type="button" onclick="SelectEnum()" id="Btn_Search">查询</button>
<button type="button" id="Btn_New" onclick="NewEnum()">新建</button>
<button type="button" id="Btn_Help" onclick="NewEnum()">帮助</button>
</div>
<strong>枚举值列表</strong>
</div>
<div class="table-body">
<table id="Table1" class="table table-striped">
<thead>
<tr>
<th style='width:53px;'>#</th>
<th style='width:103px;'>枚举值</th>
<th style='width:103px;'>名称</th>
<th>枚举信息</th>
<th style='width:30px;'>子项?</th>
<th style='width:53px;'>操作</th>
</tr>
</thead>
<tr>
</tr>
</table>
</div>
<div id="Msg"></div>
</div>
</body>
</html>