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.

495 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>
<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" />
<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>
<script src="/WF/Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
<link href="/WF/Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.layui-input, .layui-select, .layui-textarea {
height: 28px !important;
}
.layui-form-label {
padding: 3px 8px !important;
}
.layui-btn {
height: 28px !important;
line-height: 28px !important;
}
.layui-table-tool {
background-color: white !important;
}
.layui-layer-content{
overflow:hidden;
}
.layui-inline{
margin-bottom:5px;
}
</style>
<script type="text/javascript">
var searchFields = new Array(); //DDL的查询条件
var fields = []; //字符型字段查询的集合
var webUser = new WebUser();
//当前用户查询信息.
var ur;
var count;
var pageIdx = 1;
var pageSize = 10;
var pages = 1;//总页数;
var param = {
SearchType: GetQueryString("SearchType"),
FrmID: GetQueryString("FrmID"),
WorkModel:GetQueryString("WorkModel"),
pageSize: pageSize,
pageIdx: pageIdx
};
var firstLoadTable = true;
$(function () {
//用户查询注册信息
ur = new Entity("BP.Sys.UserRegedit");
ur.MyPK = webUser.No + param.FrmID + "_SearchAttrs";
ur.RetrieveFromDBSources();
Search_MapAttr();
FrmSearch_Init();
});
/**
* 设置显示的列
* @return Cols的集合
*/
var columns = new Array();;
function Search_MapAttr() {
var handler = new HttpHandler("BP.Cloud.HttpHandler.App_OneFrm_FrmSearch");
handler.AddUrlData(); //增加参数.
//获取查询条件
var data = handler.DoMethodReturnString("FrmSearch_MapAttrs");
if (data.indexOf("err@") != -1) {
layer.alert(data);
console.log(data);
return;
}
var mapAttrs = JSON.parse(data);
//用户选择显示的字段
var selectFields = ur.GetPara("SelectFields");
if (selectFields == null || selectFields == undefined)
selectFields = "";
//生成表格的Cols数组
columns.push({
title: '序',
field: '',
align: 'center',
minWidth: 30,
templet: function (d) {
return pageSize * (pageIdx - 1) + d.LAY_TABLE_INDEX + 1; // 返回每条的序号: 每页条数 *(当前页 - 1 + 序号
}
});
var keyOfEn = "";
for (var i = 0; i < mapAttrs.length; i++) {
keyOfEn = mapAttrs[i].KeyOfEn;
if (keyOfEn == "BillState")
continue;
if (selectFields.indexOf("," + keyOfEn + ",") != -1 || selectFields.indexOf("," + keyOfEn + "T" + ",") != -1 || selectFields.indexOf("," + keyOfEn + "Text" + ",") != -1)
columns.push(GenerColumn(mapAttrs[i], false));
else
columns.push(GenerColumn(mapAttrs[i], true));
}
//流程状态
columns.push({
field: "BillState",
title: "状态",
minWidth: "100",
sort: true,
templet: function (data) {
var val = data["BillState"];
if (val == 0) return "空白";
if (val == 1) return "草稿";
if (val == 2) return "编辑中";
if (val == 100) return "归档";
}
});
}
function FrmSearch_Data() {
var handler = new HttpHandler("BP.Cloud.HttpHandler.App_OneFrm_FrmSearch");
handler.AddPara("PageSize", pageSize);
handler.AddPara("PageIdx", pageIdx);
handler.AddUrlData(); //增加参数.
var data = handler.DoMethodReturnString("FrmSearch_Data");
if (data.indexOf("err@") != -1) {
layer.alert(data);
console.log(data);
return;
}
data = JSON.parse(data);
if (firstLoadTable == false) {
var tableIn = layui.table.render({
elem: '#searchTable'
, data: data
, cellMinWidth: 80
, title: '用户数据表'
, cols: [columns]
, page: false
, height: $(document).height() - $("#toolBar").height() - 100
});
tableIn.reload({ data: data });
return;
}
return data;
}
/**
* 查询数据
*/
function FrmSearch_Init() {
var data = FrmSearch_Data();
layui.use(['table'], function () {
var table = layui.table;
table.render({
elem: '#searchTable'
, data: data
, cellMinWidth: 80
, toolbar: '#toolBar' //开启头部工具栏,并为其绑定左侧模板
, title: '用户数据表'
, cols: [columns]
, page: false
, height: $(document).height() - $("#toolBar").height() - 100
});
//监听排序信息
table.on('sort(searchTable)', function (obj) { //注tool是工具条事件名test是table原始容器的属性 lay-filter="对应的值"
ur.OrderBy = obj.field; //当前排序的字段名
ur.OrderWay = obj.type; //当前排序类型desc降序、asc升序、null空对象默认排序
firstLoadTable = false;
FrmSearch_Data();
});
//头工具栏事件
table.on('toolbar(searchTable)', function (obj) {
switch (obj.event) {
case 'LAYTABLE_COLS': //筛选列
$(".layui-table-tool-panel li").find($("input[name='Title']")).attr("disabled", "disabled");
$(".layui-table-tool-panel").find("div").bind("click", function (event) {
var inputCheck = $(this).prev();
var name = inputCheck.attr("name");
var isCheck = $(this).hasClass("layui-form-checked");
var selectFields = ur.GetPara("SelectFields");
if (isCheck == false)
selectFields = selectFields.replace(name + ",", "");
else
selectFields = selectFields + name + ",";
ur.SetPara("SelectFields", selectFields);
ur.Update();
});
break;
case 'FrmSearch_Data'://查询
FrmSearch_Data();
break;
case 'SelectChange':
break;
};
});
//双击一行的事件
table.on('rowDouble(searchTable)', function (obj) {
var data = obj.data;
var width = $(document).width() * 2 / 3;
var url = "";
if (param.WorkModel == 2)
url = "/WF/CCBill/MyDict.htm";
if (param.WorkModel == 1)
url = "/WF/CCBill/MyBill.htm";
top.layui.admin.popupRight({
id: 'Lay_Flow'
, area: [width+"px",'100%']
, success: function () {
top.layui.view(this.id).render('system/comm', {
url: url,
WorkID: data.OID,
FrmID: param.FrmID,
FK_MapData: param.FrmID,
IsReadonly: 1
});
}
});
});
});
ur.RetrieveFromDBSources();
layui.use('laypage', function () {
var laypage = layui.laypage;
//执行一个laypage实例
laypage.render({
elem: 'page' //注意,这里的 page 是 ID不用加 # 号
, count: data.length //数据总数,从服务端得到
, limits: [5, 10, 15, 20, 25]
, layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
, jump: function (obj) {
if (firstLoadTable == false) {
pageIdx = obj.curr;
pageSize = obj.limit;
//刷新数据
FrmSearch_Data();
}
if (firstLoadTable = true)
firstLoadTable = false;
}
});
$('#page').css('text-align', 'right'); // 分页右对齐
$('.layui-table-page').css('text-align', 'right'); //
});
}
//
function FrmSearch_Set() {
top.layui.admin.popupRight({
id: 'Lay_Flow_Set'
, area: ['40%', '100%']
, success: function () {
top.layui.view(this.id).render('system/comm', {
url: '/App/OneFrm/FrmSearchSet.htm',
FrmID: param.FrmID,
FK_MapData:param.FK_MapData,
SearchType:param.SearchType
});
}
, end: function () {
window.location.reload();
}
});
}
/**
* 根据字段属性生成列属性
* @param attr
*/
function GenerColumn(attr, isHide) {
var field = attr.KeyOfEn;
var title = attr.Name;
var width = attr.Width;
if (field == "Title") {
width = 230;
}
if (attr.UIContralType == 1) {
if (width == null || width == "" || width == undefined)
width = 180;
return {
field: field, //字段名
title: title, //标题名称
minWidth: width, //宽度
hide: isHide, //是否隐藏
sort: true,
templet: function (data) {
var val = data[this.field + "Text"];
if (val == null && val == undefined)
val = data[this.field + "T"];
if (val == null && val == undefined)
val = data[this.field];
return val;
}
};
}
if (attr.UIContralType == 2) {
if (width == null || width == "" || width == undefined) {
width = 60;
}
return {
field: field,
title: title,
minWidth: width,
hide: isHide, //是否隐藏
sort: true,
templet: function (data) {
if (data[this.field] == "0") return "否";
if (data[this.field] == "1") return "是";
}
};
}
if (width == null || width == "" || width == undefined)
width = 100;
if (field == "FlowStartRDT")
width = 160;
return {
field: field,
title: title,
minWidth: width,
hide: isHide, //是否隐藏
sort: true,
templet: function (data) {
if (this.field == "Title") {
return "<a style='color:#1e9fff' href='javaScript:void(0)' onclick='WindowOpen(" + data.OID +")'>" + data[this.field] + "</a>";
}
return data[this.field];
}
};
}
function WindowOpen(workid) {
var data = obj.data;
var width = $(document).width() * 2 / 3;
var url = "";
if (param.WorkModel == 2)
url = "/WF/CCBill/MyDict.htm";
if (param.WorkModel == 1)
url = "/WF/CCBill/MyBill.htm";
top.layui.admin.popupRight({
id: 'Lay_Flow'
, area: [width + "px", '100%']
, success: function () {
top.layui.view(this.id).render('system/comm', {
url: url,
WorkID: workid,
FrmID: param.FrmID,
FK_MapData: param.FrmID,
IsReadonly:1
});
},
end: function () {
window.location.reload();
}
});
}
//初始化下拉列表框的OPERATION
function InitDDLOperation(frmData, mapAttr, defVal,selectVal) {
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)
if(en.IntKey == selectVal)
operations += "<option selected value='" + en.IntKey + "'>" + en.Lab + "</option>";
else
operations += "<option value='" + en.IntKey + "'>" + en.Lab + "</option>";
else
if (en.No == selectVal)
operations += "<option selected value='" + en.No + "'>" + en.Name + "</option>";
else
operations += "<option value='" + en.No + "'>" + en.Name + "</option>";
}
return operations;
}
function Reset() {
if (md.RptIsSearchKey) {
$("#tb_key").textbox("clear");
}
if (md.RptDTSearchWay != 0) {
$("#tb_dtFrom").datebox("clear");
$("#tb_dtTo").datebox("clear");
}
$.each(FilterCtrls, function () {
switch (this.type) {
case "date":
$("#" + this.id).datebox("clear");
break;
case "datetime":
$("#" + this.id).datetimebox("clear");
break;
case "text":
$("#" + this.id).textbox("clear");
break;
case "combo":
case "combotree":
$("#" + this.id).combobox("setValue", "all");
break;
case "checkbox":
$("#" + this.id)[0].checked = false;
break;
}
});
}
</script>
</head>
<body style="background-color:white">
<div class="layui-card" style="margin:10px">
<!--<form class="layui-form">
<div id="toolBar"></div>
</form>-->
<!--<script type="text/html" id="toolBar">
</script>-->
<table class="layui-hide" id="searchTable" lay-filter="searchTable"></table>
<div id="page"></div>
</div>
</body>
</html>