From b03e9738e1cf4544695543bba7abdcd83fd309c2 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Mon, 19 Jun 2023 14:22:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E6=89=AB=E7=A0=81=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=87=BA=E5=BA=93=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../showInventoryForMaterial.html | 191 +++++++++++++++--- 1 file changed, 158 insertions(+), 33 deletions(-) diff --git a/target/classes/templates/pages/showInventory/showInventoryForMaterial.html b/target/classes/templates/pages/showInventory/showInventoryForMaterial.html index de13c5ce..04b91eb4 100644 --- a/target/classes/templates/pages/showInventory/showInventoryForMaterial.html +++ b/target/classes/templates/pages/showInventory/showInventoryForMaterial.html @@ -107,7 +107,21 @@ + @@ -126,16 +140,15 @@ } - layui.use(['form', 'step', 'flow', 'inputTag'], function () { + layui.use(['form', 'step', 'flow', 'miniTab'], function () { var $ = layui.$, - inputTag = layui.inputTag, - dropdown = layui.dropdown, //下拉菜单 + miniTab = layui.miniTab, //下拉菜单 flow = layui.flow; let id = $("#id").val(); let takingPre = 0; let size = 8; - + let chooseIdList = []; $(function () { let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); $.ajax({ @@ -156,6 +169,7 @@ parent.layer.close(index); }) } else { + updateFlowShowForMaterial(); $("#mname").val(material.mname); $("#mcode").val(material.code); $("#version").val(material.version); @@ -165,43 +179,154 @@ } } }); + $.ajax({ + url: "/material/getTemporaryValue", + type: "post", + dataType: 'json', + data: JSON.stringify({"type": "Out","simple":"true"}), + contentType: "application/json;charset=utf-8", + success: function (res) { + chooseIdList = res.data; + } + }); layer.close(loading2); }); + updateFlowShowForMaterial = function() { + flow.load({ + elem: '#LAY_InventoryShow' //流加载容器 + , done: function (page, next) { //执行下一页的回调 + let result; + let lis = []; + $.get('/material/findMaterialByConditionForStockTaking?page=' + page + '&size=' + size + '&mid=' + id, function (res) { + result = res.data; + if (result === null || result === undefined) { + result = []; + } + lis.push("
"); + for (let i = 0; i < result.length; i++) { + let resultElement = result[i]; + let splitInventory = resultElement.splitInventory; + let keys = Object.keys(splitInventory); + let InventoryItem = ""; + for (let j = 0; j < keys.length; j++) { + let key = keys[j]; + let item = '

' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '

'; + InventoryItem += item; + } + lis.push('
  • ' + + '
    ' + + '' + + '

    ' + "所处位置:" + resultElement.dname + "-" + resultElement.kingdeecode + '

    '); + lis.push('
    ' + + InventoryItem + + '
  • '); + } + lis.push('
    '); + takingPre += result.length; + //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 + //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 + next(lis.join(''), takingPre < res.count); + checkedInputCheck(); + }); + } + }); + }; + - flow.load({ - elem: '#LAY_InventoryShow' //流加载容器 - , done: function (page, next) { //执行下一页的回调 - let result; - let lis = []; - $.get('/material/findMaterialByConditionForStockTaking?page=' + page + '&size=' + size + '&mid=' + id, function (res) { - result = res.data; - lis.push("
    "); - for (let i = 0; i < result.length; i++) { - let splitInventory = result[i].splitInventory; - let keys = Object.keys(splitInventory); - let InventoryItem = ""; - for (let j = 0; j < keys.length; j++) { - let key = keys[j]; - let item = '

    ' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '

    '; - InventoryItem += item; + chooseBusiness = function (obj) { + // 获取当前点击结果 + let checked = $(obj).prop("checked"); + // 获取要处理的id + let id = $(obj).attr("id"); + if (checked) { + // 保存出入库id到redis中 + $.ajax({ + url: "/material/temporaryValue", + type: "post", + dataType: 'json', + data: JSON.stringify({"id": id, "type": "Out"}), + contentType: "application/json;charset=utf-8", + }); + $.ajax({ + url: "/material/temporaryValue", + type: "post", + dataType: 'json', + data: JSON.stringify({"id": id, "type": "In"}), + contentType: "application/json;charset=utf-8", + }); + + $("#chooseBusinessType").show(); + } else { + // 删除保存redis中的出入库id + $.ajax({ + url: "/material/delTemporaryValue", + type: 'post', + data: JSON.stringify({"id": id, "type": "Out"}), + dataType: 'json', + contentType: "application/json;charset=utf-8", + success: function (res) { + let data = res.data; + if (data === 0) { + $("#chooseBusinessType").hide(); } - lis.push('
  • ' + "所处位置:" + result[i].dname+"-"+result[i].kingdeecode + '

    '); - lis.push('
    ' - + InventoryItem - + '
  • '); } - lis.push('
    '); - takingPre += result.length; - //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 - //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 - next(lis.join(''), takingPre < res.count); }); + + $.ajax({ + url: "/material/delTemporaryValue", + type: 'post', + data: JSON.stringify({"id": id, "type": "In"}), + dataType: 'json', + contentType: "application/json;charset=utf-8" + }) } - }); - $('body').on('click', '[data-refresh]', function () { - location.reload(); - }) + return false; + }; + + + /** + * 用于跳转导入库页面 + */ + applicationIn = function(){ + miniTab.openNewTabByIframeNew({ + href: "/application_In_temporaryValue", + title: "入库申请" + }); + }; + + /** + * 用于跳转到出库页面 + */ + applicationOut = function () { + miniTab.openNewTabByIframeNew({ + href: "/application_Out_temporaryValue", + title: "出库申请" + }); + }; + + /** + * 用于跳转到直接出库页面 + */ + applicationImmediateOut = function () { + miniTab.openNewTabByIframeNew({ + href: "/application_Immediate_Out_temporaryValue", + title: "出库申请" + }); + }; + + + /** + * 用于选择选择框 + */ + checkedInputCheck = function () { + if(chooseIdList.length > 0){ + for (const checkedId of chooseIdList) { + $("#"+checkedId).attr("checked","checked"); + } + $("#chooseBusinessType").show(); + } + } })