@{
    ViewBag.Title = "编辑标签";
    Layout = "~/Views/Shared/_LayoutTable.cshtml";
}
<body>
    <div class="wrapper wrapper-content animated fadeInDown">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <input type="hidden" id="nub" value="@TempData["nub"]" />
                <input type="hidden" id="classname" value="@TempData["classname"]" />
                <table id="newConfigurationTable" class="table table-bordered table-striped table-hover">
                    <tr style="height: 40px">
                        <td style="text-align: right">标签名称：</td>
                        <td>
                            <input type="text" id="txtTagsName" value="@TempData["classname"]">
                        </td>
                    </tr>
                    <tr>
                        <td style="text-align: right">备注：</td>
                        <td>
                            <textarea cols="100" rows="5" name="comment" id="txtComment">@TempData["comment"]</textarea>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td style="text-align: left; height: 60px">
                            <button id="btnSubmit" class="btn btn-default" onclick="SaveTags()"><i class="glyphicon glyphicon-ok"></i> 保存</button>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function SaveTags() {
            if ($.trim($("#txtTagsName").val()).length <= 0) {
                layer.tips('标签名称不能为空！', '#txtTagsName', {
                    shift: 0,
                    tips: [1, '#c00']
                }); return;
            }
            if ($.trim($("#txtComment").val()).length >= 300) {
                layer.tips('备注过长，已超出长度限制(300)！', '#txtComment', {
                    shift: 0,
                    tips: [1, '#c00']
                }); return;
            }
            $.ajax({
                url: "../WLTManage/SaveTags",
                data: {
                    classname: $.trim($("#txtTagsName").val()),
                    comment: $.trim($("#txtComment").val()),
                    oldclassname: $.trim($("#classname").val()),
                    nub: $.trim($("#nub").val())
                },
                datatype: "text",
                type: "post",
                success: function (data) {
                    if (data == "保存成功！") {
                        parent.$('#TagsTable').bootstrapTable('refresh');
                        parent.layer.msg(data, { time: 2000 })
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    } else {
                        layer.msg(data, { time: 2000 });
                    }
                }
            })
        }
    </script>
</body>