保存事件

This commit is contained in:
zhal 2022-08-28 23:54:25 +08:00
parent 74c6ecfb83
commit 09439f8e72
2 changed files with 185 additions and 174 deletions

View File

@ -1,6 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="renderer" content="webkit">
@ -30,6 +33,7 @@
}
</style>
<link type='text/css' rel='stylesheet' id='themeCss' href='../apps/_bpm.platform/css/theme/theme.css' name='themeCss'/>
</head>
<body>
@ -909,6 +913,12 @@ var 下一页 = "下一页";
var 上一页 = "上一页";
var 显示0到1条共2条 = "显示 {0} 到 {1} 条,共 {2} 条";
// ]]></script>
<script>// <![CDATA[
var 无数据 = "无数据";
var 下一页 = "下一页";
var 上一页 = "上一页";
var 显示0到1条共2条 = "显示 {0} 到 {1} 条,共 {2} 条";
// ]]></script>
<script src="../commons/js/jquery/scripts/ui/awsui.pagination.js?v=1532938866000"></script>
<script type="text/javascript">// <![CDATA[
var isRefreshPage = true; //点击主表单保存和子表单保存按钮均会刷新主表单
@ -947,5 +957,180 @@ function formOnload(){
$("#c9ec08d2_4cd0_0001_358e_1de5d14ecee0").hide();
}
// ]]></script>
<script id="formSave">// <![CDATA[
// 点击办理时的校验+保存字表
function formSave(isTransact){
alert(11111111)
if (!editPerm) {// 只读状态不处理
return true;
}
$.simpleAlert('正在保存', 'loading');
if(isTransact) {// 点击办理进行校验
// 判断页面是否有数据
if ($("#publisher_new_tr").css('display') == 'none' && $("#publisher_change_tr").css('display') == 'none' && $("#publisher_stop_tr").css('display') == 'none'){
$.simpleAlert('close');
$.simpleAlert('发布内容不能为空', 'info');
return false;
}
var index = 0;
if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) {
index++;
}
if (!($("#publisher_change_tr").css('display') == 'none') && changeTemp.length > 0) {
index++;
}
if (!($("#publisher_stop_tr").css('display') == 'none') && stopTemp.length > 0) {
index++;
}
if (index == 0) {
$.simpleAlert('close');
$.simpleAlert('发布内容不能为空', 'info');
return false;
}
// 校验变更文件是否全部都有变更后文件
if (!($("#publisher_change_tr").css('display') == 'none') && changeTemp.length > 0) {
var flag = false;
var msg = '以下文件没有选择变更后的文件,不允许办理';
for (var i = 0; i < changeTemp.length; i++) {
if (changeTemp[i].changedFileIdNew == "") {
flag = true;
msg += '<br>' + changeTemp[i].changeFileName + ' V' + changeTemp[i].fileVersion;
}
}
if (flag) {
var options = {
title : "提示",
content:msg,
type:"alert",
onConfirm: function(){
}
};
$.simpleAlert('close');
$.confirm(options);
return false;
}
}
}
// 保存校验
// 1.不显示的数据默认删除
var newTempData = newTemp;
var changeTempData = changeTemp;
var stopTempData = stopTemp;
if (($("#publisher_new_tr").css('display') == 'none')) {
newTempData = [];
}
if (($("#publisher_change_tr").css('display') == 'none')) {
changeTempData = [];
}
if (($("#publisher_stop_tr").css('display') == 'none')) {
stopTempData = [];
}
// 2.校验变更的数据与停用的数据是否有重叠
if(isTransact) {
if (!($("#publisher_change_tr").css('display') == 'none') && !($("#publisher_stop_tr").css('display') == 'none')) {
for (var i = 0; i < changeTempData.length; i ++) {
for (var j = 0; j < stopTempData.length; j++) {
if (changeTempData[i].changeFileId == stopTempData[j].stopFileId) {
$.simpleAlert('close');
$.simpleAlert(stopTempData[j].stopFileName + ' V' + stopTempData[j].fileVersion + "<br>在变更流程和停用流程中同时存在,不允许办理", 'error');
return false;
}
}
}
}
}
//三员管理,提交后不生成手册,更改taskId
if (isHighSecurity){
for (let i=0;i<newTempData.length;i++){
let data= newTempData[i];
if ((data.methodId == 'control.policy' || data.methodId == 'data.form' || data.methodId.indexOf('process.') > -1) && data.methodId != 'default') {
data.taskId = "new";
}
}
for (let j=0; j<changeTempData.length;j++){
let changeData = changeTempData[j];
changeData.taskId = "change";
}
}
// 保存
var param = {
sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_batch_save_before",
teamId: teamId,
wsId: wsId,
processInstId : processInstId,
newData: JSON.stringify(newTempData),
changeData: JSON.stringify(changeTempData),
stopData: JSON.stringify(stopTempData),
isTransact : isTransact
};
var flag = false;
var tempData;
$.ajax({
url : "./jd",
type : "POST",
dataType : "JSON",
async : false,
data : param,
success : function(r) {
if (r.result == 'error') {
flag = true;
tempData = r.data.data;
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$.simpleAlert("表单信息错误,请联系管理员!", 'error');
}
});
$.simpleAlert('close');
if (flag) {
var msg = '以下文件已经在其他未办理完成的表单中,不允许保存/办理';
if (tempData.length > 0) {
for (var i = 0; i < tempData.length; i++) {
msg += '<br>' + tempData[i].name + ' V' + tempData[i].version;
}
}
var options = {
title : "提示",
content:msg,
type:"alert",
onConfirm: function(){
}
};
$.confirm(options);
return false;
} else {
newTemp = newTempData;
if (newTemp.length == 0) {
newPageSetting = {
pageNum:1,
start:1
};
$('#new_pagination').hide();
initPublishData(newTemp, 'new', 1, 1);
}
changeTemp = changeTempData;
if (changeTemp.length == 0) {
changePageSetting = {
pageNum:1,
start:1
};
$('#change_pagination').hide();
initPublishData(changeTemp, 'change', 1, 1);
}
stopTemp = stopTempData;
if (stopTemp.length == 0) {
stopPageSetting = {
pageNum:1,
start:1
};
$('#stop_pagination').hide();
initPublishData(stopTemp, 'stop', 1, 1);
}
$.simpleAlert('保存成功', 'ok');
}
}
// ]]></script>
</body>
</html>

