自动化立体仓库 - WMS系统
zyx
2024-02-19 6aa7db36cd059a43fced1a3cb8780f1cace2b936
增加 选中条数的合计功能以及筛选列记忆功能
2个文件已修改
67 ■■■■■ 已修改文件
src/main/webapp/static/js/pla/plaDetl.js 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/views/pla/plaDetl.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/webapp/static/js/pla/plaDetl.js
@@ -12,7 +12,7 @@
function getCol() {
    var cols = [
        {field: 'id', title: 'id', align: 'center',hide:true}
        ,{type: 'checkbox'}
        ,{type: 'checkbox',totalRow:true}
        ,{field:'id', width:80, title: '', sort: true, totalRowText: '合计:',hide: true}
        ,{field: 'pakinTime$', title: '入库时间', align: 'center' , sort:true}
        ,{field: 'matnr', align: 'center',title: '存货编码',hide:true,edit:true}
@@ -20,7 +20,7 @@
        ,{field: 'batch', align: 'center',title: '批号',edit:true, width: 150, sort:true}
        ,{field: 'packageNo', align: 'center',title: '包装号',edit:true, sort:true}
        ,{field: 'proDate', align: 'center',title: '生产日期',edit:true, width: 100}
        ,{field: 'weight', align: 'center',title: '重量KG',edit:true}
        ,{field: 'weight', align: 'center',title: '重量KG',edit:true,totalRow:true}
        ,{field: 'packageType', align: 'center',title: '包装类型',edit:true}
        ,{field: 'zpalletType', align: 'center',title: '托盘类型',edit:true}
        ,{field: 'filmWrap', align: 'center',title: '缠膜',edit:true,hide:true}
@@ -124,7 +124,18 @@
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [getCol()],
        cols: [function(){
            var arr = getCol();
            // 初始化筛选状态
            var local = layui.data('table-filter-test'); // 获取对应的本地记录
            layui.each(arr, function(index, item){
                if(item.field in local){
                    item.hide = local[item.field];
                }
            });
            return arr;
        }() ],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
@@ -142,6 +153,17 @@
            statusCode: 200
        },
        done: function(res, curr, count) {
            // 记录筛选状态
            var that = this;
            that.elem.next().on('mousedown', 'input[lay-filter="LAY_TABLE_TOOL_COLS"]+', function(){
                var input = $(this).prev()[0];
                // 此处表名可任意定义
                layui.data('table-filter-test', {
                    key: input.name
                    ,value: input.checked
                })
            });
            //$(".lavui-table-grid-down").hide();
            if (res.code === 403) {
                top.location.href = baseUrl+"/";
@@ -168,6 +190,33 @@
                }
            });
        }
    });
    // 复选框事件
    table.on('checkbox(plaDetl)', function(obj){
        // console.log(obj); // 查看对象所有成员
        // console.log(obj.checked); // 当前是否选中状态
        // console.log(obj.data); // 选中行的相关数据
        // console.log(obj.type); // 若触发的是全选,则为:all;若触发的是单选,则为:one
        var checkStatus = table.checkStatus(obj.config.id)
        var selectedNum = checkStatus.data.length;
        var weightAll = 0;
        var weightAnfmeAll = 0;
        for (var i in checkStatus.data){
            weightAll += checkStatus.data[i].weight;
            weightAnfmeAll += checkStatus.data[i].weightAnfme;
        }
        $('.layui-table-total').find('.laytable-cell-1-0-1').text(selectedNum);
        $('.layui-table-total').find('.laytable-cell-1-0-9').text(weightAll);
        $('.layui-table-total').find('.laytable-cell-1-0-41').text(weightAnfmeAll);
    });
    // 行单击事件( 双击事件为: rowDouble )
    table.on('row(plaDetl)', function(obj){
    });
    table.on('tool(plaDetl)', function (obj) {
@@ -231,8 +280,8 @@
                    });
                }
            });
        }
    })
    // 监听头工具栏事件
@@ -516,6 +565,14 @@
        });
    }
    $(document).on('click','#updateZpallet',function (){
        debugger;
    })
    $("[name='layTableCheckbox']").click(function(){ // 通过name属性选取元素,并添加点击事件
        alert("Hello World!"); // 在控制台输出提示信息
        debugger
    });
    $(document).on('click','#add', function () {
src/main/webapp/views/pla/plaDetl.html
@@ -284,7 +284,7 @@
<script type="text/html" id="tbLook">
    <span class="layui-text">
        <a href="javascript:;" lay-event="look">
            <i class="layui-icon" style="font-size: 12px;">&#xe61a;</i> 查看明细
            <i class="layui-icon" style="font-size: 12px;">&#xe61a;</i> 查看
        </a>
    </span>
</script>