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.

511 lines
20 KiB
Plaintext

11 months ago
<!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 charset="UTF-8" />
<title>查询</title>
<!--jquery-->
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
<!--公共JS-->
<script src="../Scripts/QueryString.js" type="text/javascript"></script>
<script src="../Scripts/config.js" type="text/javascript"></script>
<script src="Gener.js" type="text/javascript"></script>
<script src="../Admin/CCFlowEnum.js" type="text/javascript"></script>
<link href="../Portal/icons/font-icons.min.css" rel="stylesheet" type="text/css" />
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<link href="../Scripts/layui/style/admin.css" rel="stylesheet" />
<script src="../Scripts/layui/layui/layui.js" type="text/javascript"></script>
<script src="../Scripts/layui/LayuiDialog.js" type="text/javascript"></script>
<script src="Search.js" type="text/javascript"></script>
<script src="../CCForm/MapExt2021.js" type="text/javascript"></script>
<!--serach页面JS开发接口-->
<script src="../../DataUser/JSLibData/SearchSelf.js" type="text/javascript"></script>
<script src="../../DataUser/JSLibData/CommonShowConfig.js"></script>
<script src="../Scripts/xss.js"></script>
<script src="../Scripts/layui/ext/xmSelect.js"></script>
<script src="../../DataUser/JSLibData/SearchAndEn.js"></script>
<style id="theme-data"></style>
<base target="_self" />
<style type="text/css">
.layui-form-label {
padding: 9px 0px;
width: auto;
}
.layui-form-label {
margin-bottom: 0px;
}
.layui-table th {
font-weight: bold;
}
.layui-table-col {
/* z-index: 989;
position: absolute;
left: 50px;
padding: 5px 0;*/
min-width: 150px;
min-height: 40px;
/* border: 1px solid #d2d2d2;*/
text-align: left;
overflow-y: auto;
background-color: #fff;
/*box-shadow: 0 2px 4px rgb(0 0 0 / 12%);*/
}
.layui-table-col li {
padding: 0 10px;
line-height: 30px;
-webkit-transition: .5s all;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.input-icon {
position: absolute;
left: calc(100% - 40px);
top: 1px;
width: 38px;
line-height: 36px;
text-align: center;
color: #d2d2d2;
}
.label-content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: revert !important;
}
.layui-table img {
max-width: 100%;
height: auto;
}
xm-select > .xm-body .xm-toolbar {
padding: 0 5px;
}
/* 按钮风格统一 */
.layui-btn {
background-color: #316ee6;
border-radius: 5px;
font-size: 14px;
padding: 0 10px;
height:26px;
line-height:26px;
}
.layui-laypage .layui-laypage-curr .layui-laypage-em {
background-color: #316ee6;
}
thead tr th div {
text-align: center;
}
tbody tr td{
text-align:center;
}
</style>
<script language="javascript" type="text/javascript">
var ensName = GetQueryString("EnsName");
var isClearSearchCond = getConfigByKey("IsClearSearchCond", false);
//定义公共个变量.
var webUser = new WebUser();
//查询的文本字段
var fields = [];
//用户查询信息的主键
var urMyPK = webUser.No + "_" + ensName + "_SearchAttrs";
var enPK = "";
//页面设置信息
var cfg = new Entity("BP.Sys.EnCfg");
cfg.No = ensName;
cfg.RetrieveFromDBSources();
var drillFields = cfg.Drill || "";
drillFields = drillFields.replace(/@/g, ",");
drillFields += ",";
var firstLoadTable = true;
//当前用户查询信息.
var ur = GetUserRegedit();
//获取当前用户选择的列
var cfield = new Entity("BP.Sys.CField");
cfield.SetPKVal(urMyPK);
cfield.RetrieveFromDBSources();
//页面分页信息显示
var count = ur.GetPara("RecCount");//查询总条数
var mapBase;
var pageIdx = this.GetQueryString("PageIdx");//当前页
if (pageIdx == null || pageIdx == undefined || pageIdx == 0)
pageIdx = 1;
var pageSize = cfg.GetPara("PageSize");
if (pageSize == null || pageSize == undefined || pageSize == 0)
pageSize = 10;//一页显示的行数
var pages = 1;//总页数
if (count % pageSize != 0)
pages = parseInt(count / pageSize) + 1;
else
pages = parseInt(count / pageSize);
if (pages == 0) pages = 1;
//页面字体大小
var fontSize = cfg.GetPara("FontSize");
if (fontSize == null || fontSize == undefined || fontSize == 0)
fontSize = 13;
//判断是否是多级表头
var isThrHeader = false; //是否是三级表头
var isSecHeader = false;//是否是二级表头
var thrMultiTitle = cfg.GetPara("MultiTitle1"); //三级表头的内容
var secMultiTitle = cfg.GetPara("MultiTitle");//二级表头的内容
var vtable = null;
var pageType = "search";
//获取用户的查询信息
function GetUserRegedit() {
var ur = new Entity("BP.Sys.UserRegedit");
ur.SetPKVal(urMyPK);
ur.RetrieveFromDBSources();
if (firstLoadTable != undefined && firstLoadTable == true) {
//清空Seach记录查询
if (isClearSearchCond == 1) {
ur.MyPK = urMyPK;
ur.SearchKey = "";
ur.AtPara = "";
ur.DTFrom = "";
ur.DTTo = "";
ur.FK_Emp = webUser.No;
ur.CfgKey = "SearchAttrs";
ur.Vals = "";
ur.FK_MapData = ensName;
ur.OrderBy = "";
ur.OrderWay = "";
ur.Save();
}
//获取Url传的查询Key值
var key = GetQueryString("Key");
if (key != null && key != undefined && firstLoadTable == true)
ur.SearchKey = key;
var dtFrom = GetQueryString("DTFrom");
if (dtFrom != null && dtFrom != undefined && firstLoadTable == true)
ur.DTFrom = dtFrom;
var dtTo = GetQueryString("DTTo");
if (dtTo != null && dtTo != undefined && firstLoadTable == true)
ur.DTTo = dtTo;
}
return ur;
}
//页面启动函数.
$(function () {
if (webUser.No == undefined) {
alert('登录信息丢失,请重新登录。');
return;
}
if (ensName == null || ensName == undefined) {
$("#Msg").html("必要的参数EnsName没有传入.");
return;
}
$("#Msg").html("<img src=../Img/loading.gif />&nbsp;正在加载,请稍后......");
$("#dialogExpFile").hide();
//处理多级表头的判断
if (thrMultiTitle == null || thrMultiTitle == undefined)
thrMultiTitle = "";
if (thrMultiTitle != "")
isThrHeader = true;
if (secMultiTitle == null || secMultiTitle == undefined)
secMultiTitle = "";
if (isThrHeader == false && secMultiTitle != "")
isSecHeader = true;
firstLoadTable = false;
layui.use(['table', 'laytpl', 'form', 'laydate'], function () {
var table = layui.table,
laytpl = layui.laytpl,
form = layui.form,
laydate = layui.laydate;
InitToolbar("search");
//按钮操作
$('.toolbar').on('click', function () {
var id = this.id;
switch (id) {
case "Search":
Search("search");
break;
case "BtnLab1":
executeFunction(cfg.BtnJS1, cfg.BtnLab1);
break;
case "BtnLab2":
executeFunction(cfg.BtnJS2, cfg.BtnLab2);
break;
case "BtnLab3":
executeFunction(cfg.BtnJS3, cfg.BtnLab3);
break;
case "Add":
New();
break;
case "Imp":
Imp();
break;
case "Setting":
Setting();
break;
default: break;
}
});
var focusField = "";
if (cfg.IsEnableFocusField == 1)
focusField = cfg.FocusField;
//OrderBys按RDT排序有问题
//var orderBys = {};
//if (ur.OrderBy != "")
// orderBys = { field: ur.OrderBy, type: ur.OrderWay };
//if (ur.OrderBy == "" && cfg.OrderBy != "")
// orderBys = { field: cfg.OrderBy.split(",")[0], type: cfg.IsDeSc == 1 ? 'desc' : 'asc' };
var data = SearchData("search");
//获取列
var cols = GetColoums(data, thrMultiTitle, secMultiTitle, cfg.ColorSet, cfg.OrderBy, focusField);
var tableData = transferHtmlData(data["DT"]);
//渲染table
var tableName = mapBase.EnDesc;
//防止出现跨域
try {
if (typeof window.top.vm != "undefined" && window.top.vm.tabsList.length > window.top.vm.selectedTabsIndex)
tableName = window.top.vm.tabsList[window.top.vm.selectedTabsIndex].name;
} catch (e) {
tableName = mapBase.EnDesc;
}
//主页面数据
vtable = table.render({
elem: '#tableSearch',
id: 'tableSearch',
data: tableData,
title: tableName,
limit: Number.MAX_VALUE,
height: $(document).height() - $("#toolbar").height() * 2 - 100,
cellMinWidth: 120,
cols: cols,
autoSort: false,
//initSort: orderBys,
page: false
});
renderLaypage();
//触发行双击事件
if (cfg.DoubleOrClickModel == 0) {
table.on('rowDouble(search)', function (obj) {
var row = obj.data;
var pkval = row[enPK];
var rowstr = JSON.stringify(row);
rowstr = encodeURIComponent(rowstr);
OpenEn(pkval, "", 0, rowstr, obj, "Edit");
});
}
if (cfg.DoubleOrClickModel == 1) {
table.on('row(search)', function (obj) {
var row = obj.data;
var pkval = row[enPK];
var rowstr = JSON.stringify(row);
rowstr = encodeURIComponent(rowstr);
OpenEn(pkval, "", 0, rowstr,obj);
});
}
table.on('tool(search)', function (obj) {
var data = obj.data;
$.each(dtMs, function (idx, dtm) {
if (obj.event == dtm.Title) {
DealRowBarOper(dtm, data);
}
});
//下载事件
if (obj.event == "downloadFile") {
downLoadFile(data[enPK]);
}
//下载事件
if (obj.event == "Btn_En1") {
var func1 = cfg.EnBtnJS1 || "";
if (func1 == "")
return;
func1 = func1.replace(/~/g, "'");
if (func1.indexOf("(") != -1)
func1 = func1.replace("@PKVal", data[enPK]);
else
func1 = func1 + "(" + data[enPK] + "," + JSON.stringify(data) + ")";
eval(func1);
}
if (obj.event == "Btn_En2") {
var func2 = cfg.EnBtnJS2;
if (func2 == null || func2 == undefined || func2 == "")
return;
func2 = func2.replace(/~/g, "'");
if (func2.indexOf("(") != -1)
func2 = func2.replace("@PKVal", data[enPK]);
else
func2 = func2 + "(" + data[enPK] + "," + JSON.stringify(data) + ")";
eval(func2);
}
});
table.on('sort(search)', function (obj) { //注sort 是工具条事件名test 是 table 原始容器的属性 lay-filter="对应的值"
orderBy = obj.field; //当前排序的字段名
orderWay = obj.type;//当前排序类型desc降序、asc升序、null空对象默认排序
//尽管我们的 table 自带排序功能,但并没有请求服务端。
//有些时候,你可能需要根据当前排序的字段,重新向服务端发送请求,从而实现服务端排序,如:
pageIdx = 1;
tableData = SearchData("search", orderBy, orderWay);
table.reload('tableSearch', { initSort: obj, data: transferHtmlData(tableData["DT"]) });
renderLaypage();
dropDownLayuiCols(tableData.Attrs);
});
dropDownLayuiCols(data.Attrs);
layui.form.on("checkbox(LAY_TABLE_TOOL_COLS)", function (e) {
var l = $(e.elem),
n = this.checked,
o = l.data("key"),
r = l.data("parentkey");
//增加隐藏显示的列
if (cfield.Attrs == "")
cfield.Attrs = ",";
if (n == false && cfield.Attrs.indexOf("," + l[0].name + ",") == -1)
cfield.Attrs = cfield.Attrs + l[0].name + ",";
//移除隐藏的列
else
cfield.Attrs = cfield.Attrs.replace(l[0].name + ",", "");
cfield.Update();
layui.each(vtable.config.cols, function (e, t) {
layui.each(t, function (t, l) {
if (e + "-" + t === o) {
var d = l.hide;
l.hide = !n;
var item = $("div[lay-id='tableSearch']").find('*[data-key="' + vtable.config.index + "-" + o + '"]');
if (l.hide == true)
item.addClass("layui-hide");
else
item.removeClass("layui-hide");
$("div[lay-id='tableSearch']").find(".laytable-cell-" + vtable.config.index + "-" + o).css("width", l.minWidth + "px");
}
});
});
})
});
});
function renderLaypage() {
//执行一个laypage实例
layui.laypage.render({
elem: 'page' //注意,这里的 page 是 ID不用加 # 号
, count: ur.GetPara("RecCount") //数据总数,从服务端得到
, limit: pageSize
, limits: [5, 10, 15, 20, 25]
, layout: ['prev', 'page', 'next', 'limit', 'skip', 'count']
, jump: function (obj, first) {
if (!first) {
pageIdx = obj.curr;
pageSize = obj.limit;
//刷新数据
var tableData = SearchData("search");
layui.table.reload('tableSearch', { data: transferHtmlData(tableData["DT"]) });
dropDownLayuiCols(tableData.Attrs);
}
}
});
$('#page').css('text-align', 'right'); // 分页右对齐
$('.layui-table-page').css('text-align', 'right'); //
}
</script>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row layui-col-space30">
<!-- 内容主体区域 -->
<div class="layui-col-md12" style="padding:20px 15px">
<div class="layui-card">
<div class="layui-card-body">
<!--查询条件-->
<div>
<form class="layui-form" id="toolbar">
</form>
</div>
<!--查询表格-->
<table class="layui-hide" id="tableSearch" lay-filter="search"></table>
<!--分页-->
<div style="height:40px">
<div style="float:left">
<ul class="pagination controls" style="margin-left:20px"><li class=" controls" id="JsResult"></li></ul>
</div>
<div style="float:right" id="page"></div>
</div>
<div id="laytable-col" class="layui-form"></div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
var theme = filterXSS(localStorage.getItem("themeColorInfo"));
if (theme == null || theme == undefined || theme == "")
return;
var data = JSON.parse(theme);
var styleScope = document.getElementById("theme-data");
var html = styleScope.innerHTML;
html += "\n .layui-btn{\n background-color:" + data.selectedMenu + ";\n}\n .layui-laypage .layui-laypage-curr .layui-laypage-em{\n background-color:" + data.selectedMenu + ";\n}";
html += "\n .layui-laypage input:focus,.layui-laypage select:focus{\n border-color:" + data.selectedMenu + " !important\n}";
html += "\n .layui-form-select dl dd.layui-this{\n background-color:" + data.selectedMenu + " !important;\n}";
html += "\n .layui-tab-title .layui-this{\n background-color:" + data.selectedMenu + " !important;\n} \n .layui-tab-title>.layui-this{\n color:#fff;\n} \n .layui-tab-title li {border: 1px solid " + data.selectedMenu + ";}";
html += "\n .layui-a-this{\n background-color:" + data.selectedMenu + ";\n color: #fff;\n}";
styleScope.innerHTML = filterXSS(html);
})
</script>
</body>
</html>