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.
462 lines
22 KiB
Plaintext
462 lines
22 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 src="../../../Scripts/jquery-1.7.2.min.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>
|
|
<!--<link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />-->
|
|
<link href="../../../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
|
|
<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/EasyUIUtility.js" type="text/javascript"></script>
|
|
<link href="../../../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" />
|
|
<script src="../js/ueditor/dialogs/internal.js"></script>
|
|
<script src="../../../Scripts/vue.js"></script>
|
|
<style type="text/css">
|
|
body{ font-size:15px;}
|
|
.trSP {
|
|
background-color: #B9D3EE
|
|
}
|
|
|
|
.table-head {
|
|
padding:10px 15px;
|
|
}
|
|
.table-head .form-group{ padding-right:15px;}
|
|
.table-head .form-group label{ padding-right:8px;}
|
|
.table-head .form-group .btn{ margin:0px 5px;}
|
|
|
|
</style>
|
|
|
|
|
|
</head>
|
|
<body>
|
|
<div id="App">
|
|
<div class="form-inline table-head">
|
|
|
|
<div class="form-group">
|
|
<label>中文名</label>
|
|
<input id="TB_Name" class="form-control"/>
|
|
</div>
|
|
<div class="form-group">
|
|
<label>字段英文名</label> <input id="TB_KeyOfEn" class="form-control" />
|
|
</div><div class="form-group"><label for="CB_Generate_Tags"><input id="CB_Generate_Tags" type="checkbox" checked="checked" />生成标签</label> </div> <div class="form-group"><label>关键字</label><input id="EnumValue" class="form-control" /> </div><div class="form-group"><input type="button" class="btn btn-primary btn-sm" id="Btn_New" @click="SelectEnum" value="查询" /> <input type="button" class="btn btn-success btn-sm" id="Btn_New" @click="NewEnum" value="新建" /> </div>
|
|
</div>
|
|
<div class="table-body">
|
|
<div style="position:relative">
|
|
<table id="Table1" class="table table-hover">
|
|
<thead>
|
|
<tr class="active">
|
|
<th style='width:53px;'>#</th>
|
|
<th style='width:103px;'>枚举值</th>
|
|
<th style='width:103px;'>名称</th>
|
|
<th>枚举信息</th>
|
|
<th>子项?</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="(sysEnumMain,index) in sysEnumMains">
|
|
<td>{{index+1}}</td>
|
|
<td>
|
|
<label>
|
|
<input type="radio" name="enumSelect" @click="ChangeEnum(sysEnumMain)" />
|
|
<template v-if="sysEnumMain.EnumKey!=''">
|
|
{{sysEnumMain.EnumKey}}
|
|
</template>
|
|
|
|
<template v-else=v-else>
|
|
{{sysEnumMain.No}}
|
|
</template>
|
|
</label>
|
|
</td>
|
|
<td>{{sysEnumMain.Name}}</td>
|
|
<td><a href="#" @click="Edit(sysEnumMain)">{{sysEnumMain.CfgVal}}</a></td>
|
|
<template v-if="sysEnumMain.IsHaveDtl==1">
|
|
<td><a href="#" @click="EditDtl(sysEnumMain)">编辑</a></td>
|
|
</template>
|
|
<template v-else=v-else>
|
|
<td><a href="#" @click="CrateDtl(sysEnumMain)">创建</a></td>
|
|
</template>
|
|
<td><a href="#" @click="Del(sysEnumMain)">删除</a></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<nav>
|
|
<ul class="pagination">
|
|
<li v-for="k in pages" :class="pagesactive==k+1?'active':''" @click.stop="pageFenye(k)"><a href="#">{{k+1}}</a></li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
<script language="javascript" type="text/javascript">
|
|
var Baseinfo = new Vue({
|
|
el: '#App',
|
|
data: {
|
|
dataType: "",
|
|
fk_mapData: "",
|
|
webUser: null,
|
|
sysEnumMains: [],
|
|
selectEnum: {
|
|
No: "",
|
|
Name: "",
|
|
CfgVal: "",
|
|
EnumKey: "",
|
|
OrgNo: "",
|
|
IsHaveDtl: false,
|
|
AtPara:"",
|
|
},
|
|
pagenum: 15,
|
|
pages: [],
|
|
pagesactive: 1,
|
|
sysList:[]
|
|
|
|
|
|
},
|
|
methods: {
|
|
pageFenye: function (num) {
|
|
this.pagesactive = num + 1;
|
|
var sysData = []
|
|
var pn = num * this.pagenum
|
|
for (i = pn; i < this.sysList.length; i++) {
|
|
var en = this.sysList[i]
|
|
if (i < this.pagenum+pn) {
|
|
sysData.push(en)
|
|
}
|
|
|
|
}
|
|
this.sysEnumMains = sysData
|
|
},
|
|
ChangeEnum: function (sysEnumMain) {
|
|
this.SelectEnum = sysEnumMain;
|
|
if (this.SelectEnum.EnumKey != "")
|
|
$("#TB_KeyOfEn").val(this.SelectEnum.EnumKey);
|
|
else
|
|
$("#TB_KeyOfEn").val(this.SelectEnum.No);
|
|
$("#TB_Name").val(this.SelectEnum.Name);
|
|
},
|
|
NewEnum: function () {
|
|
var url = "EnumerationNew.htm";
|
|
if (this.webUser.CCBPMRunModel == 2)
|
|
url = "../../../../Admin/CCFormDesigner/SysEnum/Edit.htm";
|
|
var _this = this;
|
|
OpenEasyUiDialog(url, "eudlgframe", "新建枚举", 600, 400, "icon-edit", true, null, null, null, function () {
|
|
_this.InitData();
|
|
});
|
|
},
|
|
SelectEnum: function () {
|
|
var EnumName = document.getElementById("EnumValue").value;
|
|
/*var sql = "";
|
|
if (EnumName == "")
|
|
sql = "SELECT * FROM Sys_EnumMain";
|
|
else
|
|
sql = "SELECT * FROM Sys_EnumMain WHERE (No like '%" + EnumName + "%') OR (Name like '%" + EnumName + "%')";
|
|
var sysList = DBAccess.RunSQLReturnTable(sql);*/
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
|
|
handler.AddPara("EnumName", EnumName);
|
|
var sysList = handler.DoMethodReturnString("SysEnumList_SelectEnum");
|
|
sysList = JSON.parse(sysList);
|
|
|
|
this.sysList = $.grep(sysList, function (item) {
|
|
var atPara = item.AtPara;
|
|
atPara = atPara == null || atPara == undefined ? "" : atPara;
|
|
var idx = atPara.indexOf("ParentKey");
|
|
return idx == 0 || idx == -1;
|
|
|
|
|
|
|
|
})
|
|
var pn = Math.ceil(this.sysList.length / this.pagenum)
|
|
|
|
this.pages = []
|
|
for (p = 0; p < pn; p++) {
|
|
this.pages.push(p)
|
|
}
|
|
var sysData = []
|
|
|
|
for (i = 0; i < this.sysList.length; i++) {
|
|
var en = this.sysList[i]
|
|
if (i < this.pagenum) {
|
|
en.EnumKey=en.enumkey;
|
|
en.Name=en.name;
|
|
en.CfgVal=en.cfgval;
|
|
en.No=en.no;
|
|
en.Lang=en.lang;
|
|
sysData.push(en)
|
|
}
|
|
|
|
}
|
|
console.log(sysData)
|
|
this.sysEnumMains = sysData
|
|
},
|
|
Edit: function (sysEnumMain) {
|
|
var url = "EnumerationNew.htm?DoType=FrmEnumeration_SaveEnum&EnumKey=" + sysEnumMain.No;
|
|
if (this.webUser.CCBPMRunModel == 2)
|
|
url = '../../../../Admin/CCFormDesigner/SysEnum/Edit.htm?No=' + sysEnumMain.No + '&EnumKey=' + sysEnumMain.EnumKey + '&Name=' + sysEnumMain.Name + '&CfgKeys=' + sysEnumMain.CfgKeys + '&DoType=FrmEnumeration_SaveEnum&s=' + Math.random();
|
|
var _this = this;
|
|
OpenEasyUiDialog(url, "eudlgframe", "修改枚举值", 600, 400, "icon-edit", true, null, null, null, function () {
|
|
_this.InitData();
|
|
});
|
|
},
|
|
EditDtl: function (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 += "&Type=" + GetQueryString("Type");
|
|
url += "&DataType=" + GetQueryString("DataType");
|
|
SetHref(url);
|
|
},
|
|
CrateDtl: function (sysEnumMain) {
|
|
var no = promptGener("枚举子项编号:", sysEnumMain.No + "Dtl");
|
|
if (no == null || no == undefined) return;
|
|
var name = promptGener("枚举子项名称:", sysEnumMain.Name + "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", sysEnumMain.No);
|
|
en.SetPara("ParentName", sysEnumMain.Name);
|
|
|
|
try {
|
|
en.Insert();
|
|
} catch (e) {
|
|
alert("编号已经存在");
|
|
return;
|
|
}
|
|
|
|
//更新main信息.
|
|
var en = new Entity("BP.Sys.SysEnumMain", sysEnumMain);
|
|
en.IsHaveDtl = 1;
|
|
en.SetPara("DtlEnumKey", no);
|
|
en.SetPara("DtlName", name);
|
|
en.Update();
|
|
|
|
|
|
//调用转向.
|
|
this.EditDtl(en.No, enumNo)
|
|
},
|
|
Del: function (sysEnumMain) {
|
|
var v = window.confirm("您确定要删除枚举值[" + sysEnumMain.No + "]吗?");
|
|
if (v == false)
|
|
return;
|
|
|
|
//检查该枚举值是否被其他表单字段引用.
|
|
var mapAttrs = null;
|
|
if (this.webUser.CCBPMRunModel != 2) {
|
|
mapAttrs = new Entities("BP.Sys.MapAttrs");
|
|
mapAttrs.Retrieve("UIBindKey", sysEnumMain.No);
|
|
} else {
|
|
/*var sql = "SELECT A.FK_MapData,A.KeyOfEn,A.Name From Sys_MapAttr A,Sys_MapData B Where A.FK_MapData=B.No AND A.UIBindKey='" + sysEnumMain.No + "' AND B.OrgNo='" + this.webUser.OrgNo + "'";
|
|
mapAttrs = DBAccess.RunSQLReturnTable(sql);*/
|
|
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
|
|
handler.AddPara("UIBindKey", sysEnumMain.No);
|
|
handler.AddPara("OrgNo", this.webUser.OrgNo);
|
|
mapAttrs = handler.DoMethodReturnString("SysEnumList_MapAttrs");
|
|
mapAttrs = JSON.parse(mapAttrs);
|
|
}
|
|
|
|
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", sysEnumMain.No);
|
|
if (this.webUser.CCBPMRunModel == 2)
|
|
enumMain = new Entity("BP.Cloud.Sys.SysEnumMain", sysEnumMain.No);
|
|
enumMain.Delete();
|
|
|
|
this.InitData();
|
|
},
|
|
InitData() {
|
|
var enumMains = new Entities("BP.Sys.SysEnumMains");
|
|
enumMains.RetrieveAll();
|
|
this.sysList = $.grep(enumMains, function (item) {
|
|
var atPara = item.AtPara;
|
|
atPara = atPara == null || atPara == undefined ? "" : atPara;
|
|
var idx = atPara.indexOf("ParentKey");
|
|
return idx == 0 || idx == -1;
|
|
})
|
|
var pn = Math.ceil(this.sysList.length / this.pagenum)
|
|
console.log(pn)
|
|
this.pages = []
|
|
for (p = 0; p < pn; p++) {
|
|
this.pages.push(p)
|
|
}
|
|
var sysData = []
|
|
|
|
for (i = 0; i < this.sysList.length; i++) {
|
|
var en = this.sysList[i]
|
|
if (i < this.pagenum) {
|
|
sysData.push(en)
|
|
}
|
|
|
|
}
|
|
this.sysEnumMains=sysData
|
|
|
|
|
|
},
|
|
},
|
|
created() {
|
|
this.dataType = GetQueryString("DataType");
|
|
this.fk_mapData = GetQueryString("FK_MapData");
|
|
this.webUser = new WebUser();
|
|
this.InitData();
|
|
}
|
|
});
|
|
|
|
|
|
var thePlugins = 'enum';
|
|
dialog.oncancel = function () {
|
|
if (UE.plugins[thePlugins].editdom) {
|
|
delete UE.plugins[thePlugins].editdom;
|
|
}
|
|
};
|
|
dialog.onok = function () {
|
|
var name = $.trim($("#TB_Name").val());
|
|
var KeyOfEn = $.trim($("#TB_KeyOfEn").val());
|
|
if (name == null || name.length == 0) {
|
|
$.messager.alert('错误', '字段名称不能为空。', 'error');
|
|
return false;
|
|
}
|
|
if (KeyOfEn == null || KeyOfEn.length == 0) {
|
|
$.messager.alert('错误', '英文字段不能为空。', 'error');
|
|
return false;
|
|
}
|
|
var dtlKey = "";
|
|
var selectEmum = Baseinfo.SelectEnum;
|
|
if (selectEmum.IsHaveDtl == "1") {
|
|
var v = window.confirm("您需要创建枚举值[" + name + "]的关联枚举字段吗?");
|
|
if (v == false)
|
|
dtlKey = "";
|
|
else {
|
|
dtlKey = prompt("请输入字段名(必须为字母开头、数字或者下划线组合):", KeyOfEn + "dtl");
|
|
if (dtlKey == null)
|
|
return;
|
|
Baseinfo.dataType = "Select";
|
|
}
|
|
|
|
}
|
|
var UIBindKey = selectEmum.EnumKey != "" ? selectEmum.EnumKey : selectEmum.No;
|
|
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_FoolFormDesigner");
|
|
handler.AddPara("KeyOfEn", KeyOfEn);
|
|
handler.AddPara("DtlKeyOfEn", dtlKey);
|
|
handler.AddPara("FK_MapData", Baseinfo.fk_mapData);
|
|
handler.AddPara("EnumKey", UIBindKey);
|
|
if (Baseinfo.dataType == "Radio")
|
|
handler.AddPara("UIContralType", 3);
|
|
else if (Baseinfo.dataType == "Select")
|
|
handler.AddPara("UIContralType", 1);
|
|
else if (Baseinfo.dataType == "CheckBox")
|
|
handler.AddPara("UIContralType", 2);
|
|
var data = handler.DoMethodReturnString("SysEnumList_SaveEnumField");
|
|
if (data.indexOf("err@") >= 0) {
|
|
alert(data);
|
|
return;
|
|
}
|
|
|
|
KeyOfEn = data.replace(Baseinfo.fk_mapData + "_", "");
|
|
var _Html = "";
|
|
var strs = [];
|
|
if (selectEmum.CfgVal != null && selectEmum.CfgVal != "") {
|
|
strs = selectEmum.CfgVal.split("@")
|
|
}
|
|
//单选按钮
|
|
if (Baseinfo.dataType == "Radio") {
|
|
if (strs.length != 0) {
|
|
_Html += "<span leipiplugins='enum' style='margin-top:1px;display:block;' id='SR_" + KeyOfEn + "' title='单选' name='leipiNewField' data-key='" + KeyOfEn + "' data-type='" + Baseinfo.dataType + "' data-bindKey='" + UIBindKey + "'>";
|
|
for (var i = 0; i < strs.length; i++) {
|
|
if (strs[i] == "")
|
|
continue;
|
|
var keyVal = strs[i].split("=")
|
|
if (keyVal.length == 2)
|
|
_Html += "<label style='vertical-align:middle;'><input type='radio' value= '" + keyVal[0] + "' id='RB_" + KeyOfEn + "_" + keyVal[0] + "' name='RB_" + KeyOfEn + "' data-key='" + KeyOfEn + "' data-type='" + Baseinfo.dataType + "' data-bindKey='" + UIBindKey + "' style='width:15px;height:15px;vertical-align:-1px;'/>" + keyVal[1] + " </label>";
|
|
}
|
|
_Html += "</span>";
|
|
}
|
|
}
|
|
if (Baseinfo.dataType == "Select") {
|
|
if (strs.length != 0) {
|
|
_Html += "<span leipiplugins='enum' id='SS_" + KeyOfEn + "' title='下拉框' name='leipiNewField' data-type='EnumSelect' data-bindKey='" + UIBindKey + "'>";
|
|
_Html += "<select id='DDL_" + KeyOfEn + "' name='DDL_" + KeyOfEn + "' data-type='EnumSelect' data-key='" + KeyOfEn + "' class='form-control' style='width:80%'>";
|
|
for (var i = 0; i < strs.length; i++) {
|
|
if (strs[i] == "")
|
|
continue;
|
|
var keyVal = strs[i].split("=")
|
|
if (keyVal.length == 2)
|
|
_Html += "<option value='" + keyVal[0] + "'>" + keyVal[1] + "</option>";
|
|
}
|
|
_Html += "</select>";
|
|
_Html += "</span>";
|
|
_Html += name;
|
|
//增加关联枚举值
|
|
if (selectEmum.IsHaveDtl == "1") {
|
|
var dtlUIBindKey = GetPara(selectEmum.AtPara, "DtlEnumKey");
|
|
var name = GetPara(selectEmum.AtPara, "DtlName");
|
|
_Html += "<span leipiplugins='enum' id='SS_" + dtlKey + "' title='下拉框' name='leipiNewField' data-type='EnumSelect' data-bindKey='" + dtlUIBindKey + "'>";
|
|
_Html += "<select id='DDL_" + dtlKey + "' name='DDL_" + dtlKey + "' data-type='EnumSelect' data-key='" + dtlKey + "' class='form-control' >";
|
|
//获取枚举信息
|
|
var no = dtlUIBindKey;
|
|
if (selectEmum.OrgNo != "")
|
|
no = selectEmum.OrgNo + "_" + no;
|
|
var sysEnumMain = new Entity("BP.Sys.SysEnumMain", no);
|
|
if (sysEnumMain.CfgVal != null && sysEnumMain.CfgVal != undefined)
|
|
strs = sysEnumMain.CfgVal.split("@");
|
|
else
|
|
strs = [];
|
|
for (var i = 0; i < strs.length; i++) {
|
|
if (strs[i] == "")
|
|
continue;
|
|
var keyVal = strs[i].split("=")
|
|
if (keyVal.length == 2)
|
|
_Html += "<option value='" + keyVal[0] + "'>" + keyVal[1] + "</option>";
|
|
}
|
|
_Html += "</select>";
|
|
_Html += "</span>";
|
|
_Html += name;
|
|
}
|
|
}
|
|
}
|
|
if (Baseinfo.dataType == "CheckBox") {
|
|
if (strs.length != 0) {
|
|
_Html += "<span leipiplugins='enum' style='margin-top:1px;display:block;' id='SC_" + KeyOfEn + "' title='复选框' name='leipiNewField' data-type='EnumCheckBox' data-key='" + KeyOfEn + "' data-bindKey='" + UIBindKey + "'>";
|
|
for (var i = 0; i < strs.length; i++) {
|
|
if (strs[i] == "")
|
|
continue;
|
|
var keyVal = strs[i].split("=")
|
|
if (keyVal.length == 2)
|
|
_Html += "<label style='vertical-align:middle;'><input type='checkbox' value= '" + keyVal[0] + "' id='CB_" + KeyOfEn + "_" + keyVal[0] + "' name='CB_" + KeyOfEn + "' data-type='" + Baseinfo.dataType + "' data-bindKey='" + UIBindKey + "' style='width:15px;height:15px;vertical-align:-1.5px;'/>" + keyVal[1] + " </label>";
|
|
}
|
|
_Html += "</span>";
|
|
_Html += name;
|
|
}
|
|
}
|
|
editor.execCommand('insertHtml', _Html);
|
|
};
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|