From bc16bf5632a9a20e3ea353a049688c8eeeffb07a Mon Sep 17 00:00:00 2001 From: cwchen <1048842385@qq.com> Date: Sat, 16 Nov 2024 12:56:11 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/accessory/accessory_scrap_list.js | 23 ++++++------- js/accessory/child/accessory_scrap_form.js | 24 +++++++------- .../child/choose_scrap_fit_type_list.js | 33 +++++-------------- js/accessory/child/inventory_count_form.js | 2 ++ page/accessory/accessory_scrap_list.html | 6 ++-- .../accessory/child/accessory_scrap_form.html | 4 +-- 6 files changed, 40 insertions(+), 52 deletions(-) diff --git a/js/accessory/accessory_scrap_list.js b/js/accessory/accessory_scrap_list.js index 4af9946..59aebcd 100644 --- a/js/accessory/accessory_scrap_list.js +++ b/js/accessory/accessory_scrap_list.js @@ -7,7 +7,7 @@ layui.use(["form", "table", 'laydate'], function () { laydate = layui.laydate; laydate.render({ elem: '#ID-laydate-rangeLinked', - range: ['#startDate', '#endDate'], + range: ['#startDay', '#endDay'], rangeLinked: true }); initTable(); @@ -19,8 +19,8 @@ function queryTable(type) { reloadTable(1); } else if (type === 2) { $('#keyWord').val(''); - $('#startDate').val(''); - $('#endDate').val(''); + $('#startDay').val(''); + $('#endDay').val(''); layui.form.render(); reloadTable(1); } @@ -40,8 +40,8 @@ function reloadTable(pageNum) { where: { encryptedData: JSON.stringify({ 'keyWord': $('#keyWord').val(), - 'startDate': $('#startDate').val(), - 'endDate': $('#endDate').val() + 'startDay': $('#startDay').val(), + 'endDay': $('#endDay').val() }), }, }, @@ -61,8 +61,8 @@ function initTable() { where: { encryptedData: JSON.stringify({ 'keyWord': $('#keyWord').val(), - 'startDate': $('#startDate').val(), - 'endDate': $('#endDate').val() + 'startDay': $('#startDay').val(), + 'endDay': $('#endDay').val() }), }, request: { @@ -148,11 +148,12 @@ function initTable() { // 导出 function exportExcel() { let params = { - 'proName': $('#proName').val(), - 'status': $('#status').val() + 'keyWord': $('#keyWord').val(), + 'startDay': $('#startDay').val(), + 'endDay': $('#endDay').val() } - let url = dataUrl + "backstage/export/exportFhList"; - exportExcelUtil(url, '配件入库数据', JSON.stringify(params)); + let url = dataUrl + "backstage/partScrap/export"; + exportExcelUtil(url, '报废记录', JSON.stringify(params)); } // 详情 配件报废 diff --git a/js/accessory/child/accessory_scrap_form.js b/js/accessory/child/accessory_scrap_form.js index 7401509..c4c4103 100644 --- a/js/accessory/child/accessory_scrap_form.js +++ b/js/accessory/child/accessory_scrap_form.js @@ -13,7 +13,7 @@ function setParams(obj) { table = layui.table; util = layui.util; laydate.render({ - elem: '#inputDay' + elem: '#scrapDay' }); form.verify(); form.on('submit(formData)', function (data) { @@ -32,7 +32,7 @@ function setParams(obj) { bindAction: '#hideUpload', //绑定的按钮 choose: function (obj) { let length = $('.file-iteme').length; - if(length >= 5){ + if (length >= 5) { return layer.msg('最多上传5个附件证明', { icon: 7 }); } uploadObj.config.elem.next()[0].value = ''; @@ -279,6 +279,8 @@ function setTableData(results) { if (results && results.length > 0) { for (var i = 0; i < results.length; i++) { var l = results[i]; + let scrapNum = l.scrapNum ? l.scrapNum : 0; + let price = l.price ? parseFloat(l.price) : 0; html += ""; html += ''; html += "" @@ -287,10 +289,10 @@ function setTableData(results) { html += "" + l.name + ""; html += "" + l.model + ""; html += "" + l.unit + ""; - html += "" + l.unit + ""; - html += "" + l.unit + ""; - html += "" + setFormInput(l.num, 1) + ""; - html += "" + l.unit + ""; + html += "" + l.price + ""; + html += "" + l.num + ""; + html += "" + setFormInput(l.scrapNum, 1) + ""; + html += "" + scrapNum * price + ""; html += "" + setFormInput(l.remarks, 2) + ""; html += ""; } @@ -304,8 +306,8 @@ function setTableData(results) { function setFormInput(value, type) { let html = '
'; if (type === 1) { // 报废数量 - html += ''; - }else if (type === 2) { // 备注 + html += ''; + } else if (type === 2) { // 备注 html += ''; } html += '
'; @@ -390,11 +392,11 @@ function delFitType() { // 校验数据 function checkValue(that, type) { let value = $(that).val(); - if (type === 1) { // 入库量 + if (type === 1) { // 报废数量 const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value) && value) { - layer.msg('入库量输入不合法,请重新输入!', { icon: 5 }) - $(that).val(''); + $(that).val(0); + return layer.msg('报废数量输入不合法,请重新输入!', { icon: 5 }) } } } diff --git a/js/accessory/child/choose_scrap_fit_type_list.js b/js/accessory/child/choose_scrap_fit_type_list.js index c26426d..12f770a 100644 --- a/js/accessory/child/choose_scrap_fit_type_list.js +++ b/js/accessory/child/choose_scrap_fit_type_list.js @@ -76,10 +76,8 @@ function initTable() { $.each(res.list, function (index, item) { $.each(jjDetailArr, function (index2, item2) { if (item.id === item2.id) { - item.num = item2.num; - item.price = item2.price; + item.scrapNum = item2.scrapNum; item.remarks = item2.remarks; - item.manufacturer = item2.manufacturer; } }); }); @@ -104,21 +102,21 @@ function initTable() { }, { field: "type", - width: '8%', + width: '9.9%', title: "配件类型", unresize: true, align: "center", }, { field: "name", - width: '9%', + width: '13%', title: "配件名称", unresize: true, align: "center", }, { field: "model", - width: '8%', + width: '12%', title: "规格型号", unresize: true, align: "center", @@ -131,21 +129,21 @@ function initTable() { align: "center", }, { - field: "unit", + field: "price", title: "平均单价(元)", width: '10%', unresize: true, align: "center", }, { - field: "unit", + field: "num", title: "库存量", width: '10%', unresize: true, align: "center", }, { - field: "num", + field: "scrapNum", width: '10%', title: "报废数量", unresize: true, @@ -153,15 +151,6 @@ function initTable() { edit: 'text', style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;' }, - { - field: "price", - width: '10%', - title: "金额 (元)", - unresize: true, - align: "center", - edit: 'text', - style: 'outline: 1px solid #e6e6e6;outline-offset: -5px;' - }, { field: "remarks", width: '15%', @@ -207,7 +196,7 @@ function initTable() { table.on('edit(currentTableId2)', function (obj) { var field = obj.field; // 得到修改的字段 var value = obj.value // 得到修改后的值 - if (field === 'num') { // 本次入库量 + if (field === 'scrapNum') { // 报废量 if (value) { const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value)) { @@ -215,12 +204,6 @@ function initTable() { return layer.msg('格式不正确,最大输入6位数,且为正整数!', { icon: 7 }) } } - } else if (field === 'price') { - const regex = /^(?:1(?:\d{0,8}|[0-9]*\.\d{1,2})|(?:[1-9]\d{0,7}|[1-9]\d{0,6}\.\d{1,2}|[1-9]\d{1,7}\.\d{2}|100000000(?:\.00)?))$/; - if (!regex.test(value)) { - obj.reedit(); - return layer.msg('单价格式不正确!', { icon: 7 }) - } } else if (field === 'remarks') { // 备注 if (value) { if (value.length > 255) { diff --git a/js/accessory/child/inventory_count_form.js b/js/accessory/child/inventory_count_form.js index 00ce52a..1ed5a08 100644 --- a/js/accessory/child/inventory_count_form.js +++ b/js/accessory/child/inventory_count_form.js @@ -404,6 +404,8 @@ function checkValue(that, type) { const regex = /^(0|[1-9]\d{0,6})$/; if (!regex.test(value) && value) { $(that).val(0); + $(that).parents('td').next().html(0); + $(that).parents('td').next().next().html(0); let list = getBaseTableData(); setNumAndPrice(list); return layer.msg('本次盘点量输入不合法,最大输入6位数,且为正整数,请重新输入!', { icon: 5 }) diff --git a/page/accessory/accessory_scrap_list.html b/page/accessory/accessory_scrap_list.html index bc8d917..4d2b42d 100644 --- a/page/accessory/accessory_scrap_list.html +++ b/page/accessory/accessory_scrap_list.html @@ -22,19 +22,19 @@
-
-
-
-
diff --git a/page/accessory/child/accessory_scrap_form.html b/page/accessory/child/accessory_scrap_form.html index 5f4d5c4..8f481c9 100644 --- a/page/accessory/child/accessory_scrap_form.html +++ b/page/accessory/child/accessory_scrap_form.html @@ -19,7 +19,7 @@
- +
@@ -28,7 +28,7 @@
-