1
pzy
2024-08-11 db08b0f3239df006eadea02d004451ab6a90eb5f
WebTM/views/²Ö´æ¹ÜÀí/ÌõÂ뱨±í/Kf_BarCodeOutInReport.html
@@ -418,68 +418,67 @@
                    async: false,    //async用于控制(false)同步和(true)异步,默认的是true,即请求默认的是异步请求
                    data: { "sWhere": sWhere },
                    success: function (data1) {
                        if (data1.count == 1) {
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                //动态获取列表所有列名
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                                //获取不需要显示的列(H开头的列不显示)
                                var patrn = new RegExp(/^h/i);
                                if (patrn.test(data1.list[key].ColmCols)) {
                                    titleData[key] = data1.list[key].ColmCols;
                                }
                        //无论有无数据先加载col
                        var data = [];
                        var col = [];
                        //给空的数组赋值
                        for (var key in data1.list) {
                            //动态获取列表所有列名
                            data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                            //获取不需要显示的列(H开头的列不显示)
                            var patrn = new RegExp(/^h/i);
                            if (patrn.test(data1.list[key].ColmCols)) {
                                titleData[key] = data1.list[key].ColmCols;
                            }
                        }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                            for (var i = 0; i < data.length; i++) {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                            break;
                                        case 'long':
                                        case 'Int32':
                                        case 'Int64':
                                        case 'double':
                                        case 'Decimal':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, totalRow: true });
                                            break;
                                        default:
                                            if (data[i].name == '数量') {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
                                            } else {
                                                col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                            }
                                    }
                                }
                            }
                            columns = col;
                            //设置赋值列宽
                            var colWidth = getColumnsWidth();
                            if (colWidth == "" || colWidth == []) {
                        //在列表左边添加勾选框
                        col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                        for (var i = 0; i < data.length; i++) {
                            if ($.inArray(data[i].name, titleData) > -1) {
                                col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                            }
                            else {
                                $.each(columns, function (x, m) {
                                    m["width"] = colWidth[x];
                                });
                                switch (data[i].Type) {
                                    //int
                                    case 'DateTime':
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd')}}</div>", width: 200 });
                                        break;
                                    case 'long':
                                    case 'Int32':
                                    case 'Int64':
                                    case 'double':
                                    case 'Decimal':
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 120, totalRow: true });
                                        break;
                                    default:
                                        if (data[i].name == '数量') {
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, totalRow: true });
                                        } else {
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true });
                                        }
                                }
                            }
                            option.cols = [columns];
                        }
                        columns = col;
                        //设置赋值列宽
                        var colWidth = getColumnsWidth();
                        if (colWidth == "" || colWidth == []) {
                        }
                        else {
                            $.each(columns, function (x, m) {
                                m["width"] = colWidth[x];
                            });
                        }
                        option.cols = [columns];
                        if (data1.count == 1) {
                            option.data = data1.data;
                            option.totalRow = true;
                            table.render(option);
                            ins = table.render(option);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                        } else {
                            layer.close(ajaxLoad);