From b2459fb803eaff437c3ce9377ca47698d46bc3c4 Mon Sep 17 00:00:00 2001 From: bobi Date: Sun, 3 Nov 2019 18:49:04 +0800 Subject: [PATCH] =?UTF-8?q?impr:=E5=AE=8C=E5=96=84user.html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/member/user.html | 394 ++++++++++++++++++++--------------------- 1 file changed, 196 insertions(+), 198 deletions(-) diff --git a/pages/member/user.html b/pages/member/user.html index 7eeb608..d151de6 100644 --- a/pages/member/user.html +++ b/pages/member/user.html @@ -7,215 +7,213 @@ -
- -
+
+ + + +
+ +
+ +
- -
- -
- -
-
- - - - + - - - - - - - + return false; + }); + + table.on("toolbar(tableFilter)", function (obj) { + switch (obj.event) { + case "batchEnabled": + batchEnabled(); + break; + case "batchDisabled": + batchDisabled(); + break; + case "batchDel": + batchDel(); + break; + case "add": + add(); + break; + } + }); + + table.on("tool(tableFilter)", function (obj) { + let data = obj.data; + switch (obj.event) { + case "edit": + edit(data); + break; + case "del": + del(data.id); + break; + } + }); + + function batchEnabled() { + okLayer.confirm("确定要批量启用吗?", function (index) { + layer.close(index); + let idsStr = okUtils.table.batchCheck(table); + if (idsStr) { + okUtils.ajax("/user/normalUser", "put", {idsStr: idsStr}, true).done(function (response) { + console.log(response); + okUtils.table.successMsg(response.msg); + }).fail(function (error) { + console.log(error) + }); + } + }); + } + + function batchDisabled() { + okLayer.confirm("确定要批量停用吗?", function (index) { + layer.close(index); + let idsStr = okUtils.table.batchCheck(table); + if (idsStr) { + okUtils.ajax("/user/stopUser", "put", {idsStr: idsStr}, true).done(function (response) { + console.log(response); + okUtils.table.successMsg(response.msg); + }).fail(function (error) { + console.log(error) + }); + } + }); + } + + function batchDel() { + okLayer.confirm("确定要批量删除吗?", function (index) { + layer.close(index); + let idsStr = okUtils.table.batchCheck(table); + if (idsStr) { + okUtils.ajax("/user/deleteUser", "delete", {idsStr: idsStr}, true).done(function (response) { + console.log(response); + okUtils.table.successMsg(response.msg); + }).fail(function (error) { + console.log(error) + }); + } + }); + } + + function add() { + okLayer.open("添加用户", "user-add.html", "90%", "90%", null, function () { + userTable.reload(); + }) + } + + function edit(data) { + okLayer.open("编辑用户", "user-edit.html", "90%", "90%", function (layero) { + let iframeWin = window[layero.find("iframe")[0]["name"]]; + iframeWin.initForm(data); + }, function () { + userTable.reload(); + }) + } + + function del(id) { + okLayer.confirm("确定要删除吗?", function () { + okUtils.ajax("/user/deleteUser", "delete", {idsStr: id}, true).done(function (response) { + console.log(response); + okUtils.table.successMsg(response.msg); + }).fail(function (error) { + console.log(error) + }); + }) + } + }) + + + + + + + +