From 053c8193389e1535747d6db0bbd828feaab5d0e0 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Fri, 17 Mar 2023 13:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/pages/split/split_add.html | 157 ++++++++++-------- .../pages/application/application-in.html | 1 - .../templates/pages/group/group-add_back.html | 30 +++- 3 files changed, 114 insertions(+), 74 deletions(-) diff --git a/src/main/resources/templates/pages/split/split_add.html b/src/main/resources/templates/pages/split/split_add.html index f3bedc21..abfb0ed6 100644 --- a/src/main/resources/templates/pages/split/split_add.html +++ b/src/main/resources/templates/pages/split/split_add.html @@ -236,6 +236,7 @@ data = data.split(",")[0]; if(data !== ""){ req.mname = data; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); let materialId = $("#mid"); let codeValue = $("#code"); let version = $("#version"); @@ -249,21 +250,27 @@ contentType: "application/json;charset=utf-8", success: function (d) { if (d.count > 1) { - layer.msg("请点击右侧搜索确定物品"); - materialId.val(""); - codeValue.val(""); - version.val(""); - typeName.val(""); - unit.empty(); + layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () { + materialId.val(""); + codeValue.val(""); + version.val(""); + typeName.val(""); + unit.empty(); + layer.close(loading2); + }); + return false; } else if (d.count === 0) { - layer.msg("没有该物品,请确认输入是否正确"); - materialId.val(""); - codeValue.val(""); - materialName.val(""); - version.val(""); - typeName.val(""); - unit.empty(); + layer.msg("没有该物品,请确认输入是否正确",{icon:0,time:500},function () { + materialId.val(""); + codeValue.val(""); + materialName.val(""); + version.val(""); + typeName.val(""); + unit.empty(); + layer.close(loading2); + }); + return false; } else { var material = d.data[0]; @@ -292,6 +299,7 @@ } else { $("#barCode").empty(); } + layer.close(loading2); } } }); @@ -323,6 +331,7 @@ end: function () { var mid = $("#mid").val(); if (mid !== '') { + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/findMatrialById?mid=" + mid, type: "get", @@ -349,7 +358,7 @@ if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { // 如果有对应的条形码 - $("#barCode").empty() + $("#barCode").empty(); $.each(materialAndBarCodeList, function (index, item) { $("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 }); @@ -358,6 +367,7 @@ $("#barCode").empty(); } + layer.close(loading2); } }); } @@ -385,6 +395,8 @@ var req = {}; req.qrCode = result; req.codeFlag = 2; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + $.ajax({ url: "/material/qywxApplicationInScanQrCode", type: "post", @@ -406,6 +418,7 @@ $("#version").val(""); $("#barCode").empty(); $("#unit").empty(); + layer.close(loading2); }) } else { // 如果有对应关系 @@ -441,6 +454,7 @@ unit.append(new Option(unitList[i].newUnit, unitList[i].newUnit)); } form.render(); + layer.close(loading2); } } @@ -470,6 +484,7 @@ let barCode = $("#barCode"); barCode.empty(); barCode.append(new Option(result, result)); + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/qywxApplicationInScanBarCode", type: "post", @@ -494,7 +509,7 @@ }); } form.render(); - + layer.close(loading2); } else { @@ -509,6 +524,7 @@ $("#version").val(""); unit.empty(); $("#barCode").empty(); + layer.close(loading2); }) } @@ -533,64 +549,71 @@ var req = {}; req.code = code; req.type = "in"; - $.ajax({ - url: "/material/findMatrialByCode", - type: "get", - dataType: 'json', - data: req, - contentType: "application/json;charset=utf-8", - success: function (d) { - var d = d.data; - if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); - $("#mname").val(""); - $("#mid").val(""); - $("#code").val(""); - $("#barCode").val(""); - $("#version").val(""); - $("#unit").empty(); - $("#typeName").val(""); - form.render(); - - } else { - $("#mname").val(d.mname); - $("#mid").val(d.mid); - $("#version").val(d.version); - $("#unit").empty(); - $('#unit').append(new Option(d.unit, d.unit)); - var splitInfoList = d["splitInfoList"]; - $.each(splitInfoList, function (index, item) { - $("#unit").append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 - }); - form.render(); - $("#typeName").val(d.typeName); - // 获取物料与条形码的对应关系 - var materialAndBarCodeList = d["materialAndBarCodeList"]; - if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { - // 如果有对应的条形码 - $("#barCode").remove(); - $(".layui-unselect").remove(); - var barCodeSelect = ` - `; - $("#barCodeImg").before(barCodeSelect); + if(code !== ""){ + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); + $.ajax({ + url: "/material/findMatrialByCode", + type: "get", + dataType: 'json', + data: req, + contentType: "application/json;charset=utf-8", + success: function (d) { + var d = d.data; + if (d == null) { + layer.msg("没有该编码,请确认是否输入正确",{icon:0,time:500},function () { + $("#mname").val(""); + $("#mid").val(""); + $("#code").val(""); + $("#barCode").val(""); + $("#version").val(""); + $("#unit").empty(); + $("#typeName").val(""); + form.render(); + layer.close(loading2); + }); - form.render(); - $.each(materialAndBarCodeList, function (index, item) { - $("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 + + } else { + $("#mname").val(d.mname); + $("#mid").val(d.mid); + $("#version").val(d.version); + $("#unit").empty(); + $('#unit').append(new Option(d.unit, d.unit)); + var splitInfoList = d["splitInfoList"]; + $.each(splitInfoList, function (index, item) { + $("#unit").append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 }); form.render(); - } else { - let children = $("#barCode").parent().children(); - if (children.length > 2) { - $("#barCode").empty(); - $(children[1]).empty(); + $("#typeName").val(d.typeName); + // 获取物料与条形码的对应关系 + var materialAndBarCodeList = d["materialAndBarCodeList"]; + if (materialAndBarCodeList !== null && materialAndBarCodeList.length > 0) { + // 如果有对应的条形码 + $("#barCode").remove(); + $(".layui-unselect").remove(); + var barCodeSelect = ` + `; + $("#barCodeImg").before(barCodeSelect); + + form.render(); + $.each(materialAndBarCodeList, function (index, item) { + $("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 + }); + form.render(); + } else { + let children = $("#barCode").parent().children(); + if (children.length > 2) { + $("#barCode").empty(); + $(children[1]).empty(); + } } + layer.close(loading2); } - } - } - }); + }); + + } }; diff --git a/target/classes/templates/pages/application/application-in.html b/target/classes/templates/pages/application/application-in.html index 4d91f477..580ddbb8 100644 --- a/target/classes/templates/pages/application/application-in.html +++ b/target/classes/templates/pages/application/application-in.html @@ -1550,7 +1550,6 @@ childNodes[i].remove() } } - layer.close(loading2) } }; diff --git a/target/classes/templates/pages/group/group-add_back.html b/target/classes/templates/pages/group/group-add_back.html index 109fa3b1..48db81ae 100644 --- a/target/classes/templates/pages/group/group-add_back.html +++ b/target/classes/templates/pages/group/group-add_back.html @@ -413,6 +413,7 @@ var req = {}; req.qrCode = result; req.codeFlag = 1; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/qywxApplicationInScanBarCode", type: "post", @@ -454,12 +455,14 @@ $("#unit" + idNumber).append(new Option(unitList[i].newUnit, unitList[i].newUnit)); } form.render(); + layer.close(loading2); } else { // 如果没有对应关系 layer.msg("对于编码:" + result + ",并未发现对应的物料", { icon: 0, time: 1000 //0.5秒关闭(如果不配置,默认是3秒) }, function () { + layer.close(loading2); }) } @@ -490,6 +493,7 @@ var req = {}; req.qrCode = result; req.codeFlag = 2; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/qywxApplicationInScanQrCode", type: "post", @@ -558,6 +562,7 @@ materialName.value = data.mname; materialId.value = data.mid; materialCode.value = data.code; + layer.close(loading2); } }) } @@ -601,6 +606,7 @@ }, end: function () { var mid = materialId.value; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); if (mid !== '') { $.ajax({ url: "/material/findMatrialById?mid=" + mid, @@ -652,6 +658,7 @@ } } form.render(); + layer.close(loading2); } }); } @@ -678,6 +685,7 @@ req.code = code; req.type = "in"; if (code !== "") { + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/findMatrialByCode", type: "get", @@ -687,11 +695,13 @@ success: function (d) { var d = d.data; if (d == null) { - layer.msg("仓库中暂无该物料"); + layer.msg("仓库中暂无该物料",{icon:0,time:500},function () { + layer.close(loading2); materialName.value = ""; materialId.value = ""; obj.value = ""; $('#place' + objId).empty(); + }); } else { materialName.value = d.mname; @@ -734,6 +744,7 @@ barCode.empty(); } } + layer.close(loading2); } } }); @@ -759,6 +770,7 @@ data = data.split(",")[0]; if (data !== "") { req.mname = data; + let loading2 = layer.open({ type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ url: "/material/findMaterialByCondition", type: "post", @@ -767,15 +779,20 @@ contentType: "application/json;charset=utf-8", success: function (d) { if (d.count > 1) { - layer.msg("请点击右侧搜索确定物品"); + layer.msg("请点击右侧搜索确定物品",{icon:0,time:500},function () { materialId.value = ""; codeValue.value = ""; + layer.close(loading2); + }); return false; } else if (d.count === 0) { - layer.msg("没有该物品,请确认输入是否正确"); - materialId.value = ""; - codeValue.value = ""; - materialName.value = ""; + layer.msg("没有该物品,请确认输入是否正确",{icon:5,time:500},function () { + materialId.value = ""; + codeValue.value = ""; + materialName.value = ""; + layer.close(loading2); + }); + return false; } else { var idNumber = materialId.name.split("mid")[1]; @@ -821,6 +838,7 @@ materialName.value = material.mname; materialId.value = material.id; codeValue.value = material.code; + layer.close(loading2); } } });