1223 lines
47 KiB
JavaScript
1223 lines
47 KiB
JavaScript
var sid;
|
||
var teamId;
|
||
var wsId;
|
||
var processInstId;
|
||
var initTree;
|
||
var editPerm = false;
|
||
var closeFormPage = false;
|
||
var searchType;
|
||
//统一中文变量
|
||
var varDutyDept = "责任部门";
|
||
var varDutyUser = "责任人";
|
||
$(document).ready(function(){
|
||
// $('#alertMsg').css('background', '#fff');
|
||
$('#OPTIONTYPE_0').closest('td').width('10%');
|
||
$('#OPTIONTYPE_1').closest('td').width('10%');
|
||
initParam();
|
||
initHtml();
|
||
initContentData();
|
||
// listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉
|
||
})
|
||
|
||
var resizeWaiter = false;
|
||
$(window).resize(function() {
|
||
if(!resizeWaiter){
|
||
setTimeout(function(){
|
||
resizeWaiter = true;
|
||
if (!$("#publisher_new_tr").is(':hidden')) {
|
||
initWidth(true, 'new');
|
||
}
|
||
if (!$("#publisher_change_tr").is(':hidden')) {
|
||
initWidth(true, 'change');
|
||
}
|
||
if (!$("#publisher_stop_tr").is(':hidden')) {
|
||
initWidth(true, 'stop');
|
||
}
|
||
resizeWaiter = false;
|
||
}, 500);
|
||
}
|
||
});
|
||
|
||
// 初始化自定义内容,不能写到html 文件中,表单会被平台自动调整的不成样子
|
||
function initHtml() {
|
||
var dialogHtml = '';
|
||
dialogHtml += '<div id="treeDialog" border="0" style="width: 700px; display: none;" title="流程资产库">';
|
||
dialogHtml += '<div id="searchData" class="awsui-form-input">';
|
||
dialogHtml += '</div>';
|
||
dialogHtml += '<div id="autoSearchProcessDiv" style="z-index: 999;position:absolute; background-color:white;min-width: 208px; max-height: 340px; overflow: auto; top: 80px; left: 16px; border: 1px solid #c5c5c5; display: none;">';
|
||
dialogHtml += '</div>';
|
||
dialogHtml += '<div id="treeDataDiv" border="0" style="margin: 8px; height: 350px;">';
|
||
dialogHtml += '</div>';
|
||
dialogHtml += '</div>';
|
||
$('body').append(dialogHtml);
|
||
|
||
$('#publisher_new_div').html('<div id="contentDiv1" class="" border="0"></div>');
|
||
$('#publisher_change_div').html('<div id="contentDiv2" class="" border="0"></div>');
|
||
$('#publisher_stop_div').html('<div id="contentDiv3" class="" border="0"></div>');
|
||
|
||
var newHtml = '';
|
||
newHtml += '<!-- 流程文件发布-->';
|
||
newHtml += '<div id="publisher_new" border="1">';
|
||
newHtml += '<table id="table_new" class="awsui-table awsui-table-condensed" style="width: 100%; padding: 0px; border-collapse: collapse;" border="1" cellspacing="3" cellpadding="0">';
|
||
newHtml += '<tbody>';
|
||
newHtml += '<tr>';
|
||
newHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label" for="publisher_new_file_name">流程文件</label></td>';
|
||
newHtml += '<td class="aws-form-ux-content">';
|
||
newHtml += '<div id="publisher_new_file_name" style="display:inline-block;">';
|
||
newHtml += '<span class="file_name" style="display:inline-block;text-align:left;"></span>';
|
||
newHtml += '<div id="publish_new_file_query" class="awsui-iconfont" style="font-size:15px;color:#000;display:inline-block;cursor:pointer;" onclick="openQueryDataDialog(\'new\');"></div>';
|
||
newHtml += '</div>';
|
||
newHtml += '</td>';
|
||
newHtml += '<td class="aws-form-ux-content" style="display: none;"><input id="publisher_new_file_id" class="txt" type="text" /></td>';
|
||
newHtml += '</tr>';
|
||
newHtml += '<!-- 流程手册,保存流程手册ID -->';
|
||
newHtml += '<tr>';
|
||
newHtml += '<td class="awsui-ux-title">流程手册</td>';
|
||
newHtml += '<td id="publisher_new_report_name" class="aws-form-ux-content"></td>';
|
||
newHtml += '<td id="publisher_new_report_id" class="aws-form-ux-content" style="display: none;"></td>';
|
||
newHtml += '</tr>';
|
||
newHtml += '<tr>';
|
||
newHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label">流程文件概要</label></td>';
|
||
newHtml += '<td class="aws-form-ux-content"><textarea id="publisher_new_desc" type="text" style="width:99%;height:80px;outline:none;" class="awsui-textarea"></textarea></td>';
|
||
newHtml += '</tr>';
|
||
newHtml += '</tbody>';
|
||
newHtml += '</table>';
|
||
newHtml += '</div>';
|
||
|
||
var changeHtml = '';
|
||
changeHtml += '<!-- 流程文件变更 -->';
|
||
changeHtml += '<div id="publisher_change" border="1">';
|
||
changeHtml += '<table id="table_change" class="awsui-table" style="width: 100%; padding: 0px; border-collapse: collapse;" border="1" cellspacing="3" cellpadding="0">';
|
||
changeHtml += '<tbody>';
|
||
changeHtml += '<tr>';
|
||
changeHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label" for="publisher_change_file_name">流程文件</label></td>';
|
||
changeHtml += '<td class="aws-form-ux-content">';
|
||
changeHtml += '<div id="publisher_change_source_file_name" style="display:inline-block;">';
|
||
changeHtml += '<span class="file_name" style="display:inline-block;text-align:left;"></span>';
|
||
changeHtml += '<div id="publish_change_file_query" class="awsui-iconfont" style="font-size:15px;color:#000;display:inline-block;cursor:pointer;" onclick="openQueryDataDialog(\'change\');"></div>';
|
||
changeHtml += '</div>';
|
||
changeHtml += '<input type="hidden" id="publisher_change_target_file_id" value=""/>'
|
||
changeHtml += '<input type="hidden" id="publisher_change_source_file_id" value=""/>'
|
||
changeHtml += '</td>';
|
||
changeHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label" for="publisher_change_file_name">变更后文件</label></td>';
|
||
changeHtml += '<td id="select" class="aws-form-ux-content"></td>';
|
||
changeHtml += '</tr>';
|
||
changeHtml += '<!-- 流程手册相关 -->';
|
||
changeHtml += '<tr>';
|
||
changeHtml += '<td class="awsui-ux-title">流程手册</td>';
|
||
changeHtml += '<td id="publisher_change_report_name" class="aws-form-ux-content" colspan="3"></td>';
|
||
changeHtml += '<td id="publisher_change_report_id" class="aws-form-ux-content" style="display: none;"></td>';
|
||
changeHtml += '</tr>';
|
||
changeHtml += '<tr>';
|
||
changeHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label">变化点说明</label></td>';
|
||
changeHtml += '<td class="aws-form-ux-content" colspan="3"><textarea id="publisher_change_desc" type="text" style="width:99%;height:80px;outline:none;" class="awsui-textarea"></textarea></td>';
|
||
changeHtml += '</tr>';
|
||
changeHtml += '</tbody>';
|
||
changeHtml += '</table>';
|
||
changeHtml += '</div>';
|
||
|
||
var stopHtml = '';
|
||
stopHtml += '<!-- 流程文件废止-->';
|
||
stopHtml += '<div id="publisher_stop" border="1">';
|
||
stopHtml += '<table id="table_stop" class="awsui-table" style="width: 100%; padding: 0px; border-collapse: collapse;" border="1" cellspacing="3" cellpadding="0">';
|
||
stopHtml += '<tbody>';
|
||
stopHtml += '<tr>';
|
||
stopHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label" for="publisher_stop_file_name">流程文件</label></td>';
|
||
stopHtml += '<td class="aws-form-ux-content">';
|
||
stopHtml += '<div id="publisher_stop_file_name" style="display:inline-block;">';
|
||
stopHtml += '<span class="file_name" style="display:inline-block;text-align:left;"></span>';
|
||
stopHtml += '<div id="publish_stop_file_query" class="awsui-iconfont" style="font-size:15px;color:#000;display:inline-block;cursor:pointer;" onclick="openQueryDataDialog(\'stop\');"></div>';
|
||
stopHtml += '</div>';
|
||
stopHtml += '</td>';
|
||
stopHtml += '<td class="aws-form-ux-content" style="display: none;"><input id="publisher_stop_file_id" class="txt" type="text" /></td>';
|
||
stopHtml += '</tr>';
|
||
stopHtml += '<!-- 流程手册,保存流程手册ID -->';
|
||
stopHtml += '<tr>';
|
||
stopHtml += '<td class="awsui-ux-title">流程手册</td>';
|
||
stopHtml += '<td id="publisher_stop_report_name" class="aws-form-ux-content"></td>';
|
||
stopHtml += '<td id="publisher_stop_report_id" class="aws-form-ux-content" style="display: none;"></td>';
|
||
stopHtml += '</tr>';
|
||
stopHtml += '<tr>';
|
||
stopHtml += '<td class="awsui-ux-title"><label class="aws-form-ux-label">废止说明</label></td>';
|
||
stopHtml += '<td class="aws-form-ux-content"><textarea id="publisher_stop_desc" type="text" style="width:99%;height:80px;outline:none;" class="awsui-textarea"></textarea></td>';
|
||
stopHtml += '</tr>';
|
||
stopHtml += '</tbody>';
|
||
stopHtml += '</table>';
|
||
stopHtml += '</div>';
|
||
|
||
$('#contentDiv1').append(newHtml);
|
||
$('#contentDiv2').append(changeHtml);
|
||
$('#contentDiv3').append(stopHtml);
|
||
}
|
||
|
||
// 初始化
|
||
function initParam() {
|
||
teamId = $("#TEAMID").val();
|
||
sid = $("#sid").val();
|
||
wsId = $("#WSID").val();
|
||
processInstId = $("#processInstId").val();
|
||
}
|
||
|
||
// 初始化内容数据
|
||
function initContentData() {
|
||
var param = {
|
||
cmd: 'com.actionsoft.apps.coe.pal.publisher_data_query',
|
||
processInstId: processInstId,
|
||
wsId : wsId,
|
||
sid: sid
|
||
};
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
data : param,
|
||
success : function(r) {
|
||
var isEnd = r.data.isEnd;
|
||
var proNumber = r.data.proNumber;
|
||
if (proNumber) {
|
||
editPerm = proNumber;
|
||
}
|
||
closeFormPage = r.data.closeFormPage;
|
||
var newData = r.data.newData;
|
||
var changeData = r.data.changeData;
|
||
var stopData = r.data.stopData;
|
||
var checkImg = '../apps/_bpm.portal/img/icheck_checkbox_check.png';
|
||
var uncheckImg = '../apps/_bpm.portal/img/icheck_checkbox_uncheck.png';
|
||
if (!$.isEmptyObject(newData)) {
|
||
$('#OPTIONTYPE_0').prev('img').attr('src', checkImg);
|
||
$("#OPTIONTYPE_0").check("option","checked", true);
|
||
dealPublishCheck(true, 'new');// 显示
|
||
// 更新数据
|
||
initPublishData(newData, 'new', isEnd, proNumber);
|
||
} else {
|
||
$("#OPTIONTYPE_0").check("option","checked", false);
|
||
$('#OPTIONTYPE_0').prev('img').attr('src', uncheckImg);
|
||
}
|
||
if (!$.isEmptyObject(changeData)) {
|
||
$('#OPTIONTYPE_1').prev('img').attr('src', checkImg);
|
||
$("#OPTIONTYPE_1").check("option","checked", true);
|
||
dealPublishCheck(true, 'change');
|
||
initPublishData(changeData, 'change', isEnd, proNumber);
|
||
} else {
|
||
$("#OPTIONTYPE_1").check("option","checked", false);
|
||
$('#OPTIONTYPE_1').prev('img').attr('src', uncheckImg);
|
||
}
|
||
if (!$.isEmptyObject(stopData)) {
|
||
$('#OPTIONTYPE_2').prev('img').attr('src', checkImg);
|
||
$("#OPTIONTYPE_2").check("option","checked", true);
|
||
dealPublishCheck(true, 'stop');
|
||
initPublishData(stopData, 'stop', isEnd, proNumber);
|
||
} else {
|
||
$("#OPTIONTYPE_2").check("option","checked", false);
|
||
$('#OPTIONTYPE_2').prev('img').attr('src', uncheckImg);
|
||
}
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
var changeData;
|
||
var changeOption;
|
||
/**
|
||
* 初始化数据
|
||
* @param data 源数据
|
||
* @param type 类型
|
||
* @param isEnd 流程是否结束
|
||
* @param proNumber 是不是在第一个发起节点
|
||
* @returns
|
||
*/
|
||
function initPublishData(data, type, isEnd, proNumber) {
|
||
if (type == 'new') {
|
||
var fileName = data.publishFileName + ' V' + data.fileVersion + '.0';
|
||
var aHtml = '<a class="link" href="javascript:void(0);" onclick="openPortalPage(\'' + data.publishFileId + '\', \'' + data.taskId + '\')">' + fileName + '</a>';
|
||
$('#publisher_new_file_name').children('span.file_name').html(aHtml);
|
||
$('#publisher_new_file_id').val(data.publishFileId);
|
||
if (data.taskId != undefined && data.taskId != '') {
|
||
var reportName = fileName + "-流程手册";
|
||
var reportHtml = '<span><a class="link" href="javascript:void(0);" onclick="openReportFile(\'' + data.taskId + '\')">' + reportName + '</a></span>';
|
||
$('#publisher_new_report_name').html(reportHtml);
|
||
} else {
|
||
$('#publisher_new_report_name').html('无流程手册');
|
||
}
|
||
$('#publisher_new_report_id').text(data.taskId);
|
||
$('#publisher_new_desc').val(data.publishDesc);
|
||
if (!proNumber) {
|
||
$('#publisher_new').find('input').attr("disabled", true);
|
||
$('#publisher_new').find('textarea').attr("disabled", true);
|
||
$('#publish_new_file_query').prop('onclick', "");
|
||
}
|
||
}
|
||
if (type == 'change') {
|
||
changeData = data;
|
||
// 变更文件处理
|
||
var sourceFileName = data.changeFileName + ' V' + data.fileVersion + '.0';
|
||
$('#publisher_change_source_file_name').children('span.file_name').html(sourceFileName);
|
||
$('#publisher_change_source_file_id').val(data.changeFileId);
|
||
|
||
// 变更目标文件处理
|
||
var targetFileName = "";
|
||
if (data.changedFileNameNew != undefined && data.changedFileNameNew != '') {
|
||
targetFileName = data.changedFileNameNew + ' V' + data.targetFileVersion + '.0';
|
||
}
|
||
var targetId = "";
|
||
if (data.changedFileIdNew != undefined && data.changedFileIdNew != '') {
|
||
targetId = data.changedFileIdNew;
|
||
}
|
||
$('#publisher_change_target_file_id').val(targetId);
|
||
var taskId = "";
|
||
if (data.taskId != undefined && data.taskId != '') {
|
||
taskId = data.taskId;
|
||
var reportName = targetFileName + "-流程手册";
|
||
var reportHtml = '<span><a class="link" href="javascript:void(0);" onclick="openReportFile(\'' + data.taskId + '\')">' + reportName + '</a></span>';
|
||
$('#publisher_change_report_name').html(reportHtml);
|
||
} else {
|
||
$('#publisher_change_report_name').html('无流程手册');
|
||
}
|
||
$('#publisher_change_report_id').text(data.taskId);
|
||
|
||
// 下选框处理
|
||
if (!proNumber) {
|
||
var tempHtml = '<span class="file_name" style="display:inline-block;text-align:left;"><a class="link" href="javascript:void(0);" onclick="openPortalPage(\'' + data.changedFileIdNew + '\', \'' + data.taskId + '\')">' + targetFileName + '</a></span>';
|
||
$('#select').html(tempHtml);
|
||
} else {
|
||
$('#select').html('<select id="publisher_change_target_file"></select>');
|
||
if (data.targetFiles.length > 0) {
|
||
var opt1 = {
|
||
data : []
|
||
};
|
||
var flag = false;
|
||
for (var i = 0; i < data.targetFiles.length; i++) {
|
||
var temp = data.targetFiles[i];
|
||
var name = temp.text + ' V' + temp.version + '.0';
|
||
var obj = {id:temp.id, text:name};
|
||
opt1.data.push(obj);
|
||
if (targetId == temp.id) {
|
||
flag = true;
|
||
}
|
||
}
|
||
changeOption = opt1;
|
||
$("#publisher_change_target_file").select2(opt1);
|
||
if (flag) {
|
||
$("#publisher_change_target_file").val(targetId).trigger("change");
|
||
} else {
|
||
// 没有选择的版本时默认第一个为选中,取当前选择的生成流程手册
|
||
initChangedData(changeData, changeOption);
|
||
}
|
||
// select改变事件
|
||
$('#publisher_change_target_file').on("change", function (e) {
|
||
initChangedData(changeData, changeOption);// 初始化变更文件
|
||
});
|
||
} else {
|
||
// 无数据,定义为空的select2
|
||
var opt1 = {data : []};
|
||
$("#publisher_change_target_file").select2(opt1);
|
||
$('#publisher_change_source_file_id').val('');
|
||
}
|
||
$('.select2').width('100%');
|
||
}
|
||
// 描述处理
|
||
$('#publisher_change_desc').val(data.changedDesc);
|
||
if (!proNumber) {
|
||
$('#publisher_change').find('input').attr("disabled", true);
|
||
$('#publisher_change').find('textarea').attr("disabled", true);
|
||
$('#publish_change_file_query').prop('onclick', "");
|
||
}
|
||
}
|
||
if (type == 'stop') {
|
||
var fileName = data.stopFileName + ' V' + data.fileVersion + '.0';
|
||
var aHtml = '<a class="link" href="javascript:void(0);" onclick="openPortalPage(\'' + data.stopFileId + '\', \'' + data.taskId + '\')">' + fileName + '</a>';
|
||
$('#publisher_stop_file_name').children('span.file_name').html(aHtml);
|
||
$('#publisher_stop_file_id').val(data.stopFileId);
|
||
if (data.taskId != undefined && data.taskId != '') {
|
||
var reportName = fileName + "-流程手册";
|
||
var reportHtml = '<span><a class="link" href="javascript:void(0);" onclick="openReportFile(\'' + data.taskId + '\')">' + reportName + '</a></span>';
|
||
$('#publisher_stop_report_name').html(reportHtml);
|
||
} else {
|
||
$('#publisher_stop_report_name').html('无流程手册');
|
||
}
|
||
$('#publisher_stop_report_id').text(data.taskId);
|
||
$('#publisher_stop_desc').val(data.stopDesc);
|
||
if (!proNumber) {
|
||
$('#publisher_stop').find('input').attr("disabled", true);
|
||
$('#publisher_stop').find('textarea').attr("disabled", true);
|
||
$('#publish_stop_file_query').prop('onclick', "");
|
||
}
|
||
}
|
||
}
|
||
|
||
// select2改变事件
|
||
function initChangedData(data, opt1) {
|
||
var selectedId = $("#publisher_change_target_file").val();
|
||
$('#publisher_change_target_file_id').val(selectedId);
|
||
var selectedTaskId = "";
|
||
selectedTaskId = createReport(data.category, data.methodId, selectedId, selectedTaskId);
|
||
if (selectedTaskId != '') {
|
||
var targetFileName2 = "";
|
||
for(var i = 0; i < opt1.data.length; i++) {
|
||
if (opt1.data[i].id == selectedId) {
|
||
targetFileName2 = opt1.data[i].text;
|
||
break;
|
||
}
|
||
}
|
||
var reportName2 = targetFileName2 + "-流程手册";
|
||
var reportHtml2 = '<span><a class="link" href="javascript:void(0);" onclick="openReportFile(\'' + selectedTaskId + '\')">' + reportName2 + '</a></span>';
|
||
$('#publisher_change_report_name').html(reportHtml2);
|
||
} else {
|
||
$('#publisher_change_report_name').html('无流程手册');
|
||
}
|
||
$('#publisher_change_report_id').text(selectedTaskId);
|
||
|
||
}
|
||
|
||
// 打开流程文件查看页面
|
||
function openPortalPage(uuid, taskId) {
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_repository_method_check",
|
||
uuid : uuid
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
data : param,
|
||
success : function(r) {
|
||
if (r.result == 'ok') {
|
||
window.open("./w?cmd=com.actionsoft.apps.coe.pal.publisher_publish_file_open&uuid=" + uuid + "&sid=" + sid + "&taskId=" + taskId);// open Windows
|
||
} else {
|
||
$.simpleAlert(r.msg);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// 打开流程选择dialog
|
||
function openQueryDataDialog(type) {
|
||
searchType = type;
|
||
$('#treeDataDiv').html('<div id="loadImg" style="width:100%;height:100%;text-align:center;vertical-align: middle;margin: auto;"></div>');
|
||
$('#searchData').html('<input id="processName" style="width:700px;" type="text" class="awsui-txt" placeholder="快速查询">');
|
||
$("#loadImg").loading({
|
||
description:"加载中",
|
||
size:'large',
|
||
color:'#000'
|
||
});
|
||
$('.awsui-loading').css('position', 'relative');
|
||
$('.awsui-loading').css('top', '60px');
|
||
$("#loading-demo-basic").loading();
|
||
$("#treeDialog").dialog({
|
||
buttons:[
|
||
{text:'确定',cls:"blue",handler:function(){
|
||
if (type == 'new') {
|
||
getNewPublishResult(type);
|
||
} else if( type == 'change'){
|
||
getChangeResult(type);
|
||
} else {// stop
|
||
getStopResult(type);
|
||
}
|
||
}},
|
||
{text:'关闭',handler:function(){
|
||
closeDialog();// 关闭窗口
|
||
}}
|
||
],
|
||
onClose:function(){
|
||
$('#autoSearchProcessDiv').empty();
|
||
$('#autoSearchProcessDiv').hide();
|
||
$('#treeDataDiv').empty();
|
||
$('#searchData').empty();
|
||
}
|
||
});
|
||
if (type == 'new') {
|
||
initPublishSearch(type);// 绑定搜索事件
|
||
getNotPublishTreeData(type);
|
||
} else {// stop
|
||
initPublishSearch(type);// 绑定搜索事件
|
||
getPublishedTreeData(type);
|
||
}
|
||
}
|
||
|
||
// 获取未发布文件数据结构
|
||
function getNotPublishTreeData(type) {
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_tree_data_query",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
type: type,
|
||
flag : true
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
data : param,
|
||
success : function(r) {
|
||
var data = r.data.data;
|
||
var setting = {
|
||
checkbox: false,
|
||
checkInherit: false,
|
||
event : {
|
||
beforeExpand : loadNewData
|
||
},
|
||
dataModel : {
|
||
data: data
|
||
}
|
||
};
|
||
$("#treeDataDiv").empty();
|
||
$('#treeDataDiv').html('<ul id="tree" style="width: 100%;"></ul>');
|
||
initTree = awsui.tree.init($("#tree"), setting);
|
||
}
|
||
});
|
||
}
|
||
//加载type为new的树节点
|
||
function loadNewData(treeNode) {
|
||
// 如果是父节点并且存在子节点执行加载
|
||
if (treeNode) {
|
||
var pid;
|
||
if (typeof(treeNode) == "string") {
|
||
pid = treeNode;
|
||
} else {
|
||
pid = treeNode.id;
|
||
}
|
||
var dataModel = {
|
||
url : "./w?sid=" + jQuery("#sid").val()
|
||
+ "&cmd=com.actionsoft.apps.coe.pal.publisher_publish_tree_data_query&flag=" + false + "&pid=" + pid
|
||
+ "&wsId=" + wsId + "&type=" + "new" + "&teamId=" + teamId,
|
||
method : "POST",
|
||
dataType : "json"
|
||
}
|
||
initTree.refreshNode({
|
||
id : pid,
|
||
dataModel : dataModel
|
||
});
|
||
var data = initTree.getChildrenByPid(pid);
|
||
var newData = [];
|
||
for (var i=0;i<data.length;i++){
|
||
if (data[i].pid != pid) {
|
||
continue;
|
||
}
|
||
var v = data[i].nocheck;
|
||
if (v && data[i].id.length <= 36){
|
||
data[i].name = data[i].name + ' (已发布)';
|
||
}
|
||
// 流程名称连接责任部门和责任人
|
||
data[i].tempName = data[i].name;
|
||
var hasDutyDept = false;
|
||
var hasDutyUser = false;
|
||
if (data[i].dutyDeptName != undefined && data[i].dutyDeptName != '') {
|
||
hasDutyDept = true;
|
||
}
|
||
if (data[i].dutyUserName != undefined && data[i].dutyUserName != '') {
|
||
hasDutyUser = true;
|
||
}
|
||
if (hasDutyDept && hasDutyUser) {
|
||
var tempText = '[' + varDutyDept + ':' + data[i].dutyDeptName + ' ' + varDutyUser + ':' + data[i].dutyUserName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
} else if (hasDutyDept) {
|
||
var tempText = '[' + varDutyDept + ':' + data[i].dutyDeptName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
} else if (hasDutyUser) {
|
||
var tempText = '[' + varDutyUser + ':' + data[i].dutyUserName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
}
|
||
newData.push(data[i]);
|
||
//initTree.refreshNodeById(data[i]);
|
||
}
|
||
initTree.refreshNode({
|
||
id : pid,
|
||
data : newData
|
||
});
|
||
}
|
||
}
|
||
|
||
// 发布类型结果数据回填
|
||
function getNewPublishResult(type) {
|
||
var node = initTree.getSelectedNode();
|
||
// 校验
|
||
if (node == undefined) {
|
||
$.simpleAlert("请选择资产库文件节点");
|
||
return;
|
||
}
|
||
if (node.nocheck) {
|
||
$.simpleAlert("请选择未发布文件");
|
||
return;
|
||
}
|
||
// 锁定按钮
|
||
disabledAll();
|
||
$.simpleAlert('正在加载', 'loading');
|
||
var taskId = "";
|
||
// 创建流程手册
|
||
taskId = createReport(node.category, node.method, node.id, taskId);
|
||
var data = {
|
||
category : node.category,
|
||
fileVersion : node.version,
|
||
methodId : node.method,
|
||
publishDesc : "",
|
||
publishFileId : node.id,
|
||
// publishFileName : node.name,
|
||
publishFileName : node.tempName,
|
||
taskId : taskId
|
||
}
|
||
clearData(type);// 清空
|
||
closeDialog();// 关闭窗口
|
||
initPublishData(data, type, false, true);// 回填值
|
||
}
|
||
|
||
//获取已发布文件数据结构
|
||
function getPublishedTreeData(type) {
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_tree_data_query",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
type: type,
|
||
flag : true
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
data : param,
|
||
success : function(r) {
|
||
var data = r.data.data;
|
||
var setting = {
|
||
checkbox: false,
|
||
checkInherit: false,
|
||
dataModel : {
|
||
data: data
|
||
}
|
||
};
|
||
for (var i=0;i<data.length;i++){
|
||
// 流程名称连接责任部门和责任人
|
||
data[i].tempName = data[i].name;
|
||
var hasDutyDept = false;
|
||
var hasDutyUser = false;
|
||
if (data[i].dutyDeptName != undefined && data[i].dutyDeptName != '') {
|
||
hasDutyDept = true;
|
||
}
|
||
if (data[i].dutyUserName != undefined && data[i].dutyUserName != '') {
|
||
hasDutyUser = true;
|
||
}
|
||
if (hasDutyDept && hasDutyUser) {
|
||
var tempText = '[' + varDutyDept + ':' + data[i].dutyDeptName + ' ' + varDutyUser + ':' + data[i].dutyUserName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
} else if (hasDutyDept) {
|
||
var tempText = '[' + varDutyDept + ':' + data[i].dutyDeptName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
} else if (hasDutyUser) {
|
||
var tempText = '[' + varDutyUser + ':' + data[i].dutyUserName + ']';
|
||
data[i].name += '<span style="color:#ddd">   ' + tempText + '</span>';
|
||
}
|
||
}
|
||
$("#treeDataDiv").empty();
|
||
$('#treeDataDiv').html('<ul id="tree" style="width: 100%;"></ul>');
|
||
initTree = awsui.tree.init($("#tree"), setting);
|
||
}
|
||
});
|
||
}
|
||
|
||
//变更类型结果数据回填
|
||
function getChangeResult(type) {
|
||
var node = initTree.getSelectedNode();
|
||
// 校验
|
||
if (node == undefined) {
|
||
$.simpleAlert("请选择资产库文件节点");
|
||
return;
|
||
}
|
||
if (node.nocheck) {
|
||
$.simpleAlert("请选择已发布文件");
|
||
return;
|
||
}
|
||
if (node.method == "default") {
|
||
$.simpleAlert("不允许选择该类型节点");
|
||
return;
|
||
}
|
||
// 锁定按钮
|
||
disabledAll();
|
||
$.simpleAlert('正在加载', 'loading');
|
||
var notPublishData = [];
|
||
// 查询其他未版本
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_not_publish_version_query",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
uuid: node.id
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
async : false,
|
||
data : param,
|
||
success : function(r) {
|
||
notPublishData = r.data.data;
|
||
}
|
||
});
|
||
var changeFileNewId = "";
|
||
var changeFileNewName = "";
|
||
var changeFileNewVersion = 1;
|
||
var data = {
|
||
category : node.category,
|
||
changeFileId : node.id,
|
||
// changeFileName : node.name,
|
||
changeFileName : node.tempName,
|
||
changedDesc : "",
|
||
changedFileIdNew : changeFileNewId,
|
||
changedFileNameNew : changeFileNewName,
|
||
fileVersion : node.version,
|
||
methodId : node.method,
|
||
targetCategory: node.category,
|
||
targetFileVersion: changeFileNewVersion,
|
||
targetFiles: notPublishData,
|
||
targetMethodId: node.method
|
||
}
|
||
clearData(type);// 清空
|
||
closeDialog();// 关闭窗口
|
||
initPublishData(data, type, false, true);// 回填值
|
||
}
|
||
|
||
//停用类型结果数据回填
|
||
function getStopResult(type) {
|
||
var node = initTree.getSelectedNode();
|
||
// 校验
|
||
if (node == undefined) {
|
||
$.simpleAlert("请选择资产库文件节点");
|
||
return;
|
||
}
|
||
if (node.nocheck) {
|
||
$.simpleAlert("请选择已发布文件");
|
||
return;
|
||
}
|
||
// 锁定按钮
|
||
disabledAll();
|
||
$.simpleAlert('正在加载', 'loading');
|
||
var taskId = "";
|
||
if (node.category == 'process' && node.method != "process.evc" && node.method != 'default') {
|
||
// 获取流程手册id
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_report_query",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
uuid: node.id
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
async : false,
|
||
data : param,
|
||
success : function(r) {
|
||
taskId = r.data.taskId;
|
||
}
|
||
});
|
||
}
|
||
var data = {
|
||
category : node.category,
|
||
fileVersion : node.version,
|
||
methodId : node.method,
|
||
stopDesc : "",
|
||
stopFileId : node.id,
|
||
// stopFileName : node.name,
|
||
stopFileName : node.tempName,
|
||
taskId : taskId
|
||
}
|
||
clearData(type);// 清空
|
||
closeDialog();// 关闭窗口
|
||
initPublishData(data, type, false, true);// 回填值
|
||
}
|
||
|
||
// 创建流程手册
|
||
function createReport(category, method, uuid, taskId) {
|
||
if (category == 'process' && method != "process.evc" && method != 'default') {
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_output_pr_report_create",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
uuid: uuid
|
||
}
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
async : false,
|
||
data : param,
|
||
success : function(r) {
|
||
if (r.result == 'ok') {
|
||
taskId = r.data.taskId;
|
||
}
|
||
}
|
||
});
|
||
}
|
||
return taskId;
|
||
}
|
||
|
||
// 清空树结构
|
||
function clearTreeData() {
|
||
initTree = {};
|
||
}
|
||
|
||
// 禁用按钮
|
||
function disabledAll() {
|
||
$('#treeDialog').find("div.dialog-button-wrap").find('button:first').attr({"disabled":"disabled"});
|
||
}
|
||
|
||
// 关闭模态窗
|
||
function closeDialog() {
|
||
$("#treeDialog").dialog("close");
|
||
}
|
||
|
||
// 打开流程手册
|
||
function openReportFile(taskId) {
|
||
$.simpleAlert("文件正在处理", "loading");
|
||
awsui.ajax.request({
|
||
type: "POST",
|
||
url: "./jd?sid=" + sid + "&cmd=com.actionsoft.apps.coe.pal.publisher_publish_output_file_open",
|
||
data: {taskId: taskId},
|
||
ok: function(msg) {
|
||
$.simpleAlert("close");
|
||
var url = msg.data.url;
|
||
if (msg.data.noSupport) {
|
||
window.location.href = url;
|
||
} else {
|
||
window.open(url);
|
||
}
|
||
},
|
||
err: function(msg) {
|
||
$.simpleAlert("close");
|
||
}
|
||
});
|
||
}
|
||
|
||
// 点击checkbox
|
||
function onCheckboxClickEvent(boItemName, $checkbox, val) {
|
||
var isCheck = !$checkbox.closest('div').hasClass('checked');
|
||
if (val == '流程文件发布') {
|
||
dealPublishCheck(isCheck, 'new');
|
||
} else if (val == '流程文件版本更新') {
|
||
dealPublishCheck(isCheck, 'change');
|
||
} else if (val == '流程文件废止') {
|
||
dealPublishCheck(isCheck, 'stop');
|
||
}
|
||
}
|
||
|
||
// 主体内容显示与隐藏
|
||
function dealPublishCheck(isCheck, type) {
|
||
if (type == 'new') {
|
||
clearData(type); //清空
|
||
isCheck ? $('#publisher_new_tr').show() : $('#publisher_new_tr').hide();
|
||
} else if (type == 'change') {
|
||
clearData(type);
|
||
isCheck ? $('#publisher_change_tr').show() : $('#publisher_change_tr').hide();
|
||
} else if (type == 'stop') {
|
||
clearData(type);
|
||
isCheck ? $('#publisher_stop_tr').show() : $('#publisher_stop_tr').hide();
|
||
}
|
||
// input宽度设定
|
||
initWidth(isCheck, type);
|
||
}
|
||
|
||
// 初始化宽度
|
||
function initWidth(isCheck, type) {
|
||
if (type == 'new' && isCheck) {
|
||
$('#publisher_new_file_name').width($('#publisher_new_file_name').closest('td').width());
|
||
$('#publisher_new_file_name').children('span.file_name').width($('#publisher_new_file_name').width() - 20);
|
||
$('#publisher_new_desc').width('86%');
|
||
}
|
||
if (type == 'change' && isCheck) {
|
||
$('#publisher_change_source_file_name').width($('#publisher_change_source_file_name').closest('td').width());
|
||
$('#publisher_change_source_file_name').children('span.file_name').width($('#publisher_change_source_file_name').width() - 20);
|
||
$('.select2').width('100%');
|
||
$('#publisher_change_desc').width('86%');
|
||
}
|
||
if (type == 'stop' && isCheck) {
|
||
$('#publisher_stop_file_name').width($('#publisher_stop_file_name').closest('td').width());
|
||
$('#publisher_stop_file_name').children('span.file_name').width($('#publisher_stop_file_name').width() - 20);
|
||
$('#publisher_stop_desc').width('86%');
|
||
}
|
||
}
|
||
|
||
// 清空对应模块数据
|
||
function clearData(type) {
|
||
if (type == 'new') {
|
||
$('#publisher_new_file_name').children('span.file_name').text('点击右侧按钮选择文件');
|
||
$('#publisher_new_file_id').val('');
|
||
$('#publisher_new_report_name').text('无流程手册');
|
||
$('#publisher_new_report_id').text('');
|
||
$('#publisher_new_desc').val('');
|
||
} else if (type == 'change') {
|
||
$('#publisher_change_source_file_name').children('span.file_name').text('点击右侧按钮选择文件');
|
||
$('#publisher_change_source_file_id').val('');
|
||
$('#publisher_change_target_file').empty();
|
||
$('#publisher_change_target_file_id').val('');
|
||
$('#publisher_change_report_name').text('无流程手册');
|
||
$('#publisher_change_report_id').text('');
|
||
$('#publisher_change_desc').val('');
|
||
$('#select').html('<select id="publisher_change_target_file"></select>');
|
||
var opt1 = {data : []};
|
||
$("#publisher_change_target_file").select2(opt1);
|
||
} else if (type == 'stop') {
|
||
$('#publisher_stop_file_name').children('span.file_name').text('点击右侧按钮选择文件');
|
||
$('#publisher_stop_file_id').val('');
|
||
$('#publisher_stop_report_name').text('无流程手册');
|
||
$('#publisher_stop_report_id').text('');
|
||
$('#publisher_stop_desc').val('');
|
||
}
|
||
}
|
||
|
||
// 点击办理时的校验+保存字表
|
||
function formSave(isTransact){
|
||
if (!editPerm) {// 只读状态不处理
|
||
return true;
|
||
}
|
||
if(isTransact) {// 点击办理进行校验
|
||
if ($("#publisher_new_tr").css('display') == 'none' && $("#publisher_change_tr").css('display') == 'none' && $("#publisher_stop_tr").css('display') == 'none'){
|
||
$.simpleAlert('发布内容不能为空', 'info');
|
||
return false;
|
||
}
|
||
if (!($("#publisher_new_tr").css('display') == 'none')) {
|
||
if ($('#publisher_new_file_id').val() == '') {
|
||
$.simpleAlert('发布文件不能为空', 'info');
|
||
return false;
|
||
}
|
||
}
|
||
if (!($("#publisher_change_tr").css('display') == 'none')) {
|
||
if ($('#publisher_change_target_file_id').val() == '') {
|
||
$.simpleAlert('变更后的文件不能为空', 'info');
|
||
return false;
|
||
}
|
||
}
|
||
if (!($("#publisher_stop_tr").css('display') == 'none')) {
|
||
if ($('#publisher_stop_file_id').val() == '') {
|
||
$.simpleAlert('停用文件不能为空', 'info');
|
||
return false;
|
||
}
|
||
}
|
||
if (!($("#publisher_change_tr").css('display') == 'none') && !($("#publisher_stop_tr").css('display') == 'none')) {
|
||
if ($('#publisher_change_source_file_id').val() == $('#publisher_stop_file_id').val()) {
|
||
$.simpleAlert('变更文件与停用的发布文件不能相同', 'info');
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
// 保存到子表中
|
||
//发布
|
||
var publishNewFileId = $('#publisher_new_file_id').val();
|
||
var publishNewTaskId = $('#publisher_new_report_id').text();
|
||
var publishNewDesc = $('#publisher_new_desc').val();
|
||
// 变更
|
||
var publishChangeFileId = $('#publisher_change_source_file_id').val();
|
||
var publishChangeTargetFileId = $('#publisher_change_target_file_id').val();
|
||
var publishChangeTaskId = $('#publisher_change_report_id').text();
|
||
var publishChangeDesc = $('#publisher_change_desc').val();
|
||
// 停用
|
||
var publishStopFileId = $('#publisher_stop_file_id').val();
|
||
var publishStopTaskId = $('#publisher_stop_report_id').text();
|
||
var publishStopDesc = $('#publisher_stop_desc').val();
|
||
|
||
var saveData = {};
|
||
var newObj = {
|
||
uuid : publishNewFileId,
|
||
taskId : publishNewTaskId,
|
||
desc : publishNewDesc
|
||
};
|
||
var changeObj = {
|
||
uuid : publishChangeFileId,
|
||
targetId : publishChangeTargetFileId,
|
||
taskId : publishChangeTaskId,
|
||
desc : publishChangeDesc
|
||
};
|
||
var stopObj = {
|
||
uuid : publishStopFileId,
|
||
taskId : publishStopTaskId,
|
||
desc : publishStopDesc
|
||
};
|
||
saveData.newObj = newObj;
|
||
saveData.changeObj = changeObj;
|
||
saveData.stopObj = stopObj;
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_save_before",
|
||
teamId: teamId,
|
||
wsId: wsId,
|
||
processInstId : processInstId,
|
||
data: JSON.stringify(saveData)
|
||
}
|
||
|
||
var flag = false;
|
||
var tempName;
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
async : false,
|
||
data : param,
|
||
success : function(r) {
|
||
if (r.result == 'error') {
|
||
flag = true;
|
||
var data = r.data.data;
|
||
var name = data.name + ' V' + data.version + '.0';
|
||
console.log(data);
|
||
tempName = name;
|
||
}
|
||
},
|
||
error : function(XMLHttpRequest, textStatus, errorThrown) {
|
||
$.simpleAlert("表单信息错误,请联系管理员!", 'error');
|
||
}
|
||
});
|
||
if (flag) {
|
||
$.simpleAlert(tempName + "<br>已经存在其他未办理完成表单中,不允许保存/办理", 'error');
|
||
return false;
|
||
}
|
||
}
|
||
|
||
//办理完成后关闭页面
|
||
AWSFormMainAPI.customCloseFormPage(function(){
|
||
if (closeFormPage) {
|
||
window.close();
|
||
} else {
|
||
AWSFormUtil.refreshPage();
|
||
}
|
||
// 父页面刷新
|
||
opener.refreshTab();
|
||
return true;//最后返回true
|
||
});
|
||
|
||
/********************************快速搜索start***************************************/
|
||
|
||
// 绑定事件
|
||
function initPublishSearch(type) {
|
||
$("#processName").buttonedit({
|
||
onClick: function(e){
|
||
searchProcess(type);
|
||
}
|
||
});
|
||
$("#processName").bind("keypress",function(event){
|
||
if(event.keyCode == "13"){
|
||
searchProcess(type);
|
||
}
|
||
});
|
||
$("#autoSearchProcessDiv").off("mouseenter").on("mouseenter", function () {
|
||
$('#autoSearchProcessDiv').show();
|
||
}).off("autoSearchProcessDiv").on("mouseleave", function () {
|
||
$('#autoSearchProcessDiv').hide();
|
||
});
|
||
}
|
||
|
||
// 搜索
|
||
function searchProcess(type) {
|
||
$("#autoSearchProcessDiv").empty().hide();
|
||
if ($("#processName").val() == "" || $("#processName").val().trim() == "") {
|
||
return;
|
||
}
|
||
var name = $("#processName").val().trim().toLowerCase();
|
||
var html = '';
|
||
//先向后台请求完整tree数据
|
||
if (type == 'new') {
|
||
var data = getAllTreeData();
|
||
for (var i = 0; i < data.length; i++) {
|
||
var text = data[i].name;
|
||
if (text.indexOf(name) > -1) {
|
||
var id = data[i].id;
|
||
var path = getSearchTreeNodePath(data[i], text, data, 1);
|
||
var pids = getSearchTreeNodePath(data[i], text, data, 2);
|
||
html += '<div class="auto_divcontenr" onmouseover="auto_move($(this))" onmouseout="auto_out($(this)) " onclick="auto_click($(this))">';
|
||
html += '<span plId="' + id + '" data-type="' + type +'" data-pids="' + pids + '" style="cursor:pointer; display:inline-block;margin-left:5px;">';
|
||
html += '<div style="height:100%">' + path + '</div>';
|
||
html += '<div style="float:right;height:100%"></div>';
|
||
html += '</span>';
|
||
html += '</div>';
|
||
}
|
||
}
|
||
} else {
|
||
$('span.tree-items-title').each(function() {
|
||
var text = $(this).text().toLowerCase();
|
||
if (text.indexOf(name) > -1) {// found
|
||
var id = $(this).attr('id').substring(10);
|
||
if (id.length <= 36) {
|
||
var node = initTree.getNodeById(id);
|
||
var path = getFilePath(node, text);
|
||
html += '<div class="auto_divcontenr" onmouseover="auto_move($(this))" onmouseout="auto_out($(this)) " onclick="auto_click($(this))">';
|
||
html += '<span plId="' + id + '" style="cursor:pointer; display:inline-block;margin-left:5px;">';
|
||
html += '<div style="height:100%">' + path + '</div>';
|
||
html += '<div style="float:right;height:100%"></div>';
|
||
html += '</span>';
|
||
html += '</div>';
|
||
}
|
||
}
|
||
});
|
||
}
|
||
if (html.length > 0) {
|
||
$("#autoSearchProcessDiv").html(html).show();
|
||
// $("#processName").val('');
|
||
}
|
||
}
|
||
|
||
function getAllTreeData() {
|
||
var param = {
|
||
sid : sid,
|
||
cmd : "com.actionsoft.apps.coe.pal.publisher_publish_tree_data_query_search",
|
||
teamId: teamId,
|
||
wsId: wsId
|
||
}
|
||
var data;
|
||
$.ajax({
|
||
url : "./jd",
|
||
type : "POST",
|
||
dataType : "JSON",
|
||
data : param,
|
||
async : false,
|
||
success : function(d) {
|
||
data = d;
|
||
}
|
||
});
|
||
return data;
|
||
}
|
||
|
||
function getSearchTreeNodePath(node, text, data, isPid) {
|
||
var name = text;
|
||
var pids = node.pid;
|
||
do {
|
||
var p = undefined;
|
||
for (var i = 0; i < data.length; i++) {
|
||
if (data[i].id == node.pid) {
|
||
p = data[i];
|
||
break;
|
||
}
|
||
}
|
||
if (p == undefined) {
|
||
if (node.pid == "process") {
|
||
name = "流程>" + name;
|
||
}
|
||
if (node.pid == "org") {
|
||
name = "组织>" + name;
|
||
}
|
||
if (node.pid == "data") {
|
||
name = "数据>" + name;
|
||
}
|
||
if (node.pid == "itsystem") {
|
||
name = "IT系统>" + name;
|
||
}
|
||
if (node.pid == "control") {
|
||
name = "控制>" + name;
|
||
}
|
||
break;
|
||
}
|
||
name = p.name + ">" + name;
|
||
pids = p.pid + "." + pids;
|
||
node = p;
|
||
} while(true);
|
||
if (isPid == 2) {
|
||
return pids;
|
||
} else {
|
||
return name;
|
||
}
|
||
}
|
||
|
||
function getFilePath(node, text) {
|
||
var name = text;
|
||
do {
|
||
var p = initTree.getParentNodeById(node.id);
|
||
if (p == undefined) {
|
||
break;
|
||
}
|
||
name = p.name + ">" + name;
|
||
node = p;
|
||
} while(true);
|
||
return name;
|
||
}
|
||
|
||
function auto_move(obj) {
|
||
obj.css({"color": "white", "background-image" : "url(../apps/com.actionsoft.apps.coe.pal.publisher/img/link.png)"});
|
||
}
|
||
|
||
function auto_out(obj) {
|
||
obj.css({"color": "black", "background-image" : "none"});
|
||
}
|
||
|
||
function auto_click(obj, type) {
|
||
var plId = obj.find("span").attr("plId");
|
||
var type = obj.find("span").data("type");
|
||
var dom = initTree.getNodeDomById(plId)
|
||
if (type == 'new') {
|
||
//预先去加载initTree
|
||
var pids = obj.find("span").data("pids");
|
||
var pidList = pids.split('.');
|
||
for (var i = 0; i < pidList.length; i++) {
|
||
loadNewData(pidList[i]);
|
||
dom = initTree.getNodeDomById(pidList[i]);
|
||
initTree.expandNodes(dom, true, true, true);
|
||
}
|
||
} else {
|
||
initTree.expandNodes(dom, true, true, true);
|
||
}
|
||
// 偏移至可见区域
|
||
var ele = document.getElementById('tree_span_' + plId);
|
||
$('#tree').scrollTop(ele.offsetTop);
|
||
initTree.cancelSelectNode()
|
||
initTree.selectNode(plId);
|
||
$("#autoSearchProcessDiv").empty().hide();
|
||
}
|
||
/********************************快速搜索end***************************************/
|
||
|
||
function listenCloseEvent() {
|
||
window.onbeforeunload = function(){
|
||
// 查询bo表数据,是否保存过,未保存过离开页面则删除该实例
|
||
awsui.ajax.request({
|
||
type: "POST",
|
||
url: "./jd",
|
||
async: false,
|
||
data: {
|
||
sid: sid,
|
||
cmd: "com.actionsoft.apps.coe.pal.publisher_save_status_query",
|
||
processInstId: processInstId
|
||
},
|
||
success : function(r) {
|
||
if (r.result == "ok") {
|
||
if (r.data.saveStatus == '1') {
|
||
return "未保存,关闭之后不会保存该表单!";
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
//在弹出“是否离开”的提示框后,选择离开,则触发onunload事件
|
||
window.onunload = function(){
|
||
// 查询bo表数据,是否保存过,未保存过离开页面则删除该实例
|
||
awsui.ajax.request({
|
||
type: "POST",
|
||
url: "./jd",
|
||
async: false,
|
||
data: {
|
||
sid: sid,
|
||
cmd: "com.actionsoft.apps.coe.pal.publisher_save_status_query",
|
||
processInstId: processInstId
|
||
},
|
||
success : function(r) {
|
||
if (r.result == "ok") {
|
||
if (r.data.saveStatus == '1') {
|
||
// 删除该流程实例,并刷新主页面
|
||
awsui.ajax.request({
|
||
type: "POST",
|
||
url: "./jd",
|
||
async: false,
|
||
data: {
|
||
sid: sid,
|
||
cmd: "com.actionsoft.apps.coe.pal.publisher_remove",
|
||
processInstIds: processInstId
|
||
},
|
||
success : function(r) {
|
||
if (r.result == "ok") {
|
||
// 父页面刷新
|
||
opener.refreshTab();
|
||
}
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
});
|
||
}
|
||
} |