| | |
| | | </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"> |
| | |
| | | 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'); |
| | | } |
| | | }); |
| | | }) |
| | | } |
| | | |
| | | // 添加跟进人 |
| | |
| | | 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')}, |
| | |
| | | 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 { |