中扬CRM客户关系管理系统
LSH
2024-03-28 6a70e2f5c45e376d14177e1fdb605a346701faa7
src/main/webapp/static/js/weekly/weekly.js
@@ -1,6 +1,8 @@
var pageCurr;
var admin;
var treeCond;
var htmlCstme;
var htmlCstmrData;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
@@ -72,6 +74,35 @@
        })
    }
    // // 渲染搜索模板
    // $.ajax({
    //     url: baseUrl+"/cstmr/all/get/kv",
    //     headers: {'token': localStorage.getItem('token')},
    //     data: {
    //         limit: 9999
    //     },
    //     method: 'POST',
    //     // async: false, // 设置为同步执行
    //     success: function (res) {
    //         htmlCstme = "<select id=\"select_cstmr\" name=\"select_cstmr\" lay-vertype=\"tips\" lay-verify=\"required\" required=\"\">"
    //         htmlCstme = htmlCstme +
    //             "                    <option style=\"display: none\"></option>\n"
    //         if (res.code === 200){
    //             for (var val in res.data) {
    //                 var cstmrVal = res.data[val]
    //                 console.log(cstmrVal)
    //                 htmlCstme = htmlCstme +
    //                     "        <option value = \""+cstmrVal.value+"\"+\n" +
    //                     "        > "+cstmrVal.name+" </option>\n"
    //             }
    //         } else {
    //             htmlCstme = htmlCstme +
    //                 "<option value=\"0\">异常</option>"
    //         }
    //         htmlCstme = htmlCstme +  "\n" + " </select>";
    //     }
    // })
    // 数据渲染
    tableIns = table.render({
        elem: '#weekly',
@@ -104,7 +135,7 @@
            ,{field: 'settleSize', align: 'center',title: '流程长度',hide : true}
            ,{field: 'settleCurrent', align: 'center',title: '当前进度',hide : true}
            ,{field: 'cstmrIdsPlan', align: 'center',title: '计划甲方单位ID集合',hide : true}
            ,{field: 'weeklyAll', align: 'center',title: '周数',hide : false}
            ,{field: 'weeklyAll', align: 'center',title: '周数',hide : false}
            ,{field: 'weeklyNowMonth', align: 'center',title: '当月第几周',hide : true}
            ,{field: 'weeklyYear', align: 'center',title: '年',hide : true}
            ,{field: 'weeklyMonth', align: 'center',title: '月',hide : true}
@@ -393,9 +424,9 @@
            success: function (layero, dIndex) {
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                var isExpAdd = !expTpe;
                // if (expTpe){
                //     document.getElementById('weeklyDisplay').style.display = 'none';
                // }
                if (expTpe){
                    document.getElementById('weeklyDisplay').style.display = 'none';
                }
                // 回显数据
                form.val('editForm', expTpe);
                console.log(expTpe)
@@ -430,7 +461,6 @@
                        contentType:'application/json;charset=UTF-8',
                        method: 'POST',
                        success: function (res) {
                            console.log(data)
                            layer.closeAll('loading');
                            if (res.code === 200){
                                layer.close(dIndex);
@@ -457,18 +487,29 @@
                    cols: [[
                        {type: 'numbers', title: '#'}
                        ,{field: 'weeklyDay$', align: 'center',title: '星期'}
                        ,{field: 'comment', title: '评论', width: 100, style: 'color: blue;font-weight: bold', edit:true}
                        ,{field: 'weeklyMatter', title: '需协助事项', width: 100, style: 'color: blue;font-weight: bold', edit:true}
                        ,{field: 'dailyTime$', align: 'center',title: '日报日期'}
                        ,{field: 'settleMsg', align: 'center',title: '审核进度'}
                        ,{field: 'director', align: 'center',title: '负责人'}
                        ,{field: 'settleSize', align: 'center',title: '流程长度'}
                        ,{field: 'settleCurrent', align: 'center',title: '当前进度'}
                        ,{field: 'cstmrId', align: 'center',title: '甲方单位ID'}
                        ,{field: 'workContent', title: '工作内容', style: 'color: blue;font-weight: bold', edit:true}
                        ,{field: 'workPurpose', title: '工作目的', style: 'color: blue;font-weight: bold', edit:true}
                        ,{field: 'comment', title: '评论', style: 'color: blue;font-weight: bold', edit:true}
                        ,{field: 'weeklyMatter', title: '需协助事项', style: 'color: blue;font-weight: bold', edit:true}
                        // ,{field: 'dailyTime$', align: 'center',title: '日报日期'}
                        // ,{field: 'settleMsg', align: 'center',title: '审核进度'}
                        // ,{field: 'director', align: 'center',title: '负责人'}
                        // ,{field: 'settleSize', align: 'center',title: '流程长度'}
                        // ,{field: 'settleCurrent', align: 'center',title: '当前进度'}
                        ,{field: 'cstmrId', align: 'center',title: '甲方单位ID', style: 'color: blue;font-weight: bold', templet: '#cstmrId'}//, templet: function () { return htmlCstme;}
                        ,{field: 'memo', align: 'center',title: '备注', width: 100, style: 'color: blue;font-weight: bold', edit:true}
                        ,{align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                    ]],
                    parseData: function (res) {
                        return {
                            'code': res.code,
                            'msg': res.msg,
                            'count': res.data.total,
                            'data': res.data.records
                        }
                    },
                    done: function (res, curr, count) {
                        $(".layui-table-cell").css('overflow', 'visible');//解决layui数据表格中嵌套下拉框显示问题
                        $(layero).find('.layui-table-view').css('margin', '0');
                        var options = this;
@@ -478,18 +519,40 @@
                            return table.cache[options.id][index] || {};
                        };
                        $('.input-occupation').on('text', function(){
                        $('.select-cstmr').on('change', function(){
                            console.log("cstmrId")
                            var value = this.value; // 获取选中项 value
                            var data = table.getRowData(this);
                            console.log(value);
                            console.log("value------===");
                            xxDataList.forEach(res => {
                                if (data.id === res.id){
                                if (data.LAY_TABLE_INDEX === res.LAY_TABLE_INDEX){
                                    console.log(res)
                                    res.occupation = value;
                                    // console.log(data)
                                    res.cstmrId = value;
                                }
                            })
                        });
                        $(document).ready(function () {
                            $.ajax({
                                url: baseUrl + "/cstmr/all/get/kv",
                                headers: { 'token': localStorage.getItem('token') },
                                data: {
                                    limit: 9999
                                },
                                method: 'POST',
                                success: function (res) {
                                    if (res.code === 200) {
                                        console.log("res111111111111")
                                        console.log(res)
                                        var template = $('#cstmrId').html(); // 获取模板内容
                                        var compiledTemplate = Handlebars.compile(template); // 编译模板
                                        var html = compiledTemplate(res.data); // 将数据应用到模板中
                                        $('.select-cstmr').html(html); // 渲染模板到页面
                                    } else {
                                        // 处理异常情况
                                    }
                                }
                            });
                        });
                    },
                    size: ''