@model  AngelExam.Areas.Admin.Controllers.EditOjbectClass
@{
    ViewBag.Title = "Edit";
    Layout = "~/Views/Shared/_LayoutForm.cshtml";
}


<!--数据表格-->
<table class="layui-hide" id="tableId" lay-filter="tableId"></table>

<script>
    layui.use(["table", "angelUtils", "angelLayer"], function () {
        var table = layui.table;
        var angelUtils = layui.angelUtils;
        var angelLayer = layui.angelLayer;

        var AllTable = table.render({
            elem: "#tableId",
            url: "/api/atikuksclass1api/fzlist",
            size: "sm",
            totalRow: true,
            cols: [[
                { field: "id", title: "ID", width: 80, sort: true, fixed: 'left', unresize: true, sort: true, totalRowText: '抽题数量' },
                { field: "sortName", title: "分类名称", width: 120 },
                { field: "viewFlag", title: "是否显示", width: 120 },
                { field: "fzks_percentage", title: "点击输入筛选题数量", edit: 'text', minWidth: 100, sort: true, totalRow: true }
            ]],
            done: function (res, curr, count) {
                console.log(res, curr, count);
            }
        });


        //监听单元格编辑
        table.on('edit(tableId)', function (obj) {
            var value = obj.value; //得到修改后的值
            var data = obj.data //得到所在行所有键值
            , field = obj.field; //得到字段


            angelUtils.ajax("api/atikuksclass1api/Postaddfz", "post", { SortId: data.id, Fzks_percentage: value}, true).done(function (response) {
                angelLayer.greenTickMsg(response.message, function () {
                   location.reload(); // 页面刷新
                   //parent.layer.close(parent.layer.getFrameIndex(window.name));//先得到当前iframe层的索引 再执行关闭
                });
            }).fail(function (error) {
                console.log(error)
            });
            return false;





        });





    });

</script>

