中扬CRM客户关系管理系统
LSH
2024-03-28 d91c343a39c795cf66638e71f6a7f2f1eb029e6b
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',
@@ -87,6 +118,7 @@
            {field: 'id', align: 'center',title: 'ID',hide : true}
            ,{field: 'startTime$', align: 'center',title: '开始日期',hide : true}
            ,{field: 'endTime$', align: 'center',title: '结束日期',hide : true}
            ,{field: 'weeklyDayMonth', align: 'center',title: '周',hide : false}
            ,{field: 'userId$', align: 'center',title: '所属人员',hide : true}
            ,{field: 'hostId$', align: 'center',title: '所属商户',hide : true}
            ,{field: 'deptId$', align: 'center',title: '所属部门',hide : true}
@@ -94,6 +126,8 @@
            ,{field: 'status$', align: 'center',title: '状态',hide : false}
            ,{field: 'settle$', align: 'center',title: '进度',hide : false}
            ,{field: 'settleMsg', align: 'center',title: '审核进度',hide : true}
            ,{field: 'weeklyDailyPlan', align: 'center',title: '日计划',hide : false, toolbar: '#tbLookPlan'}
            ,{field: 'weeklyDailyReality', align: 'center',title: '日行程',hide : false, toolbar: '#tbLookReality'}
            ,{field: 'comment', align: 'center',title: '评论',hide : false}
            ,{field: 'createBy$', align: 'center',title: '添加人员',hide : true}
            ,{field: 'createTime$', align: 'center',title: '添加时间',hide : true}
@@ -104,14 +138,13 @@
            ,{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 : true}
            ,{field: 'weeklyNowMonth', align: 'center',title: '当月第几周',hide : true}
            ,{field: 'weeklyYear', align: 'center',title: '年',hide : true}
            ,{field: 'weeklyMonth', align: 'center',title: '月',hide : true}
            ,{field: 'weeklyDay', align: 'center',title: '日',hide : true}
            ,{field: 'weeklyDayMonth', align: 'center',title: '周',hide : true}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:240}
        ]],
        request: {
            pageName: 'curr',
@@ -300,16 +333,16 @@
            case "edit":
                showEditModel(data);
                break;
            case "look":
                var $a = $(obj.tr).find('a[lay-event="look"]');
            case "lookPlan":
                var $a = $(obj.tr).find('a[lay-event="lookPlan"]');
                var offset = $a.offset();
                var top2 = offset.top;
                var left = offset.left;
                layer.open({
                    type: 1,
                    title: false,
                    area: '2100px',
                    offset: [top2 + 'px', (left - 1430 + $a.outerWidth()) + 'px'],
                    area: '1100px',
                    offset: [top2 + 'px', (left - 430 + $a.outerWidth()) + 'px'],
                    shade: .01,
                    shadeClose: true,
                    fixed: false,
@@ -318,37 +351,88 @@
                        table.render({
                            elem: '#lookSSXMTable',
                            headers: {token: localStorage.getItem('token')},
                            url: baseUrl+'/weeklyDetl/list/auth',
                            url: baseUrl+'/weeklyDailyPlan/list/auth',
                            where: {
                                order_id: data.id
                                weekly_id: data.id
                            },
                            page: true,
                            cellMinWidth: 100,
                            cols: [[
                                {type: 'checkbox'}
                                ,{field: 'id', align: 'center',title: 'ID'}
                                ,{field: 'dailyTime$', align: 'center',title: '日报日期'}
                                ,{field: 'userId$', align: 'center',title: '所属人员'}
                                ,{field: 'hostId$', align: 'center',title: '所属商户'}
                                ,{field: 'deptId$', align: 'center',title: '所属部门'}
                                ,{field: 'status$', align: 'center',title: '状态'}
                                ,{field: 'settle$', align: 'center',title: '进度'}
                                ,{field: 'settleMsg', align: 'center',title: '审核进度'}
                                ,{field: 'comment', align: 'center',title: '评论'}
                                ,{field: 'createBy$', align: 'center',title: '添加人员'}
                                ,{field: 'createTime$', align: 'center',title: '添加时间'}
                                ,{field: 'updateBy$', align: 'center',title: '修改人员'}
                                ,{field: 'updateTime$', align: 'center',title: 'update_time'}
                                ,{field: 'weeklyMatter', align: 'center',title: '需协助事项'}
                                ,{field: 'director$', align: 'center',title: '负责人'}
                                ,{field: 'settleSize', align: 'center',title: '流程长度'}
                                ,{field: 'settleCurrent', align: 'center',title: '当前进度'}
                                ,{field: 'weeklyId', align: 'center',title: '周报ID'}
                                ,{field: 'cstmrId', align: 'center',title: '甲方单位ID'}
                                ,{field: 'weeklyDay', align: 'center',title: '星期'}
                                ,{field: 'memo', align: 'center',title: '备注'}
                                ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
                                {type: 'numbers'}
                                ,{field: 'weeklyDay$', align: 'center',title: '星期'}
                                ,{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: '备注',  style: 'color: blue;font-weight: bold', edit:true}
                            ]],
                            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
                            },
                            done: function () {
                                $(layero).find('.layui-table-view').css('margin', '0');
                            },
                            size: ''
                        });
                    }
                });
                break;
            case "lookReality":
                var $a = $(obj.tr).find('a[lay-event="lookReality"]');
                var offset = $a.offset();
                var top2 = offset.top;
                var left = offset.left;
                layer.open({
                    type: 1,
                    title: false,
                    area: '1100px',
                    offset: [top2 + 'px', (left - 830 + $a.outerWidth()) + 'px'],
                    shade: .01,
                    shadeClose: true,
                    fixed: false,
                    content: '<table id="lookSSXMTable" lay-filter="lookSSXMTable"></table>',
                    success: function (layero) {
                        table.render({
                            elem: '#lookSSXMTable',
                            headers: {token: localStorage.getItem('token')},
                            url: baseUrl+'/weeklyDailyReality/list/auth',
                            where: {
                                weekly_id: data.id
                            },
                            page: true,
                            cellMinWidth: 100,
                            cols: [[
                                {type: 'numbers'}
                                ,{field: 'weeklyDay$', align: 'center',title: '星期'}
                                ,{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}
                            ]],
                            request: {
                                pageName: 'curr',
@@ -387,15 +471,15 @@
    function showEditModel(expTpe) {
        admin.open({
            type: 1,
            title: (expTpe ? '修改' : '添加') + '报销审批',
            title: (expTpe ? '修改' : '创建') + '周计划',
            content: $('#editDialog').html(),
            area: '2200px',
            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)
@@ -456,18 +540,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;
@@ -477,18 +572,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: ''