diff --git a/lib/layui_plugins/okUtils/okUtils.js b/lib/layui_plugins/okUtils/okUtils.js index c9dc1e2..3a29913 100644 --- a/lib/layui_plugins/okUtils/okUtils.js +++ b/lib/layui_plugins/okUtils/okUtils.js @@ -66,9 +66,9 @@ layui.define("layer", function (exports) { * 在表格页面操作成功后弹窗提示 * @param content */ - operationSuccessMsg: function (content) { + successMsg: function (content) { layer.msg(content, {icon: 1, time: 1000}, function () { - // 刷新当前table数据 + // 刷新当前页table数据 $(".layui-laypage-btn")[0].click(); }); }, diff --git a/pages/user/user.html b/pages/user/user.html index 0f2118f..b78e168 100644 --- a/pages/user/user.html +++ b/pages/user/user.html @@ -52,7 +52,7 @@ laydate.render({elem: "#startTime", type: "datetime"}); laydate.render({elem: "#endTime", type: "datetime"}); - table.render({ + var userTable = table.render({ elem: "#tableId", url: "../../data/user.json", limit: 10, @@ -78,7 +78,7 @@ }); form.on("submit(search)", function (data) { - table.reload("tableId", { + userTable.reload({ where: data.field, page: {curr: 1} }); @@ -122,7 +122,7 @@ if (idsStr) { okUtils.ajax("/user/batchNormal", "post", {idsStr: idsStr}).done(function (response) { console.log(response) - okUtils.table.operationSuccessMsg("批量启用成功"); + okUtils.table.successMsg("批量启用成功"); }).fail(function (error) { console.log(error) }); @@ -137,7 +137,7 @@ if (idsStr) { okUtils.ajax("/user/batchStop", "post", {idsStr: idsStr}).done(function (response) { console.log(response) - okUtils.table.operationSuccessMsg("批量停用成功"); + okUtils.table.successMsg("批量停用成功"); }).fail(function (error) { console.log(error) }); @@ -152,7 +152,7 @@ if (idsStr) { okUtils.ajax("/user/batchDel", "post", {idsStr: idsStr}).done(function (response) { console.log(response) - okUtils.table.operationSuccessMsg("批量删除成功"); + okUtils.table.successMsg("批量删除成功"); }).fail(function (error) { console.log(error) }); @@ -168,7 +168,7 @@ function edit (id) { okLayer.open("编辑用户", "user-edit.html?id=" + id, "90%", "90%", function () { - table.reload("tableId"); + userTable.reload(); }) } @@ -176,7 +176,7 @@ okLayer.confirm("确定要删除吗?", function () { okUtils.ajax("/user/batchDel", "post", {idsStr: id}).done(function (response) { console.log(response) - okUtils.table.operationSuccessMsg("删除成功"); + okUtils.table.successMsg("删除成功"); }).fail(function (error) { console.log(error) });