<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('服务公司许可打印')" />
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: lodop" />
</head>
<body style="text-align: center;padding-top: 20px;font-weight: bold;font-size: 20px">
</body>
<script>
    var host="http://"+window.location.host;
    $(function(){
        exportSucess('[[${printData.path}]]','[[${printData.id}]]');
        recordsGenerated('[[${printData.id}]]',false);
    });
    function exportSucess(path,id) {
        var form = $("<form>");//定义一个form表单
        form.attr("style", "display:none");
        form.attr("target", "");
        form.attr("method", "post");
        form.attr("action", "http://"+window.location.host + "/manage/cer/download");
        var input1 = $("<input>");
        input1.attr("type", "hidden");
        input1.attr("name", "templateName");
        input1.attr("value", path);
        $("body").append(form);//将表单放置在web中
        form.append(input1);
        form.submit();//表单提交
        form.remove();//表单提交
        parent.layer.confirm('<div style="text-align:center"><img src="http://'+ window.location.host + '/img/nooryes.jpg"><p>下载成功</p></div>', {
            title: "温馨提示",
            skin: "confirm-class",
            btn: ['我知道了']
            //按钮
        }, function (index) { // 按钮1的回调
            // parent.layer.close(index);
            parent.layer.closeAll();
            // parent.location.reload();
        })
    }

    function recordsGenerated(id,isPrint) {
        $.ajax({
            type: 'POST',
            url: host + "/manage/cer/recordsComGenerated",
            dataType: "json",
            data: {
                "id":id,
                "isPrint":isPrint
            },
            success: function (json) {
                if (json.successful == true || json.successful == "true") {
                    console.log("更新打印状态成功！");
                } else {
                    console.log("更新打印状态失败！");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                console && console.log(errorThrown);
            }
        });
    }

</script>
</html>
