|
|
<!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="../../../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" />
|
|
|
<script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
|
|
|
<script src="../../../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="../../../Scripts/QueryString.js" type="text/javascript"></script>
|
|
|
<script src="../../../Scripts/config.js" type="text/javascript"></script>
|
|
|
<script src="../../../Comm/Gener.js" type="text/javascript"></script>
|
|
|
<script src="../../../Scripts/PinYin.js" type="text/javascript"></script>
|
|
|
<link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
|
|
|
<style>
|
|
|
.ctrform {
|
|
|
width: 90%;
|
|
|
margin: 0px auto;
|
|
|
display: block
|
|
|
}
|
|
|
|
|
|
.ctrform .form-group {
|
|
|
margin: 0px 5px;
|
|
|
}
|
|
|
|
|
|
.ctrform .form-group input[type=radio] {
|
|
|
margin: 0px 5px 0px 0px;
|
|
|
}
|
|
|
|
|
|
.ctr-col {
|
|
|
line-height: 32px;
|
|
|
width: 50%;
|
|
|
float: left;
|
|
|
}
|
|
|
|
|
|
.ctr-help {
|
|
|
display: block
|
|
|
}
|
|
|
|
|
|
#DivEnumList {
|
|
|
clear: both
|
|
|
}
|
|
|
|
|
|
#DivEnumList .col-sm-4 {
|
|
|
padding: 5px 0px;
|
|
|
}
|
|
|
|
|
|
#DivEnumList .col-sm-4 span {
|
|
|
display: inline-block;
|
|
|
width: 20px;
|
|
|
}
|
|
|
</style>
|
|
|
<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');
|
|
|
|
|
|
if (enumKey == null) {
|
|
|
NewEnum();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//获得枚举值.
|
|
|
var enumKey = GetQueryString('EnumKey'); // $.trim($("#TB_KeyOfEn").val());
|
|
|
var enumMain = new Entity("BP.Sys.SysEnumMain", enumKey);
|
|
|
Edit(enumMain.No, enumMain.Name, enumMain.CfgVal);
|
|
|
|
|
|
});
|
|
|
|
|
|
function NewEnum() {
|
|
|
|
|
|
$("#TB_EnumName").val("");
|
|
|
$("#TB_EnumKey").val("");
|
|
|
$("#tabs").tabs('select', '枚举信息');
|
|
|
|
|
|
var str = "<div class='row'>";
|
|
|
for (var i = 0; i < 51; i++) {
|
|
|
|
|
|
str += "<div class='col-sm-4'> <span>" + i + "</span>";
|
|
|
str += "<input id='TB" + i + "' class='cc-input' /></div> ";
|
|
|
|
|
|
}
|
|
|
str += '</div>';
|
|
|
var div = this.document.getElementById('DivEnumList');
|
|
|
div.innerHTML = str;
|
|
|
pageData.DoType = "FrmEnumeration_NewEnum";
|
|
|
}
|
|
|
|
|
|
function Edit(key, name, cfgVal) {
|
|
|
|
|
|
if (key == null || key == "") {
|
|
|
alert('您没有选择行.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
$("#TB_EnumName").val(name);
|
|
|
$("#TB_EnumKey").val(key);
|
|
|
|
|
|
|
|
|
var cfgVals = cfgVal.split('@');
|
|
|
var str = "<div class='row'>";
|
|
|
var long = 0;
|
|
|
var enumCount = cfgVals.length + 10;
|
|
|
enumCount = enumCount < 51 ? 51 : 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 += "<div class='col-sm-4'> <span>" + i + "</span>";
|
|
|
str += "<input id='TB" + i + "' value='' class='easyui-textbox' /></div> ";
|
|
|
}
|
|
|
else {
|
|
|
var vls = keyValue[0].split('=');
|
|
|
var text = vls.slice(1, vls.length).join('=');
|
|
|
if (text == undefined) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
str += "<div class='col-sm-4'> <span>" + i + "</span>";
|
|
|
str += "<input id='TB" + i + "' value='" + text + "' class='cc-input' /></div> ";
|
|
|
|
|
|
long = i + 1;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
str += '</div>';
|
|
|
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 se = new Entity("BP.Sys.SysEnum");
|
|
|
se.Delete("EnumKey", keyofEn);
|
|
|
|
|
|
var strs = '';
|
|
|
for (var i = 0; i < 50; i++) {
|
|
|
var v = $("#TB" + i).val();
|
|
|
if (v == '' || v == null)
|
|
|
continue;
|
|
|
|
|
|
strs += '@' + i + '=' + v; //该变量用于保存sys_EnumMain .
|
|
|
|
|
|
//创建实例.
|
|
|
var se = new Entity("BP.Sys.SysEnum");
|
|
|
|
|
|
//给实体的各个属性赋值.
|
|
|
se.EnumKey = keyofEn;
|
|
|
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 en = new Entity("BP.Sys.SysEnumMain");
|
|
|
en.SetPKVal(keyofEn);
|
|
|
en.No = keyofEn;
|
|
|
|
|
|
if (doType == "FrmEnumeration_NewEnum") {
|
|
|
var i = en.RetrieveFromDBSources();
|
|
|
if (i == 1) {
|
|
|
alert('枚举值已经存在');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
en.CfgVal = strs;
|
|
|
en.Lang = "CH";
|
|
|
en.Name = name;
|
|
|
en.Insert();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
en.Retrieve();
|
|
|
en.Name = name;
|
|
|
en.CfgVal = strs;
|
|
|
en.Update();
|
|
|
|
|
|
}
|
|
|
|
|
|
// var data = en.DoMethodReturnString("SaveEnum", strs);
|
|
|
//alert(data);
|
|
|
|
|
|
var url = '?EnumKey=' + keyofEn + '&DoType=FrmEnumeration_SaveEnum&s=' + Math.random();
|
|
|
SetHref(url);
|
|
|
}
|
|
|
</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 < 50; 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 group-easyui-body">
|
|
|
<div data-options="region:'center'" style="overflow:auto">
|
|
|
<!--<div id="tabs" class="easyui-tabs" data-options="fit:true ,border:false">
|
|
|
<div title="枚举信息" id="tab_Edit">-->
|
|
|
<table style=" z-index: 1000;position:fixed; background-color: white;width:100%">
|
|
|
<tr>
|
|
|
<td>标签 </td>
|
|
|
<td><input id="TB_EnumName" class="cc-input" /> </td>
|
|
|
<td>枚举键值 </td>
|
|
|
<td><input id="TB_EnumKey" class="cc-input" /> </td>
|
|
|
<td>
|
|
|
<label for="RB_QP">
|
|
|
<input id="RB_QP" type="radio" name="RB_QPJP" value="ziduanquanpin" />
|
|
|
全拼
|
|
|
</label>
|
|
|
<label for="RB_JP">
|
|
|
<input id="RB_JP" type="radio" name="RB_QPJP" checked="checked" value="ziduanjianpin" />简拼
|
|
|
</label>
|
|
|
</td>
|
|
|
|
|
|
<td>
|
|
|
<input type="button" class="cc-btn-tab" value="保存" onclick="SaveEnum()" />
|
|
|
<input type="button" value="重置" class="cc-btn-tab" onclick="NewEnum()" style="display:none" />
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
</table>
|
|
|
|
|
|
<div class="container" style="margin-top:70px;">
|
|
|
<div class="">
|
|
|
<div id='DivEnumList'></div>
|
|
|
</div>
|
|
|
|
|
|
<fieldset id="help">
|
|
|
<legend id="help">帮助</legend>
|
|
|
<ul>
|
|
|
<li>1. 请在标签上面输入枚举中文名,比如:"请假类型" </li>
|
|
|
<li>2. 系统自动生成枚举标识字段,QJLX .</li>
|
|
|
<li>3. 请在右边文本框列表,输入枚举值,比如: 病假 事假 婚假 其他</li>
|
|
|
<li>4. 点击保存.</li>
|
|
|
</ul>
|
|
|
</fieldset>
|
|
|
|
|
|
</div>
|
|
|
<!--</div>
|
|
|
</div>-->
|
|
|
</div>
|
|
|
|
|
|
|
|
|
</body>
|
|
|
</html>
|