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.

420 lines
18 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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>
<link href="../../../Scripts/easyUI145/themes/icon.css" rel="stylesheet" type="text/css" />
<link href="../../../Scripts/easyUI145/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
<script src="../../../Scripts/easyUI145/jquery.min.js" type="text/javascript"></script>
<script src="../../../Scripts/easyUI145/jquery.easyui.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="../../../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../../../Comm/Gener.js" type="text/javascript"></script>
<script src="DDLBar.js" type="text/javascript"></script>
<script src="../../EnumLab.js"></script>
<script src="../../../Admin/Admin.js"></script>
<script language="javascript" type="text/javascript">
var frmID = GetQueryString("FrmID");
var ddlkeys = "";
var mapAttrs = "";
//页面启动函数.
$(function () {
$("#Msg").html("<img src=../../../Img/loading.gif />&nbsp;正在加载,请稍后......");
InitBar("SearchCond");
InitPage();
$("#Msg").html("");
});
function InitPage() {
mapAttrs = new Entities("BP.Sys.MapAttrs");
mapAttrs.Retrieve("FK_MapData", frmID,"GroupID,Idx");
var mapData = new Entity("BP.Sys.MapData", frmID);
var isSearchKey = mapData.GetPara("IsSearchKey") == "1" ? true : false;
document.getElementById("CB_Key_0").checked = isSearchKey;
document.getElementById("CB_Key_1").checked = isSearchKey == true ? false : true;
var StringSearchKeys = mapData.GetPara("StringSearchKeys");
var RptSearchKeys = mapData.GetPara("RptSearchKeys");
var DTSearchWay = mapData.GetPara("DTSearchWay");
var DTSearchKey = mapData.GetPara("DTSearchKey");
var DDLShowWays = mapData.GetPara("DDLShowWays"); //下拉框展示模式
//绑定外键字段.
var dateMapAttrs = [];
var count = 0;
var htmlFKeys = "<table>";
htmlFKeys += "<tr>";
htmlFKeys += "<th>字段</th>";
htmlFKeys += "<th>展示方式</th>";
htmlFKeys += "<th>是否单选</th>";
htmlFKeys += "<th>填充</th>";
htmlFKeys += "<th>级联关系</th>";
htmlFKeys += "</tr>";
for (var i = 0, length = mapAttrs.length; i < length; i++) {
var attr = mapAttrs[i];
if (attr.MyDataType == 6 || attr.MyDataType == 7) {
dateMapAttrs.push(attr);
continue;
}
if (attr.UIVisible == 0) {
continue;
}
//文本字段
if (attr.MyDataType == 1 && attr.UIContralType == 0) {
count++;
flag = false;
if (StringSearchKeys) {
flag = (StringSearchKeys.indexOf("*" + attr.KeyOfEn + ",") != -1);
}
$("#StringKeys").append("<input type='checkbox' " + (flag ? "checked = 'checked'" : "") + " id='" + attr.KeyOfEn + "' data-name='" + attr.Name + "'style='margin-right:3px'/><span for='" + attr.KeyOfEn + "' style='margin-right:3px'>" + attr.Name + "(" + attr.KeyOfEn + ")</span>&nbsp;&nbsp;&nbsp;");
if (count == 3) {
$("#StringKeys").append("<br/>");
count = 0;
}
continue;
}
if (attr.UIBindKey == "") {
continue;
}
ddlkeys += "'" + attr.UIBindKey + "',";
flag = false;
if (RptSearchKeys) {
flag = (RptSearchKeys.indexOf("*" + attr.KeyOfEn + "*") != -1);
}
htmlFKeys += "<tr>";
htmlFKeys += "<td>";
htmlFKeys += "<input class='ddl_field' type='checkbox' " + (flag ? "checked = 'checked'" : "") + " id='" + attr.KeyOfEn + "' style='margin-right:3px'/><span for='" + attr.KeyOfEn + "' >" + attr.Name + "(" + attr.KeyOfEn + ")</span>";
htmlFKeys += "</td>";
htmlFKeys += "<td>";
htmlFKeys += "<select id='"+attr.KeyOfEn+"_ShowWay'>";
htmlFKeys += "<option value=0>下拉框展示</option>";
htmlFKeys += "<option value=1>平铺展示</option>";
htmlFKeys += "</select>";
htmlFKeys += "</td>";
htmlFKeys += "<td>";
htmlFKeys += "<input type='checkbox' id='CB_" + attr.KeyOfEn + "' id='CB_" + attr.KeyOfEn + "' checked='checked'/>";
htmlFKeys += "</td>";
htmlFKeys += "<td>";
htmlFKeys += "<a href=\"javascript:AutoFullDLL('" + attr.KeyOfEn + "');\" >数据权限</a>";
htmlFKeys += "</td>";
htmlFKeys += "<td>";
htmlFKeys += "<a href=\"javascript:ActiveDDL('" + attr.KeyOfEn + "','"+attr.Name+"');\" >级联关系</a>";
htmlFKeys += "</td>";
htmlFKeys += "</tr>";
}
if (ddlkeys!="")
ddlkeys = ddlkeys.substring(0, ddlkeys.length - 1);
$("#FKeys").html(htmlFKeys); //("<input type='checkbox' " + (flag ? "checked = 'checked'" : "") + " id='" + attr.KeyOfEn + "' /><label for='" + attr.KeyOfEn + "' >" + attr.Name + "(" + attr.KeyOfEn + ")</label></br>");
//列表展示方式
var listShowWay = mapData.GetPara("ListShowWay");
listShowWay = listShowWay == null || listShowWay == undefined || listShowWay == "" ? 0 : listShowWay;
var listShowWayKey = mapData.GetPara("ListShowWayKey");
$("#DDL_ListShowWay").val(listShowWay);
ChageOption(listShowWay);
$("#DDL_ListShowWayKey").val(listShowWayKey);
if (DDLShowWays) {
var ddls = DDLShowWays.split("*");
$.each(ddls, function (i, item) {
if (item == "")
return true;
var strs = item.split("=");
if (strs.length == 2) {
if (strs[1].indexOf("_") != -1) {
var ss = strs[1].split("_");
$("#" + strs[0] + "_ShowWay").val(ss[0]);
if(ss[1]=="1")
$("#CB_" + strs[0]).prop('checked', 'checked');
else
$("#CB_" + strs[0]).prop('checked', '');;
return true;
}
$("#" + strs[0] + "_ShowWay").val(strs[1]);
}
})
}
$("#DDL_DTSearchWay").val(DTSearchWay);
//绑定日期下拉框.
if (dateMapAttrs != null) {
GenerBindDDL("DDL_DTSearchKey", dateMapAttrs, "KeyOfEn", "Name", DTSearchKey);
}
var hidenField = mapData.GetPara("HidenField");
while (hidenField && hidenField.indexOf("[%]") != -1)
hidenField = hidenField.replace("[%]", "%");
$("#TB_HidenField").val(hidenField);
var DTShowWay = mapData.GetPara("DTShowWay");
DTShowWay = DTShowWay == null || DTShowWay == undefined || DTShowWay == "" ? 0 : DTShowWay;
$("#DDL_DTShowWay").val(DTShowWay);
}
function ActiveDDL(key,name) {
var url = "./SearchCond/ActiveDDL.htm?FK_MapData=" + GetQueryString("FrmID") + "&KeyOfEn=" + key+"&Name="+name;
window.open(url);
}
function AutoFullDLL(key) {
var url = "./SearchCond/AutoFullDLL.htm?FK_MapData=" + GetQueryString("FrmID") + "&KeyOfEn=" + key;
window.open(url);
}
function Save() {
var mapData = new Entity("BP.Sys.MapData", frmID);
var IsSearchKey = document.getElementById("CB_Key_0").checked ? 1 : 0;
mapData.SetPara("IsSearchKey", IsSearchKey);
mapData.SetPara("DTSearchWay", document.getElementById("DDL_DTSearchWay").value);
mapData.SetPara("DTSearchKey", document.getElementById("DDL_DTSearchKey").value);
mapData.SetPara("DTSearchLabel", $("#DDL_DTSearchKey").find("option:selected").text());
var hidenField = $("#TB_HidenField").val();
hidenField = hidenField.replace(/%/g, '[%]');
mapData.SetPara("HidenField", hidenField);
var DDLShowWays = "";
var fields = "";
var oChecks = $(".ddl_field");
$.each(oChecks, function (i, item) {
if (item.checked) {
//获取展示方式
var showWay = $("#" + item.id + "_ShowWay").val();
fields += "*" + item.id;
var isRadioSelect = 0;
if ($("#CB_" + item.id)[0].checked == true)
isRadioSelect = 1;
DDLShowWays += "*" + item.id + "=" + showWay + "_" + isRadioSelect;
}
})
if (fields == "") {
mapData.SetPara("RptSearchKeys", "");
} else {
mapData.SetPara("RptSearchKeys", fields + "*");
}
if (DDLShowWays == "") {
mapData.SetPara("DDLShowWays", "");
} else {
mapData.SetPara("DDLShowWays", DDLShowWays + "*");
}
fields = "";
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("data-name");
}
}
if (fields == "") {
mapData.SetPara("StringSearchKeys", "");
} else {
mapData.SetPara("StringSearchKeys", fields + "*");
}
mapData.SetPara("DTShowWay", $("#DDL_DTShowWay").val());
mapData.SetPara("ListShowWay", $("#DDL_ListShowWay").val());
mapData.SetPara("ListShowWayKey", $("#DDL_ListShowWayKey").val());
mapData.Update();
Reload();
}
function changeStringKeysState(val) {
if (val == 0) {
$("#StringKeys input[type=checkbox]").attr("disabled", 'disabled');
$("#StringKeys input[type=checkbox]").removeAttr("checked");
}
if (val == 1) {
$("#StringKeys input[type=checkbox]").removeAttr("disabled");
}
}
function ChageOption(val) {
$("#DDL_ListShowWayKey").empty();
$("#DDL_ListShowWayKey").val("");
//列表展示
if (val == 0) {
$("#DDL_ListShowWayKey").append("<option value=''>不设置</option>");
}
//树形结构的展示
if (val == 1) {
//获取当前是树形结构的外键或者外部数据源
if (ddlkeys == null || ddlkeys == undefined || ddlkeys == "") {
$("#DDL_ListShowWay").val(0);
return;
}
var ens = new Entities("BP.Sys.SFTables");
ens.RetrieveCond("No", "IN", "(" + ddlkeys + ")");
if (ens.length == 0) {
$("#DDL_ListShowWay").val(0);
return;
}
$.each(ens, function (i, en) {
var attrs = $.grep(mapAttrs, function (mapAttr) {
return mapAttr.UIBindKey == en.No;
});
$.each(attrs, function (idx, attr) {
$("#DDL_ListShowWayKey").append("<option value='" + attr.KeyOfEn + "'>" + attr.Name + "</option>");
})
})
}
//级联的下拉框
if (val == 2) {
var ens = new Entities("BP.Sys.MapExts");
ens.Retrieve("FK_MapData", frmID, "ExtType", "ActiveDDLSearchCond");
if (ens.length == 0) {
$("#DDL_ListShowWay").val(0);
return;
}
$.each(ens, function (i, en) {
$("#DDL_ListShowWayKey").append("<option value='" + en.AttrOfOper+"'>"+en.Tag5+"</option>");
})
}
}
</script>
<base target="_self" />
</head>
<body>
<form id="cc">
<div id="bar">
</div>
<fieldset>
<legend>
<label><input type="radio" name="CB_Key" id="CB_Key_0" value="0" onchange="changeStringKeysState(this.value)" />全部关键字查询</label>
</legend>
<ul>
<li> 关键字查询是接受用户输入一个关键字在整个报表的显示列中使用like查询(外键、枚举、数值类型的除外)</li>
<li> 关键字搜索提示, 默认为:请输入关键字... </li>
<li> <a href="https://www.bilibili.com/video/BV15P4y1p7Sj" target="_blank" class="icon-camrecorder"><font color="blue">&nbsp;查询条件定义视频教程</font></a> </li>
<li>
<input id="TB_Alert" name="TB_Alert" type="text" value="" placeholder="例如:请输入电话、地址等关键字..." style="width:300px;" />
</li>
</ul>
<legend>
<label><input type="radio" name="CB_Key" id="CB_Key_1" value="1" onchange="changeStringKeysState(this.value)" />特定关键字查询</label>
</legend>
<ul>
<li>选择特定字段,在报表中根据 like 模糊查询 </li>
</ul>
<div id="StringKeys" style="margin-left:15px"> </div>
<legend>
外键与枚举
</legend>
<div id="FKeys"></div>
<legend> 展现方式</legend>
<table>
<tr>
<td> 选择方式</td>
<td>
<select name="DDL_ListShowWay" id="DDL_ListShowWay" onchange="ChageOption(this.value)">
<option selected="selected" value="0">经典列表结构</option>
<option value="1">树干叶子模式</option>
<option value="2">级联模式</option>
</select>
</td>
<td> 字段</td>
<td>
<select name="DDL_ListShowWayKey" id="DDL_ListShowWayKey">
</select>
</td>
</tr>
</table>
<legend> 时间段的查询</legend>
<table>
<tr>
<td> 选择方式</td>
<td>
<select name="DDL_DTSearchWay" id="DDL_DTSearchWay">
<option selected="selected" value="0">不启用</option>
<option value="1">按日期</option>
<option value="2">按日期时间</option>
</select>
</td>
<td> 字段</td>
<td>
<select name="DDL_DTSearchKey" id="DDL_DTSearchKey">
</select>
</td>
<td> 显示方式</td>
<td>
<select name="DDL_DTShowWay" id="DDL_DTShowWay">
<option selected="selected" value="0">字段方式(日期从,到)</option>
<option value="1">日期Tab页月份、季度、年度</option>
<option value="2">日期Tab页月份、季度、年度、自定义(未解析)</option>
</select>
</td>
</tr>
</table>
<legend> 增加隐藏查询条件</legend>
<ul>
<li>
1.数据源类型按SQL查询
<br /><font color="green"> WFState=1</font> 多个条件:<font color="green"> WFState=1 AND Starter=_WebUser.No</font>
<br /> <span>支持_+表达式变量.</span>
</li>
<li>
2.数据源类型按URL请求查询(仅支持Post请求的方式)
<br />隐藏的条件可以增加 &UserNo=_WebUser.No&WFState=1
</li>
<li>
3.数据源类型按存储过程请求查询:
<br /><font color="green"> WFState=1</font> 多个条件:<font color="green"> Starter=_WebUser.No,WFState=1</font>
<br /> <span>支持_+表达式变量</span>
</li>
</ul>
<input id="TB_HidenField" name="TB_HidenField" type="text" value="" placeholder="例如: WFState=1 AND Starter=_WebUser.No " style="width:98%" />
<legend>帮助 </legend>
<img src="SearchCond.png" class="HelpImg" />
</fieldset>
</form>
</body>
</html>