<%@ page contentType="text/html;charset=UTF-8" %>
	<script>
    /**
     * 项目经理组织交底页面
     * */
    $(document).ready(function () {
        jp.ajaxForm("#inputForm", function (data) {
            if (data.success) {
                jp.success(data.msg);
                jp.go("${ctx}/managementcenter/divide");
            } else {
                jp.error(data.msg);
                $("#inputForm").find("button:submit").button("reset");
            }
        });


        $("#agree").click(function () {
            jp.prompt("备注说明", function (message) {
                jp.post("${ctx}/act/task/audit3",
                    {
                        "taskId": "${construction.act.taskId}",
                        "taskName": "${construction.act.taskName}",
                        "taskDefKey": "${construction.act.taskDefKey}",
                        "procInsId": "${construction.act.procInsId}",
                        "procDefId": "${construction.act.procDefId}",
                        "flag": "yes",
                        "comment": window.encodeURI(message)
                    },
                    function (data) {
                        if (data.success) {
                            jp.success(data.msg);
                            jp.go("${ctx}/act/task/todo")
                        }else {
                            jp.error(data.msg);
                        }
                    })
            })
        })


        $('#startTime').datetimepicker({
            format: "YYYY-MM-DD HH:mm:ss"
        });
        $('#endTime').datetimepicker({
            format: "YYYY-MM-DD HH:mm:ss"
        });
        //富文本初始化
        $('#reason').summernote({
            height: 300,
            lang: 'zh-CN',
            readonly: true,
            callbacks: {
                onChange: function (contents, $editable) {
                    $("input[name='reason']").val($('#reason').summernote('code'));//取富文本的值
                }
            }
        });

        /**
         * 导入交底结论
         * */
        $("#importConclusion").click(function () {
            var procInsId = $("#procInsId").val();
            var projectName = $("#projectName").val();
            jp.open({
                type: 2,
                area: [500, 200],
                auto: true,
                title: "导入交底结论",
                content: "${ctx}/tag/importExcel",
                btn: ['确定', '关闭'],
                btn1: function (index, layero) {
                    var iframeWin = layero.find('iframe')[0]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
                    iframeWin.contentWindow.importExcel('${ctx}/managementcenter/divide/importConclusion1', function (data) {
                        if (data.success) {
                            jp.alert(data.msg);
                            jp.go("${ctx}/act/task/todo")
                        } else {
                            jp.alert(data.msg);
                        }
                        jp.close(index);
                    });//调用保存事件
                    return false;
                },
                btn2: function (index) {
                    jp.close(index);
                }
            });
        });

    })
</script>
