<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
	  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta charset="UTF-8"/>
	<title>工作流</title>

	<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
	<script src="https://cdn.bootcss.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
	<link rel="stylesheet"  th:href="@{/static/layui/css/layui.css}"  media="all">
</head>
<body class="text-center">
<div>
	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label" style="margin-right: 560px;width: 140px;">当前流程图信息</label>
		<div class="layui-input-block">
			<img id="image" style="margin-left: -250px;">
		</div>
	</div>

	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label" style="margin-right: 560px;width: 145px;">请输入审核原因</label>
		<div class="layui-input-block">
			<textarea placeholder="请输入内容" id="comment" style="width: 500px;height: 100px;" class="layui-textarea"></textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="layui-input-block" style="margin-left: 0px;">
			<button class="layui-btn"  lay-submit="" lay-filter="sys_user_form" id="sys_user_form" onclick="add()" style="background-color: #005ba7;margin-top: -10px">提交</button>
		</div>
	</div>
</div>
<input type="hidden" id="taskId" th:value="${taskId}">
<input type="hidden" id="approvalDeail" th:value="${approvalDeail}">
</body>
</div>
</body>
</html>

<style>
	* {
		font-family: "微软雅黑";
		font-size: 15px;
		margin: 0 auto;
	}
	div{
		text-align:center;
		padding-top:10px;
	}
	input,button{
		margin-top:10px;
	}

	.btn{
		border-color: #10c8ef;
		background-color: #10c8ef;
		color: #fff;
	}
</style>
<script src="/js/plugins/jquery.min.js"></script>
<script src="/js/plugins/layer/layer.js"></script>
<script>

    $(function () {
        var taskId=$("#taskId").val()
        var executionId=$("#executionId").val()
        var a="process:4:62504";
        var url="http://localhost:8087/api/bpm/task/process/trace/current?executionId="+executionId+"&taskId="+taskId
        $("#image").attr("src",url)
    })



    //获取用户Id
    var userId=sessionStorage.getItem("userId");
    //获取用户Id
    var userName=sessionStorage.getItem("userName");
    function add(){
        var taskId=$("#taskId").val();
        var comment=$("#comment").val();
        $.post(
            "/api/bpm/task/completeTask",
            {
                userId:userId,
                taskId:taskId,
                comments:comment
            },
            function (data) {
                if(data.code == 200){
                    layer.msg('操作成功!', {icon: 1,time:1000});
                    setTimeout(function (){
                        parent.location.reload();
                    },500);
                }else{
                    layer.msg('操作失败!',{icon: 2,time:1000});
                }
            },"json"
        )
    }

</script>

