  
layui.use(['form', 'layer', 'jquery', 'laydate', 'layedit'], function () {
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        $ = layui.jquery,
        laydate = layui.laydate;
    layedit = layui.layedit;  
    //监听提交
    form.on('submit(SubmitData)', function (data) {
        //所有表单数据
        var dataArr = new Array();
        dataArr = data.field; 
        dataArr["F_Content"] = $("#F_Content").val();
        /*layedit.getContent(index); layedit.getContent(layedit.build('F_Content'));$("#F_Content").val()*/
       
        //接收部门
        //dataArr["F_ReceiveInfo"] = $("#F_ReceiveInfo").find("option:selected").text();
        dataArr["F_ReceiveInfo"] = $("#F_ReceiveInfo").val();
        //接收人
        dataArr["F_DeviceId"] = $("#F_UserId").val();
        dataArr["F_UserName"] = $("#F_UserName").val();
        $.ajax({
            url: "/SystemManage/SaveNoticeData",
            type: "post",
            async: false,//同步请求
            contentType: "application/json",
            dataType: "text",
            cache: false,
            data: JSON.stringify(dataArr),
            // data: dataArr,
            success: function (thisResult, result) {

                if (thisResult === "True") { 
                    debugger
                    layer.open({
                        content: '提交成功'
                        , btn: ['确定']
                        , yes: function (index, layero) {

                            layer.close(index);
                            ////刷新父窗体

                            var thisindex = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(thisindex);


                        }
                        , cancel: function () {

                            var thisindex = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(thisindex);

                        }
                    });

                    return false;
                } else {
                    layui.layer.alert("提交失败!", {
                        icon: 2
                    });

                    return false;
                }

            },
            error: function (error) {
                return false;
            }
        });
        return false;
    });

    

});


//关闭当前页
$('.closeThisPage').on('click', function () {
    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    parent.layer.close(index);
});