View File

@ -1280,7 +1280,6 @@ function getStopBatchResult(type) {
// 获取已有的流程手册
function queryBatchReport(data) {
debugger;
var ids = [];
for (var i = 0; i < data.length; i++) {
var temp = data[i];
@ -1870,179 +1869,7 @@ function saveFormData(type) {
}
}
// 点击办理时的校验+保存字表
function formSave(isTransact){
if (!editPerm) {// 只读状态不处理
return true;
}
$.simpleAlert('正在保存', 'loading');
if(isTransact) {// 点击办理进行校验
// 判断页面是否有数据
if ($("#publisher_new_tr").css('display') == 'none' && $("#publisher_change_tr").css('display') == 'none' && $("#publisher_stop_tr").css('display') == 'none'){
$.simpleAlert('close');
$.simpleAlert('发布内容不能为空', 'info');
return false;
}
debugger;
var index = 0;
if (!($("#publisher_new_tr").css('display') == 'none') && newTemp.length > 0) {
index++;
}
if (!($("#publisher_change_tr").css('display') == 'none') && changeTemp.length > 0) {
index++;
}
if (!($("#publisher_stop_tr").css('display') == 'none') && stopTemp.length > 0) {
index++;
}
if (index == 0) {
$.simpleAlert('close');
$.simpleAlert('发布内容不能为空', 'info');
return false;
}
// 校验变更文件是否全部都有变更后文件
if (!($("#publisher_change_tr").css('display') == 'none') && changeTemp.length > 0) {
var flag = false;
var msg = '以下文件没有选择变更后的文件,不允许办理';
for (var i = 0; i < changeTemp.length; i++) {
if (changeTemp[i].changedFileIdNew == "") {
flag = true;
msg += '<br>' + changeTemp[i].changeFileName + ' V' + changeTemp[i].fileVersion;
}
}
if (flag) {
var options = {
title : "提示",
content:msg,
type:"alert",
onConfirm: function(){
}
};
$.simpleAlert('close');
$.confirm(options);
return false;
}
}
}
// 保存校验
// 1.不显示的数据默认删除
var newTempData = newTemp;
var changeTempData = changeTemp;
var stopTempData = stopTemp;
if (($("#publisher_new_tr").css('display') == 'none')) {
newTempData = [];
}
if (($("#publisher_change_tr").css('display') == 'none')) {
changeTempData = [];
}
if (($("#publisher_stop_tr").css('display') == 'none')) {
stopTempData = [];
}
// 2.校验变更的数据与停用的数据是否有重叠
if(isTransact) {
if (!($("#publisher_change_tr").css('display') == 'none') && !($("#publisher_stop_tr").css('display') == 'none')) {
for (var i = 0; i < changeTempData.length; i ++) {
for (var j = 0; j < stopTempData.length; j++) {
if (changeTempData[i].changeFileId == stopTempData[j].stopFileId) {
$.simpleAlert('close');
$.simpleAlert(stopTempData[j].stopFileName + ' V' + stopTempData[j].fileVersion + "<br>在变更流程和停用流程中同时存在,不允许办理", 'error');
return false;
}
}
}
}
}
//三员管理,提交后不生成手册,更改taskId
if (isHighSecurity){
for (let i=0;i<newTempData.length;i++){
let data= newTempData[i];
if ((data.methodId == 'control.policy' || data.methodId == 'data.form' || data.methodId.indexOf('process.') > -1) && data.methodId != 'default') {
data.taskId = "new";
}
}
for (let j=0; j<changeTempData.length;j++){
let changeData = changeTempData[j];
changeData.taskId = "change";
}
}
// 保存
var param = {
sid : sid,
cmd : "com.actionsoft.apps.coe.pal.publisher_batch_save_before",
teamId: teamId,
wsId: wsId,
processInstId : processInstId,
newData: JSON.stringify(newTempData),
changeData: JSON.stringify(changeTempData),
stopData: JSON.stringify(stopTempData),
isTransact : isTransact
};
var flag = false;
var tempData;
$.ajax({
url : "./jd",
type : "POST",
dataType : "JSON",
async : false,
data : param,
success : function(r) {
if (r.result == 'error') {
flag = true;
tempData = r.data.data;
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
$.simpleAlert("表单信息错误,请联系管理员!", 'error');
}
});
$.simpleAlert('close');
if (flag) {
var msg = '以下文件已经在其他未办理完成的表单中,不允许保存/办理';
if (tempData.length > 0) {
for (var i = 0; i < tempData.length; i++) {
msg += '<br>' + tempData[i].name + ' V' + tempData[i].version;
}
}
var options = {
title : "提示",
content:msg,
type:"alert",
onConfirm: function(){
}
};
$.confirm(options);
return false;
} else {
newTemp = newTempData;
if (newTemp.length == 0) {
newPageSetting = {
pageNum:1,
start:1
};
$('#new_pagination').hide();
initPublishData(newTemp, 'new', 1, 1);
}
changeTemp = changeTempData;
if (changeTemp.length == 0) {
changePageSetting = {
pageNum:1,
start:1
};
$('#change_pagination').hide();
initPublishData(changeTemp, 'change', 1, 1);
}
stopTemp = stopTempData;
if (stopTemp.length == 0) {
stopPageSetting = {
pageNum:1,
start:1
};
$('#stop_pagination').hide();
initPublishData(stopTemp, 'stop', 1, 1);
}
$.simpleAlert('保存成功', 'ok');
}
}
//办理完成后关闭页面
AWSFormMainAPI.customCloseFormPage(function(){
@ -2307,7 +2134,6 @@ function downloadReport(uuid, taskId) {
uuid: uuid
},
success : function(r) {
debugger;
if (r.result == "ok") {
debugger;
window.open (r.data.url);