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.

433 lines
18 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>
<title>退回</title>
<!--
1, 退回界面。
2需要 FK_Flow, FK_Node,WorkID, FID.
3, 调用方法 ReturnWork.htm?FK_Flow=001&FK_Node=103&WorkID=232&FID=23
4. 确定按钮后,要关闭主窗口。
5.当为父流程退回时,如果已经启动子流程时则不能执行退回功能
6.当为子流程退回时,如果已经启动平级子流程时则不能执行退回功能
7.退回到指定节点,如果退回到的节点中间有启动子流程或者平级子流程的节点,则不处理,正常退回
-->
<script type="text/javascript" src="../Scripts/QueryString.js"></script>
<script type="text/javascript" src="../Scripts/jquery-1.7.2.min.js"></script>
<script src="../Scripts/commonYangYH.js"></script>
<!-- 导入配置文件. -->
<!-- 该文件可以被集成厂商自己定义风格,可以自己修改,以达到流程设计器与自己的系统风格统一. -->
<link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet" />
<script type="text/javascript" src="../Scripts/config.js"></script>
<script type="text/javascript" src="../Comm/Gener.js"></script>
<!-- 加载通用的配置文件. -->
<script type="text/javascript" src="../../DataUser/JSLibData/CommonShowConfig.js"></script>
<script type="text/javascript" src="../../DataUser/JSLibData/ReturnWork.js"></script>
<script src="../InitMapAttr.js"></script>
<link href="../Scripts/layui/layui/css/layui.css" rel="stylesheet" />
<style type="text/css">
body {
background: transparent;
}
body div {
text-align: left;
margin: 20px auto;
}
#Message {
width: 100%;
}
</style>
<script type="text/javascript">
function isExitsVariable(variableName) {
try {
if (typeof (cceval(variableName)) == "undefined") {
console.log("已声明变量,但未初始化");
return false;
} else {
console.log("已声明变量,且已经初始化");
return true;
}
} catch (e) {
console.log("未声明变量");
}
return false;
}
var pageData = {};
// ?
var isFrameCross = GetQueryString("isFrameCross");
isFrameCross = isFrameCross == null || isFrameCross == undefined ? 0 : isFrameCross;
var node = null;
//是否全局设置了,强制每个节点都是原路返回?
var _ReturnWin_IsBackTracking_Selected = getConfigByKey("ReturnWin_IsBackTracking_Selected", false);;
$(function () {
//初始化页面退回信息.
pageData = {
FK_Node: GetQueryString('FK_Node'),
WorkID: GetQueryString('WorkID'),
FID: GetQueryString('FID'),
Message: GetQueryString('Info'),
FK_Flow: GetQueryString("FK_Flow"),
WorkIDs: GetQueryString("WorkIDs")
};
//如果有退回信息字段,就让其绑定到,退回原因的文本框里.
if (pageData.Message != undefined && pageData.Message != '') {
$('#TB_Doc').val(pageData.Message);
}
//调用接口传入url的参数。
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
handler.AddUrlData(); //FK_Flow, FK_Node,WorkID,Info info=退回信息字段.
//初始化数据.
var data = handler.DoMethodReturnString("Return_Init");
if (data.indexOf('info@') == 0) {
//这种情况下,有可能是自动退回,自动退回就提示退回消息.
//设置弹出框的大小
$(".modal-content", parent.document).css("width", "");
$(".modal-content", parent.document).css("height", "300px");
$("#iframeReturnWorkForm", parent.document).css("height", "300px");
data = data.replace('info@', '');
data = data.replace(/null/g, '');
data = "<font>" + data + "</font>";
$("#Msg").html("");
$("#DIV_Nodes").html(data);
$("#DIV_Doc").html("");
$("#btnReturn").css("display", "none");
// $("#btnIsBackTracking").css("display", "block");
//$("#btnIsKillEtcThread").css("display", "block");
$("#btnClose").attr("onclick", "Close(1)");
return;
}
//对与非法的调用,系统会提示,比如:不应该退回而退回,已经发送到下一个节点还要执行退回等等.
if (data.indexOf('err@') == 0) {
//console.error("退回窗口错误信息" + data);
data = data.replace('err@', '');
data = "<font color=red>" + data + "</font>";
$("#Msg").html(data);
// alert(data);
return;
}
node = new Entity("BP.WF.Node", pageData.FK_Node);
//子线程退回到分流节点:子线程删除规则. 不删除其他的子线程.
if (node.IsKillEtcThread == 0 && node.RunModel==4 ) {
document.getElementById("btnIsKillEtcThread").style.display = 'none';
document.getElementById("CB_IsKillEtcThread").checked = false;
}
//子线程退回到分流节点:删除其他的子线程.
if (node.IsKillEtcThread == 1 && node.RunModel == 4) {
document.getElementById("btnIsKillEtcThread").style.display = 'inline';
document.getElementById("CB_IsKillEtcThread").checked = true;
$('#CB_IsKillEtcThread').attr("disabled", 'disabled'); //让其不可编辑.
}
//子线程退回到分流节点:由用户决定.
if (node.IsKillEtcThread == 2 && node.RunModel == 4) {
document.getElementById("btnIsKillEtcThread").style.display = 'inline';
document.getElementById("CB_IsKillEtcThread").checked = true;
// $('#CB_IsKillEtcThread').attr("disabled", 'disabled'); //让其不可编辑.
}
////是否选择. 退回并原路返回. 强制设置,退回并原路返回.
if (_ReturnWin_IsBackTracking_Selected == true) {
// document.getElementById("btnIsKillEtcThread").style.display = 'inline';
document.getElementById("CB_IsBackTracking").checked = true;
// document.getElementById("CB_IsBackTracking").checked = true;
$('#CB_IsBackTracking').attr("disabled", 'disabled');
} else {
//不允许原路返回.
if (node.IsBackTracking === 0) {
document.getElementById("CB_IsBackTracking").checked = false;
$('#CB_IsBackTracking').attr("disabled", 'disabled');
// $("#btnIsBackTracking").css("display", "inline");
}
//强制设置原路返回.
if (node.IsBackTracking === 2) {
document.getElementById("CB_IsBackTracking").checked = true;
$('#CB_IsBackTracking').attr("disabled", 'disabled');
$("#btnIsBackTracking").css("display", "inline");
}
//让用户决定,是否可以原路返回.
if (node.IsBackTracking === 1) {
$("#btnIsBackTracking").css("display", "inline");
}
}
if (node.ReturnCHEnable == 1) {
var mapAttrs = new Entities("BP.Sys.MapAttrs");
mapAttrs.Retrieve("FK_MapData", "BP.WF.ReturnWorks", "Idx");
var idx = 0;
if (mapAttrs.length != 0) {
$("#ReturnCH").show();
var html = " 退回考核规则信息:";
html += "<table style='width:100%;'>";
for (var i = 0; i < mapAttrs.length; i++) {
if (mapAttrs[i].AtPara.indexOf("FK_Flow=" + pageData.FK_Flow) != -1) {
idx++;
if ((idx + 1) % 2 == 0)
html += "<tr>";
html += "<td>" + mapAttrs[i].Name + "</td>";
html += "<td style='text-align:left'>";
html += InitAthMapAttrOfCtrlFool(null, mapAttrs[i], null);
html += "</td>";
if (idx % 2 == 0)
html += "</tr>";
}
}
html += "</table>";
if (idx != 0) {
$("#ReturnCH").html(html);
}
}
}
//获得可以退回的节点集合。
var returnNodeArr = JSON.parse(data);
var nodeListHtml = '';
$.each(returnNodeArr, function (i, returnNode) {
if (returnNode.AtPara && returnNode.AtPara.indexOf('IsHuiQian=1') >= 0) {
return true; //退回这个字段里包含 IsHuiQian=1的字符就排除掉.
}
if (nodeListHtml.indexOf(returnNode.No + '@') != -1)
return true;
nodeListHtml += '<option data-IsKillEtcThread=' + returnNode.IsKillEtcThread + ' data-IsBackTracking=' + returnNode.IsBackTracking + ' value="' + returnNode.No + '@' + returnNode.Rec + '">' + returnNode.RecName + '=&gt;' + returnNode.Name + '</option>';
});
//绑定退回到节点的数据.
$('#DDL_Nodes').html(nodeListHtml);
//获取当前节点属性,是否可以执行退回并原路返回的按钮?
//var node = new Entity("BP.WF.Node", pageData.FK_Node)
if (node.IsBackTracking != "0")
$('#btnIsBackTracking').css("display", "inline");
if (node.IsKillEtcThread == "1" && (node.RunModel == 4))
$('#btnIsKillEtcThread').css("display", "inline");
$("section").show();
$(".wait").hide();
Common.MaxLengthError();
//临时处理sls 的需求, 退回任意节点 \datauser\JsLab\ReturnWork.js 代码.
try {
LoaclOperation();
} catch (e) {
}
});
//确定 退回 执行退回操作
// isBack=0 是退回按钮调用, =1是退回并原路返回按钮调用.
function Save(isBack) {
//判断退回并原路返回复选框是否被选中
if ($("#CB_IsBackTracking").prop("checked") == true)
isBack = 1;
//是否全部(子线程)退回?
var IsKillEtcThread = 0;
if ($("#CB_IsKillEtcThread").prop("checked") == true)
IsKillEtcThread = 1;
if (node.IsKillEtcThread == "1")
IsKillEtcThread = 1;
//获得选择退回的节点.
var selectedNodeID = $('#DDL_Nodes').val();
if (selectedNodeID == null || selectedNodeID == undefined || selectedNodeID == "") {
alert('请选择要退回的节点');
return;
}
//获得退回原因.
var val = escape($('#TB_Doc').val().trim());
if (val == null || val == "" || val == undefined) {
alert("请输入退回原因.");
return;
}
$('.foot input').attr('disabled', 'disabled');
$('.foot input').css('background', 'gray');
var doc = "";
doc = $('#TB_Doc').val();
//调动退回接口.
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt");
var doMethod = "DoReturnWork";
if (pageData.WorkIDs != null && pageData.WorkIDs != undefined && pageData.WorkIDs != "") {
handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_Batch");
handler.AddPara("WorkIDs", pageData.WorkIDs);
doMethod = "Batch_Return";
}
handler.AddPara("FK_Flow", pageData.FK_Flow);
handler.AddPara("WorkID", pageData.WorkID);
handler.AddPara("FID", pageData.FID);
handler.AddPara("FK_Node", pageData.FK_Node);
handler.AddPara("ReturnToNode", selectedNodeID);
handler.AddPara("ReturnInfo", doc);
//如果强制设置了退回并原路返回.
if (_ReturnWin_IsBackTracking_Selected != undefined && _ReturnWin_IsBackTracking_Selected == true)
isBack = 1;
handler.AddPara("IsBack", isBack);
//是否全部子线程退回?
handler.AddPara("IsKillEtcThread", IsKillEtcThread);
// alert(IsKillEtcThread);
//增加字段属性, 这部分vue可以不翻译.
var parasData = $("form").serialize();
handler.AddPara("PageData", parasData);
//调用退回方法.
var data = handler.DoMethodReturnString(doMethod); //执行方法.
if (isFrameCross == 0) {
if (window.parent != null && window.parent.WindowCloseReloadPage != null && typeof window.parent.WindowCloseReloadPage === "function") {
window.parent.WindowCloseReloadPage(data);
} else {
if (typeof WindowCloseReloadPage != 'undefined'
&& WindowCloseReloadPage instanceof Function)
WindowCloseReloadPage(data);
}
} else {
ChildrenPostMessage(data, "WindowCloseReloadPage");
}
//提示退回消息, 并关闭窗口,刷新父父窗口.
data = data.replace(/null/g, '');
if (isFrameCross == 0) {
var url = window.parent ? window.parent.location.href : "";
if (window.parent && typeof window.parent.returnWorkWindowClose == "function" && url.indexOf("WorkCheckModel") == -1) {
window.parent.returnWorkWindowClose(data);
} else if (window.opener && typeof window.opener.returnWorkWindowClose == "function" && url.indexOf("WorkCheckModel") == -1) {
window.opener.returnWorkWindowClose(data);
} else {
$("#DIV_Nodes").hide();
$("#DIV_Doc").hide();
$("#btnReturn").hide();
$('body').append($('<div>' + data + '</div>'));
$('#btnOk').attr('disabled', true);
}
} else {
ChildrenPostMessage(data, "returnWorkWindowClose");
}
$(".foot").hide();
}
//取消退回
function Close(flag) {
if (isFrameCross == 0) {
var url = window.parent ? window.parent.location.href : "";
if (window.parent && typeof window.parent.returnWorkWindowClose == "function" && url.indexOf("WorkCheckModel") == -1) {
window.parent.returnWorkWindowClose("取消");
if (flag == 1)
window.parent.close();
}
else if (window.parent && typeof window.parent.CloseBootstrapDialog == "function") {
window.parent.CloseBootstrapDialog("");
}
else {
$('body').append($('<div>' + "已取消操作" + '</div>'));
window.close();
}
} else {
ChildrenPostMessage("取消", "returnWorkWindowClose");
if (flag == 1)
window.parent.close();
}
}
</script>
</head>
<body>
<div style="padding:0 15px;">
<div class="wait" style="text-align: center;" id="Msg">页面数据正在加载中,请稍候......</div>
<div id="DIV_Nodes">
要退回到:
<select id="DDL_Nodes" name="DDL_Nodes" style="width: 60%;border:solid 1px #ccc" class="layui-select"></select>
</div>
<!--启用了退回考核规则的设置-->
<form id="cc">
<div id="ReturnCH" style="display:none;"></div>
</form>
<div id="DIV_Doc">
<textarea id="TB_Doc" name="TB_Doc" placeholder="请输入退回原因..."
style="width: 100%; height:100px;border:solid 1px #ccc"
maxlength="500" class="layui-textarea"></textarea>
</div>
</div>
<!--<div> 上传附件:</div>
<div style="height:100px;">上传附件预留:该功能正在建设中</div>
-->
<div class="form-inline" style="margin-right:15px;text-align:right;bottom: 20px;">
<div id="btnIsBackTracking" style="margin-top:6px;display:none">
<label>
<input type="checkbox" id="CB_IsBackTracking" />
本次退回后,并由被退回节点直接发送到本环节&nbsp;&nbsp;
</label>
</div>
<div id="btnIsKillEtcThread" style="margin-top: 6px; display: none">
<label>
<input type="checkbox" id="CB_IsKillEtcThread" />
全部子线程退回&nbsp;&nbsp;
</label>
</div>
<button type="button" onclick="Close();" id="btnClose" class="layui-btn layui-btn-primary">
<!--<img src="../Img/Btn/Close.png" />--> 关闭
</button>
<button type="button" onclick="Save(0);" id="btnReturn" class="layui-btn layui-btn-normal">
<!--<img src="../Img/Btn/Confirm.png" />--> 退回
</button>
</div>
</body>
</html>