zrg
2024-07-23 e40eee31a528e0a8d0003d169d14faabb40d3c26
WebTM/views/ÑéÊÕÈë¿â/ÆäËûÈë¿â/Kf_OtherInBill_FastList.html
@@ -125,6 +125,7 @@
        var sBillType = '1203';
        var col = [];
        var option = {}
        //动态加载源单类型列表 new
        //加载源单类型
@@ -132,6 +133,49 @@
        //初始化界面
        function set_ClearBill() {
            get_Display();
            //#region ç‚¹å‡»è¡Œé€‰ä¸­é«˜äº®
            table.on('row(mainTable)', function (obj) {
                //选中行改变颜色
                var flag = !obj.tr.find(':checkbox:first').prop('checked');
                obj.tr.find(':checkbox').prop('checked', flag);
                if (flag) {
                    obj.tr.find('.layui-form-checkbox').addClass('layui-form-checked');  //设置复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:#ceedfa;color:black" });//改变当前tr背景颜色和字体颜色
                } else {
                    obj.tr.find('.layui-form-checkbox').removeClass('layui-form-checked');//取消复选框选中样式
                    $(obj.tr.selector).attr({ "style": "background:" });//取消当前tr颜色
                }
                //mainTable ä¸ºè¡¨æ ¼ID   æ³¨æ„æ­¤å¤„如果ID不正确将导致你在监听复选框时获取不到你选择的数据,前面的只是添加或删除选中未选中样式以及设置背景色,字体颜色
                layui.each(table.cache.mainTable, function (i, l) {
                    if (obj.tr.index() == l.LAY_TABLE_INDEX) {
                        l.LAY_CHECKED = flag;
                    }
                });
            })
            //#endregion
            table.render({
                elem: '#dj-table'
                , url: GetWEBURL() + '/Web/chanpinruk'
                , toolbar: '#toolbarDemo'
                , where: { HBillType: sBillType, sHMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
                , cols: [[
                    { type: 'radio' }
                    , { field: '单据内码', title: '单据内码', width: 80 }
                    , { field: '单据号', title: '单据号', width: 80 }
                    , { field: '制单人', title: '制单人', width: 100 }
                    , { field: '制单日期', title: '制单日期', width: 100 }
                    , { field: '数量', title: '数量', width: 100, totalRow: true}
                    , { field: '源单单号', title: '源单单号', width: 100 }
                    , { field: '红蓝字', title: '红蓝字', width: 100 }
                    , { field: '源单类型', title: '源单类型', width: 100 }
                ]]
                , height: 500
                , done: function () {
                    layer.closeAll("loading");
                }
            })
            table.render(option);
            //已上传列表
            table.render({
                elem: '#yd-table'
@@ -150,7 +194,7 @@
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HQty', title: '数量', width: 100, totalRow: true}
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HOrgID', title: '组织', width: 120 }
                ]]
@@ -172,7 +216,7 @@
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100 }
                    , { field: 'HQty', title: '数量', width: 100, totalRow: true }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HOrgID', title: '组织', width: 120 }
                ]]
