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.

306 lines
10 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>方向条件-独立表单字段条件</title>
<script type="text/javascript" src="../../Scripts/bootstrap/js/jquery.min.js"></script>
<script type="text/javascript" src="../../Scripts/bootstrap/js/bootstrap.min.js"></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/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
<link href="../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<link href="../../Style/skin/css/Default.css" rel="stylesheet" />
<link href="../../Style/skin/adminfont/iconfont.css" rel="stylesheet" />
<link href="../../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script src="../Admin.js" type="text/javascript"></script>
<base target="_self" />
<script type="text/javascript">
function Esc() {
if (event.keyCode == 27)
window.close();
return true;
}
var OperForString = null;
var OperForNumber = null;
//初始化页面函数.....
$(function () {
//两者都隐藏.
document.getElementById("TB_Val").style.display = "none";
document.getElementById("DDL_Val").style.display = "none";
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
handler.AddUrlData();
var data = handler.DoMethodReturnString("StandAloneFrm_Init");
if (data.indexOf('err@') == 0) {
$("#Msg").html("<font color=red>加载失败:<br>" + data + "</font> .");
return;
}
//转json.
data = JSON.parse(data);
var frms = data.Frms;
if (frms.length <= 1) {
alert("非多表单或只绑定了一个独立表单")
Back();
return;
}
GenerBindDDL("DDL_Frms", frms, "No", "Name", "all");
var cond = data["WF_Cond"];
if (cond != null && cond != undefined) {
cond = cond[0];
var frmID = cond.FK_Attr.replace("_" + cond.AttrKey, "");
$("#DDL_Frms").val(frmID);
changeForm($("#DDL_Frms")[0]);
$("#DDL_Fields").val(cond.AttrKey);
changeCond($("#DDL_Fields")[0]);
$("#DDL_Operator").val(getOperText(cond.FK_Operator));
$("#TB_Val").val(cond.OperatorValue);
}
});
function getOperText(Oper) {
if (Oper == "")
return "all";
switch (Oper) {
case "=":
return "dengyu";
case ">":
return "dayu";
case ">=":
return "dayudengyu";
case "<":
return "xiaoyu";
case "<=":
return "xiaoyudengyu";
case "!=":
return "budengyu"
case "LIKE":
return "like";
default:
return "all";
}
}
//执行保存..
function Save() {
var DDL_Fields = $("#DDL_Fields").val(); // 字段.
var DDL_Operator = $("#DDL_Operator").val(); // 操作符.
var OperVal = "";
var tb = document.getElementById("TB_Val");
if (tb.style.display == "") {
OperVal = tb.value;
} else {
OperVal = $("#DDL_Val").val(); // 操作符.
}
var DDL_Frms = $("#DDL_Frms").val();
if (typeof DDL_Frms == "undefined" || DDL_Frms == "" || DDL_Frms == "all") {
alert("请选择独立表单");
return;
} else if (typeof DDL_Fields == "undefined" || DDL_Fields == "") {
alert("请选择表单字段");
return;
} else if (typeof OperVal == "undefined" || OperVal == "") {
alert("请选择操作符");
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
handler.AddPara("DDL_Fields", DDL_Fields);
handler.AddPara("DDL_Operator", DDL_Operator);
handler.AddPara("OperVal", OperVal);
handler.AddUrlData();
handler.AddPara("FrmID", $("#DDL_Frms").val()); //表单ID.
handler.AddFormData();
var data = handler.DoMethodReturnString("StandAloneFrm_Save");
if (data.indexOf('err@') == 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
if (data.indexOf('url@') == 0) {
var url = data.replace('url@', '');
SetHref(url);
return;
}
alert("保存成功");
Back();
}
function changeForm(s) {
var value = $(s).val();
if (value == "all") {
$("#DDL_Fields").empty();
$("#DDL_Fields").trigger("change");
} else {
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
handler.AddPara("FrmID", value);
var data = handler.DoMethodReturnString("StandAloneFrm_InitFrmAttr");
if (data) {
GenerBindDDL("DDL_Fields", JSON.parse(data), "KeyOfEn", "Name");
$("#DDL_Fields").trigger("change");
}
}
}
//当字段选择的时候.
function changeCond(c) {
if (c == null || c.value.length == 0 || c.value == "all") {
$("#DDL_Operator").empty();
return;
}
var key = c.value;
var fk_flow = GetQueryString("FK_Flow");
var handler = new HttpHandler("BP.WF.HttpHandler.WF_Admin_Cond");
handler.AddPara("KeyOfEn", key);
handler.AddPara("FK_Flow", fk_flow);
handler.AddPara("FrmID", $("#DDL_Frms").val());
var data = handler.DoMethodReturnString("StandAloneFrm_InitField");
if (data.indexOf('err@') == 0) {
$("#Msg").html("<font color=red>" + data + "</font>");
return;
}
if (data.indexOf('url@') == 0) {
var url = data.replace('url@', '');
SetHref(url);
return;
}
data = JSON.parse(data);
//获得 mapattr.
var mapattr = data["Sys_MapAttr"][0];
//操作符.
var opers = data["Opers"];
//两者都隐藏.
document.getElementById("TB_Val").style.display = "none";
document.getElementById("DDL_Val").style.display = "none";
if (mapattr.LGType == "1") {
/*是枚举类型*/
var enums = data["Enums"];
GenerBindDDL("DDL_Val", enums, "IntKey", "Lab", 0);
//显示.
document.getElementById("DDL_Val").style.display = "";
} else {
document.getElementById("TB_Val").style.display = "";
}
//绑定操作符.
GenerBindDDL("DDL_Operator", opers, "No", "Name", "=");
}
//返回.
function Back() {
var url = GetHrefUrl();
url = url.replace('StandAloneFrm.htm', 'List.htm');
if (url.indexOf("MyPK=") != -1) {
url = url.replace("&MyPK=" + GetQueryString("MyPK"), "");
}
SetHref(url);
}
</script>
</head>
<body onkeypress="Esc();">
<div class="container-full">
<div class="attrnode-bar-header">
<span class="pull-right">
<button class="cc-btn-tab btn-save" onclick='Save();' />保存</button>
<button id="Btn_Back" name="Btn_Back" onclick="Back();">返回</button>
</span>
<strong>按照独立表单做方向条件</strong>
</div>
<form id="cc">
<table id="table" class="table">
<tr>
<td style="width: 20%;">
选择独立表单:
</td>
<td>
<select id="DDL_Frms" name="DDL_Frms" style="width: 400px;" onchange="changeForm(this)">
</select>
</td>
</tr>
<tr>
<td style="width: 20%;">
选择表单字段:
</td>
<td>
<select id="DDL_Fields" name="DDL_Fields" style="width: 400px;" onchange="changeCond(this)">
</select>
</td>
</tr>
<tr>
<td style="width: 20%;">
操作符:
</td>
<td>
<select id="DDL_Operator" name="DDL_Operator" style="width: 100px;">
</select>
</td>
</tr>
<tr>
<td style="width: 20%;">
值:
</td>
<td>
<input type="text" value="" style="width: 100px;" id="TB_Val" name="TB_Val" />
<br />
<select id="DDL_Val" name="DDL_Val" style="width: 100px;">
</select>
</td>
</tr>
<!-- <tr>
<td></td>
<td>
<input type='button' value='保存' class="cc-btn-tab" onclick='Save();' />
</td>
</tr>-->
</table>
</form>
<center>
<div id="Msg" />
</center>
</div>
</body>
</html>