
layui.use(['form', 'layer', 'jquery', 'laydate'], function () {
    var form = layui.form,
        layer = parent.layer === undefined ? layui.layer : parent.layer,
        $ = layui.jquery,
        laydate = layui.laydate;

    //监听提交
    form.on('submit(SubmitData)', function (data) {
        //所有表单数据
        var dataArr = new Array();
        dataArr = data.field;

        $.ajax({
            url: "/SystemManage/SaveBussiTypeData",
            type: "post",
            async: false,//同步请求
            contentType: "application/json",
            dataType: "text",
            cache: false,
            data: JSON.stringify(dataArr),
            // data: dataArr,
            success: function (thisResult, result) {

                if (thisResult == "True") {
                    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;
    });

})

