中扬CRM客户关系管理系统
LSH
2024-03-29 a26763201b83e1aa7823a0fe3219445a912b47b9
src/main/webapp/static/js/weekly/weekly.js
@@ -3,6 +3,8 @@
var treeCond;
var htmlCstme;
var htmlCstmrData;
var indexS = "9999,8888";
var indexDelSign = 0;
layui.config({
    base: baseUrl + "/static/layui/lay/modules/"
}).extend({
@@ -73,35 +75,6 @@
            }
        })
    }
    // // 渲染搜索模板
    // $.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({
@@ -363,17 +336,18 @@
                            cols: [[
                                {type: 'numbers'}
                                ,{field: 'weeklyDay$', align: 'center',title: '星期'}
                                ,{field: 'workContent', title: '工作内容', edit:true}
                                ,{field: 'workPurpose', title: '工作目的', edit:true}
                                ,{field: 'comment', title: '评论', edit:true}
                                ,{field: 'weeklyMatter', title: '需协助事项',  edit:true}
                                ,{field: 'dailyTime$', align: 'center',title: '日期'}
                                ,{field: 'workContent', align: 'center', title: '工作内容', edit:false}
                                ,{field: 'workPurpose', title: '工作目的', edit:false}
                                ,{field: 'comment', title: '评论', edit:false}
                                ,{field: 'weeklyMatter', title: '需协助事项',  edit:false}
                                // ,{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',   templet: '#cstmrId'}//, templet: function () { return htmlCstme;}
                                ,{field: 'memo', align: 'center',title: '备注',   edit:true}
                                ,{field: 'cstmrId', align: 'center',title: '甲方单位ID'}//, templet: function () { return htmlCstme;}
                                ,{field: 'memo', align: 'center',title: '备注',   edit:false}
                            ]],
                            request: {
                                pageName: 'curr',
@@ -425,17 +399,18 @@
                            cols: [[
                                {type: 'numbers'}
                                ,{field: 'weeklyDay$', align: 'center',title: '星期'}
                                ,{field: 'workContent', align: 'center', title: '工作内容', edit:true}
                                ,{field: 'workPurpose', title: '工作目的', edit:true}
                                ,{field: 'comment', title: '评论', edit:true}
                                ,{field: 'weeklyMatter', title: '需协助事项',  edit:true}
                                ,{field: 'dailyTime$', align: 'center',title: '日期'}
                                ,{field: 'workContent', align: 'center', title: '工作内容', edit:false}
                                ,{field: 'workPurpose', title: '工作目的', edit:false}
                                ,{field: 'comment', title: '评论', edit:false}
                                ,{field: 'weeklyMatter', title: '需协助事项',  edit:false}
                                // ,{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',   templet: '#cstmrId'}//, templet: function () { return htmlCstme;}
                                ,{field: 'memo', align: 'center',title: '备注',   edit:true}
                                ,{field: 'cstmrId', align: 'center',title: '甲方单位ID'}//, templet: function () { return htmlCstme;}
                                ,{field: 'memo', align: 'center',title: '备注',   edit:false}
                            ]],
                            request: {
                                pageName: 'curr',
@@ -566,14 +541,56 @@
                    },
                    done: function (res, curr, count) {
                        $(".layui-table-cell").css('overflow', 'visible');//解决layui数据表格中嵌套下拉框显示问题
                        $(".laytable-cell-2-0-6").css('color', 'rgba(0, 0, 0, 0)');
                        $(layero).find('.layui-table-view').css('margin', '0');
                        var options = this;
                        var indexSign = 0;
                        // 获取当前行数据
                        table.getRowData = function(elem){
                            var index = $(elem).closest('tr').data('index');
                            console.log("index-----")
                            console.log(index)
                            var indexArray = indexS.split(","); // 将字符串拆分为数组
                            // 遍历数组中的每个元素
                            for (var i = 0; i < indexArray.length; i++) {
                                var element = Number(indexArray[i]);
                                // 进行相应的操作
                                console.log("element-----");
                                console.log(element);
                                if (element===index){
                                    indexSign = 1;
                                }
                            }
                            if (indexSign === 0){
                                indexS = indexS+","+index;
                                console.log("indexS-----")
                                console.log(indexS)
                            }
                            return table.cache[options.id][index] || {};
                        };
                        if (indexSign === 0 && indexDelSign === 0){
                            console.log("渲染")
                            // 渲染搜索模板
                            $.ajax({
                                url: baseUrl+"/cstmr/all/get/kv",
                                headers: {'token': localStorage.getItem('token')},
                                data: {
                                    limit: 9999
                                },
                                method: 'POST',
                                // async: false, // 设置为同步执行
                                success: function (res) {
                                    console.log(res)
                                    console.log($("#cstmrId").html())
                                    res.data.forEach((item) => {
                                        console.log(item)
                                        $("#cstmrId").append("<option value='" + item.value  + "';"+" class=\"cstmrDetl\""+">" + item.name + "</option>")
                                    })
                                }
                            })
                        }
                        $('.select-cstmr').on('change', function(){
                            console.log("cstmrId")
@@ -687,6 +704,9 @@
                        title: (exp ? '修改' : '添加') + '明细',
                        content: $('#matEditDialog').html(),
                        success: function (layero, dIndex) {
                            if (!exp){
                                indexDelSign = 1;
                            }
                            // 回显数据
                            form.val('matEditForm', exp);
                            // 表单提交事件
@@ -856,6 +876,8 @@
                    },
                    done: function (res, curr, count) {
                        $(".layui-table-cell").css('overflow', 'visible');//解决layui数据表格中嵌套下拉框显示问题
                        // $(".laytable-cell-2-0-6").css('color', 'rgba(0, 0, 0, 0)');
                        $(layero).find('.layui-table-view').css('margin', '0');
                        var options = this;