<!DOCTYPE html>
|
<html>
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
<title>任务管理</title>
|
<meta charset="utf-8">
|
<meta http-equiv="Pragma" content="no-cache">
|
<meta http-equiv="Cache-Control" content="no-cache">
|
<meta http-equiv="Expires" content="0">
|
<meta name="viewport" content="user-scalable=no, initial-scale=1, width=device-width, height=device-height">
|
<meta name="format-detection" content="telephone=no">
|
<link href="../../../css/common.css" rel="stylesheet" type="text/css">
|
<link href="../../../css/control.css" rel="stylesheet" type="text/css"/>
|
<link href="../../../css/grid.css" rel="stylesheet" type="text/css">
|
<script src="../../../js/jquery-1.7.2.min.js"></script>
|
<script src="../../../js/foundation-2.0.js"></script>
|
<script src="../../../js/grid.js"></script>
|
<script src="../../../js/formcontrol.js"></script>
|
<style>
|
.div_coming_label{ margin:30px; color:#808080; text-align:center;font-size: 22px;font-family: STHupo; }
|
.img_coming_icon{ display:block; margin:10px auto; width:128px; height:128px; }
|
</style>
|
|
<script type="text/javascript">
|
var grid , taskid, task_def_key_ , loacationType;
|
|
function downlad(){
|
var line = grid.getSelected();
|
var taskId = line.id;
|
if(taskId){
|
Server.call("root/process/task/getModelId","taskId="+taskId,function(callback){
|
if(callback.success){
|
alert(JSON.stringify(callback));
|
var modelId = callback.string;
|
//download_file("../../../model/"+modelId+".bpmn20.xml");
|
//window.open("../../../model/"+modelId+".bpmn20.xml");
|
download2(modelId)
|
}
|
});
|
}
|
}
|
function download2(modelId) {
|
var $form = $('<form method="GET"></form>');
|
$form.attr('action', '../../../model/'+modelId+'.bpmn20.xml');
|
$form.appendTo($('body'));
|
$form.submit();
|
}
|
function download_file(url) {
|
var iframe = document.createElement("iframe");
|
download_file.iframe = iframe;
|
document.body.appendChild(download_file.iframe);
|
|
|
download_file.iframe.src = url;
|
alert(download_file.iframe.src);
|
download_file.iframe.style.display = "none";
|
|
}
|
|
function readBlobAsDataURL(blob, callback) {
|
var a = new FileReader();
|
a.onload = function(e) {callback(e.target.result);};
|
a.readAsDataURL(blob);
|
}
|
|
function checkWorkflow(){
|
var line = grid.getSelected();
|
var pId = line.pid;
|
url = "root/process/runtime/getDiagram?executionId="+pId;
|
var oReq = new XMLHttpRequest();
|
oReq.open("GET", url, true);
|
oReq.responseType = "arraybuffer";
|
oReq.onload = function(oEvent) {
|
var blob = new Blob([oReq.response], {type: "image/png"});
|
readBlobAsDataURL(blob, function (dataurl){
|
$("#process_img").attr('src',dataurl);
|
});
|
};
|
oReq.send();
|
}
|
|
function moreInfo(){
|
var line = grid.getSelected();
|
var processInstanceId = line.pid;
|
Server.call("root/process/history/getTaskDetail","processInstanceId="+processInstanceId,function(callback){
|
alert(JSON.stringify(callback));
|
});
|
}
|
|
function commitReapply(){
|
var data = {};
|
data.taskid = taskid;
|
data.passName = task_def_key_;
|
data.reApply = true;
|
data.leaveType = $("#leave_type").val();
|
data.startTime = $("#start_time").val();
|
data.endTime = $("#end_time").val();
|
data.reason = $("#reason").val();
|
|
Server.postData("root/process/task/completeTask",data,function(callback){
|
alert(JSON.stringify(callback));
|
grid.refresh();
|
$('#from_reapply').hide();
|
});
|
}
|
|
function reApply(isreapply){
|
$("#btn_reject").hide();
|
$("#btn_complete").hide();
|
var data = {};
|
data.taskid = taskid;
|
data.passName = task_def_key_;
|
data.reApply = isreapply
|
if(isreapply){
|
$('#from').hide();
|
$('#from_reapply').show();
|
}
|
else{
|
Server.postData("root/process/task/completeTask",data,function(callback){
|
alert(JSON.stringify(callback));
|
grid.refresh();
|
$('#from').hide();
|
});
|
}
|
|
}
|
|
function complete(agree){
|
$("#btn_reject").show();
|
|
var data = {};
|
var advice = $("#complete_reason").val();
|
|
data.taskid = taskid;
|
if(task_def_key_ == "reportBack"){
|
data.passName = task_def_key_
|
var real_end = $("#real_end").val();
|
var real_start = $("#real_start").val();
|
data.real_end = $("#real_end").val();
|
data.real_start = $("#real_start").val();
|
|
}
|
else{
|
data.passName = task_def_key_+"Pass";
|
data.passValue = agree;
|
data.reasonName = task_def_key_+"Reason";
|
data.reasonValue = advice;
|
}
|
|
Server.postData("root/process/task/completeTask",data,function(callback){
|
alert(JSON.stringify(callback));
|
grid.refresh();
|
$('#from').hide();
|
});
|
}
|
|
function claimTask(){
|
var line = grid.getSelected();
|
var taskStatus = line.status;
|
taskid = line.id
|
|
if(taskStatus == "待接收"){
|
Server.call("root/process/task/claimTask","taskId="+taskid,function(callback){
|
if(callback.success){
|
alert("接收成功");
|
grid.refresh();
|
}
|
});
|
}
|
else {
|
alert("请选择待接收的任务");
|
}
|
|
}
|
|
function handleTask(){
|
var line = grid.getSelected();
|
var taskStatus = line.status;
|
taskid = line.id
|
|
if(taskStatus == "待办理"){
|
Server.call("root/process/task/getTaskDetail","taskId="+taskid,function(callback){
|
alert(JSON.stringify(callback));
|
var info = "";
|
if(callback.success){
|
var data = callback.detail.tasks;
|
if(data.user_id !=""){
|
info += '<div>申请人:'+data.user_id+'</div>';
|
}
|
if(data.leave_type !=""){
|
info += '<div>类型:'+data.leave_type+'</div>';
|
}
|
if(data.apply_time !=""){
|
info += '<div>创建时间:'+data.apply_time+'</div>';
|
}
|
if(data.start_time !=""){
|
info += '<div>开始时间:'+data.start_time+'</div>';
|
}
|
if(data.end_time !=""){
|
info += '<div>结束时间:'+data.end_time+'</div>';
|
}
|
if(data.reason !=""){
|
info += '<div>原因:'+data.reason+'</div>';
|
}
|
if(data.task_def_key_ == "reportBack"){
|
info += '<div>实际开始时间 <input type="date" id="real_start" ></div>';
|
info += '<div>实际结束时间 <input type="date" id="real_end" ></div>';
|
$("#btn_reject").hide();
|
}
|
else if (data.task_def_key_ == "modifyApply") {
|
var callbackinfo = callback.detail.empty;
|
info += '<div>部门领导意见:'+callbackinfo.deptLeaderReason+'</div>';
|
info += '<div>hr意见:'+callbackinfo.hrReason+'</div>';
|
info += '<button onclick="reApply(false)">取消申请</button>';
|
info += '<button onclick="reApply(true)">调整申请</button>';
|
$("#btn_reject").hide();
|
$("#btn_complete").hide();
|
}
|
else{
|
info += '<div> <input id="complete_reason"></div>';
|
}
|
task_def_key_ = data.task_def_key_.split("Audit")[0];
|
alert(task_def_key_);
|
$("#from").show();
|
$("#fromroot").html(info);
|
}
|
});
|
}
|
else {
|
alert("请选择待办理的任务");
|
}
|
|
}
|
|
function Query(){
|
param = filter.toFilter();
|
var url = "root/data/procedure/getSalesflow/pageno=1&pagesize=10&" + param;
|
grid.setURL(url);
|
}
|
|
$(document).ready(function() {
|
var username = window.top.user.name;
|
Server.call("root/process/indentity/getuserinfo","username="+username,function(callback){});
|
|
var typeurl = "";
|
loacationType = location.href.split("=")[1];
|
|
if(loacationType == "waiting"){
|
typeurl = "root/process/task/getTodoTask?pageno=1&pagesize=10";
|
}
|
else if (loacationType == "mine") {
|
typeurl = "root/process/history/getMyRunTask?pageno=1&pagesize=10";
|
$("#btn_claim").hide();
|
$("#btn_handle").hide();
|
}
|
else if (loacationType == "all") {
|
typeurl = "root/process/history/getAllTask?pageno=1&pagesize=10";
|
$("#btn_claim").hide();
|
$("#btn_handle").hide();
|
}
|
else if (loacationType == "history") {
|
typeurl = "root/process/history/getHistoryTask?pageno=1&pagesize=10";
|
$("#btn_claim").hide();
|
$("#btn_handle").hide();
|
$("#btn_readworkflow").hide();
|
|
}
|
|
grid = new $.fm.Grid({
|
element: "sheet",
|
url: typeurl,
|
showPage: true,
|
limit: 12,
|
columns: [
|
{field: "id", caption: "编号", width: 100},
|
{field: "pdname", caption: "流程名称", width: 200},
|
{field: "status", caption: "当前状态", width: 100},
|
{field: "pdversion", caption: "版本", width: 100},
|
{field: "createtime", caption: "创建时间", width: 180, align: "left"},
|
{field: "name", caption: "当前进度", width: 100, align: "left"},
|
{field: "pid", caption: "流程实例ID", width: 220, align: "left"},
|
{field: "sid", caption: "发起人", width: 220, align: "left"},
|
{field: "issuspension", caption: "挂起", width: 220, align: "left"}
|
]
|
});
|
});
|
|
</script>
|
</head>
|
|
<body>
|
<div >
|
<img id="process_img">
|
</div>
|
<div id="sheet" style="margin: 0px 15px"></div>
|
|
<div style="height: 30px; line-height: 30px; margin-top: 15px;" align="center">
|
<div class="btn btn-green" onclick="claimTask();" id="btn_claim">接收</div>
|
<div class="btn btn-green" onclick="handleTask();" id="btn_handle">办理</div>
|
<div class="btn btn-green" onclick="moreInfo();" id="btn_moreinfo">详细信息</div>
|
<div class="btn btn-green" onclick="checkWorkflow();" style="margin-left: 30px;" id="btn_readworkflow">查看流程</div>
|
<div class="btn btn-green" onclick="downlad();" id="btn_downloadworkfolw">下载</div>
|
</div>
|
|
|
<div id="from" style="position: absolute; width: 300px; height: 300px; top: 400px; left: 400px;display:none">
|
<legend><small>流程办理</small></legend>
|
<div id="fromroot">
|
</div>
|
|
|
<button id="btn_complete" onclick="complete(true)">同意</button>
|
<button id="btn_reject" onclick="complete(false)">驳回</button>
|
<button onclick="$('#from').hide()">取消</button>
|
</div>
|
|
<div id="from_reapply" style="position: absolute; width: 300px; height: 300px; top: 400px; left: 1000px;display:none">
|
<legend><small>流程办理</small></legend>
|
<div id="fromroot_reapply">
|
<div>
|
<select id="leave_type" name="leaveType">
|
<option>公休</option>
|
<option>病假</option>
|
<option>调休</option>
|
<option>事假</option>
|
<option>婚假</option>
|
</select>
|
</div>
|
<div>
|
<div>开始时间:</div>
|
<div><input type="date" id="start_time" name="start_time" ></div>
|
</div>
|
<div>
|
<div>结束时间:</div>
|
<div><input type="date" id="end_time" name="end_time" ></div>
|
</div>
|
<div>
|
<td>原因:</td>
|
<td><textarea name="reason" id="reason"></textarea></td>
|
</div>
|
|
<button onclick="commitReapply()">提交</button>
|
<button onclick="$('#from_reapply').hide()">取消</button>
|
</div>
|
|
</body>
|
</html>
|