#
18516761980
2022-06-14 d16d3b70e94f798d7e5abd145f8566d81d0c66c9
src/main/webapp/static/js/matCode/matCode.js
@@ -1,5 +1,15 @@
var pageCurr;
var printMatCodeNos = [];
function getCol() {
    var cols = [
        {type: 'checkbox'}
    ];
    cols.push.apply(cols, matCols);
    cols.push({field: 'modiUser$', align: 'center',title: '修改人员', hide: true}
        ,{field: 'modiTime$', align: 'center',title: '修改时间', hide: true}
        ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120})
    return cols;
}
layui.use(['table','laydate', 'form','upload'], function(){
    var table = layui.table;
    var $ = layui.jquery;
@@ -19,23 +29,7 @@
        even: true,
        toolbar: '#toolbar',
        cellMinWidth: 50,
        cols: [[
            {type: 'checkbox'}
//            ,{field: 'id', title: 'ID', sort: true,align: 'center', fixed: 'left', width: 80}
            ,{field: 'matNo', align: 'center',title: '物料编码'}
            // ,{field: 'barcode', align: 'center',title: '条码'}
            ,{field: 'matName', align: 'center',title: '物料名称'}
            ,{field: 'str2', align: 'center',title: '物料规格'}
            ,{field: 'str3', align: 'center',title: '颜色'}
            ,{field: 'num1', align: 'center',title: '重量'}
            ,{field: 'str1', align: 'center',title: '物料单位'}
            ,{field: 'str4', align: 'center',title: '客户'}
            ,{field: 'modiUser$', align: 'center',title: '修改人员', hide: true}
            ,{field: 'modiTime$', align: 'center',title: '修改时间', hide: true}
            // ,{field: 'status', align: 'center',title: ''}
            ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width:120}
        ]],
        cols: [getCol()],
        request: {
            pageName: 'curr',
            pageSize: 'limit'
@@ -107,6 +101,21 @@
                        layer.getChildFrame('#data-detail-submit-edit', index).hide();
                       clearFormVal(layer.getChildFrame('#detail', index));
                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                        // 字段注入物料编码
                        $.ajax({
                            url: baseUrl+"/matCode/auto/id/auth",
                            headers: {'token': localStorage.getItem('token')},
                            method: 'GET',
                            success: function (res) {
                                if (res.code === 200){
                                    layer.getChildFrame('#matNo', index).val(res.data);
                                } else if (res.code === 403){
                                    parent.location.href = "/";
                                }else {
                                    layer.msg(res.msg)
                                }
                            }
                        })
                    }
                });
                break;
@@ -125,7 +134,7 @@
                            success: function (res) {
                                if (res.code === 200){
                                    layer.closeAll();
                                    tableReload(false);
                                    $(".layui-laypage-btn")[0].click();
                                } else if (res.code === 403){
                                    top.location.href = baseUrl+"/";
                                } else {
@@ -261,6 +270,26 @@
                    }
                });
                break;
            // 编辑
            case 'edit':
                layer.open({
                    type: 2,
                    title: '修改',
                    maxmin: true,
                    area: [top.detailWidth, top.detailHeight],
                    shadeClose: false,
                    content: 'matCode_detail.html',
                    success: function(layero, index){
                        layer.getChildFrame('#data-detail-submit-save', index).hide();
                        setFormVal(layer.getChildFrame('#detail', index), data, false);
                        // top.convertDisabled(layer.getChildFrame('#data-detail :input', index), false);
                        top.convertDisabled(layer.getChildFrame('#matNo', index), true);
                        layer.iframeAuto(index);layer.style(index, {top: (($(window).height()-layer.getChildFrame('#data-detail', index).height())/3)+"px"});
                        layero.find('iframe')[0].contentWindow.layui.form.render('select');
                        layero.find('iframe')[0].contentWindow.layui.form.render('checkbox');
                    }
                });
                break;
            // 打印
            case "btnPrint":
                printMatCodeNos = [];