|
|
|
|
<!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 src="../../../../WF/Scripts/config.js" type="text/javascript"></script>
|
|
|
|
|
<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/jquery-1.7.2.min.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../../../../WF/Scripts/jquery.easyui.min.js" type="text/javascript"></script>
|
|
|
|
|
<!-- <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>-->
|
|
|
|
|
|
|
|
|
|
<script src="../js/FormDesignerService.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/Comm/Gener.js" type="text/javascript"></script>
|
|
|
|
|
<script src="../../../../WF/Scripts/PinYin.js" type="text/javascript"></script>
|
|
|
|
|
<script language="javascript" type="text/javascript">
|
|
|
|
|
|
|
|
|
|
closeWhileEscUp();
|
|
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
|
|
var doType = GetQueryString('DoType');
|
|
|
|
|
|
|
|
|
|
if (doType != null) {
|
|
|
|
|
$("#RB_QPJP").attr({ "disabled": "disabled" });
|
|
|
|
|
$("#RB_QPQP").attr({ "disabled": "disabled" });
|
|
|
|
|
$("#TB_EnumKey").attr({ "disabled": "disabled" });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var tb_Name = document.getElementById("TB_EnumName");
|
|
|
|
|
tb_Name.focus();
|
|
|
|
|
|
|
|
|
|
$('#TB_EnumName').blur(function () //文本失去焦点时触发的事件
|
|
|
|
|
{
|
|
|
|
|
var name = document.getElementById("TB_EnumName").value;
|
|
|
|
|
var val = $('input:radio[name="RB_QPJP"]:checked').val();
|
|
|
|
|
if (name == "") {
|
|
|
|
|
document.getElementById("TB_EnumKey").value = "";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (val == "ziduanquanpin") {
|
|
|
|
|
ParsePinYin(name, true, "TB_EnumKey");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ParsePinYin(name, false, "TB_EnumKey");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//点击全拼
|
|
|
|
|
$('input[id=RB_QP]').change(function () {
|
|
|
|
|
var tbName = document.getElementById("TB_EnumName").value;
|
|
|
|
|
ParsePinYin(tbName, true, "TB_EnumKey");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//点击简拼
|
|
|
|
|
$('input[id=RB_JP]').change(function () {
|
|
|
|
|
var tbName = document.getElementById("TB_EnumName").value;
|
|
|
|
|
ParsePinYin(tbName, false, "TB_EnumKey");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var pageData = {};
|
|
|
|
|
|
|
|
|
|
//初始化,信息.
|
|
|
|
|
$(function () {
|
|
|
|
|
|
|
|
|
|
var enumKey = GetQueryString('EnumKey');
|
|
|
|
|
var no = GetQueryString('No');
|
|
|
|
|
if (enumKey == null) {
|
|
|
|
|
NewEnum();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获得枚举值.
|
|
|
|
|
var enumKey = GetQueryString('EnumKey'); // $.trim($("#TB_KeyOfEn").val());
|
|
|
|
|
var enumMain = new Entity("BP.Cloud.Sys.SysEnumMain", no);
|
|
|
|
|
Edit(enumMain.No, enumMain.Name, enumMain.CfgVal, enumKey);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function NewEnum() {
|
|
|
|
|
|
|
|
|
|
$("#TB_EnumName").val("");
|
|
|
|
|
$("#TB_EnumKey").val("");
|
|
|
|
|
$("#tabs").tabs('select', '枚举信息');
|
|
|
|
|
|
|
|
|
|
var str = '<table>';
|
|
|
|
|
for (var i = 0; i < 31; i++) {
|
|
|
|
|
|
|
|
|
|
str += '<tr>';
|
|
|
|
|
str += "<td> " + i + "</td> ";
|
|
|
|
|
str += "<td> <input id='TB" + i + "' class='easyui-textbox' style=' width: 200px' /></td> ";
|
|
|
|
|
str += '</tr>';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var div = this.document.getElementById('DivEnumList');
|
|
|
|
|
div.innerHTML = str;
|
|
|
|
|
pageData.DoType = "FrmEnumeration_NewEnum";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function Edit(key, name, cfgVal, enumKey) {
|
|
|
|
|
|
|
|
|
|
if (enumKey == null || enumKey == "") {
|
|
|
|
|
alert('您没有选择行.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("#TB_EnumName").val(name);
|
|
|
|
|
$("#TB_EnumKey").val(enumKey);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cfgVals = cfgVal.split('@');
|
|
|
|
|
var str = '<table>';
|
|
|
|
|
var long = 0;
|
|
|
|
|
var enumCount = cfgVals.length + 10;
|
|
|
|
|
enumCount = enumCount < 31 ? 31 : enumCount;
|
|
|
|
|
for (var i = 0; i < enumCount; i++) {
|
|
|
|
|
var keyValue = [];
|
|
|
|
|
keyValue = $.grep(cfgVals, function (value) {
|
|
|
|
|
var keyValue = value.split('=');
|
|
|
|
|
return keyValue.length >= 2 && keyValue[0] == i;
|
|
|
|
|
});
|
|
|
|
|
if (keyValue.length == 0) {
|
|
|
|
|
str += '<tr>';
|
|
|
|
|
str += "<td> " + i + "</td> ";
|
|
|
|
|
str += "<td> <input id='TB" + i + "' value='' class='easyui-textbox' style=' width: 200px' /></td> ";
|
|
|
|
|
str += '</tr>';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var vls = keyValue[0].split('=');
|
|
|
|
|
var text = vls.slice(1, vls.length).join('=');
|
|
|
|
|
if (text == undefined) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
str += '<tr>';
|
|
|
|
|
str += "<td> " + i + "</td> ";
|
|
|
|
|
str += "<td> <input id='TB" + i + "' value='" + text + "' class='easyui-textbox' style='width: 200px' /></td> ";
|
|
|
|
|
str += '</tr>';
|
|
|
|
|
long = i + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var div = this.document.getElementById('DivEnumList');
|
|
|
|
|
div.innerHTML = str;
|
|
|
|
|
|
|
|
|
|
pageData.DoType = "FrmEnumeration_SaveEnum";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//执行保存.
|
|
|
|
|
function SaveEnum() {
|
|
|
|
|
|
|
|
|
|
//组织数据.
|
|
|
|
|
var name = $("#TB_EnumName").val();
|
|
|
|
|
var keyofEn = $("#TB_EnumKey").val();
|
|
|
|
|
|
|
|
|
|
if (name == '' || name == null) {
|
|
|
|
|
alert('枚举中文名称不能为空.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keyofEn == '' || keyofEn == null) {
|
|
|
|
|
alert('枚举英文名称不能为空.');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//秦 18.11.16
|
|
|
|
|
if (!CheckID(keyofEn)) {
|
|
|
|
|
alert("枚举键值不符合规则");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var webUser = new WebUser();
|
|
|
|
|
var doType = GetQueryString("DoType");
|
|
|
|
|
if (doType == null || doType == undefined) {
|
|
|
|
|
doType = "FrmEnumeration_NewEnum";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//验证同一组织结构下是否存在新增枚举值
|
|
|
|
|
var en = new Entity("BP.Cloud.Sys.SysEnumMain");
|
|
|
|
|
var key = webUser.OrgNo + "_" + keyofEn;
|
|
|
|
|
en.SetPKVal(key);
|
|
|
|
|
en.No = key;
|
|
|
|
|
|
|
|
|
|
if (doType == "FrmEnumeration_NewEnum") {
|
|
|
|
|
var i = en.RetrieveFromDBSources();
|
|
|
|
|
if (i == 1) {
|
|
|
|
|
alert('枚举值已经存在');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//删除现在的枚举值.
|
|
|
|
|
var se = new Entity("BP.Cloud.Sys.SysEnum");
|
|
|
|
|
se.Delete("EnumKey", keyofEn,"OrgNo",webUser.OrgNo);
|
|
|
|
|
|
|
|
|
|
var strs = '';
|
|
|
|
|
for (var i = 0; i < 30; i++) {
|
|
|
|
|
var v = $("#TB" + i).val();
|
|
|
|
|
if (v == '' || v == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
strs += '@' + i + '=' + v; //该变量用于保存sys_EnumMain .
|
|
|
|
|
|
|
|
|
|
//创建实例.
|
|
|
|
|
var se = new Entity("BP.Cloud.Sys.SysEnum");
|
|
|
|
|
|
|
|
|
|
//给实体的各个属性赋值.
|
|
|
|
|
se.EnumKey = keyofEn;
|
|
|
|
|
//se.RefPK = key;
|
|
|
|
|
se.OrgNo = webUser.OrgNo;
|
|
|
|
|
se.Lab = v;
|
|
|
|
|
se.IntKey = i;
|
|
|
|
|
se.Lang = "CH";
|
|
|
|
|
se.MyPK = se.EnumKey + '_CH_' + se.IntKey;
|
|
|
|
|
se.SetPKVal(se.MyPK);
|
|
|
|
|
|
|
|
|
|
se.Insert();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//alert('将要保存' + strs + " name=" + name + " keyofEn=" + keyofEn);
|
|
|
|
|
//定义参数,让其保存到数据库里。
|
|
|
|
|
|
|
|
|
|
var doType = GetQueryString("DoType");
|
|
|
|
|
if (doType == null || doType == undefined) {
|
|
|
|
|
doType = "FrmEnumeration_NewEnum";
|
|
|
|
|
}
|
|
|
|
|
var enMain = new Entity("BP.Cloud.Sys.SysEnumMain");
|
|
|
|
|
|
|
|
|
|
enMain.SetPKVal(key);
|
|
|
|
|
enMain.No = key;
|
|
|
|
|
|
|
|
|
|
if (doType == "FrmEnumeration_NewEnum") {
|
|
|
|
|
/* var i = en.RetrieveFromDBSources();
|
|
|
|
|
if (i == 1) {
|
|
|
|
|
alert('枚举值已经存在');
|
|
|
|
|
return;
|
|
|
|
|
}*/
|
|
|
|
|
enMain.EnumKey = keyofEn;
|
|
|
|
|
enMain.CfgVal = strs;
|
|
|
|
|
enMain.Lang = "CH";
|
|
|
|
|
enMain.Name = name;
|
|
|
|
|
enMain.OrgNo = webUser.FK_Dept;
|
|
|
|
|
|
|
|
|
|
enMain.Insert();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
enMain.Retrieve();
|
|
|
|
|
enMain.Name = name;
|
|
|
|
|
enMain.CfgVal = strs;
|
|
|
|
|
enMain.Update();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// var data = en.DoMethodReturnString("SaveEnum", strs);
|
|
|
|
|
//alert(data);
|
|
|
|
|
$("#TB_EnumName").val("");
|
|
|
|
|
$("#TB_EnumKey").val("");
|
|
|
|
|
|
|
|
|
|
/* var url = '?EnumKey=' + key + '&DoType=FrmEnumeration_SaveEnum&s=' + Math.random();
|
|
|
|
|
SetHref(url);*/
|
|
|
|
|
parent.doCloseDialog.call();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<!--李震-->
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
$(".easyui-textbox").attr("disabled", "true");//所有文本框变为不可用
|
|
|
|
|
$("#TB_EnumKey").removeAttr("disabled");
|
|
|
|
|
var j = 0;
|
|
|
|
|
for (var i = 0; i < 30; i++) {
|
|
|
|
|
if ($("#TB" + i + "").val().length > 0)
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
for (var i = 0; i < j; i++) {
|
|
|
|
|
if ($("#TB" + i + "").val().length > 0)
|
|
|
|
|
$(".easyui-textbox:eq(" + i + ")").removeAttr("disabled");
|
|
|
|
|
}
|
|
|
|
|
$(".easyui-textbox:eq(" + i + ")").removeAttr("disabled");//启用第一个文本框
|
|
|
|
|
$('.easyui-textbox').bind('input propertychange', function () //监听当前操作的文本框,若有值输入,则启用下一个文本框
|
|
|
|
|
{
|
|
|
|
|
$(this).parent().parent().next().find(".easyui-textbox").removeAttr("disabled");
|
|
|
|
|
});
|
|
|
|
|
$(".easyui-textbox").keyup(function (event) { //当前文本框内容全部删除时,禁用下一个文本框
|
|
|
|
|
if (event.keyCode == 8 && ($(this).val().length < 1)) {
|
|
|
|
|
$(this).parent().parent().next().find(".easyui-textbox").attr("disabled", "true");
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</head>
|
|
|
|
|
<body class="easyui-layout">
|
|
|
|
|
<div data-options="region:'center'">
|
|
|
|
|
<div id="tabs" class="easyui-tabs" data-options="fit:true ,border:false">
|
|
|
|
|
|
|
|
|
|
<!-- <div title="选择已有枚举值" style="width: 600px; height: 600px; visibility:hidden" >
|
|
|
|
|
<div id="tb" style="padding: 3px;">
|
|
|
|
|
<input type="button" id="Btn_New" class="easyui-button" onclick="NewEnum()" value="新增" />
|
|
|
|
|
|
|
|
|
|
<input type="button" id="Btn_Edit" onclick="Edit(true)" value="编辑" />
|
|
|
|
|
|
|
|
|
|
<input type="button" id="Btn_DELETE" onclick="Del()" value="删除" />
|
|
|
|
|
</div>
|
|
|
|
|
<table id="newsGrid" toolbar="#tb" class="easyui-datagrid">
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<br />
|
|
|
|
|
中文名:
|
|
|
|
|
<input id="TB_Name" class="easyui-textbox" style="width: 150px" />
|
|
|
|
|
字段英文名:<input id="TB_KeyOfEn" class="easyui-textbox" style="width: 100px" />
|
|
|
|
|
<input id="CB_Generate_Tags" type="checkbox" checked="checked" /><label for="CB_Generate_Tags">生成标签</label>
|
|
|
|
|
<input id="TB_UIBindKey" class="easyui-textbox" style="width: 200px; visibility:hidden" />
|
|
|
|
|
<input id="TB_Vals" class="easyui-textbox" style="width: 200px; visibility:hidden" />
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>-->
|
|
|
|
|
|
|
|
|
|
<div title="枚举信息" id="tab_Edit" style="padding: 10px">
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<tr>
|
|
|
|
|
<td valign="top">
|
|
|
|
|
|
|
|
|
|
<table>
|
|
|
|
|
<tr>
|
|
|
|
|
<td> 标签 </td>
|
|
|
|
|
<td> <input id="TB_EnumName" style="width: 200px" /> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td> 枚举键值 </td>
|
|
|
|
|
<td> <input id="TB_EnumKey" style="width: 200px" /> </td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<input id="RB_QP" type="radio" name="RB_QPJP" value="ziduanquanpin" /><label for="RB_QP">字段全拼</label>
|
|
|
|
|
<input id="RB_JP" type="radio" name="RB_QPJP" checked="checked" value="ziduanjianpin" /><label for="RB_JP">字段简拼</label>
|
|
|
|
|
<input type="button" value="保存" onclick="SaveEnum()" />
|
|
|
|
|
<input type="button" value="重置" onclick="NewEnum()" style="visibility:hidden" />
|
|
|
|
|
<!-- <input type="button" value="删除" onclick="DelEnum()" />-->
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td colspan="2">
|
|
|
|
|
<p class="text-right">帮助:</p>
|
|
|
|
|
|
|
|
|
|
<p class="text-right">1. 请在标签上面输入枚举中文名,比如:"请假类型"</p>
|
|
|
|
|
<p class="text-right">2. 系统自动生成枚举标识字段,QJLX .</p>
|
|
|
|
|
<p class="text-right">3. 请在右边文本框列表,输入枚举值,比如: 病假 事假 婚假 其他</p>
|
|
|
|
|
<p class="text-right">4. 点击保存.</p>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
<td valign="top">
|
|
|
|
|
<div id='DivEnumList'></div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|