@@ -181,8 +225,10 @@
        }
        //退出
        form.on('submit(Cancel)', function () {
            parent.location.href = "../../../views/index.html"
        form.on('submit(cmdCancel)', function () {
            layer.confirm('您确定要退出吗?', { icon: 3, title: '提示' }, function (index) {
                parent.location.href = "../../../views/index_Mobile.html"
            });
            //window.close();//关闭当前页
        })
        //编辑
@@ -208,41 +254,26 @@
        //刷新
        form.on('submit(cmdRefresh)', function () {
            get_Display();
            table.render({
                    elem: '#yd-table'
                    , url: GetWEBURL() + '/Web/DisBillUpdateLoad_Json'
                    , toolbar: '#toolbarDemo'
                    , where: { HBillType: sBillType, HMaker: sessionStorage["HUserName"], HOrgID: sessionStorage["OrganizationID"] }
                    , page: true  // å¼€å¯åˆ†é¡µ
                    , limits: [20, 40, 80, 100]
                    , limit: 20
                    , cols: [[
                        { type: 'radio' }
                        , { field: 'HInterID', title: '单据内码', width: 120 }
                        , { field: 'HBillNo', title: '单据号', width: 150 }
                        , { field: 'HMaker', title: '制单人', width: 120 }
                        , { field: 'HMakeDate', title: '制单日期', width: 150 }
                        , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                        , { field: 'HMaterName', title: '物料名称', width: 150 }
                        , { field: 'HMaterModel', title: '规格型号', width: 150 }
                        , { field: 'HQty', title: '数量', width: 100 }
                        , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                        , { field: 'HOrgID', title: '组织', width: 120 }
                    ]]
                    , height: 500
                    , done: function () {
                        layer.closeAll("loading");
                    }
                })
            location.reload();
        });
        
        //撤销功能
        form.on('submit(cmdRescind)', function () {
            var checkStatus = table.checkStatus('yd-table')
                , data = checkStatus.data;
            var sInterID = data[0].HInterID
            var sBillNo = data[0].HBillNo
            var checkStatus = table.checkStatus('yd-table');
            var checkStatus2 = table.checkStatus('sy-table');
            var checkStatus3 = table.checkStatus('dj-table');
            var data = "";
            if (checkStatus.data.length != 0) {
                data = checkStatus.data;
            } else if (checkStatus2.data.length != 0) {
                data = checkStatus2.data;
            } else if (checkStatus3.data.length != 0) {
                data = checkStatus3.data;
            }else {
                return layer.msg("请选择一条数据");
            }
            var sInterID = data[0].HInterID == 'undefined' ? data[0].单据内码 : data[0].HInterID;
            var sBillNo = data[0].HBillNo == 'undefined' ? data[0].单据号 : data[0].HBillNo;
            var sBillType = '1203'
            $.ajax(
                {
@@ -269,7 +300,7 @@
                    error: function (err) {
                        layer.msg('错误' + err, {
                            icon: 5,
                            time: 20000
                            time: 2000
                        }, function () {
                            //do something
                        });
@@ -284,7 +315,7 @@
            var checkStatus = table.checkStatus('dj-table')
                , data = checkStatus.data;
            if (checkStatus.data.length === 1) {
                var sInterID = data[0].HInterID
                var sInterID = data[0].HInterID == 'undefined' ? data[0].单据内码 : data[0].HInterID;
            //逻辑删除方法
                layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                    $.ajax(
@@ -318,31 +349,63 @@
            }
        });
        //查询
        //form.on('submit(cmdQuery)', function () {
        //    var HBillNo = $("#HBillNo").val();
        //    var HSourceBillNo = $("#HSourceBillNo").val();
        //    //进入页面显示的缓存列表
        //    $.ajax({
        //        url: GetWEBURL() + '/Gy_Mould/list1',
        //        type: "GET",
        //        data: { "BillType": sBillType, "HBillNo": HBillNo, "HSourceBillNo": HSourceBillNo},
        //        success: function (data1) {
        //            if (data1.count == 1) {
        //                option.data = data1.data;
        //                table.render(option);
        //                layer.close(index);
        //            } else {
        //                layer.close(index);
        //                layer.alert(data1.code + data1.Message, { icon: 5 });
        //            }
        //        }, error: function () {
        //            layer.close(index);
        //            layer.alert("接口请求失败!", { icon: 5 });
        //        }
        //    });
        //});
        form.on('submit(cmdQuery)', function () {
            var HBillNo = $("#HBillNo").val();
            var HSourceBillNo = $("#HSourceBillNo").val();
            //进入页面显示的缓存列表
            $.ajax({
                url: GetWEBURL() + '/Gy_Mould/list1',
                type: "GET",
                data: { "BillType": sBillType, "HBillNo": HBillNo, "HSourceBillNo": HSourceBillNo},
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        layer.close(index);
                    } else {
                        layer.close(index);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.close(index);
                    layer.alert("接口请求失败!", { icon: 5 });
            var HSourceBillNo = $("#HSourceBillNo").val();;
            table.render({
                elem: '#sy-table'
                , url: GetWEBURL() + '/ProductInBillList/list1'
                , toolbar: '#toolbarDemo'
                , defaultToolbar: []
                , where: { "BillType": sBillType, "HBillNo": HBillNo, "HSourceBillNo": HSourceBillNo }
                , cols: [[
                    { type: 'radio' }
                    , { field: 'HInterID', title: '单据内码', width: 120 }
                    , { field: 'HBillNo', title: '单据号', width: 150 }
                    , { field: 'HMaker', title: '制单人', width: 120 }
                    , { field: 'HMakeDate', title: '制单日期', width: 150 }
                    , { field: 'HMaterNumber', title: '物料代码', width: 150 }
                    , { field: 'HMaterName', title: '物料名称', width: 150 }
                    , { field: 'HMaterModel', title: '规格型号', width: 150 }
                    , { field: 'HQty', title: '数量', width: 100, totalRow: true }
                    , { field: 'HSourceBillNo', title: '源单单号', width: 150 }
                    , { field: 'HOrgID', title: '组织', width: 120 }
                ]]
                , height: 500
                , done: function () {
                    layer.closeAll("loading");
                }
            });
        });
            })
          });
        //加载缓存列表数据
        function get_Display() {
            var ajaxLoad = layer.load();
@@ -358,6 +421,7 @@
                            data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                        }
                        col.push({ type: 'radio' });
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].name == '单据内码' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
@@ -368,23 +432,33 @@
                                    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:
                                        col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: true, width: 200 });
                                }
                            }
                        }
                        //动态显示列名
                        table.render({
                        option = {
                            elem: '#dj-table'
                            , cols: [col]
                            , data: data1.data
                            , height: 550
                            , page: true
                            , totalRow: true
                            , cellMinWidth: 90
                            , limit: 50
                            , limits: [50, 500, 5000, 20000]
                        });
                        };
                        //动态显示列名
                        table.render(option);
                        layer.close(ajaxLoad);
                        //layer.alert("查询成功", { icon: 1 });
@@ -398,7 +472,7 @@
                }
            });
        }
        //刷新明细页签
        table.render({
            elem: '#mx-table'