中扬CRM客户关系管理系统
#
luxiaotao1123
2022-11-08 e7a01b236a9f6bee3616ddf2d1d88ada738490a9
src/main/webapp/views/cstmr/cstmr_more.html
@@ -54,7 +54,7 @@
            <div class="layui-card-header">
                <div>
                    <i class="layui-icon" style="font-size: 20px;color: #1890ff;font-weight: bold">&#xe68e;</i>
                    <span style="margin: 0 5px">浙江中扬立库技术有限公司</span>
                    <span id="form-name" style="margin: 0 6px;font-size: 18px;font-weight: bold;letter-spacing: 1px"></span>
                </div>
            </div>
            <div class="layui-card-body">
@@ -62,8 +62,8 @@
                    <div class="header-sub">
                        电话
                    </div>
                    <div class="header-desc">
                        15067665399
                    <div class="header-desc" id="form-tel">
                        &nbsp;
                    </div>
                </div>
@@ -71,8 +71,8 @@
                    <div class="header-sub">
                        详细地址
                    </div>
                    <div class="header-desc">
                        河北省邯郸市君邦乳业有限公司
                    <div class="header-desc" id="form-addr">
                        &nbsp;
                    </div>
                </div>
@@ -80,14 +80,14 @@
                    <div class="header-sub">
                        负责人
                    </div>
                    <div class="header-desc" style="color: #006fdb;">
                        陆晓涛
                    <div class="header-desc" id="form-director" style="color: #006fdb;">
                        &nbsp;
                    </div>
                </div>
            </div>
        </div>
        <!-- 基本信息 -->
        <div class="layui-row">
            <!-- 基本信息 -->
            <div class="layui-col-md9">
                <div class="layui-card">
                    <div class="layui-card-header">
@@ -178,16 +178,17 @@
                    </div>
                </div>
            </div>
            <!-- 跟进人 -->
            <div class="layui-col-md3" style="width: 24%;margin-left: 1%">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <span>跟进人</span>
                        <span style="float: right;cursor: pointer;">
                        <span id="follower-add" style="float: right;cursor: pointer;">
                            <i class="layui-icon" style="font-size: 20px;color: #1890ff;">&#xe61f;</i>
                        </span>
                    </div>
                    <div class="layui-card-body">
                        <table id="originTable" lay-filter="originTable"></table>
                        <table id="followersTable" lay-filter="followersTable"></table>
                    </div>
                </div>
            </div>
@@ -200,6 +201,24 @@
    </div>
</form>
<!-- 跟进人 -->
<script type="text/html" id="followerEditDialog">
    <form id="followerEditForm" lay-filter="followerEditForm" class="layui-form model-form">
        <input name="experimentId" type="hidden"/>
        <div class="layui-form-item" style="float: left;clear: none;margin-right: 20px">
            <label class="layui-form-label">选择成员</label>
            <div class="layui-input-block">
                <div id="followersBox" name="followersBox">
                </div>
            </div>
        </div>
        <div class="layui-form-item text-right" style="float: left;clear: none">
            <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
            <button class="layui-btn" lay-filter="followerSubmit" lay-submit>保存</button>
        </div>
    </form>
</script>
<script>
    var cstmrId = top.cstmrByMore;
    $('.layui-layer-close').hide();
@@ -207,12 +226,13 @@
        base: baseUrl + "/static/layui/lay/modules/"
    }).extend({
        notice: 'notice/notice',
    }).use(['form', 'table', 'laydate', 'notice'], function () {
    }).use(['form', 'table', 'laydate', 'notice', 'xmSelect'], function () {
        var $ = layui.jquery;
        var form = layui.form;
        var table = layui.table;
        var laydate = layui.laydate;
        var notice = layui.notice;
        var xmSelect = layui.xmSelect;
        form.render('select');
@@ -227,10 +247,15 @@
                    notice.destroy();
                    if (res.code === 200) {
                        let cstmr = res.data;
                        console.log(cstmr)
                        top.cstmrByMore = null;
                        $("#form-name").html(cstmr.name);
                        if (cstmr.tel) {$("#form-tel").html(cstmr.tel);}
                        if (cstmr.addr) {$("#form-addr").html(cstmr.addr);}
                        if (cstmr.director$) {$("#form-director").html(cstmr.director$);}
                        // 设备明细
                        form.val('formAdvForm', cstmr);
                        // 跟进人
                        initFollowers(cstmr.id);
                        layDateRender();
                    } else if (res.code === 403) {
                        top.location.href = baseUrl + "/";
@@ -247,14 +272,130 @@
                elem: '#endTime',
                type: 'datetime'
            });
            laydate.render({
                elem: '#lastTime',
                type: 'datetime'
            });
        }
        layDateRender();
        // 渲染跟进人模块
        function initFollowers(cstmrId) {
            if (!cstmrId) {
                return;
            }
            var insTb = table.render({
                elem: '#followersTable',
                url: baseUrl + '/cstmr/followers/table/auth',
                where: {
                    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
                    }
                },
                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');
                }
            });
        }
        // 添加跟进人
        var followerLayer;
        $(document).on('click', "#follower-add", function () {
            if (followerLayer) {return;}
            followerLayer = admin.open({
                type: 1,
                offset: '150px',
                area: '600px',
                title: '添加跟进人',
                content: $('#followerEditDialog').html(),
                success: function (layero, dIndex) {
                    // 表单提交事件
                    form.on('submit(followerSubmit)', function (data) {
                        let selectList = xmSelectIdx.getValue();
                        if (selectList.length === 0) {
                            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')},
                            data: {
                                cstmrId: cstmrId,
                                followerIds: selectList.map(function (d) {
                                    return d.value;
                                })
                            },
                            method: 'POST',
                            success: function (res) {
                                if (res.code === 200){
                                    layer.msg(res.msg, {icon: 1})
                                    // insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                } else if (res.code === 403){
                                    top.location.href = baseUrl+"/";
                                }else {
                                    layer.msg(res.msg, {icon: 2})
                                }
                            }
                        })
                        layer.close(dIndex);
                        return false;
                    });
                    let xmSelectIdx = xmSelect.render({
                        el: '#followersBox',
                        style: {
                            width: '280px',
                        },
                        autoRow: true,
                        toolbar: { show: true },
                        filterable: true,
                        remoteSearch: true,
                        remoteMethod: function(val, cb, show){
                            $.ajax({
                                url: baseUrl+"/user/all/get/kv",
                                headers: {'token': localStorage.getItem('token')},
                                data: {
                                    condition: val
                                },
                                method: 'POST',
                                success: function (res) {
                                    if (res.code === 200){
                                        cb(res.data)
                                    } else {
                                        cb([]);
                                        layer.msg(res.msg, {icon: 2});
                                    }
                                }
                            });
                        }
                    })
                    // 弹窗不出现滚动条
                    $(layero).children('.layui-layer-content').css('overflow', 'visible');
                    layui.form.render('select');
                }
            })
        })
        /* 监听表单提交 */
        form.on('submit(refresh)', function (data) {