@{
    ViewBag.Title = "权限组新增";
    Layout = "~/Views/Shared/_LayoutTable.cshtml";
}
<body>
    <div class="wrapper wrapper-content">
        <div class="ibox-content">
            <table class="table table-bordered table-striped table-hover">
                <tr>
                    <td style="text-align: right;width:140px">权限组编号：</td>
                    <td>
                        <input type="text" class="form-control" id="txtAuthorityGroupNumber" maxlength="18">
                    </td>
                </tr>
                <tr>
                    <td style="text-align: right;">权限组名称：</td>
                    <td>
                        <input type="text" class="form-control" id="txtPermissionGroupName" maxlength="18">
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right;">备注：</td>
                    <td>
                        <textarea cols="100" class="form-control" rows="5" name="cmarks" id="txtRemark"></textarea>
                    </td>
                </tr>
                <tr>
                    <td style="text-align:right;"></td>
                    <td><button id="btnSave" class="btn btn-default" onclick="Save()"><i class="glyphicon glyphicon-saved"></i> 保 存</button></td>
                </tr>
            </table>
        </div>
    </div>
    <script type="text/javascript">
    function Save() {
        var limitCode = $("#txtAuthorityGroupNumber").val().trim();
        var limitName = $("#txtPermissionGroupName").val().trim();
        var comment = $("#txtRemark").val().trim();
        if (!limitCode) { layer.tips('权限组编号不能为空', '#txtAuthorityGroupNumber', { tips: [1, "red"] }); return; }
        if (!limitName) { layer.tips('权限组名称不能为空', '#txtPermissionGroupName', { tips: [1, "red"] }); return; }
        $.ajax({
            url: "../WLTManage/AddLimitGroup",
            data: {
                limitCode: limitCode,
                limitName: limitName,
                comment: comment
            },
            datatype: "text",
            type: "post",
            success: function (data) {
                if (data == "ok") {
                    parent.layer.msg("权限组新增成功", { icon: 1, time: 2000 });
                    parent.$('#GroupRightsTable').bootstrapTable("refresh");
                    parent.layer.close(parent.layer.getFrameIndex(window.name));
                } else if (data == "exist") {
                    layer.msg("权限组编号或权限组名称已存在", { icon: 2, time: 2000 });
                } else {
                    layer.msg("权限组新增失败", { icon: 2, time: 2000 });
                }
            }
        })
    }
    </script>
</body>