From d656e7369dd346c52c2623d36385b57191c3be1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E8=BF=AA?= <2596750866@qq.com> Date: Fri, 9 Aug 2024 10:53:47 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=20=E5=AE=A2=E6=88=B7=E9=94=80=E5=94=AE=E8=AE=A2=E5=8D=95=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E9=94=80=E5=94=AE=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=88=96=E6=B8=85=E9=99=A4=E7=89=B9=E5=AE=9A=E8=A1=8C?= =?UTF-8?q?=E7=9A=84=E6=8C=87=E5=AE=9A=E5=88=97=E7=9A=84=E5=80=BC=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=9B=20=E4=BF=AE=E6=94=B9=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=88=97=E5=8F=AF=E8=A7=81=E6=80=A7=E7=9A=84=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=8C=89=E5=B8=81=E7=A7=8D=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E8=B5=8B=E8=A1=A8=E6=A0=BC=E7=A8=8E=E7=8E=87=E5=80=BC?= =?UTF-8?q?=E4=B8=BA0=E6=96=B9=E6=B3=95=EF=BC=9B=20=E4=B8=BA=E7=A8=8E?= =?UTF-8?q?=E7=8E=87=E8=BE=93=E5=85=A5=E6=A1=86=E6=B7=BB=E5=8A=A0=20change?= =?UTF-8?q?=20=E4=BA=8B=E4=BB=B6=E7=9B=91=E5=90=AC=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8A=A8=E6=80=81=E6=9B=B4=E6=96=B0=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E4=B8=AD=E7=A8=8E=E7=8E=87=E5=88=97=E5=80=BC=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=B9=E5=A4=96=E5=94=AE=E4=BB=B7=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=B1=9E=E6=80=A7=EF=BC=8C=E5=8E=BB=E9=99=A4=E5=8F=AF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C=E5=B9=B6=E5=9C=A8=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E6=97=B6=E8=B5=8B0=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/system/salesOrder/add.html | 146 +++++++++++++----- 1 file changed, 104 insertions(+), 42 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html index 4b00e58a..8c2a3885 100644 --- a/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/salesOrder/add.html @@ -66,12 +66,12 @@
-
- -
- -
-
+ + + + + +
@@ -342,9 +342,24 @@ } }, {title: '半成品类型',field: 'processMethod',align: 'center',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, - { title: '对外售价',field: 'materialSole',editable: true}, + { title: '对外售价',field: 'materialSole',align: 'center',}, {title: '国内税率',field: 'countTax',align: 'center',editable: {type: 'text',mode: 'inline',},}, { title: '美元汇率',field: 'usdTax', align: 'center',editable: {type: 'text',mode: 'inline', }}, + {title: '物料的数量',field: 'materialNum',align: 'center', + editable:{ + type : 'text', + mode: 'inline', + title : '物料的数量', + validate : function(value) { + if (!value) { + return '用量不能为空'; + } + if (isNaN(value)) { + return '用量必须为数字'; + } + } + }, + }, { title: '物料的不含税单价(RMB)', field: 'materialNoRmb', align: 'center', @@ -374,21 +389,6 @@ } }, { title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center',}, - {field: 'materialNum',align: 'center',title: '物料的数量', - editable:{ - type : 'text', - mode: 'inline', - title : '物料的数量', - validate : function(value) { - if (!value) { - return '用量不能为空'; - } - if (isNaN(value)) { - return '用量必须为数字'; - } - } - }, - }, {title: '物料的不含税总价(RMB)',field: 'materialNoRmbSum',align: 'center',}, { title: '物料的含税总价(RMB)',field: 'materialRmbSum',align: 'center',}, {title: '物料的不含税单价(美元)', @@ -514,15 +514,15 @@ // } // }); //获取单号 - $.ajax({ - url: prefix + "/getId", - type: "post", - dateType: "json", - success: function (resp) { - if (resp.code === 0) {$("input[name='salesOrderCode']").val(resp.data);} else {$.modal.msgError("失败啦");} - }, - error: function () {$.modal.msgError("后台出错啦!");} - }); + // $.ajax({ + // url: prefix + "/getId", + // type: "post", + // dateType: "json", + // success: function (resp) { + // if (resp.code === 0) {$("input[name='salesOrderCode']").val(resp.data);} else {$.modal.msgError("失败啦");} + // }, + // error: function () {$.modal.msgError("后台出错啦!");} + // }); //获取客户信息 var options = []; // $.ajax({ @@ -643,11 +643,53 @@ // $("select[name='enterpriseCode']").val(null).trigger('change'); } }); - + // 更新列可见性的函数 + function updateColumnVisibility(currencyType,columnName) { + var $table = $("#bootstrap-sub-table-order"); + var usdColumns = ['usdTax', 'materialNoUsd', 'materialUsd', 'materialUsdSum', 'materialNoUsdSum']; + var rmbColumns = ['countTax', 'materialNoRmb', 'materialRmb', 'materialNoRmbSum', 'materialRmbSum']; + if (currencyType === '1') { + // 隐藏指定的列 + usdColumns.forEach(function(columnName) { + $table.bootstrapTable('hideColumn', columnName); + }); + // 显示指定的列 + rmbColumns.forEach(function(columnName) { + $table.bootstrapTable('showColumn', columnName); + }); + var data = $table.bootstrapTable('getData'); + data.forEach(function(row, index) { + updateColumnValue(index, 0, "usdTax"); + }); + } else { + // 隐藏指定的列 + rmbColumns.forEach(function(columnName) { + $table.bootstrapTable('hideColumn', columnName); + }); + // 显示指定的列 + usdColumns.forEach(function(columnName) { + $table.bootstrapTable('showColumn', columnName); + }); + var data = $table.bootstrapTable('getData'); + data.forEach(function(row, index) { + updateColumnValue(index, 0, "countTax"); + }); + } + } + // 更新或清除特定行的指定列的值 + function updateColumnValue(rowIndex, value, columnName) { + var $table = $("#bootstrap-sub-table-order"); + $table.bootstrapTable('updateCell', { + index: rowIndex, + field: columnName, + value: value + }); + } // 选择币种 $("#commonCurrency_add").on('change', function() { var selectedValue = $(this).val(); - + var $table = $("#bootstrap-sub-table-order"); + updateColumnVisibility(selectedValue); if(selectedValue ==="1"){ if($('#usdTax').length!=0){ $('#usdTax').remove(); @@ -667,6 +709,16 @@ '
' ); $('#commonCurrency').after($taxArea); + // 为税率输入框添加 change 事件监听器 + $taxArea.on('change', '#taxRate_add', function(event) { + // console.log('税率改变:', $(this).val()); + var taxValue = $(this).val(); + var data = $table.bootstrapTable('getData'); + data.forEach(function(row, index) { + updateColumnValue(index, taxValue, "countTax"); + }); + }); + $taxArea.find('#taxRate_add').trigger('change'); }else if(selectedValue ==="2"){ if($('#usdTax').length!=0){ $('#usdTax').remove(); @@ -675,14 +727,24 @@ $('#rmbTax').remove(); } var $taxArea = $( - '
' + - '' + - '
' + - '' + - '
' + - '
' - ); - $('#commonCurrency').after($taxArea); + '
' + + '' + + '
' + + '' + + '
' + + '
' + ); + $('#commonCurrency').after($taxArea); + // 为税率输入框添加 change 事件监听器 + $taxArea.on('change', '#usdTax_add', function(event) { + var taxValue = $(this).val(); + var data = $table.bootstrapTable('getData'); + data.forEach(function(row, index) { + updateColumnValue(index, taxValue, "usdTax"); + }); + + }); + $taxArea.find('#usdTax_add').trigger('change'); } }); @@ -809,7 +871,7 @@ warehouseDept: rowData.warehouseDept, countTax: $("#taxRate_add").val(), usdTax: $("#usdTax_add").val(), - materialSole: "", + materialSole: 0, materialNum: "", materialNoRmb: 0.00, materialNoUsd: 0.00,