From 31cb50140e8a62a72e087a55ab5bf5d68dcb6bf0 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Wed, 10 Jul 2024 20:31:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E4=B8=9A=E5=8A=A1=E7=BB=8F=E7=90=86=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=8A=A5=E4=BB=B7=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9C=89=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/system/customerQuote/add.html | 89 +++++---- .../system/customerQuote/detail.html | 27 +-- .../templates/system/customerQuote/edit.html | 22 +-- .../system/customerQuote/taskModifyApply.html | 172 ++++++++++-------- .../system/customerQuote/taskYwjlVerify.html | 100 +++++----- .../system/customerQuote/taskYwzgVerify.html | 65 ++++--- .../system/customerQuote/taskZozjVerify.html | 87 ++++----- 7 files changed, 276 insertions(+), 286 deletions(-) diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html index 2a1da822..f722f360 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html @@ -145,6 +145,7 @@ var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; var processMethodDatas = [[${@dict.getType('processMethod')}]]; var userName = [[${@permission.getPrincipalProperty('userName')}]]; + var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; var prefix = ctx + "system/customerQuote"; var commonCurrency = $("#commonCurrency_add option:selected").val(); $("#form-customerQuote-add").validate({focusCleanup: true}); @@ -166,11 +167,9 @@ } } } - //获取客户信息 - - // 监听客户编号下拉框的变化 - $('#customerCode').on('change', function() { + // 监听客户编号下拉框的变化 + $('#customerCode').on('change', function() { var selectedCustomerCode = $(this).val(); // 获取选中的客户ID if (selectedCustomerCode) { // 发起Ajax请求获取客户名称 @@ -208,14 +207,12 @@ $('input[name="customerName"]').val(''); } }); - - $(document).ready(function() { // 初始化时默认加载客户编号列表 loadCustomerIds(); }); // 假设的加载客户编号列表函数 - function loadCustomerIds() { + function loadCustomerIds() { var url = ctx + 'system/customer/getCustomers'; $.ajax({ type: 'GET', // 请求类型 @@ -245,9 +242,6 @@ } }); } - - - //添加收款明细 function insertNoMaterialNoRow() { // 生成一个简单的唯一标识,这里使用时间戳作为示例 @@ -270,8 +264,6 @@ } - - $(function() { var options = { id:'bootstrap-sub-table-quoteChild', @@ -544,46 +536,51 @@ // 可以选择取消这次编辑操作,但Bootstrap Table默认不会提供直接的API来取消编辑后的保存,您可能需要手动恢复数据或采取其他策略。 } }); - // 初始化时也需要根据当前的货币类型设置一次 $("#commonCurrency_add").trigger('change'); + getBusinessMembers(); + getCustomerCode(); }); - //获取单号 - $.ajax({ - url: prefix + "/getId", - type: "post", - dateType: "json", - success: function (resp) { - if (resp.code === 0) { - $("input[name='supplierCode']").val(resp.data); - } else { - $.modal.msgError("失败啦"); + function getCustomerCode(){ + //获取单号 + $.ajax({ + url: prefix + "/getId", + type: "post", + dateType: "json", + success: function (resp) { + if (resp.code === 0) { + $("input[name='supplierCode']").val(resp.data); + } else { + $.modal.msgError("失败啦"); + } + }, + error: function () { + $.modal.msgError("后台出错啦!"); } - }, - error: function () { - $.modal.msgError("后台出错啦!"); - } - }); - /*业务员列表*/ - $.ajax({ - url: ctx + 'system/salesOrder/getBinessMembers', - type: 'get', - success: function (res) { - console.log(res) - if (res.rows.length > 0) { - var usertData = res.rows; - //alert(JSON.stringify(data)); - for (let i in usertData) { - // console.log(finishProductData[i].finishProductCode) - $("#form-customerQuote-add select[name='businessMembers']").append( - ""); + }); + } + function getBusinessMembers(){ + /*业务员列表*/ + $.ajax({ + url: ctx + 'system/salesOrder/getBinessMembers', + type: 'get', + success: function (res) { + console.log(res) + if (res.rows.length > 0) { + var usertData = res.rows; + //alert(JSON.stringify(data)); + for (let i in usertData) { + // console.log(finishProductData[i].finishProductCode) + $("#form-customerQuote-add select[name='businessMembers']").append( + ""); + } + $("#form-customerQuote-add select[name='businessMembers']").val(loginName).trigger("change"); + } else { + $.modal.msgError(res.msg); } - $("#form-customerQuote-add select[name='businessMembers']").val(userName).trigger("change"); - } else { - $.modal.msgError(res.msg); } - } - }); + }); + } function doSubmit(index, layero,uniqueId){ console.log(uniqueId); var iframeWin = window[layero.find('iframe')[0]['name']]; diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html index 4a5e27d6..df0750e0 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html @@ -70,7 +70,10 @@
- +
+ + % +
@@ -142,28 +145,6 @@ var commonCurrency = $("#commonCurrency_edit option:selected").val(); $("#form-customerQuote-edit").validate({focusCleanup: true}); //计算 - $(function() { - /*业务员列表*/ - $.ajax({ - url: ctx + 'system/salesOrder/getBinessMembers', - type: 'get', - success: function (res) { - console.log(res) - if (res.rows.length > 0) { - var usertData = res.rows; - //alert(JSON.stringify(data)); - for (let i in usertData) { - // console.log(finishProductData[i].finishProductCode) - $("#form-customerQuote-detail select[name='businessMembers']").append(""); - } - $("#form-customerQuote-detail select[name='businessMembers']").val(sysCustomerQuote.businessMembers); - } else { - $.modal.msgError(res.msg); - } - } - }); - }); $(function() { var options = { id: "bootstrap-table-Quote-child-detail", diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html index 79b379e2..54f3e6c0 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html @@ -466,22 +466,22 @@ //计算 function getTotalAmount(){ let getData = $("#bootstrap-table-Quote-child-edit1").bootstrapTable('getData', true); - var enterprise = ""; + var enterprise = 0; let enterpriseSum = 0; let noRmb = 0;let rmb = 0;let noRmbSum = 0; let rmbSum = 0;let noUsd = 0;let usd = 0; let noUsdSum = 0;let usdSum = 0; for(var i=0;i + + @@ -16,13 +18,13 @@
- +
- +
@@ -31,7 +33,7 @@
- +
@@ -48,12 +50,11 @@
-
+
- + +
@@ -84,8 +85,8 @@
- -
+ +
@@ -96,7 +97,10 @@
- +
+ + % +
@@ -170,6 +174,9 @@
+ + + @@ -184,39 +191,16 @@ var sysCustomerQuote = [[${formData}]]; var prefix = ctx + "system/customerQuote" var commonCurrency = $("#commonCurrency_edit option:selected").val(); - $("#form-customerQuote-modify").validate({ - focusCleanup: true, - }); - $(function() { - /*业务员列表*/ - $.ajax({ - url: ctx + 'system/salesOrder/getBinessMembers', - type: 'get', - success: function (res) { - console.log(res) - if (res.rows.length > 0) { - var usertData = res.rows; - for (let i in usertData) { - $("#form-customerQuote-modify select[name='businessMembers']").append(""); - } - $("#form-customerQuote-modify select[name='businessMembers']").val(sysCustomerQuote.businessMembers).trigger("change") - } else { - $.modal.msgError(res.msg); - } - } - }); - var confirmFax = $("input[name='confirmFax']"); - confirmFax.val([sysCustomerQuote.confirmFax]); - $("input[name='rmbTax']").val([sysCustomerQuote.taxRate]); - confirmFax.change(function () { - if ($("input[name='confirmFax']").val() == "1") { - $("input[name='rmbTax']").val(sysCustomerQuote.taxRate); - } else { - $("input[name='rmbTax']").val(0); - } - }); - $("#commonCurrency_edit").val(sysCustomerQuote.commonCurrency).trigger('change'); + var businessMembers = [[${formData.businessMembers}]]; + var confirmFax = $("input[name='confirmFax']"); + $("#form-customerQuote-modify").validate({ focusCleanup: true}); + confirmFax.val([sysCustomerQuote.confirmFax]); + confirmFax.change(function () { + if ($("input[name='confirmFax']").val() == "1") { + $("input[name='rmbTax']").val(sysCustomerQuote.taxRate); + } else { + $("input[name='rmbTax']").val(0); + } }); $(function() { var options = { @@ -410,6 +394,25 @@ }; $.table.init(options); }); + function getBuniessMembers(){ + /*业务员列表*/ + $.ajax({ + url: ctx + 'system/salesOrder/getBinessMembers', + type: 'get', + success: function (res) { + console.log(res) + if (res.rows.length > 0) { + var usertData = res.rows; + for (let i in usertData) { + $("#form-customerQuote-modify select[name='businessMembers']").append(""); + } + } else { + $.modal.msgError(res.msg); + } + } + }); + } function queryParams(params) { var curParams = { // 传递参数查询参数 @@ -422,11 +425,7 @@ } function submitHandler() { if ($.validate.form()) { - var formData = $("#form-customerQuote-modify").serializeArray(); - console.log("formData",formData); var tableData = $("#bootstrap-table-Quote-child2").bootstrapTable('getData'); - console.log("tableData",JSON.stringify(tableData)); - var rows = tableData.length; var materialType = $('#selectMaterialType').select2('val'); $('#materialType').val(materialType); if ($('textarea[name="comment"]').val()) { @@ -495,43 +494,66 @@ }); getTotalAmount(); } - $("input[name='pricingDate']").datetimepicker({ - format: "yyyy-mm-dd", - minView: "month", - autoclose: true - }); //计算 function getTotalAmount(){ let getData = $("#bootstrap-table-Quote-child2").bootstrapTable('getData', true); - var enterprise = ""; + let enterprise = 0; let enterpriseSum = 0; let noRmb = 0;let rmb = 0;let noRmbSum = 0; let rmbSum = 0;let noUsd = 0;let usd = 0; let noUsdSum = 0;let usdSum = 0; - for(var i=0;i \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html index e1d261e9..b2b8310a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html @@ -14,13 +14,13 @@
- +
- +
@@ -29,7 +29,7 @@
- +
@@ -46,12 +46,10 @@
-
+
- +
@@ -69,7 +67,7 @@
- @@ -78,7 +76,7 @@
- +
@@ -94,7 +92,10 @@
- +
+ + % +
@@ -116,7 +117,7 @@

计算

- +
@@ -174,6 +175,7 @@
+ @@ -188,39 +190,6 @@ var sysCustomerQuote = [[${formData}]]; var prefix = ctx + "system/customerQuote" var commonCurrency = $("#commonCurrency_edit option:selected").val(); - $("#form-customerQuote-ywjl").validate({ - focusCleanup: true, - }); - $(function() { - /*业务员列表*/ - $.ajax({ - url: ctx + 'system/salesOrder/getBinessMembers', - type: 'get', - success: function (res) { - console.log(res) - if (res.rows.length > 0) { - var usertData = res.rows; - for (let i in usertData) { - $("#form-customerQuote-ywjl select[name='businessMembers']").append(""); - } - $("#form-customerQuote-ywjl select[name='businessMembers']").val(sysCustomerQuote.businessMembers).trigger("change") - } else { - $.modal.msgError(res.msg); - } - } - }); - var confirmFax = $("input[name='confirmFax']"); - confirmFax.val([sysCustomerQuote.confirmFax]); - $("input[name='rmbTax']").val([sysCustomerQuote.taxRate]); - confirmFax.change(function () { - if ($("input[name='confirmFax']").val() == "1") { - $("input[name='rmbTax']").val(sysCustomerQuote.taxRate); - } else { - $("input[name='rmbTax']").val(0); - } - }); - $("#commonCurrency_edit").val(sysCustomerQuote.commonCurrency).trigger('change'); - }); $(function() { var options = { id: "bootstrap-table-Quote-child4", @@ -479,6 +448,24 @@ }) getTotalAmount(); } + function getBuniessMembers() { + $.ajax({ + url: ctx + 'system/salesOrder/getBinessMembers', + type: 'get', + success: function (res) { + console.log(res) + if (res.rows.length > 0) { + var usertData = res.rows; + for (let i in usertData) { + $("#form-customerQuote-ywjl select[name='businessMembers']").append(""); + } + $("#form-customerQuote-ywjl select[name='businessMembers']").val(sysCustomerQuote.businessMembers).trigger("change") + } else { + $.modal.msgError(res.msg); + } + } + }); + } $("input[name='pricingDate']").datetimepicker({ format: "yyyy-mm-dd", minView: "month", @@ -486,23 +473,24 @@ }); //计算 function getTotalAmount(){ - let getData = $("#bootstrap-table-Quote-child4").bootstrapTable('getData', true); - var enterprise = ""; + let getData = $("#bootstrap-table-Quote-child4").bootstrapTable('getData'); + var enterprise = 0; let enterpriseSum = 0; let noRmb = 0;let rmb = 0;let noRmbSum = 0; let rmbSum = 0;let noUsd = 0;let usd = 0; let noUsdSum = 0;let usdSum = 0; for(var i=0;i
-
+
- + +
@@ -174,6 +173,7 @@
+ @@ -490,28 +490,43 @@ let noRmb = 0;let rmb = 0;let noRmbSum = 0; let rmbSum = 0;let noUsd = 0;let usd = 0; let noUsdSum = 0;let usdSum = 0; - for(var i=0;i sum + (parseInt(item.materialNum) || 0), 0); + + // 先累加数值,toFixed在累加后应用以避免精度损失 + for (let i = 0; i < getData.length; i++) { + noRmb += parseFloat(getData[i].materialNoRmb) || 0; + rmb += parseFloat(getData[i].materialRmb) || 0; + noRmbSum += parseFloat(getData[i].materialNoRmbSum) || 0; + rmbSum += parseFloat(getData[i].materialRmbSum) || 0; + noUsd += parseFloat(getData[i].materialNoUsd) || 0; + usd += parseFloat(getData[i].materialUsd) || 0; + noUsdSum += parseFloat(getData[i].materialNoUsdSum) || 0; + usdSum += parseFloat(getData[i].materialUsdSum) || 0; } - $("#enterprise_edit").val(enterprise); - $("#enterpriseSum_edit").val(enterpriseSum); - $("#noRmb_edit").val(noRmb); - $("#rmb_edit").val(rmb); - $("#noRmbSum_edit").val(noRmbSum); - $("#rmbSum_edit").val(rmbSum); - $("#noUsd_edit").val(noUsd); - $("#usd_edit").val(usd); - $("#noUsdSum_edit").val(noUsdSum); - $("#usdSum_edit").val(usdSum); + + // 将累加的结果格式化为两位小数 + noRmb = noRmb.toFixed(2); + rmb = rmb.toFixed(2); + noRmbSum = noRmbSum.toFixed(2); + rmbSum = rmbSum.toFixed(2); + noUsd = noUsd.toFixed(2); + usd = usd.toFixed(2); + noUsdSum = noUsdSum.toFixed(2); + usdSum = usdSum.toFixed(2); + + // 设置表单输入值 + $("input[name='enterprise']").val(enterprise); + $("input[name='enterpriseSum']").val(enterpriseSum); + $("input[name='noRmb']").val(noRmb); + $("input[name='noRmbSum']").val(noRmbSum); + $("input[name='rmb']").val(rmb); + $("input[name='rmbSum']").val(rmbSum); + $("input[name='noUsd']").val(noUsd); + $("input[name='noUsdSum']").val(noUsdSum); + $("input[name='usd']").val(usd); + $("input[name='usdSum']").val(usdSum); } function submitHandler() { if ($.validate.form()) { diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html index 56abf0c9..75ec7cf9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html @@ -175,6 +175,7 @@
+ @@ -188,35 +189,6 @@ var prefix = ctx + "system/customerQuote" var commonCurrency = $("#commonCurrency_edit option:selected").val(); $("#form-customerQuote-zozj").validate({focusCleanup: true}); - $(function() { - /*业务员列表*/ - $.ajax({ - url: ctx + 'system/salesOrder/getBinessMembers', - type: 'get', - success: function (res) { - console.log(res) - if (res.rows.length > 0) { - var usertData = res.rows; - for (let i in usertData) { - $("#form-customerQuote-zozj select[name='businessMembers']").append(""); - } - $("#form-customerQuote-zozj select[name='businessMembers']").val(sysCustomerQuote.businessMembers).trigger("change") - } else { - $.modal.msgError(res.msg); - } - } - }); - var confirmFax = $("input[name='confirmFax']"); - confirmFax.val([sysCustomerQuote.confirmFax]).attr("checked", "check"); - $("input[name='rmbTax']").val([sysCustomerQuote.taxRate]); - confirmFax.change(function () { - if ($("input[name='confirmFax']").val() == "1") { - $("input[name='rmbTax']").val(sysCustomerQuote.taxRate); - } else { - $("input[name='rmbTax']").val(0); - } - }); - }); $(function() { var options = { id: "bootstrap-table-Quote-child5", @@ -423,28 +395,43 @@ let noRmb = 0;let rmb = 0;let noRmbSum = 0; let rmbSum = 0;let noUsd = 0;let usd = 0; let noUsdSum = 0;let usdSum = 0; - for(var i=0;i sum + (parseInt(item.materialNum) || 0), 0); + + // 先累加数值,toFixed在累加后应用以避免精度损失 + for (let i = 0; i < getData.length; i++) { + noRmb += parseFloat(getData[i].materialNoRmb) || 0; + rmb += parseFloat(getData[i].materialRmb) || 0; + noRmbSum += parseFloat(getData[i].materialNoRmbSum) || 0; + rmbSum += parseFloat(getData[i].materialRmbSum) || 0; + noUsd += parseFloat(getData[i].materialNoUsd) || 0; + usd += parseFloat(getData[i].materialUsd) || 0; + noUsdSum += parseFloat(getData[i].materialNoUsdSum) || 0; + usdSum += parseFloat(getData[i].materialUsdSum) || 0; } - $("#enterprise_edit").val(enterprise); - $("#enterpriseSum_edit").val(enterpriseSum); - $("#noRmb_edit").val(noRmb); - $("#rmb_edit").val(rmb); - $("#noRmbSum_edit").val(noRmbSum); - $("#rmbSum_edit").val(rmbSum); - $("#noUsd_edit").val(noUsd); - $("#usd_edit").val(usd); - $("#noUsdSum_edit").val(noUsdSum); - $("#usdSum_edit").val(usdSum); + + // 将累加的结果格式化为两位小数 + noRmb = noRmb.toFixed(2); + rmb = rmb.toFixed(2); + noRmbSum = noRmbSum.toFixed(2); + rmbSum = rmbSum.toFixed(2); + noUsd = noUsd.toFixed(2); + usd = usd.toFixed(2); + noUsdSum = noUsdSum.toFixed(2); + usdSum = usdSum.toFixed(2); + + // 设置表单输入值 + $("input[name='enterprise']").val(enterprise); + $("input[name='enterpriseSum']").val(enterpriseSum); + $("input[name='noRmb']").val(noRmb); + $("input[name='noRmbSum']").val(noRmbSum); + $("input[name='rmb']").val(rmb); + $("input[name='rmbSum']").val(rmbSum); + $("input[name='noUsd']").val(noUsd); + $("input[name='noUsdSum']").val(noUsdSum); + $("input[name='usd']").val(usd); + $("input[name='usdSum']").val(usdSum); } function submitHandler() {