From de5996788779f7388d3d3ccc22911914eaaf8fcc Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 30 六月 2020 16:24:06 +0800
Subject: [PATCH] #

---
 src/main/webapp/static/js/user/user.js |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/main/webapp/static/js/user/user.js b/src/main/webapp/static/js/user/user.js
index dbadde7..32f7177 100644
--- a/src/main/webapp/static/js/user/user.js
+++ b/src/main/webapp/static/js/user/user.js
@@ -1,4 +1,5 @@
 var pageCurr;
+var tableData;
 layui.use(['table','laydate', 'form'], function(){
     var table = layui.table;
     var $ = layui.jquery;
@@ -23,7 +24,7 @@
             // ,{field: 'hostName', align: 'center',title: '鎺堟潈鍟嗘埛'}
             ,{field: 'mobile', align: 'center',title: '璐﹀彿'}
             ,{field: 'username', align: 'center',title: '鍚嶇О'}
-            ,{field: 'password', align: 'center',title: '瀵嗙爜'}
+            // ,{field: 'password', align: 'center',title: '瀵嗙爜'}
             ,{field: 'roleName', align: 'center',title: '瑙掕壊'}
             // ,{field: 'createTime$', align: 'center',title: '娉ㄥ唽鏃堕棿'}
             ,{field: 'status$', align: 'center',title: '鐘舵��', templet: '#statusTpl', width: 120, unresize: true}
@@ -49,6 +50,7 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
+            tableData = table.cache.user;
             pageCurr=curr;
             limit();
         }
@@ -56,8 +58,13 @@
 
     // 淇敼鐘舵��
     form.on('switch(statusSwitch)', function (obj) {
-        layer.tips(this.value + ' ' + this.name + '锛�'+ obj.elem.checked, obj.othis);
-        layer.msg("鎿嶄綔鎴愬姛")
+        var index  = obj.othis.parents('tr').attr("data-index");
+        var data = tableData[index];
+        data[this.name] = obj.elem.checked?1:0;
+        http.post(baseUrl+"/user/edit/auth", {id: data.id, status: data[this.name]}, function (res) {
+            $(".layui-laypage-btn")[0].click();
+            layer.msg("鎿嶄綔鎴愬姛")
+        })
     })
 
     // 鐩戝惉鎺掑簭浜嬩欢
@@ -77,6 +84,7 @@
                 if (res.code === 403) {
                     top.location.href = baseUrl+"/";
                 }
+                tableData = table.cache.user;
                 pageCurr=curr;
                 limit();
             }
@@ -375,6 +383,7 @@
             if (res.code === 403) {
                 top.location.href = baseUrl+"/";
             }
+            tableData = table.cache.user;
             pageCurr=curr;
             if (res.data.length === 0 && count !== 0) {
                 tableIns.reload({

--
Gitblit v1.9.1