From ea85cc2dd034540151074a66192e3198b1303a8c Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期二, 08 十一月 2022 10:31:26 +0800 Subject: [PATCH] # --- src/main/webapp/views/cstmr/cstmr_more.html | 93 ++++++++++++++++++++++++++++------------------ 1 files changed, 57 insertions(+), 36 deletions(-) diff --git a/src/main/webapp/views/cstmr/cstmr_more.html b/src/main/webapp/views/cstmr/cstmr_more.html index b0cd688..8240b4c 100644 --- a/src/main/webapp/views/cstmr/cstmr_more.html +++ b/src/main/webapp/views/cstmr/cstmr_more.html @@ -201,6 +201,11 @@ </div> </form> + +<script type="text/html" id="followerTabOperate"> + <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="del">鍒犻櫎</a> +</script> + <!-- 璺熻繘浜� --> <script type="text/html" id="followerEditDialog"> <form id="followerEditForm" lay-filter="followerEditForm" class="layui-form model-form"> @@ -280,38 +285,61 @@ if (!cstmrId) { return; } - var insTb = table.render({ - elem: '#followersTable', - url: baseUrl + '/cstmr/followers/table/auth', - where: { + $.ajax({ + url: baseUrl+"/cstmr/followers/table/auth", + headers: {'token': localStorage.getItem('token')}, + data: { cstmrId: cstmrId }, - // height: 'full-100', - headers: {token: localStorage.getItem('token')}, - request: { - pageName: 'curr', - pageSize: 'limit' - }, - parseData: function (res) { - return { - 'code': res.code, - 'msg': res.msg, - 'count': res.data.total, - 'data': res.data.records + method: 'GET', + success: function (res) { + if (res.code === 200){ + var follTab = table.render({ + elem: '#followersTable', + data: res.data, + cols: [[ + {field: 'userName', title: '宸ヤ綔浜哄憳'}, + {fixed: 'right', title:'', align: 'center', toolbar: '#followerTabOperate', width: 70} + ]], + done: function (res, curr, count) { + $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); + } + }); + // 鐩戝惉琛屽伐鍏蜂簨浠� + table.on('tool(followersTable)', function(obj){ + let data = obj.data; + switch (obj.event) { + case "del": + let loadIndex = layer.load(2); + $.ajax({ + url: baseUrl+"/cstmr/followers/remove/auth", + headers: {'token': localStorage.getItem('token')}, + data: { + cstmrId: cstmrId, + userId: data.userId + }, + method: 'POST', + success: function (res) { + layer.close(loadIndex); + if (res.code === 200){ + initFollowers(cstmrId); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + } else { + layer.msg(res.msg, {icon: 2}); + } + } + }) + break; + } + }); + } else if (res.code === 403){ + top.location.href = baseUrl+"/"; + }else { + layer.msg(res.msg, {icon: 2}) } - }, - response: { - statusCode: 200 - }, - defaultToolbar: [], - cols: [[ - {field: 'id', title: '缂栧彿', width: 70, align: 'center'}, - {field: 'name', title: '宸ヤ綔浜哄憳'} - ]], - done: function (res, curr, count) { - $('#dictTable+.layui-table-view .layui-table-body tbody>tr:first').trigger('click'); } - }); + }) } // 娣诲姞璺熻繘浜� @@ -332,12 +360,6 @@ layer.msg("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�", {icon: 3}); return false; } - console.log(JSON.stringify({ - cstmrId: cstmrId, - followerIds: selectList.map(function (d) { - return d.value; - }) - })) $.ajax({ url: baseUrl+"/cstmr/followers/add/auth", headers: {'token': localStorage.getItem('token')}, @@ -350,8 +372,7 @@ method: 'POST', success: function (res) { if (res.code === 200){ - layer.msg(res.msg, {icon: 1}) - // insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); + initFollowers(cstmrId); } else if (res.code === 403){ top.location.href = baseUrl+"/"; }else { -- Gitblit v1.9.1