diff --git a/erp_web/js/common/common.js b/erp_web/js/common/common.js index fdb3b0bb..e4b40b1d 100644 --- a/erp_web/js/common/common.js +++ b/erp_web/js/common/common.js @@ -132,7 +132,7 @@ currentPage: 1, pageSize: 100 }), - async: false, + async: false, //设置为同步 success: function (res) { if (res && res.code === 200) { if(res.data && res.data.page) { @@ -152,6 +152,26 @@ return info; } + //初始化系统基础信息 + function getSystemDepot(){ + var depotList = null; + $.ajax({ + type:"get", + url: "/depot/getAllList", + async:false, //设置为同步 + dataType: "json", + success: function (res) { + if(res && res.code === 200) { + depotList = res.data; + } else { + $.messager.alert('提示', '查找系统基础信息异常,请与管理员联系!', 'error'); + return; + } + } + }); + return depotList; + } + /** * js生成唯一ID值 32位值随机值 * @returns 生成的字符串 diff --git a/erp_web/js/pages/materials/in_out.js b/erp_web/js/pages/materials/in_out.js index da09073b..f617558c 100644 --- a/erp_web/js/pages/materials/in_out.js +++ b/erp_web/js/pages/materials/in_out.js @@ -171,48 +171,32 @@ } }); } - //初始化系统基础信息 + + //初始化系统仓库信息 function initSystemData_depot(){ - $.ajax({ - type:"get", - url: "/depot/getAllList", - //设置为同步 - async:false, - dataType: "json", - success: function (res) { - if(res && res.code === 200){ - depotList = res.data; - if(depotList !=null) { - for(var i = 0 ;i < depotList.length;i++) { - var depot = depotList[i]; - var config = getSystemConfig(); - if(config && config.depotFlag == "1") { - if(userdepot!=null) { - if(userdepot.indexOf("["+depot.id+"]")!=-1) { - if(depot.isDefault){ - defDepotId = depot.id; - } - depotString = depotString + depot.id + ","; - } - } - } else { - if(depot.isDefault){ - defDepotId = depot.id; - } - depotString = depotString + depot.id + ","; - } - if(depot.type === 1){ - depotString = depotString + depot.id + ","; - } - } - depotString = depotString.substring(0, depotString.length-1); - } - } else { - $.messager.alert('提示', '查找系统基础信息异常,请与管理员联系!', 'error'); - return; - } - } - }); + var config = getSystemConfig(); + var depotList = getSystemDepot(); + if(depotList !=null) { + for(var i = 0 ;i < depotList.length;i++) { + var depot = depotList[i]; + if(config && config.depotFlag == "1") { + if(userdepot!=null) { + if(userdepot.indexOf("["+depot.id+"]")!=-1) { + if(depot.isDefault){ + defDepotId = depot.id; + } + depotString = depotString + depot.id + ","; + } + } + } else { + if(depot.isDefault){ + defDepotId = depot.id; + } + depotString = depotString + ","; + } + } + depotString = depotString.substring(0, depotString.length-1); + } } //初始化供应商、客户、散户信息 function initSupplier(){