中扬CRM客户关系管理系统
#
luxiaotao1123
2022-09-16 34e7e0732b5accf8220c4cd140d698569b14ad32
src/main/webapp/static/js/cstmr/cstmr.js
@@ -1,11 +1,11 @@
var pageCurr;
var pageCount = 0;
var treeCond;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
    dropdown: 'dropdown/dropdown',
    cascader: 'cascader/cascader',
}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'dropdown', 'element', 'cascader', 'tree'], function(){
}).use(['table','laydate', 'form', 'admin', 'xmSelect', 'element', 'cascader', 'tree', 'dropdown'], function(){
    var table = layui.table;
    var $ = layui.jquery;
    var layer = layui.layer;
@@ -15,18 +15,30 @@
    var xmSelect = layui.xmSelect;
    var cascader = layui.cascader;
    var tree = layui.tree;
    var dropdown = layui.dropdown;
    dropdown.render({
        elem: '#organization'
        ,content: ['<div id="organizationTree" style="height: calc(100vh - 525px);border: none"></div>'].join('')
        ,style: 'width: 370px; height: 500px; padding: 0 15px; box-shadow: 1px 1px 30px rgb(0 0 0 / 12%);'
        ,ready: function(){
            loadTree();
        }
    });
    // 树形图
    var organizationTree;
    window.loadTree = function(condition){
        var loadIndex = layer.load(2);
        $.ajax({
            url: baseUrl+"/tag/tree/auth",
            url: baseUrl+"/dept/user/tree/auth",
            headers: {'token': localStorage.getItem('token')},
            data: {
                'condition': condition
            },
            method: 'POST',
            success: function (res) {
                layer.close(loadIndex);
                if (res.code === 200){
                    organizationTree = tree.render({
                        elem: '#organizationTree',
@@ -34,9 +46,16 @@
                        onlyIconControl: true,
                        data: res.data,
                        click: function (obj) {
                            selObj = obj;
                            treeCond = {
                                key: obj.data.key,
                                val: obj.data.id
                            }
                            $('#organizationTree').find('.ew-tree-click').removeClass('ew-tree-click');
                            $(obj.elem).children('.layui-tree-entry').addClass('ew-tree-click');
                            tableIns.reload({
                                where: {[obj.data.key]: obj.data.id},
                                page: {curr: 1}
                            });
                        }
                    });
                    treeData = res.data;
@@ -48,7 +67,6 @@
            }
        })
    }
    loadTree();
    // 数据渲染
    tableIns = table.render({
@@ -58,8 +76,8 @@
        page: true,
        limit: 15,
        limits: [15, 30, 50, 100, 200, 500],
        cellMinWidth: 100,
        height: 'full-145',
        // cellMinWidth: 100,
        height: 'full-148',
        // size: 'sm',
        skin: 'line',
        cols: [[
@@ -71,9 +89,9 @@
            ,{field: 'addr', align: 'left',title: '详细地址', templet:function(d){return emptyShow(d.addr)}}
            ,{field: 'tel', align: 'left',title: '电话', templet:function(d){return emptyShow(d.tel)}}
            ,{field: 'remarks', align: 'left',title: '备注', templet:function(d){return emptyShow(d.remarks)}}
            ,{field: 'createTime$', align: 'left',title: '添加时间'}
            ,{field: 'userId$', align: 'left',title: '添加人员'}
            ,{field: 'cstmrType$', align: 'left',title: '客户类别'}
            ,{field: 'userId$', align: 'left',title: '添加人员'}
            ,{field: 'createTime$', align: 'left',title: '添加时间'}
            ,{field: 'deptId$', align: 'left',title: '所属部门', hide: true}
            ,{field: 'simple', align: 'left',title: '客户简称', hide: true}
            ,{field: 'rela', align: 'left',title: '客户关系', hide: true}
@@ -247,6 +265,7 @@
    // 搜索
    form.on('submit(search)', function (data) {
        pageCurr = 1;
        pageCount = 0;
        tableReload();
    });
@@ -281,8 +300,7 @@
            itemHeight: '250px',
            filterable: true,
            onChange: function (values, data) {
                // console.log(values);
                // console.log(data);
                // console.log(values);console.log(data);
            }
        });
    }
@@ -300,6 +318,9 @@
        $.each($('#search-box [name]').serializeArray(), function() {
            searchData[this.name] = this.value;
        });
        if (treeCond) {
            searchData[treeCond.key] = treeCond.val;
        }
        tableIns.reload({
            where: searchData,
            page: {curr: pageCurr}