暂停和中止按钮功能
if (obj.event === 'del') {
layer.confirm('确认中止么', function (index) {
$.ajax({
type: "post",
url: "/flow/processIntance/delete.afca",
data: {
"processInstanceId": data.processInstanceId,
"deleteReason": inputValue
},
dataType: 'json',
success: function (data) {
if (data.code === '0') {
// obj.del();
layer.close(index);
layer.msg(data.msg, {icon: 1, time: 2000, shade: 0.1});
console.log(table);
reload();
} else {
layer.close(index);
layer.alert(data.msg, {
icon: 2, title: '提示'
});
return;
}
},
error: function () {
}
})
});
} else if (obj.event === 'start-process' || obj.event === 'stop-process') {
var text = (data.suspended) ? "继续" : "暂停";
layer.confirm('确认' + text + '当前流程吗', function (index) {
$.ajax({
type: "post",
url: "/flow/isSuspended.afca",
data: {
"processInstanceId": data.processInstanceId,
"type": data.suspended ? 'start' : 'stop'
},
dataType: 'json',
success: function (data) {
if (data.code === '0') {
// obj.del();
layer.close(index);
layer.msg(data.msg, {icon: 1, time: 2000, shade: 0.1});
reload();
} else {
layer.close(index);
layer.alert(data.msg, {
icon: 2, title: '提示'
});
return;
}
},
error: function () {
}
})
});
}
//编辑,删除,发布申请
table.on('tool(demo)', function(obj){
var data = obj.data;
// console.log(data)
if(obj.event === 'check'){
// console.log(data.id);
$('.textCon').val("");
layer.open({
title: '发布申请'
,type: 1
,maxmin:true
,area: ['700px','570px']
,content: $('#toExamine')
,btn: ['申请', '取消']
,yes: function(index, layero) {
var userName = $('#userRadio').val();
if(userName == null || userName == ''){
layer.msg("请选择用户", {icon: 2, time: 2000});
return;
}
var describe = $('.textCon').val();
if(describe == null || describe == ''){
layer.msg("请输入内容", {icon: 2, time: 2000});
return;
}
$.ajax({
type: "post",
url: "/approval/application/save.afca",
dataType:'json',
data: {
name: data.toolName,
targerId: data.id,
status: 0,
type: 'script',
describe: $('.textCon').val(),
key: 'script',
supUser:userName
},
success: function (data) {
var message = data.msg;
if(data.code === '0'){
obj.del();
layer.close(index);
layer.msg(message,{icon: 1,time:2000});
tableObj.reload({
url:'/cd/workPlatform/tool/queryTools.afca'
});
} else {
layer.alert(message, {
icon: 2,title:'提示'
});
return;
}
},
error: function () {
}
})
}
});
getAllUser();
$('.laytable-cell-checkbox').eq(0).empty();
} else if(obj.event === 'del'){
layer.confirm('确认删除么', function(index) {
$.ajax({
type: "post",
url: "/cd/workPlatform/tool/remove.afca",
dataType:'json',
data: "id="+data.id,
dataType: "json",
success: function (data) {
// console.log(data);
var message = data.msg;
var code = data.code;
// console.log(message);
// console.log(code);
if(data.code === '0'){
//obj.del();
layer.close(index);
layer.alert(message,{icon: 1,time:2000});
tableObj.reload({
url:'/cd/workPlatform/tool/queryTools.afca'
});
} else {
layer.alert(message, {
icon: 2,title:'提示'
});
return;
}
},
error: function () {
}
})
});
//编辑脚本定义
}else if(obj.event === 'edit'){
//之前版本
// window.location.href='workToolEdit.html?toolSceneId='+data.toolSceneId+'&'+'id='+data.id;
//脚本编辑弹出层
var name = encodeURIComponent(data.toolName);
// console.log(data.toolName);
parent.layer.open({
type: 2,
title: '编辑脚本定义',
// title:data.to,
shadeClose: true,
shade: 0.8,
// maxmin: true,
area: ['100%', '100%'],
content: 'html/taskManagement/scriptManagement/workToolEdit.html?toolSceneId='+data.toolSceneId+'&'+'id='+data.id
});
}else if(obj.event === 'showInformation'){
//脚本展示弹出层
var name = encodeURIComponent(data.toolName);
// console.log(data.toolName);
parent.layer.open({
type: 2,
title: '展示脚本定义',
// title:data.to,
shadeClose: true,
shade: 0.8,
// maxmin: true,
area: ['100%', '100%'],
content: 'html/taskManagement/scriptManagement/showScriptInformation.html?id='+data.id
});
}
else if(obj.event ==='jump'){
// window.location.href='openScriptParaVerManagement.html?toolId='+data.id;
var name = encodeURIComponent(data.toolName);
// console.log(data.toolName);
parent.layer.open({
type: 2,
title: '参数版本管理',
// title:data.to,
shadeClose: true,
shade: 0.8,
// maxmin: true,
area: ['100%', '100%'],
content: 'html/taskManagement/scriptManagement/openScriptParaVerManagement.html?toolId='+data.id+"&jiaoben="+name+"&banben="+data.version+"&scriptLanguage="+data.scriptLanguage+"&categoryName="+data.categoryName+"&=status"+data.status
});
}
});