layui.use(['form','layer'], function(){
    var form = layui.form,
    layer = layui.layer,
        $ = layui.jquery


    //监听提交
    form.on('submit(addTime)', function(data){
        layer.confirm('确定提交吗？', function (index) {
           var field = data.field
            var begin = field.begintime
            var end =field.endtime
            begin = filterXSS(begin);
            end = filterXSS(end);

            $.ajax({
                type: 'POST',
                dataType: "json",
                data:{
                    msgType:1,
                    value1:begin,
                    value2:end,
                    msgName:'time'+begin+'-'+end,
                    state:0
                },
                url: '/pqs9900/message/addMsgDicdata',
                success: function (data) {
                    if(data.code == 200){
                        //***********关闭loading
                        parent.layer.closeAll()
                        window.parent.flushPage()
                        window.parent.msgTo()
                    }else {
                        layer.msg(data.message,{icon:2})
                        return false
                    }

                }
            });
        })

        return false;
    });

})