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.

338 lines
14 KiB
Plaintext

11 months ago
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>流程查询条件设置</title>
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<script src="/WF/Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<!--layui-->
<link href="../layuiadmin/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
<link href="../layuiadmin/layui/css/layui.css" rel="stylesheet" />
<link href="../layuiadmin/layui/css/modules/code.css" rel="stylesheet" />
<script src="../layuiadmin/layui/layui.js" type="text/javascript"></script>
<script src="../layuiadmin/layui/lay/modules/layer.js" type="text/javascript"></script>
<!--通用的JS-->
<script src="/WF/Scripts/config.js" type="text/javascript"></script>
<script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
<script src="/WF/Scripts/QueryString.js" type="text/javascript"></script>
<script src="/WF/Comm/Gener.js" type="text/javascript"></script>
<style type="text/css">
.layui-code-view {
border-left-width:1px !important;
}
.layui-form-radio * {
font-size: 12px;
}
.layui-code-h3, .layui-code-view{
font-size:14px
}
.layui-form-item{
margin-bottom:0px;
padding-left:20px;
background-color:white;
padding-bottom:10px;
}
</style>
<script language="javascript" type="text/javascript">
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitPage();
$("#Msg").html("");
});
var webUser = new WebUser();
var rptNo = "ND" + parseInt(GetQueryString("FK_Flow")) + "Rpt";
var searchType = GetQueryString("SearchType");
var ur;
function InitPage() {
if (searchType != "MyDept") {
$("#MyDept").hide();
}
//用户查询注册信息
ur = new Entity("BP.Sys.UserRegedit");
ur.MyPK = webUser.No + rptNo + "_SearchAttrs";
ur.RetrieveFromDBSources();
var handler = new HttpHandler("BP.Cloud.HttpHandler.App_OneFlow_RptSearch");
handler.AddPara("SearchType", "MyJoin");
handler.AddUrlData(); //增加参数.
//获取查询条件
var data = handler.DoMethodReturnString("FlowSearch_MapAttrs");
if (data.indexOf("err@") != -1) {
layer.alert(data);
console.log(data);
return;
}
data = JSON.parse(data);
//系统字段
var mapAttrOfSys = data["Sys_MapAttrOfSystem"];
//流程所有字段
var mapAttrOfAll = data["Sys_MapAttr"];
//系统字段字符串
var sysFields = data["Sys_Fields"][0].Field;
//表单字段
var mapAttrOfFrm = $.grep(mapAttrOfAll, function (item) {
if (item.UIContralType != 0 && item.UIContralType != 1 && item.UIContralType != 2 && item.UIContralType != 3)
return true;
if (sysFields.indexOf("," + item.KeyOfEn + ",") != -1)
return true;
return false;
}, true);
var mapAttrs = mapAttrOfFrm.concat(mapAttrOfSys);
var mapAttrOfData=[];
//基础信息
//是否关键字查询
var isSearchKey = true;
if (ur.GetPara("IsSearchKeys") == "0")
isSearchKey = false;
if (isSearchKey == true)
$("#StringKeys").hide();
document.getElementById("key_0").checked = isSearchKey;
document.getElementById("key_1").checked = isSearchKey == true ? false : true;
document.getElementById("CB_NextLeavel").checked = (ur.AtPara.indexOf("@IsSearchNextLeavel=1@") != -1);
//获取设置的值
var StringSearchKeys = ur.GetPara("StringSearchKeys");
var rptDLLSearchKeys = ur.GetPara("RptDDLSearchKeys");
var DTSearchWay = ur.GetPara("DTSearchWay");
var DTSearchKey = ur.GetPara("DTSearchKey");
//绑定外键字段.
var disabled = "";
if (isSearchKey == true)
disabled = " disabled=disabled ";
var flag = false;
$.each(mapAttrs, function (i, item) {
if (item.MyDataType == 6 || item.MyDataType == 7) {
mapAttrOfData.push(item);
return true;
}
//文本字段
if (item.MyDataType == 1 && item.UIContralType == 0) {
//count++;
flag = false;
if (StringSearchKeys) {
flag = (StringSearchKeys.indexOf("*" + item.KeyOfEn + ",") != -1);
}
$("#StringKeys").append("<input type='checkbox' " + disabled + (flag ? " checked = 'checked'" : "") + " id='" + item.KeyOfEn + "' lay-skin='primary' title='" + item.Name + "'/><br/>");
return true;
}
if (item.UIContralType == 1 || item.UIContralType == 3) {
if (rptDLLSearchKeys) {
flag = (rptDLLSearchKeys.indexOf("*" + item.KeyOfEn + "*") != -1);
}
$("#FKeys").append("<input type='checkbox' " + (flag ? "checked = 'checked'" : "") + " id='" + item.KeyOfEn + "' lay-skin='primary' title='" + item.Name + "' /></br>");
}
})
$("#DDL_DTSearchWay").val(DTSearchWay);
//绑定日期下拉框.
if (mapAttrOfData != null) {
GenerBindDDLAppend("DDL_DTSearchKey", mapAttrOfData, "KeyOfEn", "Name");
}
return;
}
function Save() {
ur = new Entity("BP.Sys.UserRegedit");
ur.MyPK = webUser.No + rptNo + "_SearchAttrs";
ur.RetrieveFromDBSources();
var FK_Flow = GetQueryString("FK_Flow"),
RptNo = GetQueryString("RptNo"),
IsSearchKey = document.getElementById("key_0").checked ? 1 : 0,
DTSearchWay = document.getElementById("DDL_DTSearchWay").value,
DTSearchKey = document.getElementById("DDL_DTSearchKey").value,
fields = "";
//获得外键.
var oChecks = document.getElementById("FKeys").getElementsByTagName("input");
for (var i = 0, len = oChecks.length; i < len; i++) {
var item = oChecks[i];
if (item.checked) {
fields += "*" + item.id;
}
}
ur.SetPara("RptDDLSearchKeys", fields+"*");
ur.SetPara("IsSearchKeys", IsSearchKey);
fields = "";
if (IsSearchKey == 0) {
oChecks = document.getElementById("StringKeys").getElementsByTagName("input");
for (var i = 0, len = oChecks.length; i < len; i++) {
var item = oChecks[i];
if (item.checked) {
fields += "*" + item.id + "," + item.getAttribute("title");
}
}
if (fields != "")
fields = fields + "*";
}
ur.SetPara("StringSearchKeys", fields);
ur.SetPara("DTSearchWay", DTSearchWay);
ur.SetPara("DTSearchKey", DTSearchKey);
ur.SetPara("IsSearchNextLeavel", document.getElementById("CB_NextLeavel").checked ? 1 : 0);
ur.Update();
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
// parent.layui.index.openTabsPage("/App/OneFlow/RptSearch.htm?SearchType="+searchType+"&FK_Flow="+GetQueryString("FK_Flow"));
// $("#LAY_app_body .layadmin-tabsbody-item .layui-show", window.parent).reload();
//parent.location.reload();
//parent.OpenWindowRight("/App/OneFlow/RptSearch.htm?SearchType=" + searchType + "&FK_Flow=" + GetQueryString("FK_Flow"), "我发起的");
$(".layui-nav-tree",window.parent.document).find("li").find("dd[data-name=MyStartFlows]").find("a").click();
parent.layer.closeAll(); //再执行关闭
}
//获得所有的checkbox 的id组成一个string用逗号分开, 以方便后台接受的值保存.
function GetSelectedCheckIDs() {
var checkBoxIDs = "";
var arrObj = document.getElementsByTagName("input");
for (var i = 0, len = arrObj.length; i < len; i++) {
if (arrObj[i].type == 'checkbox') {
if (arrObj[i].checked)
checkBoxIDs += arrObj[i].id + ',';
}
}
return checkBoxIDs;
}
</script>
<base target="_self" />
</head>
<body>
<div class="layui-card" style="height:95%">
<div class="layui-card-header">查询条件设置</div>
<div class="layui-card-body" style="overflow-y:auto;height:630px">
<form class="layui-form">
<div style="position: relative;margin-top: 15px;">
<div class="layui-code layui-box layui-code-view">
<h3 class="layui-code-h3">字段String类型查询</h3>
<div class="layui-form-item">
<input type="radio" name="key" lay-filter="keyM" id="key_0" value="0" title="是否增加关键字查询" checked>
<br />
<input type="radio" name="key" lay-filter="keyM" id="key_1" value="1" title="是否增加特定字段的查询">
<br />
<div id="StringKeys" style="margin-left:15px"> </div>
</div>
</div>
<div class="layui-code layui-box layui-code-view">
<h3 class="layui-code-h3">外键与枚举类型</h3>
<div class="layui-form-item">
<span style="font-size:12px">外键、枚举类型的数据可以添加到查询条件中,请选择要添加的查询条件:</span><br />
<div id="FKeys"></div>
</div>
</div>
<div class="layui-code layui-box layui-code-view">
<h3 class="layui-code-h3">时间段</h3>
<div class="layui-form-item">
<span style="font-size:12px">对数据按照时间段进行查询,比如:按流程的发起时间,在指定时间段内进行查询。</span><br />
<div class="layui-inline">
<label class="layui-form-label" style="width:60px;padding:9px 15px 9px 0px">选择方式</label>
<div class="layui-input-inline">
<select name="DDL_DTSearchWay" id="DDL_DTSearchWay" style="width:140px">
<option value="0">不启用</option>
<option value="1">按日期</option>
<option value="2">按日期时间</option>
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width:40px">字段</label>
<div class="layui-input-inline">
<select name="DDL_DTSearchKey" id="DDL_DTSearchKey" style="width:160px"></select>
</div>
</div>
</div>
</div>
<div class="layui-code layui-box layui-code-view" id="MyDept">
<h3 class="layui-code-h3">是否查询子级部门</h3>
<div class="layui-form-item">
<span style="font-size:12px">子级部门查询是查询这个子级部门的下一级<br /></span>
<input id="CB_NextLeavel" type="checkbox" name="CB_NextLeavel" lay-skin="primary" title="是否查询子级部门" />
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<input type="button" class="layui-btn" onclick="Save()" value="保存" />
</div>
</div>
</div>
</form>
</div>
</div>
<script type="text/javascript">
layui.use(['form', 'element'], function () {
var form = layui.form;
form.on("radio(keyM)", function (data) {
var val = data.value;
if (val == 0) {
$("#StringKeys input[type=checkbox]").attr("disabled", 'disabled');
$("#StringKeys input[type=checkbox]").next().addClass('layui-checkbox-disbaled layui-disabled');
$("#StringKeys input[type=checkbox]").removeAttr("checked");
$("#StringKeys input[type=checkbox]").next().removeClass('layui-form-checked');
$("#StringKeys").hide();
}
if (val == 1) {
$("#StringKeys input[type=checkbox]").removeAttr("disabled");
$("#StringKeys input[type=checkbox]").next().removeClass('layui-checkbox-disbaled layui-disabled');
$("#StringKeys").show();
}
});
});
</script>
</body>
</html>