diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java b/src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java index ae7070bb..0b06195a 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java @@ -53,7 +53,8 @@ public class StockTakingController { // 用于添加盘点记录 @PostMapping("/addStockTakingRecord") - public RestResponse addStockTakingRecord(@RequestBody Map map, HttpServletRequest request){ + public RestResponse addStockTakingRecord(@RequestBody Map map, HttpServletRequest request) + { UserByPort userToken = (UserByPort) request.getAttribute("userToken"); diff --git a/src/main/resources/static/css/inputTag.css b/src/main/resources/static/css/inputTag.css new file mode 100644 index 00000000..6341beb9 --- /dev/null +++ b/src/main/resources/static/css/inputTag.css @@ -0,0 +1,86 @@ +@keyframes fariy-fadein { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +.fairy-tag-container { + width: 100%; + height: 38px; + border: 1px solid #e6e6e6; + background-color: #ffffff; +} +.fairy-tag-container:hover { + border-color: #d2d2d2; +} +.fairy-tag-container span.fairy-tag { + float: left; + font-size: 13px; + padding: 5px 8px; + margin-right: 5px; + margin-bottom: 5px; + border-radius: 2px; + line-height: 16px; +} +.fairy-tag-container span.fairy-tag a { + font-size: 11px; + font-weight: bolder; + color: #ffffff; + text-decoration: none; + margin-left: 6px; +} +.fairy-tag-container span.fairy-tag a:hover { + cursor: pointer; +} +.fairy-tag-container span.fairy-bg-red { + background-color: #FF5722; +} +.fairy-tag-container span.fairy-bg-orange { + background-color: #FFB800; +} +.fairy-tag-container span.fairy-bg-green { + background-color: #009688; +} +.fairy-tag-container span.fairy-bg-cyan { + background-color: #2F4056; +} +.fairy-tag-container span.fairy-bg-blue { + background-color: #1E9FFF; +} +.fairy-tag-container span.fairy-bg-black { + background-color: #393D49; +} +.fairy-tag-container span.fairy-bg-red, +.fairy-tag-container span.fairy-bg-orange, +.fairy-tag-container span.fairy-bg-green, +.fairy-tag-container span.fairy-bg-cyan, +.fairy-tag-container span.fairy-bg-blue, +.fairy-tag-container span.fairy-bg-black { + color: #ffffff; +} +.fairy-tag-container .fairy-anim-fadein { + animation: fariy-fadein 0.3s both; +} +.fairy-tag-container .fairy-tag-input[type='text'] { + width: 80px; + font-size: 13px; + padding: 6px; + background: transparent; + border: 0 none; + outline: 0; +} +.fairy-tag-container .fairy-tag-input[type='text']:focus::-webkit-input-placeholder { + color: transparent; +} +.fairy-tag-container .fairy-tag-input[type='text']:focus:-moz-placeholder { + color: transparent; +} +.fairy-tag-container .fairy-tag-input[type='text']:focus:-moz-placeholder { + color: transparent; +} +.fairy-tag-container .fairy-tag-input[type='text']:focus:-ms-input-placeholder { + color: transparent; +} +/*# sourceMappingURL=inputTag.css.map */ \ No newline at end of file diff --git a/src/main/resources/static/css/inputTag.less b/src/main/resources/static/css/inputTag.less new file mode 100644 index 00000000..895e91f8 --- /dev/null +++ b/src/main/resources/static/css/inputTag.less @@ -0,0 +1,104 @@ +@keyframes fariy-fadein { + 0% { + opacity: 0 + } + + 100% { + opacity: 1 + } +} + +.fairy-tag-container { + width: auto; + min-height: 100px; + padding: 5px; + border: 1px solid #e6e6e6; + background-color: #ffffff; + + &:hover { + border-color: #d2d2d2; + } + + span { + &.fairy-tag { + float: left; + font-size: 13px; + padding: 5px 8px; + margin-right: 5px; + margin-bottom: 5px; + border-radius: 2px; + line-height: 16px; + + a { + font-size: 11px; + font-weight: bolder; + color: #ffffff; + text-decoration: none; + margin-left: 6px; + + &:hover { + cursor: pointer; + } + } + } + + &.fairy-bg-red { + background-color: #FF5722; + } + + &.fairy-bg-orange { + background-color: #FFB800; + } + + &.fairy-bg-green { + background-color: #009688; + } + + &.fairy-bg-cyan { + background-color: #2F4056; + } + + &.fairy-bg-blue { + background-color: #1E9FFF; + } + + &.fairy-bg-black { + background-color: #393D49; + } + + &.fairy-bg-red, &.fairy-bg-orange, &.fairy-bg-green, &.fairy-bg-cyan, &.fairy-bg-blue, &.fairy-bg-black { + color: #ffffff; + } + } + + .fairy-anim-fadein { + animation: fariy-fadein .3s both; + } + + .fairy-tag-input[type='text'] { + width: 80px; + font-size: 13px; + padding: 6px; + background: transparent; + border: 0 none; + outline: 0; + + &:focus { + &::-webkit-input-placeholder { + color: transparent; + } + + &:-moz-placeholder { + color: transparent; + } + + &:-moz-placeholder { + color: transparent; + } + + &:-ms-input-placeholder { + color: transparent; + } + } + } +} diff --git a/src/main/resources/static/js/lay-module/inputTag.js b/src/main/resources/static/js/lay-module/inputTag.js new file mode 100644 index 00000000..d6802997 --- /dev/null +++ b/src/main/resources/static/js/lay-module/inputTag.js @@ -0,0 +1,152 @@ +/* + * Name: inputTag + * Author: cshaptx4869 + * Project: https://github.com/cshaptx4869/inputTag + */ +(function (define) { + define(['jquery'], function ($) { + "use strict"; + + class InputTag { + + options = { + elem: '.fairy-tag-input', + theme: ['fairy-bg-red', 'fairy-bg-orange', 'fairy-bg-green', 'fairy-bg-cyan', 'fairy-bg-blue', 'fairy-bg-black'], + data: [], + removeKeyNum: 8, + createKeyNum: 13, + permanentData: [], + }; + + get elem() { + return $(this.options.elem); + } + + get copyData() { + return [...this.options.data]; + } + + constructor(options) { + this.render(options); + } + + render(options) { + this.init(options); + this.listen(); + } + + init(options) { + var spans = '', that = this; + this.options = $.extend(this.options, options); + !this.elem.attr('placeholder') && this.elem.attr('placeholder', '添加标签'); + $.each(this.options.data, function (index, item) { + spans += that.spanHtml(item); + }); + this.elem.before(spans); + } + + listen() { + var that = this; + + this.elem.parent().on('click', 'a', function () { + that.removeItem($(this).parent('span')); + }); + + this.elem.parent().on('click', function () { + that.elem.focus(); + }); + + this.elem.keydown(function (event) { + var keyNum = (event.keyCode ? event.keyCode : event.which); + if (keyNum === that.options.removeKeyNum) { + if (!that.elem.val().trim()) { + var closeItems = that.elem.parent().find('a'); + if (closeItems.length) { + that.removeItem($(closeItems[closeItems.length - 1]).parent('span')); + event.preventDefault(); + } + } + } + }); + + this.elem.focusout(function(event){ + that.createItem(); + event.preventDefault(); + }) + } + + createItem() { + var value = this.elem.val().trim(); + + if (this.options.beforeCreate && typeof this.options.beforeCreate === 'function') { + var modifiedValue = this.options.beforeCreate(this.copyData, value); + if (typeof modifiedValue == 'string' && modifiedValue) { + value = modifiedValue; + } else { + value = ''; + } + } + + if (value) { + if (!this.options.data.includes(value)) { + this.options.data.push(value); + this.elem.before(this.spanHtml(value)); + this.onChange(value, 'create'); + } + } + + this.elem.val(''); + } + + removeItem(target) { + var that = this; + var closeSpan = target.remove(), + closeSpanText = $(closeSpan).children('span').text(); + var closeSpanTextIndex = $.inArray(closeSpanText, that.options.data); + var value = that.options.data.splice($.inArray(closeSpanText, that.options.data), 1); + value.length === 1 && that.onChange(value[0], 'remove',closeSpanTextIndex); + } + + randomColor() { + return this.options.theme[Math.floor(Math.random() * this.options.theme.length)]; + } + + spanHtml(value) { + return '' + + '' + value + '' + + (this.options.permanentData.includes(value) ? '' : '×') + + ''; + } + + onChange(value, type,index) { + this.options.onChange && typeof this.options.onChange === 'function' && this.options.onChange(this.copyData, value, type,index); + } + + getData() { + return this.copyData; + } + + clearData() { + this.options.data = []; + this.elem.prevAll('span.fairy-tag').remove(); + } + } + + return { + render(options) { + return new InputTag(options); + } + } + }); +}(typeof define === 'function' && define.amd ? define : function (deps, factory) { + var MOD_NAME = 'inputTag'; + if (typeof module !== 'undefined' && module.exports) { //Node + module.exports = factory(require('jquery')); + } else if (window.layui && layui.define) { + layui.define('jquery', function (exports) { //layui加载 + exports(MOD_NAME, factory(layui.jquery)); + }); + } else { + window[MOD_NAME] = factory(window.jQuery); + } +})); diff --git a/src/main/resources/templates/pages/post/selectManager.html b/src/main/resources/templates/pages/post/selectManager.html index f9b11ad5..1d88f53f 100644 --- a/src/main/resources/templates/pages/post/selectManager.html +++ b/src/main/resources/templates/pages/post/selectManager.html @@ -27,16 +27,17 @@ return false; } var name = $("#departmentManager", window.parent.document).val(); + var id = $("#departmentManagerId", window.parent.document).val(); - if (name === undefined || name === null || name === "") { + // if (name === undefined || name === null || name === "") { $("#departmentManager", window.parent.document).val(data.title); - } else { - $("#departmentManager", window.parent.document).val(name + data.title); - } + // } else { + // $("#departmentManager", window.parent.document).val(name + data.title); + // } if (id === undefined || id === null || id === "") { $("#departmentManagerId", window.parent.document).val(data.id); } else { - $("#departmentManagerId", window.parent.document).val(id + data.id); + $("#departmentManagerId", window.parent.document).val(id + data.id + ","); } var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); diff --git a/src/main/resources/templates/pages/stockTaking/stockTaking.html b/src/main/resources/templates/pages/stockTaking/stockTaking.html index b870e749..48d50bae 100644 --- a/src/main/resources/templates/pages/stockTaking/stockTaking.html +++ b/src/main/resources/templates/pages/stockTaking/stockTaking.html @@ -9,6 +9,7 @@ + @@ -75,13 +79,20 @@
- - +
+
+ + + +
+
@@ -98,7 +109,8 @@
-
- - + + @@ -318,10 +330,11 @@ let barCodeList = {}; let needToUpdate = {}; - layui.use(['form', 'step', 'flow','laydate'], function () { + layui.use(['form', 'step', 'flow', 'laydate', 'inputTag'], function () { var $ = layui.$, form = layui.form, laydate = layui.laydate, + inputTag = layui.inputTag, step = layui.step; departmentManagerId = $("#departmentManagerId").val(); @@ -338,6 +351,30 @@ }] }); + let tagData = []; + let tempData = $("#departmentManager").val().split(","); + $.each(tempData, function (index, item) { + if(item !== ""){ + tagData.push(item) + } + }); + + + let tagLabel= inputTag.render({ + elem: '#departmentManager', + data: tagData,//初始值 + removeKeyNum: 8,//删除按键编号 默认,BackSpace 键 + createKeyNum: 13,//创建按键编号 默认,Enter 键 + onChange: function (data, value, type,index) { + if(type === "remove"){ + let split = departmentManagerId.split(","); + split.splice(index,1); + departmentManagerId = split.toString(); + $("#departmentManagerId").val(departmentManagerId); + } + } + }); + // 用于打开仓库树形菜单 $('#openSonByDepository').on('click', function () { layer.open({ @@ -350,12 +387,12 @@ move: '.layui-layer-title', fixed: false, content: '/selectDepository?type=2', - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); }, end: function () { var nowDepositoryId = $("#depositoryId").val(); @@ -378,7 +415,7 @@ // 用于打开负责人树形菜单 - $("#departmentManager").on('click', function () { + $("#selectdepartmentManager").on('click', function () { layer.open({ type: 2, title: '弹窗内容', @@ -390,14 +427,15 @@ fixed: false, content: '/selectManager', end: function () { - departmentManagerId = $("#departmentManagerId").val() + departmentManagerId = $("#departmentManagerId").val(); + tagLabel.createItem(); }, - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); } }); }); @@ -409,6 +447,7 @@ data.params = params; data.needToUpdate = needToUpdate; data.barCodeListByNoMaterial = barCodeList; + data.departmentManagerId = departmentManagerId; $.ajax({ url: "/stockTaking/addStockTakingRecord", type: 'post', @@ -537,7 +576,7 @@
+ name=` + "oldInventory" + NewIdNumber + ` id=` + "oldInventory" + NewIdNumber + ` lay-verify="required"/>
@@ -703,16 +742,16 @@ fixed: false, content: '/getMaterialAll?mname=' + mname + '&type=3&clickObj=' + parentId + '&placeId=' + placeId + '&depositoryId=' + depositoryId, // content: '/selectMaterialByCardForTaking?mname=' + mname + '&type=3&clickObj=' + parentId + '&placeId=' + placeId + '&depositoryId=' + depositoryId, - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); }, end: function () { var mid = materialId.value; - if(mid !== ''){ + if (mid !== '') { $.ajax({ url: "/material/findInventoryByIdAndPid?mid=" + mid + "&pid=" + placeId, type: "get", @@ -744,11 +783,11 @@ }); form.render(); } - let unitItem = $("#unit"+idNumber); + let unitItem = $("#unit" + idNumber); unitItem.empty() - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ + if (splitInfoList.length > 0) { $.each(splitInfoList, function (index, item) { unitItem.append(new Option(item.newUnit, item.newUnit)); }) @@ -764,7 +803,7 @@ }) } form.render(); - }else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -837,7 +876,7 @@ success: function (d) { var d = d.data; if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); + layer.msg("该位置暂未该物品,请确认是否输入正确"); materialName.value = ""; materialId.value = ""; obj.value = ""; @@ -847,8 +886,7 @@ versionChildren.childNodes[3].childNodes[1].value = ""; unitChildren.childNodes[3].childNodes[1].value = ""; inventoryChildren.childNodes[3].childNodes[1].value = ""; - } - else { + } else { materialName.value = d.mname; materialId.value = d.id; materialTypeItem[1].value = d.typeName; @@ -859,14 +897,14 @@ // 获取物料与条形码的对应关系 var materialAndBarCodeList = d["materialAndBarCodeList"]; var idNumber = materialId.name.split("mid")[1]; - let unit = $("#unit"+idNumber); + let unit = $("#unit" + idNumber); var barCode = $("#barCode" + idNumber); if (barCode.length > 0) { barCode.empty(); } unit.empty(); - unit.append(new Option(d.unit,"-1")); - if(d.splitInfoList !==null && d.splitInfoList.length > 0){ + unit.append(new Option(d.unit, "-1")); + if (d.splitInfoList !== null && d.splitInfoList.length > 0) { $.each(d.splitInfoList, function (index, item) { unit.append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 }); @@ -896,8 +934,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1012,11 +1049,11 @@ }); form.render(); } - let unitItem = $("#unit"+idNumber); + let unitItem = $("#unit" + idNumber); unitItem.empty(); - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ + if (splitInfoList.length > 0) { $.each(splitInfoList, function (index, item) { unitItem.append(new Option(item.newUnit, item.newUnit)); }) @@ -1031,8 +1068,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1143,7 +1179,7 @@
+ name=` + "oldInventory" + NewIdNumber + ` id=` + "oldInventory" + NewIdNumber + ` lay-verify="required"/>
@@ -1192,7 +1228,7 @@ parent.wx.scanQRCode({ desc: 'scanQRCode desc', needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, - scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 + scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 success: function (res) { // 回调 var result = res.resultStr;//当needResult为1时返回处理结果 @@ -1270,13 +1306,13 @@ }); form.render(); } - var unitItem = $("#unit"+idNumber); + var unitItem = $("#unit" + idNumber); unitItem.empty(); - unitItem.append(new Option(data.unit,"-1")); + unitItem.append(new Option(data.unit, "-1")); let splitInfoList = data.splitInfoList; - if(splitInfoList.length > 0){ - $.each(splitInfoList,function (index,item) { - unitItem.append(new Option(item.newUnit,item.newUnit)); + if (splitInfoList.length > 0) { + $.each(splitInfoList, function (index, item) { + unitItem.append(new Option(item.newUnit, item.newUnit)); }) } form.render(); @@ -1290,8 +1326,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1389,19 +1424,18 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + id).hide(); form.render(); } form.render(); - var unitItem = $("#unit"+id); + var unitItem = $("#unit" + id); unitItem.empty(); - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ - $.each(splitInfoList,function (index,item) { - unitItem.append(new Option(item.newUnit,item.newUnit)); + if (splitInfoList.length > 0) { + $.each(splitInfoList, function (index, item) { + unitItem.append(new Option(item.newUnit, item.newUnit)); }) } form.render(); @@ -1486,7 +1520,7 @@ form.on('select()', function (data) { var id = data.elem.id; //得到select原始DOM对象id var req = {}; - if(id.includes("producedDate")) { + if (id.includes("producedDate")) { var idNumber = id.split('producedDate')[1]; // 得到当前id对应数字 req.mid = $("#" + "mid" + idNumber).val(); req.producedDate = data.value; @@ -1500,8 +1534,7 @@ $("#" + "oldInventory" + idNumber).val(d.data) } }); - } - else if(id.includes("unit")){ + } else if (id.includes("unit")) { let idNumber = id.split("unit")[1]; // 得到当前id对应数字 req.mid = $("#" + "mid" + idNumber).val(); req.unit = data.value; diff --git a/target/classes/templates/pages/post/selectManager.html b/target/classes/templates/pages/post/selectManager.html index f9b11ad5..1d88f53f 100644 --- a/target/classes/templates/pages/post/selectManager.html +++ b/target/classes/templates/pages/post/selectManager.html @@ -27,16 +27,17 @@ return false; } var name = $("#departmentManager", window.parent.document).val(); + var id = $("#departmentManagerId", window.parent.document).val(); - if (name === undefined || name === null || name === "") { + // if (name === undefined || name === null || name === "") { $("#departmentManager", window.parent.document).val(data.title); - } else { - $("#departmentManager", window.parent.document).val(name + data.title); - } + // } else { + // $("#departmentManager", window.parent.document).val(name + data.title); + // } if (id === undefined || id === null || id === "") { $("#departmentManagerId", window.parent.document).val(data.id); } else { - $("#departmentManagerId", window.parent.document).val(id + data.id); + $("#departmentManagerId", window.parent.document).val(id + data.id + ","); } var index = parent.layer.getFrameIndex(window.name); parent.layer.close(index); diff --git a/target/classes/templates/pages/stockTaking/stockTaking.html b/target/classes/templates/pages/stockTaking/stockTaking.html index b870e749..48d50bae 100644 --- a/target/classes/templates/pages/stockTaking/stockTaking.html +++ b/target/classes/templates/pages/stockTaking/stockTaking.html @@ -9,6 +9,7 @@ + @@ -75,13 +79,20 @@
- - +
+
+ + + +
+
@@ -98,7 +109,8 @@
-
- - + + @@ -318,10 +330,11 @@ let barCodeList = {}; let needToUpdate = {}; - layui.use(['form', 'step', 'flow','laydate'], function () { + layui.use(['form', 'step', 'flow', 'laydate', 'inputTag'], function () { var $ = layui.$, form = layui.form, laydate = layui.laydate, + inputTag = layui.inputTag, step = layui.step; departmentManagerId = $("#departmentManagerId").val(); @@ -338,6 +351,30 @@ }] }); + let tagData = []; + let tempData = $("#departmentManager").val().split(","); + $.each(tempData, function (index, item) { + if(item !== ""){ + tagData.push(item) + } + }); + + + let tagLabel= inputTag.render({ + elem: '#departmentManager', + data: tagData,//初始值 + removeKeyNum: 8,//删除按键编号 默认,BackSpace 键 + createKeyNum: 13,//创建按键编号 默认,Enter 键 + onChange: function (data, value, type,index) { + if(type === "remove"){ + let split = departmentManagerId.split(","); + split.splice(index,1); + departmentManagerId = split.toString(); + $("#departmentManagerId").val(departmentManagerId); + } + } + }); + // 用于打开仓库树形菜单 $('#openSonByDepository').on('click', function () { layer.open({ @@ -350,12 +387,12 @@ move: '.layui-layer-title', fixed: false, content: '/selectDepository?type=2', - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); }, end: function () { var nowDepositoryId = $("#depositoryId").val(); @@ -378,7 +415,7 @@ // 用于打开负责人树形菜单 - $("#departmentManager").on('click', function () { + $("#selectdepartmentManager").on('click', function () { layer.open({ type: 2, title: '弹窗内容', @@ -390,14 +427,15 @@ fixed: false, content: '/selectManager', end: function () { - departmentManagerId = $("#departmentManagerId").val() + departmentManagerId = $("#departmentManagerId").val(); + tagLabel.createItem(); }, - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); } }); }); @@ -409,6 +447,7 @@ data.params = params; data.needToUpdate = needToUpdate; data.barCodeListByNoMaterial = barCodeList; + data.departmentManagerId = departmentManagerId; $.ajax({ url: "/stockTaking/addStockTakingRecord", type: 'post', @@ -537,7 +576,7 @@
+ name=` + "oldInventory" + NewIdNumber + ` id=` + "oldInventory" + NewIdNumber + ` lay-verify="required"/>
@@ -703,16 +742,16 @@ fixed: false, content: '/getMaterialAll?mname=' + mname + '&type=3&clickObj=' + parentId + '&placeId=' + placeId + '&depositoryId=' + depositoryId, // content: '/selectMaterialByCardForTaking?mname=' + mname + '&type=3&clickObj=' + parentId + '&placeId=' + placeId + '&depositoryId=' + depositoryId, - success: function(layero, index){ + success: function (layero, index) { var children = layero.children(); var content = $(children[1]); var iframeChildren = $(content.children()); - content.css('height','100%'); - iframeChildren.css('height','100%'); + content.css('height', '100%'); + iframeChildren.css('height', '100%'); }, end: function () { var mid = materialId.value; - if(mid !== ''){ + if (mid !== '') { $.ajax({ url: "/material/findInventoryByIdAndPid?mid=" + mid + "&pid=" + placeId, type: "get", @@ -744,11 +783,11 @@ }); form.render(); } - let unitItem = $("#unit"+idNumber); + let unitItem = $("#unit" + idNumber); unitItem.empty() - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ + if (splitInfoList.length > 0) { $.each(splitInfoList, function (index, item) { unitItem.append(new Option(item.newUnit, item.newUnit)); }) @@ -764,7 +803,7 @@ }) } form.render(); - }else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -837,7 +876,7 @@ success: function (d) { var d = d.data; if (d == null) { - layer.msg("没有该编码,请确认是否输入正确"); + layer.msg("该位置暂未该物品,请确认是否输入正确"); materialName.value = ""; materialId.value = ""; obj.value = ""; @@ -847,8 +886,7 @@ versionChildren.childNodes[3].childNodes[1].value = ""; unitChildren.childNodes[3].childNodes[1].value = ""; inventoryChildren.childNodes[3].childNodes[1].value = ""; - } - else { + } else { materialName.value = d.mname; materialId.value = d.id; materialTypeItem[1].value = d.typeName; @@ -859,14 +897,14 @@ // 获取物料与条形码的对应关系 var materialAndBarCodeList = d["materialAndBarCodeList"]; var idNumber = materialId.name.split("mid")[1]; - let unit = $("#unit"+idNumber); + let unit = $("#unit" + idNumber); var barCode = $("#barCode" + idNumber); if (barCode.length > 0) { barCode.empty(); } unit.empty(); - unit.append(new Option(d.unit,"-1")); - if(d.splitInfoList !==null && d.splitInfoList.length > 0){ + unit.append(new Option(d.unit, "-1")); + if (d.splitInfoList !== null && d.splitInfoList.length > 0) { $.each(d.splitInfoList, function (index, item) { unit.append(new Option(item.newUnit, item.newUnit));//往下拉菜单里添加元素 }); @@ -896,8 +934,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1012,11 +1049,11 @@ }); form.render(); } - let unitItem = $("#unit"+idNumber); + let unitItem = $("#unit" + idNumber); unitItem.empty(); - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ + if (splitInfoList.length > 0) { $.each(splitInfoList, function (index, item) { unitItem.append(new Option(item.newUnit, item.newUnit)); }) @@ -1031,8 +1068,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1143,7 +1179,7 @@
+ name=` + "oldInventory" + NewIdNumber + ` id=` + "oldInventory" + NewIdNumber + ` lay-verify="required"/>
@@ -1192,7 +1228,7 @@ parent.wx.scanQRCode({ desc: 'scanQRCode desc', needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, - scanType: ["qrCode","barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 + scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 success: function (res) { // 回调 var result = res.resultStr;//当needResult为1时返回处理结果 @@ -1270,13 +1306,13 @@ }); form.render(); } - var unitItem = $("#unit"+idNumber); + var unitItem = $("#unit" + idNumber); unitItem.empty(); - unitItem.append(new Option(data.unit,"-1")); + unitItem.append(new Option(data.unit, "-1")); let splitInfoList = data.splitInfoList; - if(splitInfoList.length > 0){ - $.each(splitInfoList,function (index,item) { - unitItem.append(new Option(item.newUnit,item.newUnit)); + if (splitInfoList.length > 0) { + $.each(splitInfoList, function (index, item) { + unitItem.append(new Option(item.newUnit, item.newUnit)); }) } form.render(); @@ -1290,8 +1326,7 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + idNumber).hide(); form.render(); } @@ -1389,19 +1424,18 @@ }) } form.render(); - } - else{ + } else { $("#" + "producedDateItem" + id).hide(); form.render(); } form.render(); - var unitItem = $("#unit"+id); + var unitItem = $("#unit" + id); unitItem.empty(); - unitItem.append(new Option(material.unit,"-1")); + unitItem.append(new Option(material.unit, "-1")); let splitInfoList = material.splitInfoList; - if(splitInfoList.length > 0){ - $.each(splitInfoList,function (index,item) { - unitItem.append(new Option(item.newUnit,item.newUnit)); + if (splitInfoList.length > 0) { + $.each(splitInfoList, function (index, item) { + unitItem.append(new Option(item.newUnit, item.newUnit)); }) } form.render(); @@ -1486,7 +1520,7 @@ form.on('select()', function (data) { var id = data.elem.id; //得到select原始DOM对象id var req = {}; - if(id.includes("producedDate")) { + if (id.includes("producedDate")) { var idNumber = id.split('producedDate')[1]; // 得到当前id对应数字 req.mid = $("#" + "mid" + idNumber).val(); req.producedDate = data.value; @@ -1500,8 +1534,7 @@ $("#" + "oldInventory" + idNumber).val(d.data) } }); - } - else if(id.includes("unit")){ + } else if (id.includes("unit")) { let idNumber = id.split("unit")[1]; // 得到当前id对应数字 req.mid = $("#" + "mid" + idNumber).val(); req.unit = data.value;