|
|
<!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="../Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
|
|
|
<!--layui-->
|
|
|
<link href="../Scripts/layui/layui/css/modules/layer/default/layer.css" rel="stylesheet" />
|
|
|
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
|
|
|
<script src="../Scripts/layui/layui/layui.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/layui/layui/lay/modules/layer.js" type="text/javascript"></script>
|
|
|
|
|
|
<!--通用的JS-->
|
|
|
<script src="../Scripts/config.js" type="text/javascript"></script>
|
|
|
<script src="../Scripts/QueryString.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="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
|
|
|
<link href="../Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
|
|
|
<!--生成二维码-->
|
|
|
<script src="../Scripts/jquery.qrcode.min.js" type="text/javascript"></script>
|
|
|
<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 param = {
|
|
|
FK_Flow: GetQueryString("FlowNo"),
|
|
|
FrmID: GetQueryString("FrmID"),
|
|
|
FrmOID: GetQueryString("FrmOID")
|
|
|
};
|
|
|
var rptNo = "ND" + parseInt(param.FK_Flow) + "Rpt";
|
|
|
|
|
|
|
|
|
|
|
|
var firstLoadTable = true;
|
|
|
$(function () {
|
|
|
//用户查询注册信息
|
|
|
ur = new Entity("BP.Sys.UserRegedit");
|
|
|
ur.MyPK = webUser.No + rptNo + "_SearchAttrs";
|
|
|
if (ur.RetrieveFromDBSources() == 0) {
|
|
|
var selectFields = ",Title,FlowStarter,FlowStartRDT,FK_Dept,WFState,";
|
|
|
ur.MyPK = webUser.No + rptNo + "_SearchAttrs";
|
|
|
ur.FK_Emp = webUser.No;
|
|
|
ur.CfgKey = rptNo + "_SearchAttrs";
|
|
|
ur.SetPara("SelectFields", selectFields);
|
|
|
ur.OrderBy = "OID";
|
|
|
ur.OrderWay = "asc";
|
|
|
ur.Insert();
|
|
|
}
|
|
|
|
|
|
|
|
|
DictFlow_MapAttr();
|
|
|
DictFlow_Search_Init();
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 设置显示的列
|
|
|
* @return Cols的集合
|
|
|
*/
|
|
|
var columns = new Array();;
|
|
|
function DictFlow_MapAttr() {
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
|
|
|
handler.AddJson(param);
|
|
|
|
|
|
//获取查询条件
|
|
|
var data = handler.DoMethodReturnString("DictFlow_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 selectFields = ur.GetPara("SelectFields");
|
|
|
|
|
|
//生成表格的Cols数组
|
|
|
columns.push({
|
|
|
title: '序',
|
|
|
field: '',
|
|
|
align: 'center',
|
|
|
minWidth: 30,
|
|
|
type: 'numbers'
|
|
|
|
|
|
});
|
|
|
var keyOfEn = "";
|
|
|
for (var i = 0; i < mapAttrOfSys.length; i++) {
|
|
|
keyOfEn = mapAttrOfSys[i].KeyOfEn;
|
|
|
if (keyOfEn == "WFState" || keyOfEn == "FlowEndNode")
|
|
|
continue;
|
|
|
if (selectFields.indexOf("," + keyOfEn + ",") != -1 || selectFields.indexOf("," + keyOfEn + "T" + ",") != -1 || selectFields.indexOf("," + keyOfEn + "Text" + ",") != -1)
|
|
|
columns.push(GenerColumn(mapAttrOfSys[i], false));
|
|
|
else
|
|
|
columns.push(GenerColumn(mapAttrOfSys[i], true));
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
for (var i = 0; i < mapAttrOfFrm.length; i++) {
|
|
|
keyOfEn = mapAttrOfFrm[i].KeyOfEn;
|
|
|
if (selectFields.indexOf("," + keyOfEn + ",") != -1 || selectFields.indexOf("," + keyOfEn + "T" + ",") != -1 || selectFields.indexOf("," + keyOfEn + "Text" + ",") != -1)
|
|
|
columns.push(GenerColumn(mapAttrOfFrm[i], false));
|
|
|
else
|
|
|
columns.push(GenerColumn(mapAttrOfFrm[i], true));
|
|
|
}
|
|
|
//当前所在节点
|
|
|
columns.push({
|
|
|
field: "FlowEndNode",
|
|
|
title: "当前所在节点",
|
|
|
minWidth: "100",
|
|
|
sort: true,
|
|
|
|
|
|
});
|
|
|
//流程状态
|
|
|
columns.push({
|
|
|
field: "WFState",
|
|
|
title: "状态",
|
|
|
minWidth: "100",
|
|
|
sort: true,
|
|
|
templet: function (data) {
|
|
|
return data["WFStateText"];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查询数据
|
|
|
*/
|
|
|
|
|
|
function DictFlow_Search_Init() {
|
|
|
|
|
|
var handler = new HttpHandler("BP.CCBill.WF_CCBill");
|
|
|
|
|
|
|
|
|
handler.AddJson(param); //增加参数.
|
|
|
|
|
|
var data = handler.DoMethodReturnString("DictFlow_Search");
|
|
|
if (data.indexOf("err@") != -1) {
|
|
|
layer.alert(data);
|
|
|
console.log(data);
|
|
|
return;
|
|
|
}
|
|
|
data = JSON.parse(data);
|
|
|
|
|
|
|
|
|
layui.use(['table'], function () {
|
|
|
var table = layui.table;
|
|
|
|
|
|
table.render({
|
|
|
elem: '#searchTable'
|
|
|
, data: data
|
|
|
, cellMinWidth: 80
|
|
|
, title: '用户数据表'
|
|
|
, toolbar: '#toolbarDemo'
|
|
|
, cols: [columns]
|
|
|
, page: false
|
|
|
, height: $(document).height() - $("#toolBar").height() - 100
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//头工具栏事件
|
|
|
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;
|
|
|
default: break;
|
|
|
|
|
|
};
|
|
|
});
|
|
|
|
|
|
//双击一行的事件
|
|
|
table.on('rowDouble(searchTable)', function (obj) {
|
|
|
var data = obj.data;
|
|
|
var width = $(document).width() * 2 / 3;
|
|
|
top.layui.admin.popupRight({
|
|
|
id: 'Lay_Flow'
|
|
|
, area: [width + "px", '100%']
|
|
|
|
|
|
, success: function () {
|
|
|
top.layui.view(this.id).render('system/comm', {
|
|
|
url: '../MyView.htm',
|
|
|
WorkID: data.OID,
|
|
|
FK_Flow: GetQueryString("FK_Flow"),
|
|
|
FK_Node: data.FlowEndNode,
|
|
|
FID: data.FID ? data.FID : 0
|
|
|
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 根据字段属性生成列属性
|
|
|
* @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.FlowEndNode + "," + data.FID + ")'>" + data[this.field] + "</a>";
|
|
|
}
|
|
|
return data[this.field];
|
|
|
}
|
|
|
|
|
|
};
|
|
|
}
|
|
|
|
|
|
function WindowOpen(workid, fk_node, fid) {
|
|
|
var data = obj.data;
|
|
|
var width = $(document).width() * 2 / 3;
|
|
|
// var url = '/WF/MyView.htm?WorkID=' + data.OID + '&FK_Flow=' + GetQueryString("FK_Flow") + '&FK_Node=' + data.FlowEndNode + '&FID=' + (data.FID ? data.FID : 0) + '&t=' + Math.random();
|
|
|
top.layui.admin.popupRight({
|
|
|
id: 'Lay_Flow'
|
|
|
, area: [width + "px", '100%']
|
|
|
|
|
|
, success: function () {
|
|
|
top.layui.view(this.id).render('system/comm', {
|
|
|
url: '/WF/MyView.htm',
|
|
|
WorkID: workid,
|
|
|
FK_Flow: GetQueryString("FK_Flow"),
|
|
|
FK_Node: fk_node,
|
|
|
FID: fid ? fid : 0
|
|
|
|
|
|
});
|
|
|
},
|
|
|
end: function () {
|
|
|
window.location.reload();
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//返回
|
|
|
function Back() {
|
|
|
SetHref("./MyDict.htm?WorkID=" + param.FrmOID + "&FrmID=" + param.FrmID + "&IsReadonly=" + GetQueryString("IsReadonly") + "&FK_MapData=" + param.FrmID);
|
|
|
}
|
|
|
|
|
|
//发起子流程
|
|
|
function StartFlow() {
|
|
|
//判断当前流程是内部流程还是外部流程
|
|
|
var flow = new Entity("BP.WF.Flow", param.FK_Flow);
|
|
|
if (flow.GuestFlowRole == 1) {
|
|
|
layer.open({
|
|
|
title: '外部发起流程二维码',
|
|
|
type: 2,
|
|
|
area: ['500px', '300px'],
|
|
|
content: './Qcode.htm?FK_Flow=' + param.FK_Flow + "&FrmID=" + param.FrmID + "&FrmOID=" + param.FrmOID //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
handler = new HttpHandler("BP.WF.HttpHandler.WF_MyFlow");
|
|
|
handler.AddPara("FK_Flow", param.FK_Flow);
|
|
|
handler.AddPara("OrgNo", flow.OrgNo);
|
|
|
handler.AddPara("FrmID", param.FrmID);
|
|
|
handler.AddPara("FrmOID", param.FrmOID);
|
|
|
|
|
|
handler.AddUrlData();
|
|
|
data = handler.DoMethodReturnString("DictFlow_Init");
|
|
|
|
|
|
if (data.indexOf('err@') == 0) {
|
|
|
$("#Msg").html("<br>" + data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (data.indexOf('url@') == 0) {
|
|
|
|
|
|
data = data.replace('url@', ''); //如果返回url,就直接转向.
|
|
|
data = data.replace('?DoType=HttpHandler', '?');
|
|
|
data = data.replace('&DoType=HttpHandler', '');
|
|
|
data = data.replace('&DoMethod=MyFlow_Init', '');
|
|
|
data = data.replace('&HttpHandlerName=BP.WF.HttpHandler.WF_MyFlow', '');
|
|
|
data = data.replace('?&', '?');
|
|
|
|
|
|
//如果返回url,就直接转向.
|
|
|
window.open("../" + data);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
</head>
|
|
|
<body style="background-color:white">
|
|
|
<div class="layui-card" style="margin:10px">
|
|
|
|
|
|
<script type="text/html" id="toolbarDemo">
|
|
|
<input type="button" class="layui-btn" id="StartFlowBtn" onclick="StartFlow()" style="margin-left: 15px;background-color:#5cb2ff" value="新建" />
|
|
|
<input type="button" class="layui-btn" id="BackBtn" onclick="Back()" style="margin-left: 15px;background-color:#5cb2ff" value="返回" />
|
|
|
|
|
|
</script>
|
|
|
|
|
|
<table class="layui-hide" id="searchTable" lay-filter="searchTable"></table>
|
|
|
<div id="page"></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|