中扬CRM客户关系管理系统
LSH
2023-10-10 8bbebba0b2c3f9d43671f6d7eb5fe35f8cfdca05
src/main/webapp/static/js/priOnline2/priOnline.js
@@ -84,14 +84,17 @@
        cols: [[
            {type: 'checkbox', fixed: 'left'}
            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80,hide: true}
            ,{field: 'templateName', align: 'center',title: '核价名',hide: false}
            ,{field: 'orderNum', align: 'center',title: '核价单号'}
            ,{field: 'planId$', align: 'center',title: '规划单号'}
            ,{field: 'templateName', align: 'center',title: '客户名称', style: 'color: #1890ff;cursor:pointer', event: 'moreCstmr', width: 350,hide: false}
            ,{field: 'cstmrId$', align: 'center',title: '客户id',hide: true}
            ,{field: 'orderNum', align: 'center',title: '核价单号',hide: false}
            ,{field: 'planId$', align: 'center',title: '规划单号', style: 'color: #1890ff;cursor:pointer', event: 'morePlan',hide: false}
            ,{field: 'itemId', align: 'center',title: '规划单号', hide: true}
            ,{field: 'createTime$', align: 'center',title: '创建时间'}
            ,{field: 'updateTime$', align: 'center',title: '更新时间'}
            ,{field: 'status$', align: 'center',title: '状态'}
            ,{field: 'memberId$', align: 'center',title: '业务员'}
            ,{field: 'user$', align: 'center',title: '创建人员'}
            // ,{field: 'memberId$', align: 'center',title: ''}
            ,{field: 'settle$', align: 'center',title: '进度', style: 'color: #1890ff;cursor:pointer', event: 'more',hide: false}
            ,{field: 'user$', align: 'center',title: '业务员'}
            ,{field: 'updateUserId$', align: 'center',title: '更新人员'}
            ,{field: 'checkDataStatus$', align: 'center',title: '报价数据'}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:350}
@@ -169,7 +172,7 @@
                } else {
                    layer.confirm('确定删除'+(ids.length===1?'此':ids.length)+'条数据吗', function(){
                        $.ajax({
                            url: baseUrl+"/priOnline/delete/auth",
                            url: baseUrl+"/priOnline2/delete/auth",
                            headers: {'token': localStorage.getItem('token')},
                            data: {ids: ids},
                            method: 'POST',
@@ -207,7 +210,7 @@
                        'fields': fields
                    };
                    $.ajax({
                        url: baseUrl+"/priOnline/export/auth",
                        url: baseUrl+"/priOnline2/export/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: JSON.stringify(param),
                        dataType:'json',
@@ -233,6 +236,105 @@
    table.on('tool(priOnline)', function(obj){
        var data = obj.data;
        switch (obj.event) {
            case 'approval':
                layer.confirm('审批通过?', {
                    skin: 'layui-layer-admin',
                    shade: .1,
                    offset: '200px',
                    title: data.name
                }, function (i) {
                    layer.close(i);
                    // 指定规划员
                    if (data.settle === 2) {
                        admin.open({
                            type: 1,
                            area: '300px',
                            title: '选择规划员',
                            content: $('#plannerListDialog').html(),
                            success: function (layero, dIndex) {
                                let plannerSel = xmSelect.render({
                                    el: '#plannerXmlSel',
                                    autoRow: true,
                                    filterable: true,
                                    remoteSearch: true,
                                    clickClose: true,
                                    radio: true,
                                    remoteMethod: function (val, cb, show) {
                                        let loadIndex = layer.load(2);
                                        $.ajax({
                                            url: baseUrl+"/priOnline2/priQuoteAdd/list/auth",
                                            headers: {'token': localStorage.getItem('token')},
                                            data: {
                                                planId: data.id
                                            },
                                            method: 'POST',
                                            success: function (res) {
                                                layer.close(loadIndex);
                                                if (res.code === 200) {
                                                    cb(res.data)
                                                } else {
                                                    layer.close(dIndex);
                                                    layer.msg(res.msg, {icon: 2});
                                                }
                                            }
                                        })
                                    }
                                });
                                form.on('submit(editSubmit)', function () {
                                    let plannerId = plannerSel.getValue()[0] ? plannerSel.getValue()[0].value : null;
                                    if (!plannerId) {
                                        layer.msg("请选择规划员", {icon: 2});
                                        top.requireTip($('#plannerXmlSel'));
                                        return false;
                                    }
                                    approval(data.id, plannerId, dIndex);
                                });
                                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                            }
                        })
                    } else {
                        approval(data.id);
                    }
                });
                break;
            case 'moreCstmr':
                top.cstmrByMore = data.cstmrId$;
                admin.popupRight({
                    type: 1,
                    window: "top",
                    area: "1250px",
                    url: "../cstmr/cstmr_more.html",
                    end: function () {
                        // $(".layui-laypage-btn")[0].click();
                    }
                })
                break;
            case 'morePlan':
                top.planByMore = data.itemId;
                admin.popupRight({
                    type: 1,
                    window: "top",
                    area: "1250px",
                    url: "../plan/plan_more_other.html",
                    end: function () {
                        // $(".layui-laypage-btn")[0].click();
                    }
                })
                break;
            case 'more':
                top.priOnlineByMore = data.id;
                admin.popupRight({
                    type: 1,
                    window: "top",
                    area: "1250px",
                    url: "priOnline_more.html",
                    end: function () {
                        // $(".layui-laypage-btn")[0].click();
                    }
                })
                break;
            // 核价
            case 'check':
                layer.open({
@@ -447,6 +549,34 @@
        });
    }
    function approval(priOnlineId, plannerId, dIdx) {
        let loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/priOnline2/approval/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                priOnlineId: priOnlineId,
                plannerId: plannerId
            },
            method: 'POST',
            success: function (res) {
                if (dIdx) {
                    layer.close(dIdx);
                }
                layer.close(loadIndex);
                if (res.code === 200){
                    layer.msg(res.msg, {icon: 1});
                    tableReload();
                } else if (res.code === 403){
                    top.location.href = baseUrl+"/";
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }
        })
    }
});
// 关闭动作