"use strict";
layui.extend({
    common    :   'js/common'
}).use(['jquery','layer','common','form'],function(){
    var $ = layui.jquery;

    var $node = {
        resetBtn :  $('button[type="reset"]')
    };
    var common = layui.common;

    //  绑定表单提交事件
    layui.form.on("submit(entity_submit_event)",function(data){
        common.timer($('button[lay-filter="entity_submit_event"]'));
        $.ajax({
            url     :   '/device/mq/add',
            data    :   data.field,
            type    :   'POST',
            success :   function(){
                $node.resetBtn.click();
                parent.location.reload();
            }
        });
    });

    //  绑定取消事件
    $node.resetBtn.on('click',function(){
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    });

});
