yusijie
2023-04-16 22ae2a27d1f66c6acbb126fdbd3d1446b6837acb
WebTM/views/ÁìÁÏ·¢»õ/ÆäËû³ö¿â/Kf_OtherOutBill_FastList.html
@@ -121,7 +121,8 @@
        , table = layui.table
        , form = layui.form
        , element = layui.element;
        var sBillType = '1206'
        var sBillType = '1206';
        var option = [];
        //清空界面  new
        //动态加载源单类型列表 new
@@ -338,25 +339,93 @@
            })
        });
        table.render({
            elem: '#dj-table'
            , url: GetWEBURL() + '/Web/chanpinruk'
            , toolbar: '#toolbarDemo'
            , where: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
            , cols: [[
                { type: 'radio' }
                , { field: 'HInterID', title: '单据内码', width: 120 }
                , { field: 'HBillNo', title: '单据号', width: 150 }
                , { field: 'HMaker', title: '制单人', width: 120 }
                , { field: 'HMakeDate', title: '制单日期', width: 150 }
                , { field: 'HQty', title: '数量', width: 100 }
                , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                , { field: 'HRedBlueFlag', title: '红蓝字', width: 120 }
                , { field: 'HSourceBillType', title: '源单类型', width: 100 }
            ]]
            , height: 500
            , done: function () {
                layer.closeAll("loading");
        //table.render({
        //    elem: '#dj-table'
        //    , url: GetWEBURL() + '/Web/chanpinruk'
        //    , toolbar: '#toolbarDemo'
        //    , where: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
        //    , cols: [[
        //        { type: 'radio' }
        //        , { field: 'HInterID', title: '单据内码', width: 120 }
        //        , { field: 'HBillNo', title: '单据号', width: 150 }
        //        , { field: 'HMaker', title: '制单人', width: 120 }
        //        , { field: 'HMakeDate', title: '制单日期', width: 150 }
        //        , { field: 'HQty', title: '数量', width: 100 }
        //        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
        //        , { field: 'HRedBlueFlag', title: '红蓝字', width: 120 }
        //        , { field: 'HSourceBillType', title: '源单类型', width: 100 }
        //    ]]
        //    , height: 500
        //    , done: function () {
        //        layer.closeAll("loading");
        //    }
        //})
        //动态列
        $.ajax({
            url: GetWEBURL() + "/Web/chanpinruk1",
            type: "GET",
            async: false,
            data: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] },
            //async: false,
            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 });
                    }
                    //在列表左边添加勾选框
                    col.push({ type: 'radio', fixed: 'left' });
                    for (var i = 0; i < data.length; i++) {
                        if ($.inArray(data[i].name, "") > -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 HH:mm:ss')}}</div>", width: 200 });
                                    break;
                                default:
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                            }
                        }
                    }
                    option = {
                        elem: '#dj-table'
                        , toolbar: '#toolbarDemo'
                        , height: 500
                        , page: true //开启分页
                        , limit: 50
                        , limits: [50, 500, 5000, 20000]
                        , cols: [col]
                        , data: data1.data
                    };
                    table.render(option);
                } else {
                    option = {
                        elem: '#dj-table'
                        , toolbar: '#toolbarDemo'
                        , height: 500
                        , page: true //开启分页
                        , limit: 50
                        , limits: [50, 500, 5000, 20000]
                        , cols: [[
                            { type: 'radio' }
                            , { field: 'HMakeDate', title: '制单日期', width: 150 }
                            , { field: 'HBillNo', title: '单据号', width: 150 }
                            , { field: 'HMaterName', title: '物料名称', width: 150 }
                            , { field: 'HQty', title: '数量', width: 100 }
                        ]]
                        , data:[]
                    };
                    table.render(option);
                }
            }
        })