1
duhe
2023-11-03 e6cf55b13c472954c8ff3bc65f89b3e124cdc752
WebTM/views/²É¹º¹ÜÀí/²É¹º¶©µ¥/Cg_POOrderBillEdit.html
@@ -714,22 +714,59 @@
                                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                    if (checkStatus.data.length != 1) {
                                        return layer.msg("请选择一条数据");
                                    }
                                    //if (checkStatus.data.length != 1) {
                                    //    return layer.msg("请选择一条数据");
                                    //}
                                    //更新表格缓存的数据
                                    obj.update({
                                        "HMaterID": checkStatus.data[0].HItemID
                                        , "物料代码": checkStatus.data[0].HNumber
                                        , "物料名称": checkStatus.data[0].HName
                                        , "规格型号": checkStatus.data[0].HModel
                                        , "HUnitID": checkStatus.data[0].HUnitID
                                        , "计量单位": checkStatus.data[0].HUnitName
                                    })
                                    layer.close(index);//关闭弹窗
                                    var rowIndex = $(obj.tr).attr("data-index") * 1;
                                    for (var i = 0; i < checkStatus.data.length; i++) {
                                        if (rowIndex + i >= option.data.length) {
                                            var NewRow = {
                                                "HMaterID": 0, "物料代码": "", "物料名称": "", "规格型号": "", "HUnitID": 0, "计量单位": "", "数量": "", "HRemark": ""
                                                , "HPrice": "0", "HTaxPrice": "0", "HMoney": "0", "HDiscountRate": "0", "HRelTaxPrice": "0", "HTaxRate": "0", "HTaxMoney": "0", "HlineTotal": "0", "HlineTotalBB": "0", "HDate": "2022-12-05"
                                            };
                                            table.cache["mainTable"].push(NewRow);
                                            option.data = table.cache["mainTable"];
                                            table.render(option);
                                        }
                                        var HMaterID = checkStatus.data[i].HItemID;
                                        var resultData = getMaterialByMaterID(HMaterID);
                                        option.data[rowIndex + i].HMaterID = resultData.HMaterID;
                                        option.data[rowIndex + i].物料代码 = resultData.HMaterNumber;
                                        option.data[rowIndex + i].物料名称 = resultData.HMaterName;
                                        option.data[rowIndex + i].规格型号 = resultData.HMaterModel;
                                        option.data[rowIndex + i].HUnitID = resultData.HUnitID;
                                        option.data[rowIndex + i].计量单位 = resultData.HUnitName;
                                        ////更新表格缓存的数据
                                        //obj.update({
                                        //    "HMaterID": checkStatus.data[0].HItemID
                                        //    , "物料代码": checkStatus.data[0].HNumber
                                        //    , "物料名称": checkStatus.data[0].HName
                                        //    , "规格型号": checkStatus.data[0].HModel
                                        //    , "HUnitID": checkStatus.data[0].HUnitID
                                        //    , "计量单位": checkStatus.data[0].HUnitName
                                        //})
                                        //layer.close(index);//关闭弹窗
                                    }
                                    table.render(option);
                                    layer.closeAll();
                                    //layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                                }
                            })
                                , btn2: function (index, layero) {
                                    //按钮【按钮二】的回调
                                    //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                                },
                                end: function () {
                                    }
                                });
                        }
                        //计量单位
                        if (obj.event == "HUnitID") {
@@ -748,7 +785,7 @@
                                    var iframeWindow = window["layui-layer-iframe" + index];//获取弹框页面
                                    var checkStatus = iframeWindow.layui.table.checkStatus("mainTable");//获取选中的数据
                                    if (checkStatus.data.length != 1) {
                                    if (checkStatus.data.length != 0) {
                                        return layer.msg("请选择一条数据");
                                    }
                                    //更新表格缓存的数据
@@ -948,6 +985,31 @@
                })
            }
            //#region æ ¹æ®ç‰©æ–™ID获取物料详细信息
            function getMaterialByMaterID(HMaterID) {
                var resultData = {};
                $.ajax({
                    url: GetWEBURL() + "Cg_POOrderBill/getMaterialByMaterID",
                    async: false,
                    type: "GET",
                    data: {
                        "HMaterID": HMaterID
                    },
                    success: function (result) {
                        if (result.code == 1) {
                            var data = result.data;
                            resultData = data[0];
                        } else {
                            layer.alert(result.msg, { icon: 5, btn: ['退出'], time: 100000, offset: 't' });
                        }
                    }, error: function () {
                        layer.alert("发生错误!", { icon: 5 });
                    }
                });
                return resultData;
            }
            //#endregion
            //#region ä¿å­˜åŽæµè§ˆæ–¹æ³•
            function ReRoadBillMain() {
                location.replace('Add_Edit_Cg_POInStockBillList.html?OperationType=4&linterid=' + linterid + '&HSouceBillType=');