<%@ 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 () {
            var wbsEncoding = $("#wbsEncoding").val();
            var wbsNumber = $("#wbsNumber").val();
            if (''==wbsEncoding) {
                jp.error('请填写项目的wbs编码');
                return;
            }
            if (''==wbsNumber) {
                jp.error('请填写项目需要填写多少资产卡片号');
                return;
            }
            jp.prompt(" 审批意见", function (message) {
                jp.post("${ctx}/fund/wbsTask",
                    {
                        "taskId": "${fund.act.taskId}",
                        "taskName": "${fund.act.taskName}",
                        "taskDefKey": "${fund.act.taskDefKey}",
                        "procInsId": "${fund.act.procInsId}",
                        "procDefId": "${fund.act.procDefId}",
                        "flag":"yes",
                        "wbsEncoding":wbsEncoding,
                        "wbsNumber":wbsNumber,
                        "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'));//取富文本的值
                }
            }
        });


    })

    //刷新列表
    function refresh(){
        location.reload();
    }
</script>
