|
|
<!DOCTYPE html>
|
|
|
<html>
|
|
|
<head>
|
|
|
<meta charset="utf-8">
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
<title>列表</title>
|
|
|
<link href="../Scripts/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
|
|
|
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.css" rel="stylesheet"
|
|
|
type="text/css" />
|
|
|
<link href="../Scripts/bootstrap/css/style.min.css" rel="stylesheet" type="text/css"
|
|
|
media="all" />
|
|
|
<!--jquery-->
|
|
|
<script src="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/layui/layui/lay/modules/layer.js"></script>
|
|
|
<link href="../Scripts/layui/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
|
|
|
<!--bootstrap-table-->
|
|
|
<script src="../Scripts/bootstrap/bootstrap-table/src/bootstrap-table.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/bootstrap/bootstrap-table/src/locale/bootstrap-table-zh-CN.js"
|
|
|
type="text/javascript"></script>
|
|
|
<script src="../Scripts/bootstrap/BootstrapUIDialog.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/bootstrap/bootstrap-paginator/js/bootstrap-paginator.js"
|
|
|
type="text/javascript"></script>
|
|
|
<!--bootstrap列拖拽-->
|
|
|
<script src="../Scripts/bootstrap/bootstrap-table/src/colResizable-1.6.min.js"></script>
|
|
|
<script src="../Scripts/bootstrap/bootstrap-table/src/extensions/resizable/bootstrap-table-resizable.js"></script>
|
|
|
|
|
|
<!--公共JS-->
|
|
|
<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 language="JavaScript" src="../Comm/JScript.js" type="text/javascript"></script>
|
|
|
<script src="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
|
|
|
<link href="../Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
|
|
|
<link href="../Comm/Style/Search.css" rel="stylesheet" />
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
var webUser = null;
|
|
|
var frmDict = null;
|
|
|
var frmID;
|
|
|
var fields = []; //字符型字段查询的集合
|
|
|
var ur;//当前用户的查询信息
|
|
|
var pageIdx = 1;
|
|
|
|
|
|
//分页信息
|
|
|
var count = 0;//总条数
|
|
|
var pageSize = 10;//一页10条
|
|
|
var pages = 1; //总页数
|
|
|
|
|
|
var firstLoadTable = false;
|
|
|
|
|
|
//判断是否是多级表头
|
|
|
var isThrHeader = false; //是否是三级表头
|
|
|
var isSecHeader = false;//是否是二级表头
|
|
|
var thrMultiTitle = ""; //三级表头的内容
|
|
|
var secMultiTitle = "";//二级表头的内容
|
|
|
|
|
|
//初始化页面
|
|
|
$(function () {
|
|
|
InitPage();
|
|
|
});
|
|
|
function InitPage() {
|
|
|
webUser = new WebUser();
|
|
|
if (webUser.No == null)
|
|
|
return;
|
|
|
|
|
|
frmID = GetQueryString("FrmID");
|
|
|
|
|
|
pageIdx = GetQueryString("PageIdx");//当前页
|
|
|
|
|
|
frmDict = new Entity("BP.CCBill.FrmDict", frmID);
|
|
|
document.title = frmDict.Name;
|
|
|
|
|
|
//当前用户查询信息.
|
|
|
ur = new Entity("BP.Sys.UserRegedit");
|
|
|
ur.MyPK = webUser.No+ frmID + "_SearchAttrs";
|
|
|
ur.RetrieveFromDBSources();
|
|
|
|
|
|
pageSize = ur.GetPara("PageSize");
|
|
|
if (pageSize == "" || pageSize == undefined)
|
|
|
pageSize = "10";
|
|
|
|
|
|
//处理多级表头的判断
|
|
|
thrMultiTitle = frmDict.GetPara("MultiTitle1"); //三级表头的内容
|
|
|
secMultiTitle = frmDict.GetPara("MultiTitle");//二级表头的内容
|
|
|
|
|
|
if (thrMultiTitle == null || thrMultiTitle == undefined)
|
|
|
thrMultiTitle = "";
|
|
|
if (thrMultiTitle != "")
|
|
|
isThrHeader = true;
|
|
|
|
|
|
if (secMultiTitle == null || secMultiTitle == undefined)
|
|
|
secMultiTitle = "";
|
|
|
if (isThrHeader == false && secMultiTitle != "")
|
|
|
isSecHeader = true;
|
|
|
//初始化查询条件
|
|
|
Init_ToolBar();
|
|
|
|
|
|
//显示查询数据
|
|
|
BindTable();
|
|
|
|
|
|
$("td").on("mouseover", function () {
|
|
|
if (this.offsetWidth < this.scrollWidth) {
|
|
|
var that = this;
|
|
|
var text = $(this).text();
|
|
|
layer.tips(text, that, {
|
|
|
tips: 1,
|
|
|
time: 0
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
$("td").on("mouseout", function () {
|
|
|
layer.closeAll();
|
|
|
});
|
|
|
|
|
|
if (pageIdx == null || pageIdx == undefined || pageIdx == "")
|
|
|
pageIdx = 1;
|
|
|
//分页
|
|
|
Paginator(pages, pageIdx);
|
|
|
};
|
|
|
|
|
|
|
|
|
function Init_ToolBar() {
|
|
|
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
|
|
|
handler.AddPara("FrmID", frmID);
|
|
|
var data = handler.DoMethodReturnString("Search_ToolBar");
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
$("#Msg").html(data);
|
|
|
return;
|
|
|
}
|
|
|
var data = JSON.parse(data);
|
|
|
|
|
|
//单据表单属性
|
|
|
var mapData = data.Sys_MapData;
|
|
|
var attrs = data.Attrs;
|
|
|
|
|
|
var html = "";
|
|
|
|
|
|
html += "<tr>";
|
|
|
var atPara = mapData[0].AtPara;
|
|
|
|
|
|
var count = 0;//计算是否换行
|
|
|
|
|
|
var stringSearchKeys = GetPara(atPara, "RptStringSearchKeys");
|
|
|
if (stringSearchKeys != null && stringSearchKeys != undefined && stringSearchKeys != "") {
|
|
|
var strs = stringSearchKeys.split("*");
|
|
|
var fieldV = ""
|
|
|
$.each(strs, function (i, str) {
|
|
|
if (str != "") {
|
|
|
var item = str.split(",");
|
|
|
fieldV = ur.GetPara(fields[0]);
|
|
|
if (fieldV == null || fieldV == undefined)
|
|
|
fieldV = "";
|
|
|
if (item.length == 2) {
|
|
|
|
|
|
fields.push(item[0]);
|
|
|
html += "<td><label style='text-align: right; margin-top:5px;margin-left:5px;' for='TB_" + item[0] + "'>" + item[1] + ":  </label></td>"
|
|
|
html += "<td align='left'><input style='width:100%;' type=text id='TB_" + item[0] + "' name='TB_" + item[0] + "' value='" + fieldV + "' class='form-control' /></td>";
|
|
|
count++;
|
|
|
if (count == 4) {
|
|
|
html += "</tr>";
|
|
|
html += "<tr>";
|
|
|
count = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else if (GetPara(atPara, "IsSearchKey") == "1") {
|
|
|
|
|
|
var keyLabel = GetPara(atPara, "DTSearchLabel");
|
|
|
var keyLabel = "关键字";
|
|
|
html += "<td><label style='text-align: right; margin-top:5px;margin-left:5px;' for='TB_Key'>" + keyLabel + ":  </label></td>"
|
|
|
html += "<td align='left'><input style='width:100%;' type=text id='TB_Key' placeholder='请输入关键字...' name='TB_Key' value='" + ur.SearchKey + "' class='form-control' /></td>";
|
|
|
count++;
|
|
|
}
|
|
|
|
|
|
if (GetPara(atPara, "DTSearchWay") != "0") {
|
|
|
|
|
|
var dtFrom = GetPara(atPara, "DTSearchLabel");
|
|
|
if (dtFrom == undefined)
|
|
|
dtFrom = '日期从';
|
|
|
|
|
|
html += "<td align='right'><label style='text-align: right; margin-top:5px;padding-left:20px;'>" + dtFrom + ":</label></td>";
|
|
|
|
|
|
if (GetPara(atPara, "DTSearchWay") == "1") {
|
|
|
html += "<td align='left' style='width:120px'><input type=text id='TB_DTFrom' name='TB_DTFrom' value='" + ur.DTFrom + "' onfocus=\"WdatePicker({dateFmt:'yyyy-MM-dd'})\" style='width:120px;' class='form-control Wdate' /></td>";
|
|
|
html += "<td align='right'><label>到 </label></td><td align='left'><input type=text id='TB_DTTo' name='TB_DTTo' value='" + ur.DTTo + "' onfocus=\"WdatePicker({dateFmt:'yyyy-MM-dd'})\" style='width:120px;' class='form-control Wdate' /></td>";
|
|
|
} else {
|
|
|
html += "<td align='left' style='width:160px'><input type=text id='TB_DTFrom' name='TB_DTFrom' value='" + ur.DTFrom + "' onfocus=\"WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});\" style='width:160px;' class='form-control Wdate' /></td>";
|
|
|
html += "<td align='right'><label>到 </label></td><td align='left'><input type=text id='TB_DTTo' name='TB_DTTo' value='" + ur.DTTo + "' onfocus=\"WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});\" style='width:160px;' class='form-control Wdate' /></td>";
|
|
|
}
|
|
|
|
|
|
count = count + 2
|
|
|
if (count == 4 || count > 4) {
|
|
|
html += "</tr>";
|
|
|
html += "<tr>";
|
|
|
count = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//格式为: @WFSta=0@FK_Dept=02
|
|
|
var json = AtParaToJson(ur.Vals);
|
|
|
|
|
|
for (var i = 0; i < attrs.length; i++) {
|
|
|
var attr = attrs[i];
|
|
|
var W = attr.Width;
|
|
|
if (attr.Width >= 1000) {
|
|
|
html += "</tr>";
|
|
|
html += "<tr>";
|
|
|
W = 130;
|
|
|
}
|
|
|
html += "<td align='right'><label style='text-align: right; margin-top:5px;margin-left:5px;' for='DDL_" + attr.Field + "'>" + attr.Name + ":</label></td>";
|
|
|
html += "<td align='left'><select class='form-control' style='margin-top:5px;width:100%;' name='DDL_" + attr.Field + "' ID='DDL_" + attr.Field + "'>" + InitDDLOperation(data, attr, "all") + "</select></td>";
|
|
|
count++
|
|
|
if (count == 4) {
|
|
|
html += "</tr>";
|
|
|
html += "<tr>";
|
|
|
count = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//增加按钮.
|
|
|
html += '<td align="left" colspan=2 style="padding-top:4px"><a href="#"class="btn btn-primary btn-sm" style="margin-left:20px" id="Btn_Search" onclick="Search()">查询</a> ';
|
|
|
html += "</td></tr>";
|
|
|
|
|
|
html += "</table>";
|
|
|
|
|
|
$("#toolBar").append(html);
|
|
|
}
|
|
|
|
|
|
//初始化下拉列表框的OPERATION
|
|
|
function InitDDLOperation(frmData, mapAttr, defVal) {
|
|
|
|
|
|
var operations = "";
|
|
|
operations += "<option value='all' >全部</option>";
|
|
|
|
|
|
var ens = frmData[mapAttr.Field];
|
|
|
if (ens == null) {
|
|
|
ens = [{ 'IntKey': 0, 'Lab': '否' }, { 'IntKey': 1, 'Lab': '是' }];
|
|
|
}
|
|
|
for (var i = 0; i < ens.length; i++) {
|
|
|
|
|
|
var en = ens[i];
|
|
|
|
|
|
if (en.No == undefined)
|
|
|
operations += "<option value='" + en.IntKey + "'>" + en.Lab + "</option>";
|
|
|
else
|
|
|
operations += "<option value='" + en.No + "'>" + en.Name + "</option>";
|
|
|
}
|
|
|
return operations;
|
|
|
}
|
|
|
|
|
|
|
|
|
//执行查询.
|
|
|
function Search() {
|
|
|
|
|
|
//保存查询条件.
|
|
|
|
|
|
ur = new Entity("BP.Sys.UserRegedit");
|
|
|
ur.MyPK = webUser.No+ frmID + "_SearchAttrs";
|
|
|
ur.FK_Emp = webUser.No;
|
|
|
|
|
|
if ($("#TB_Key") != null && $("#TB_Key").val() != "" && fields.length == 0)
|
|
|
ur.SearchKey = $("#TB_Key").val();
|
|
|
else
|
|
|
ur.SearchKey = "";
|
|
|
|
|
|
//设置查询时间.
|
|
|
if ($("#TB_DTFrom").length == 1)
|
|
|
ur.DTFrom = $("#TB_DTFrom").val();
|
|
|
|
|
|
if ($("#TB_DTTo").length == 1)
|
|
|
ur.DTTo = $("#TB_DTTo").val();
|
|
|
|
|
|
//获得外键的查询条件,存储里面去.
|
|
|
var str = "";
|
|
|
$("select[name^='DDL_']").each(function () {
|
|
|
var id = $(this).attr("id");
|
|
|
id = id.replace("DDL_", "");
|
|
|
str += "@" + id + "=" + $(this).val();
|
|
|
});
|
|
|
|
|
|
//增加字段查询
|
|
|
for (var i = 0; i < fields.length; i++) {
|
|
|
var field = fields[i];
|
|
|
var strs = $("input[name='TB_" + field + "']");
|
|
|
if (strs.length == 1) {
|
|
|
ur.SetPara(field, $("#TB_" + field).val());
|
|
|
} else {
|
|
|
if ($("#TB_" + field + "_0").val() == "" && $("#TB_" + field + "_1").val() == "")
|
|
|
ur.SetPara(field, "");
|
|
|
else
|
|
|
ur.SetPara(field, $("#TB_" + field + "_0").val() + "," + $("#TB_" + field + "_1").val());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ur.FK_Emp = webUser.No;
|
|
|
ur.CfgKey = "SearchAttrs";
|
|
|
ur.Vals = str;
|
|
|
ur.FK_MapData = frmID;
|
|
|
ur.SetPara("RecCount", count);
|
|
|
var i = ur.Save();
|
|
|
|
|
|
var url = GetHrefUrl();
|
|
|
if (url.indexOf("PageIdx") != -1)
|
|
|
url = replaceParamVal(url, "PageIdx", 1);
|
|
|
|
|
|
BindTable();
|
|
|
|
|
|
SetHref(url);
|
|
|
}
|
|
|
|
|
|
|
|
|
function SearchData(orderBy, orderWay) {
|
|
|
//创建处理器.
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
|
|
|
handler.AddUrlData()
|
|
|
handler.AddPara("PageIdx", pageIdx);
|
|
|
handler.AddPara("PageSize", pageSize);
|
|
|
|
|
|
if (orderBy != null && orderBy != undefined)
|
|
|
ur.OrderBy = orderBy;
|
|
|
if (orderWay != null && orderWay != undefined)
|
|
|
ur.OrderWay = orderWay;
|
|
|
ur.Update();
|
|
|
|
|
|
//查询集合
|
|
|
var data = handler.DoMethodReturnString("Search_Init");
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
alert(data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
ur = new Entity("BP.Sys.UserRegedit");
|
|
|
ur.MyPK = webUser.No+ frmID + "_SearchAttrs";
|
|
|
ur.RetrieveFromDBSources();
|
|
|
|
|
|
|
|
|
count = ur.GetPara("RecCount");
|
|
|
if (count % pageSize != 0)
|
|
|
pages = parseInt(count / pageSize) + 1;
|
|
|
else
|
|
|
pages = parseInt(count / pageSize);
|
|
|
|
|
|
if (pages == 0) pages = 1;
|
|
|
|
|
|
if (firstLoadTable) {
|
|
|
$('#dg').bootstrapTable("load", data["DT"]);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
return data;
|
|
|
}
|
|
|
|
|
|
//生成查询页面..
|
|
|
function BindTable() {
|
|
|
|
|
|
//获取页面的高度
|
|
|
var H = document.body.clientHeight;
|
|
|
var tableH = H - $("#toolbar").outerHeight() - $("#page-nav").outerHeight() - 70;
|
|
|
|
|
|
if (pageIdx == "" || pageIdx == undefined)
|
|
|
pageIdx = "1";
|
|
|
|
|
|
var mapdata = SearchData();
|
|
|
var attrs = mapdata["Attrs"];
|
|
|
|
|
|
if (attrs == undefined) {
|
|
|
alert('没有取得属性.');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var keyOfEn = "";
|
|
|
var firstColumns = new Array();
|
|
|
var secondColumns = new Array();
|
|
|
var threeColumns = new Array();
|
|
|
|
|
|
|
|
|
var sortColumns = frmDict.SortColumns; //排序字段
|
|
|
//颜色设置
|
|
|
var colorSet = frmDict.ColorSet;
|
|
|
|
|
|
|
|
|
var fieldColumns = {
|
|
|
title: '序',
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
width: 25,
|
|
|
rowspan: isThrHeader == true ? 3 : isSecHeader == true ? 2 : 1,
|
|
|
formatter: function (value, row, index) {
|
|
|
return pageSize * (pageIdx - 1) + index + 1; // 返回每条的序号: 每页条数 *(当前页 - 1 )+ 序号
|
|
|
}
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, isThrHeader == true ? 3 : isSecHeader == true ? 2 : 1);
|
|
|
for (var i = 0; i < attrs.length; i++) {
|
|
|
var attr = attrs[i];
|
|
|
|
|
|
if (attr.UIVisible == 0
|
|
|
|| attr.KeyOfEn == "OID"
|
|
|
|| attr.KeyOfEn == "WorkID"
|
|
|
|| attr.KeyOfEn == "NodeID"
|
|
|
|| attr.KeyOfEn == "MyNum"
|
|
|
|| attr.KeyOfEn == "MyPK") {
|
|
|
keyOfEn = attr.KeyOfEn
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
var keyRowSpan = GetAttrKeyRowSpan(attr.KeyOfEn);
|
|
|
if (keyRowSpan == 3 && thrcolspan.field != undefined) {
|
|
|
threeColumns.push(thrcolspan);
|
|
|
thrcolspan = {};
|
|
|
}
|
|
|
|
|
|
//是否增加二级或者三级分组
|
|
|
if ((isSecHeader == true && keyRowSpan == 1)
|
|
|
|| isThrHeader == true && keyRowSpan != 3)
|
|
|
AddSecOrThrColumn(attr.KeyOfEn, keyRowSpan, secondColumns, threeColumns);
|
|
|
|
|
|
var field = attr.KeyOfEn;
|
|
|
var title = attr.Name;
|
|
|
var width = attr.Width;
|
|
|
var sortable = true;
|
|
|
if (sortColumns != null && sortColumns != "")
|
|
|
sortable = sortColumns.indexOf(field) != -1 ? true : false;
|
|
|
|
|
|
if (field == "BillState") {
|
|
|
fieldColumns = {
|
|
|
field: field,
|
|
|
title: title,
|
|
|
width: attr.Width,
|
|
|
fixed: false,
|
|
|
sortable: sortable,
|
|
|
rowspan: keyRowSpan,
|
|
|
formatter: function (value, row, index) {
|
|
|
return GetBillState(value);
|
|
|
}
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, keyRowSpan);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (field == "Title") {
|
|
|
fieldColumns = {
|
|
|
field: field,
|
|
|
title: title,
|
|
|
width: attr.Width,
|
|
|
fixed: false,
|
|
|
sortable: sortable,
|
|
|
rowspan: keyRowSpan,
|
|
|
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, keyRowSpan);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
if (attr.UIContralType == 1 || attr.UIContralType == 3) {
|
|
|
if (width == null || width == "" || width == undefined)
|
|
|
width = 180;
|
|
|
|
|
|
fieldColumns = {
|
|
|
field: field,
|
|
|
title: title,
|
|
|
fixed: false,
|
|
|
width: width,
|
|
|
sortable: sortable,
|
|
|
rowspan: keyRowSpan,
|
|
|
cellStyle: {
|
|
|
css: { "white-space": "nowrap", "word-break": "keep-all", "width": "100%" }
|
|
|
},
|
|
|
formatter: function (value, row, index) {
|
|
|
var val = row[this.field + "Text"];
|
|
|
if (val == undefined || val == null)
|
|
|
val = row[this.field + "T"];
|
|
|
|
|
|
if (val == undefined || val == null)
|
|
|
return value;
|
|
|
else
|
|
|
return val;
|
|
|
}
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, keyRowSpan);
|
|
|
continue;
|
|
|
}
|
|
|
if (attr.UIContralType == 2) {
|
|
|
fieldColumns = {
|
|
|
field: field,
|
|
|
title: title,
|
|
|
width: attr.Width,
|
|
|
fixed: false,
|
|
|
sortable: sortable,
|
|
|
rowspan: keyRowSpan,
|
|
|
formatter: function (value, row, index) {
|
|
|
if (value == "0") return "否";
|
|
|
if (value == "1") return "是";
|
|
|
}
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, keyRowSpan);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (width == null || width == "" || width == undefined)
|
|
|
width = 100;
|
|
|
fieldColumns = {
|
|
|
field: field,
|
|
|
title: title,
|
|
|
width: attr.Width,
|
|
|
fixed: false,
|
|
|
sortable: sortable,
|
|
|
rowspan: keyRowSpan,
|
|
|
};
|
|
|
AddColumn(fieldColumns, firstColumns, secondColumns, threeColumns, keyRowSpan);
|
|
|
}
|
|
|
if (thrcolspan.field != undefined)
|
|
|
threeColumns.push(thrcolspan);
|
|
|
|
|
|
var columns = new Array();
|
|
|
if (isThrHeader == false && isSecHeader == false)
|
|
|
columns[0] = firstColumns;
|
|
|
if (isSecHeader == true) {
|
|
|
columns[0] = secondColumns;
|
|
|
columns[1] = firstColumns;
|
|
|
}
|
|
|
|
|
|
if (isThrHeader == true) {
|
|
|
columns[0] = threeColumns;
|
|
|
columns[1] = secondColumns;
|
|
|
columns[2] = firstColumns;
|
|
|
}
|
|
|
|
|
|
$('#dg').html("");
|
|
|
$('#dg').bootstrapTable({
|
|
|
data: mapdata["DT"],
|
|
|
columns: columns,
|
|
|
cache: false,
|
|
|
striped: true,
|
|
|
height: tableH,
|
|
|
singleSelect: false,
|
|
|
selectOnCheck: false,
|
|
|
maintainSelected: true,
|
|
|
sidePagination: "client",
|
|
|
pageNumber: 1,
|
|
|
strictSearch: true,
|
|
|
onSort: function (name, order) {
|
|
|
pageIdx = 1;
|
|
|
SearchData(name, order);
|
|
|
Paginator(pages, 1)
|
|
|
},
|
|
|
//得到查询的参数
|
|
|
queryParams: function (params) {
|
|
|
//这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
|
|
|
var temp = {
|
|
|
rows: 10, //页面大小
|
|
|
page: (count / 10) + 1, //页码
|
|
|
|
|
|
};
|
|
|
return temp;
|
|
|
},
|
|
|
|
|
|
onDblClickRow: function (row, $element) {
|
|
|
//处理选择实体数据后生成单据信息
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
|
|
|
handler.AddPara("RefOID", row.OID);
|
|
|
handler.AddPara("RefDict", GetQueryString("FrmID"));
|
|
|
handler.AddPara("FrmID", GetQueryString("BillID"));
|
|
|
var data = handler.DoMethodReturnString("RefDict_CreateBillWorkID");
|
|
|
if (data.indexOf("err@") != -1) {
|
|
|
alert(data);
|
|
|
console.log(data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//打开学生缴费页面
|
|
|
SetHref("./MyBill.htm?FrmID=" + GetQueryString("BillID") + "&FK_MapData=" + GetQueryString("BillID") + "&WorkID=" + data);
|
|
|
}
|
|
|
|
|
|
});
|
|
|
$("#dg").colResizable({
|
|
|
liveDrag: true,
|
|
|
gripInnerHtml: "<div class='grip'></div>",
|
|
|
draggingClass: "dragging",
|
|
|
resizeMode: 'fit',
|
|
|
//拖动事件
|
|
|
onDrag: function () {
|
|
|
$('#dg').bootstrapTable("resetView")
|
|
|
}
|
|
|
});
|
|
|
firstLoadTable = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 把列增加到对应的数组中
|
|
|
* @param column 列信息
|
|
|
* @param firstColumns 一级表头数组
|
|
|
* @param secondColumns 二级表头数组
|
|
|
* @param threeColumns 三级表头数组
|
|
|
* @param columnIdx 隶属那个表头
|
|
|
*/
|
|
|
function AddColumn(column, firstColumns, secondColumns, threeColumns, columnIdx) {
|
|
|
if (columnIdx == 1)
|
|
|
firstColumns.push(column);
|
|
|
if (columnIdx == 2)
|
|
|
secondColumns.push(column);
|
|
|
if (columnIdx == 3)
|
|
|
threeColumns.push(column);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取数据字段跨的行数
|
|
|
* @param keyOfEn
|
|
|
*/
|
|
|
function GetAttrKeyRowSpan(keyOfEn) {
|
|
|
//一级表头
|
|
|
if (isThrHeader == false && isSecHeader == false)
|
|
|
return 1;
|
|
|
//先判断是否是隶属于二级表头下的字段
|
|
|
if (secMultiTitle.indexOf("," + keyOfEn + ",") != -1)
|
|
|
return 1;
|
|
|
//是否是隶属于三级表头下的字段
|
|
|
if (thrMultiTitle.indexOf("," + keyOfEn + ",") != -1)
|
|
|
return 2;
|
|
|
return isThrHeader == true ? 3 : 2;
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* 增加二级或三级表头的分组
|
|
|
* @param keyOfEn
|
|
|
* @param keyRowSpan
|
|
|
* @param secondColumns
|
|
|
* @param threeColumns
|
|
|
*/
|
|
|
var curSecGroup = "";
|
|
|
var curTreGroup = "";
|
|
|
var thrcolspan = {};
|
|
|
var isSecChange = false;
|
|
|
function AddSecOrThrColumn(keyOfEn, keyRowSpan, secondColumns, threeColumns) {
|
|
|
//计算二级表头分组
|
|
|
var secfilds = getMutliFile(keyOfEn, secMultiTitle);
|
|
|
var secRowSpan = 1;
|
|
|
if (isSecHeader == true && keyRowSpan == 1)
|
|
|
secRowSpan = 1;
|
|
|
if (isThrHeader == true && keyRowSpan == 1) {
|
|
|
if (thrMultiTitle.indexOf("," + secfilds[0] + ",") == -1)
|
|
|
secRowSpan = 2;
|
|
|
else
|
|
|
secRowSpan = 1;
|
|
|
}
|
|
|
if (isThrHeader == true && keyRowSpan == 2)
|
|
|
secRowSpan = 0;
|
|
|
//增加二级表头
|
|
|
if (secRowSpan == 1) {
|
|
|
var colspan = secfilds.length - 1;
|
|
|
if (curSecGroup == "" || curSecGroup != secfilds[0]) {
|
|
|
curSecGroup = secfilds[0];
|
|
|
isSecChange = true;
|
|
|
secondColumns.push({
|
|
|
title: secfilds[0],
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
colspan: colspan,
|
|
|
rowspan: secRowSpan
|
|
|
});
|
|
|
} else {
|
|
|
isSecChange = false;
|
|
|
}
|
|
|
//增加三级表头
|
|
|
if (isThrHeader == true && secRowSpan == 1) {
|
|
|
var filds = getMutliFile(secfilds[0], thrMultiTitle);
|
|
|
if (curTreGroup == "" || curTreGroup != filds[0]) {
|
|
|
//增加三级表头
|
|
|
if (curTreGroup != "" && curTreGroup != filds[0]) {
|
|
|
threeColumns.push(thrcolspan);
|
|
|
thrcolspan = {};
|
|
|
}
|
|
|
thrcolspan = {
|
|
|
title: filds[0],
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
colspan: colspan,
|
|
|
}
|
|
|
|
|
|
curTreGroup = filds[0];
|
|
|
} else {
|
|
|
if (isSecChange == true)
|
|
|
thrcolspan.colspan = thrcolspan.colspan + colspan;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
//三级表头
|
|
|
if (secRowSpan == 2) {
|
|
|
if (thrcolspan.title != undefined) {
|
|
|
threeColumns.push(thrcolspan);
|
|
|
thrcolspan = {};
|
|
|
}
|
|
|
if (curTreGroup == "" || curTreGroup != secfilds[0]) {
|
|
|
curTreGroup = secfilds[0];
|
|
|
threeColumns.push({
|
|
|
title: secfilds[0],
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
colspan: secfilds.length - 1,
|
|
|
rowspan: secRowSpan
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (secRowSpan == 0) {
|
|
|
filds = getMutliFile(keyOfEn, thrMultiTitle);
|
|
|
if (curTreGroup == "" || curTreGroup != filds[0]) {
|
|
|
//增加三级表头
|
|
|
if (curTreGroup != "" && curTreGroup != filds[0]) {
|
|
|
threeColumns.push(thrcolspan);
|
|
|
}
|
|
|
thrcolspan = {
|
|
|
title: filds[0],
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
colspan: 1,
|
|
|
};
|
|
|
curTreGroup = filds[0];
|
|
|
} else {
|
|
|
thrcolspan.colspan = thrcolspan.colspan + 1;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
function getMutliFile(keyOfEn, multi) {
|
|
|
var fields = multi.split(";");
|
|
|
for (var i = 0; i < fields.length; i++) {
|
|
|
var str = fields[i];
|
|
|
if (str == "")
|
|
|
continue;
|
|
|
if (str.indexOf("," + keyOfEn + ",") == -1)
|
|
|
continue;
|
|
|
var strs = str.substring(0, str.length - 1).split(",");
|
|
|
return strs;
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//分页功能
|
|
|
function Paginator(pageCount, currentPage) {
|
|
|
var selects = "<Select id='DDL_PageSize' onchange='changePageSie()' style='min-width: 40px !important; width: 50px;' class='form-control'><option value=5>5</option><option value=10>10</option><option value=15>15</option><option value=20>20</option><option value=25>25</option></Select>";
|
|
|
var pageCount = pageCount; //取到pageCount的值(把返回数据转成object类型)
|
|
|
var options = {
|
|
|
bootstrapMajorVersion: 3, //版本
|
|
|
currentPage: currentPage, //当前页数
|
|
|
totalPages: pageCount, //总页数
|
|
|
shouldShowPage: true, //是否显示该按钮
|
|
|
itemTexts: function (type, page, current) {
|
|
|
switch (type) {
|
|
|
case "first":
|
|
|
return "首页";
|
|
|
case "prev":
|
|
|
return "上一页";
|
|
|
case "next":
|
|
|
return "下一页";
|
|
|
case "last":
|
|
|
return "末页";
|
|
|
case "page":
|
|
|
return page;
|
|
|
}
|
|
|
}, //点击事件,用于通过Ajax来刷新整个list列表
|
|
|
onPageClicked: function (event, originalEvent, type, page) {
|
|
|
pageIdx = page;
|
|
|
SearchData(page);
|
|
|
$('#page_info').html("").append("<li class='disabled controls'>" + selects + "当前第" + pageIdx + "页,总共" + pages +
|
|
|
"页,总共" + count + "条记录。</li>");
|
|
|
}
|
|
|
};
|
|
|
$('#page_nav').bootstrapPaginator(options);
|
|
|
$('#page_info').html("").append("<li class='disabled controls'>" + selects + "当前第" + pageIdx + "页,总共" + pages +
|
|
|
"页,总共" + count + "条记录。</li>");
|
|
|
|
|
|
$("#DDL_PageSize").val(pageSize);
|
|
|
}
|
|
|
|
|
|
function changePageSie() {
|
|
|
pageSize = $("#DDL_PageSize").val();
|
|
|
ur = new Entity("BP.Sys.UserRegedit");
|
|
|
ur.MyPK = webUser.No + frmID + "_SearchAttrs";
|
|
|
ur.RetrieveFromDBSources();
|
|
|
ur.SetPara("PageSize", pageSize);
|
|
|
ur.Update();
|
|
|
|
|
|
pageIdx = 1;
|
|
|
SearchData();
|
|
|
Paginator(pages, pageIdx);
|
|
|
}
|
|
|
|
|
|
|
|
|
function GetBillState(BillState, isCanDo) {
|
|
|
if (BillState == 0)
|
|
|
return "空白";
|
|
|
|
|
|
if (BillState == 1)
|
|
|
return "草稿";
|
|
|
|
|
|
if (BillState == 2)
|
|
|
return "编辑中";
|
|
|
|
|
|
if (BillState == 100)
|
|
|
return "归档";
|
|
|
|
|
|
return BillState;
|
|
|
}
|
|
|
|
|
|
function OpenIt(workid, frmID, nodeID, emps, userNo, BillState) {
|
|
|
|
|
|
//RowOpenModel 0=新窗口打开 1=在本窗口打开 2=弹出窗口打开,关闭后不刷新列表 3=弹出窗口打开,关闭
|
|
|
var rowOpenModel = parseInt(frmDict.RowOpenModel);
|
|
|
|
|
|
var url = "";
|
|
|
url = "MyDict.htm?WorkID=" + workid + "&FrmID=" + frmID + "&FK_MapData=" + frmID;
|
|
|
if (top.layui && top.layui.index) {
|
|
|
url = "./" + url;
|
|
|
top.layui.index.openTabsPage(url, frmDict.Name)
|
|
|
} else {
|
|
|
if (rowOpenModel == 0)
|
|
|
window.open(url);
|
|
|
if (rowOpenModel == 1)
|
|
|
SetHref(url);
|
|
|
if (rowOpenModel == 2) {
|
|
|
var W = document.body.clientWidth - 40;
|
|
|
var H = document.body.clientHeight - 40;
|
|
|
|
|
|
OpenBootStrapModal(url, "eudlgframe", frmDict.Name, W, H, "icon-property", null, null, null, null, null, "black");
|
|
|
}
|
|
|
if (rowOpenModel == 3) {
|
|
|
var W = document.body.clientWidth - 40;
|
|
|
var H = document.body.clientHeight - 40;
|
|
|
OpenBootStrapModal(url, "eudlgframe", frmDict.Name, W, H, "icon-property", null, null, null, function () {
|
|
|
Reload();
|
|
|
}, null, "black");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
|
<body id="SearchHtml" class="cs-search-html">
|
|
|
<div class="wrapper wrapper-content animated fadeInRight cs-table" style="padding: 0px 10px 0px 10px">
|
|
|
<div class="ibox-content">
|
|
|
<div class="row cs-shadow-box">
|
|
|
<div class="panel panel-default" style="border: 0px; margin-bottom: 3px">
|
|
|
<div id="toolBar" style="width: 100%">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="row cs-shadow-box">
|
|
|
<table id="dg" class="table table-hover JColResizer" style="word-wrap: break-word; word-break: break-all;"></table>
|
|
|
<!-- 显示分页信息 -->
|
|
|
<div>
|
|
|
<div class="row cs-pagination" style="float:left;width:40%;text-align: left;">
|
|
|
<ul class="pagination controls" style="margin-left:20px"><li class=" controls" id="FieldSet"></li></ul>
|
|
|
</div>
|
|
|
<div class="row cs-pagination" style="float:right;width:60%">
|
|
|
<ul class="pagination" id="page_nav"></ul>
|
|
|
<ul class="pagination controls" id="page_info"></ul>
|
|
|
<div style="clear: both;">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div id="Msg">
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
</html>
|