diff --git a/pages/user/user.html b/pages/user/user.html index d492add..32fafe0 100644 --- a/pages/user/user.html +++ b/pages/user/user.html @@ -63,7 +63,7 @@ }).extend({ okLayer: "okLayer/okLayer", okUtils: "okUtils/okUtils" - }).use(["element", "table", "form", "jquery", "laydate", "okLayer", "okUtils"], function () { + }).use(["element", "table", "form", "laydate", "okLayer", "okUtils"], function () { var table = layui.table; var form = layui.form; var $ = layui.jquery; @@ -108,18 +108,9 @@ var data = obj.data; var layEvent = obj.event; if (layEvent === "edit") { - okLayer.open("编辑用户", "user-edit.html", "90%", "90%", function () { - $(".layui-laypage-btn")[0].click(); - }) + edit(data.id) } else if (layEvent === "del") { - okLayer.confirm("确定要删除吗?", function () { - okUtils.ajax("/user/batchDel", "post", {idsStr: data.id}).done(function (response) { - console.log(response) - okUtils.table.operationSuccessMsg("删除成功"); - }).fail(function (error) { - console.log(error) - }); - }) + del(data.id); } }); @@ -175,6 +166,23 @@ $(".layui-laypage-btn")[0].click(); }) }) + + function edit (id) { + okLayer.open("编辑用户", "user-edit.html?id=" + id, "90%", "90%", function () { + $(".layui-laypage-btn")[0].click(); + }) + } + + function del (id) { + okLayer.confirm("确定要删除吗?", function () { + okUtils.ajax("/user/batchDel", "post", {idsStr: id}).done(function (response) { + console.log(response) + okUtils.table.operationSuccessMsg("删除成功"); + }).fail(function (error) { + console.log(error) + }); + }) + } })