From cf40eb92155ad798751931a47930809c3b24fd58 Mon Sep 17 00:00:00 2001 From: weizhiqiang <598748873@qq.com> Date: Mon, 17 Jun 2024 20:49:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9D=A1=E5=BD=A2=E7=A0=81=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../template/js/materialCode/batchCopy.js | 8 +++++++ .../js/materialCode/materialCodeAdd.js | 24 ++++++++++++++++++- .../js/materialCode/materialCodeReportList.js | 4 ++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/erp/src/main/resources/template/js/materialCode/batchCopy.js b/erp/src/main/resources/template/js/materialCode/batchCopy.js index 46883a022..30102a8cd 100644 --- a/erp/src/main/resources/template/js/materialCode/batchCopy.js +++ b/erp/src/main/resources/template/js/materialCode/batchCopy.js @@ -11,9 +11,17 @@ layui.config({ textool = layui.textool, form = layui.form; var selTemplate = getFileContent('tpl/template/select-option.tpl'); + var materialId = getNotUndefinedVal(GetUrlParam("materialId")); AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryAllMaterialList", params: {}, type: 'json', method: 'GET', callback: function (json) { $("#materialId").html(getDataUseHandlebars(selTemplate, json)); + if (!isNull(materialId)) { + $("#materialId").val(materialId); + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryNormsListByMaterialId", params: {materialId: materialId}, type: 'json', method: 'GET', callback: function (result) { + $("#normsId").html(getDataUseHandlebars(selTemplate, result)); + form.render("select"); + }, async: false}); + } form.render("select"); skyeyeClassEnumUtil.showEnumDataListByClassName("materialNormsCodeInDepot", 'radio', "inDepot", '', form); diff --git a/erp/src/main/resources/template/js/materialCode/materialCodeAdd.js b/erp/src/main/resources/template/js/materialCode/materialCodeAdd.js index 3389d0217..68018c6aa 100644 --- a/erp/src/main/resources/template/js/materialCode/materialCodeAdd.js +++ b/erp/src/main/resources/template/js/materialCode/materialCodeAdd.js @@ -12,6 +12,10 @@ layui.config({ var index = parent.layer.getFrameIndex(window.name); var $ = layui.$, form = layui.form; + var selOptionHtml = getFileContent('tpl/template/select-option.tpl'); + + let materialId = getNotUndefinedVal(GetUrlParam("materialId")); + let materialMap = {}; initTableChooseUtil.initTable({ id: "materialNormsList", @@ -24,12 +28,30 @@ layui.config({ delete allChooseProduct[trcusid]; }, addRowCallback: function (trcusid) { + if (!isNull(materialId)) { + $("#materialId").val(materialId); + if (isNull(materialMap[materialId])) { + AjaxPostUtil.request({url: sysMainMation.erpBasePath + "queryMaterialListById", params: {"id": materialId}, type: 'json', method: 'GET', callback: function (json) { + materialMap[materialId] = json.bean + }, async: false}); + } + let chooseProductMation = materialMap[materialId] + // 获取表格行号 + var thisRowKey = trcusid.replace("tr", ""); + // 产品名称赋值 + $("#materialId" + thisRowKey).val(chooseProductMation.name); + $("#materialId" + thisRowKey).attr(initTableChooseUtil.chooseInputDataIdKey, chooseProductMation.id); + // 规格赋值 + $("#normsId" + thisRowKey).html(getDataUseHandlebars(selOptionHtml, {rows: chooseProductMation.materialNorms})); + form.render('select'); + // 商品赋值 + allChooseProduct[trcusid] = chooseProductMation; + } }, form: form, minData: 1 }); - var selOptionHtml = getFileContent('tpl/template/select-option.tpl'); $("body").on("click", ".chooseProductBtn", function (e) { var trId = $(this).parent().parent().attr("trcusid"); erpOrderUtil.openMaterialChooseChoosePage(function (chooseProductMation) { diff --git a/erp/src/main/resources/template/js/materialCode/materialCodeReportList.js b/erp/src/main/resources/template/js/materialCode/materialCodeReportList.js index 6745d18f2..3b60369e4 100644 --- a/erp/src/main/resources/template/js/materialCode/materialCodeReportList.js +++ b/erp/src/main/resources/template/js/materialCode/materialCodeReportList.js @@ -86,7 +86,7 @@ layui.config({ // 新增 $("body").on("click", "#addBean", function() { _openNewWindows({ - url: "../../tpl/materialCode/materialCodeAdd.html", + url: "../../tpl/materialCode/materialCodeAdd.html?materialId=" + materialId, title: systemLanguage["com.skyeye.addPageTitle"][languageType], pageId: "materialCodeAdd", area: ['90vw', '90vh'], @@ -99,7 +99,7 @@ layui.config({ // 批量复制 $("body").on("click", "#batchCopy", function() { _openNewWindows({ - url: "../../tpl/materialCode/batchCopy.html", + url: "../../tpl/materialCode/batchCopy.html?materialId=" + materialId, title: '批量复制', pageId: "materialCodeBatchCopy", area: ['90vw', '90vh'], -- GitLab