中扬CRM客户关系管理系统
Junjie
2023-08-31 cff0c053baeb229a6c7a7794c061c179111e0b7f
src/main/webapp/static/js/reimburseOnline/reimburseOnline.js
@@ -298,7 +298,7 @@
                });
                break;
            case "edit":
                showEditForm(data);
                showEditModel(data);
                break;
            case "look":
                var $a = $(obj.tr).find('a[lay-event="look"]');
@@ -452,7 +452,7 @@
                    cellMinWidth: 100,
                    cols: [[
                        {type: 'numbers', title: '#'},
                        {field: 'occupation', title: '事由', width: 100},
                        {field: 'occupation', title: '事由', width: 100, style: 'color: blue;font-weight: bold', templet: '#occupation'},
                        // {field: 'expenseType', title: '费用类型', width: 100},
                        {field: 'expenseType$', title: '费用类型', width: 100},
                        {field: 'taxRate', title: '税率', width: 60},
@@ -474,9 +474,31 @@
                        // {field: 'updateUserId', title: '更新人员ID', width: 160},
                        {field: 'updateUserName', title: '更新人员名字'},
                        // {field: 'creationTime', title: '创建日期', width: 160}
                        {align: 'center', title: '操作', toolbar: '#formSSXMTableBar', minWidth: 80, width: 80, fixed: 'right'}
                    ]],
                    done: function (res) {
                    done: function (res, curr, count) {
                        $(layero).find('.layui-table-view').css('margin', '0');
                        var options = this;
                        // 获取当前行数据
                        table.getRowData = function(elem){
                            var index = $(elem).closest('tr').data('index');
                            return table.cache[options.id][index] || {};
                        };
                        $('.input-occupation').on('text', function(){
                            var value = this.value; // 获取选中项 value
                            var data = table.getRowData(this);
                            console.log(value);
                            console.log("value------===");
                            xxDataList.forEach(res => {
                                if (data.id === res.id){
                                    console.log(res)
                                    res.occupation = value;
                                }
                            })
                        });
                    },
                    size: ''
                };
@@ -559,6 +581,7 @@
                            // 表单提交事件
                            form.on('submit(matEditSubmit)', function (data) {
                                let selectList = matXmSelect.getValue();
                                console.log(selectList)
                                for (let i = 0; i<selectList.length; i++) {
                                    let item = selectList[i];
                                    // 查询物料详情
@@ -570,13 +593,16 @@
                                        success: function (res) {
                                            if (res.code === 200){
                                                var bige=true;
                                                for (var j = 0; j < xxDataList.length; j++) {
                                                    if (xxDataList[j].matnr === res.data.matnr && xxDataList[j].batch === res.data.batch) {
                                                        bige=false;
                                                        break;
                                                    }
                                                }
                                                // console.log("-------2.1-------")
                                                // for (var j = 0; j < xxDataList.length; j++) {
                                                //     if (xxDataList[j].expenseType === res.data.expenseType && xxDataList[j].batch === res.data.batch) {
                                                //         bige=false;
                                                //         console.log("-------2.2-------")
                                                //         break;
                                                //     }
                                                // }
                                                if (bige){
                                                    // console.log("-------2.3-------")
                                                    xxDataList.push(res.data);
                                                    insTbSSXM.reload({data: xxDataList, page: {curr: 1}});
                                                }
@@ -690,44 +716,44 @@
    //     });
    // }
    // 更新form
    function showEditForm(mData) {
        admin.open({
            type: 1,
            area: '800px',
            title: '核价信息编辑',
            content: $('#editStatus').html(),
            success: function (layero, dIndex) {
                form.val('editStatusDetail', mData);
                form.render('select')
                form.on('submit(editSubmit)', function (data) {
                    var loadIndex = layer.load(2);
                    $.ajax({
                        url: baseUrl+"/reimburseOnline/updateForm/auth",
                        headers: {'token': localStorage.getItem('token')},
                        data: data.field,
                        method: 'POST',
                        traditional:true,
                        success: function (res) {
                            if (res.code === 200){
                                layer.closeAll();
                                tableReload(false);
                            } else if (res.code === 403){
                                top.location.href = baseUrl+"/";
                            } else {
                                layer.msg(res.msg)
                            }
                        }
                    })
                    layer.close(loadIndex);
                    layer.close(dIndex);
                    return false;
                });
                $(layero).children('.layui-layer-content').css('overflow', 'visible');
                layui.form.render('select');
            }
        });
    }
    // // 更新form
    // function showEditForm(mData) {
    //     admin.open({
    //         type: 1,
    //         area: '800px',
    //         title: '核价信息编辑',
    //         content: $('#editStatus').html(),
    //         success: function (layero, dIndex) {
    //             form.val('editStatusDetail', mData);
    //             form.render('select')
    //             form.on('submit(editSubmit)', function (data) {
    //                 var loadIndex = layer.load(2);
    //                 $.ajax({
    //                     url: baseUrl+"/reimburseOnline/updateForm/auth",
    //                     headers: {'token': localStorage.getItem('token')},
    //                     data: data.field,
    //                     method: 'POST',
    //                     traditional:true,
    //                     success: function (res) {
    //                         if (res.code === 200){
    //                             layer.closeAll();
    //                             tableReload(false);
    //                         } else if (res.code === 403){
    //                             top.location.href = baseUrl+"/";
    //                         } else {
    //                             layer.msg(res.msg)
    //                         }
    //                     }
    //                 })
    //                 layer.close(loadIndex);
    //                 layer.close(dIndex);
    //                 return false;
    //             });
    //             $(layero).children('.layui-layer-content').css('overflow', 'visible');
    //             layui.form.render('select');
    //         }
    //     });
    // }
});