From e94d3ede9abe9bbcaa1b4f2ae28e098418d35841 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Thu, 26 Sep 2024 13:43:20 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E5=B7=A5=E7=A8=8B=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7=E4=BF=AE=E6=94=B9=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9C=80=E6=96=B0=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7(RMB)=E3=80=81=E6=9C=80=E6=96=B0=E6=8A=A5=E4=BB=B7(?= =?UTF-8?q?=E7=BE=8E=E5=85=83)=E3=80=81=E5=92=8C=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=8C=89=E9=92=AE=EF=BC=9B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=B7=BB=E5=8A=A0=E7=89=A9=E6=96=99=E4=B8=BA?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=B7=BB=E5=8A=A0=EF=BC=9B=E6=9F=A5=E6=89=BE?= =?UTF-8?q?=E6=9C=80=E6=96=B0=E7=9A=84=E6=8A=A5=E4=BB=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84js=E6=96=B9=E6=B3=95=EF=BC=9B=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=96=B0=E5=A2=9E=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=BC=82=E6=AD=A5=E5=A4=84=E7=90=86=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E8=8E=B7=E5=8F=96=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7RM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=8C=89=E9=92=AE=EF=BC=9B?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9C=80=E6=96=B0=E6=8A=A5=E4=BB=B7(RMB)?= =?UTF-8?q?=E3=80=81=E6=9C=80=E6=96=B0=E6=8A=A5=E4=BB=B7(=E7=BE=8E?= =?UTF-8?q?=E5=85=83)=E3=80=81=E5=92=8C=E6=9C=80=E6=96=B0=E6=8A=A5?= =?UTF-8?q?=E4=BB=B7=E5=8E=86=E5=8F=B2=E6=8C=89=E9=92=AE=EF=BC=9B=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=AE=A2=E6=88=B7=E6=8A=A5=E4=BB=B7?= =?UTF-8?q?=E5=8E=86=E5=8F=B2=E9=A1=B5=E9=9D=A2=EF=BC=9A=E5=8E=BB=E6=8E=89?= =?UTF-8?q?table=E4=B8=8A=E5=A4=9A=E4=BD=99=E7=9A=84=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/customerQuote/detail.html | 92 ++------- .../templates/system/customerQuote/edit.html | 190 ++++++++++++++---- .../customerQuote/recentQuotationHistory.html | 3 + .../system/customerQuote/taskModifyApply.html | 171 ++++++++++++---- .../system/customerQuote/taskYwjlVerify.html | 102 ++-------- .../system/customerQuote/taskYwzgVerify.html | 101 ++-------- .../system/customerQuote/taskZozjVerify.html | 102 ++-------- 7 files changed, 372 insertions(+), 389 deletions(-) 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 70db2877..7d11c970 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/detail.html @@ -196,92 +196,28 @@ } }, { title: '对外售价',field: 'materialSole', - editable: { - type: 'number', - mode: 'inline', - title: '对外售价', - validate: function (value) { - if (!value) { - return '对外售价不能为空'; - } - if (isNaN(value)) { - return '对外售价必须为数字'; - } - } + }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); } }, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', 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: 'materialNoRmb', align: 'center', - editable:{ - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(RMB)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的不含税单价(美元)', field: 'materialNoUsd', align: 'center', - editable: { - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(美元)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'}, @@ -373,6 +309,16 @@ $("#noUsdSum_detail").val(noUsdSum); $("#usdSum_detail").val(usdSum); } + + function recentQuotationHistory(materialCode){ + var customerCode = $("#customerCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = prefix + '/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } \ No newline at end of file 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 609553aa..a9fa7f8f 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/edit.html @@ -251,6 +251,16 @@ } } }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); + } + }, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', align: 'center',}, {field: 'materialNum',align: 'center',title: '物料的数量', @@ -404,46 +414,139 @@ } } } - function doSubmit(index, layero,uniqueId){ + function doSubmit(index, layero, uniqueId) { console.log(uniqueId); var iframeWin = window[layero.find('iframe')[0]['name']]; - var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; - console.log("rowData: "+rowData); - let enterpriseSum = $("#enterpriseSum").val(); - $("#enterpriseSum").val((enterpriseSum==''?0:enterpriseSum) + 1); - var timestamp = new Date().getTime(); - var totalNum = $("#bootstrap-table-Quote-child-edit1").bootstrapTable('getData').length; - $("#bootstrap-table-Quote-child-edit1").bootstrapTable('insertRow', { - index: totalNum, - row: { - id:'', - quoteId:$("#supplierCode").val(), - materialId:rowData.id, - materialCode: rowData.materialNo, - materialName: rowData.materialName, - materialType: rowData.materialType, - describe: rowData.describe, - brand: rowData.brand, - photoUrl: rowData.photoUrl, - unit: rowData.unit, - processMethod: rowData.processMethod, - countTax: '', - usdTax: '', - materialSole: "", - materialRmb: "", - materialNum: "", - materialNoRmb: "", - materialNoUsd: "", - materialRmb: "", - materialNoRmbSum: "", - materialRmbSum: "", - materialUsd: "", - materialUsdSum: "", - materialNoUsdSum: "", - remark: "", + var selectedRows = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections'); + + if (selectedRows.length === 0) { + $.modal.alertError("请选择至少一条物料信息"); + return; + } + + var existingData = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData'); + var promises = []; + + // 存储要插入的新行 + var newRows = []; + + // 遍历选中的每一行物料信息 + for (var i = 0; i < selectedRows.length; i++) { + var rowData = selectedRows[i]; + + // 检查是否已经存在相同的物料 + var isDuplicate = false; + for (var j = 0; j < existingData.length; j++) { + if (existingData[j].materialCode === rowData.materialNo) { + isDuplicate = true; + break; + } + } + + if (!isDuplicate) { + // 如果不存在,则准备插入新行,并发起查询请求 + promises.push(queryRecentQuotation(rowData.materialNo).then(function (quotationData) { + // 将查询结果赋值给 newRows 中的相应字段 + return { + materialId: rowData.id, + materialCode: rowData.materialNo, + materialName: rowData.materialName, + materialType: rowData.materialType, + describe: rowData.describe, + brand: rowData.brand, + unit: rowData.unit, + processMethod: rowData.processMethod, + photoUrl: rowData.photoUrl, + countTax: '', + usdTax: '', + materialNum: "", + materialSole: "", + recentQuotationRMB: quotationData.data.materialRmb || '', + recentQuotationUSD: quotationData.data.materialUsd || '', + materialRmb: "", + materialNoRmb: "", + materialNoUsd: "", + materialUsd: "", + materialUsdSum: "", + materialNoUsdSum: "", + materialNoRmbSum: "", + materialRmbSum: "", + createBy: "", + createTime: "", + updateBy: "", + updateTime: "", + remark: "", + }; + }).catch(function (error) { + // 返回一个默认对象以保证数据结构一致 + return { + materialId: rowData.id, + materialCode: rowData.materialNo, + materialName: rowData.materialName, + materialType: rowData.materialType, + describe: rowData.describe, + brand: rowData.brand, + unit: rowData.unit, + processMethod: rowData.processMethod, + photoUrl: rowData.photoUrl, + countTax: '', + usdTax: '', + materialNum: "", + materialSole: "", + recentQuotationRMB: '', + recentQuotationUSD: '', + materialRmb: "", + materialNoRmb: "", + materialNoUsd: "", + materialUsd: "", + materialUsdSum: "", + materialNoUsdSum: "", + materialNoRmbSum: "", + materialRmbSum: "", + createBy: "", + createTime: "", + updateBy: "", + updateTime: "", + remark: "", + }; + })); + } else { + $.modal.alertError("不能选择已添加过的相同料号"); } - }) - layer.close(index); + } + + // 使用Promise.all等待所有查询完成 + Promise.all(promises).then(function (rows) { + newRows = rows.filter(row => !!row); // 清除可能的null或undefined + if (newRows.length > 0) { + // 批量插入新行 + for (var k = 0; k < newRows.length; k++) { + $("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', { index: 1, row: newRows[k] }); + } + } + layer.close(index); + }).catch(function (error) { + console.error('Some requests failed:', error); + layer.close(index); + }); + } + + // 查找最新的报价数据 + function queryRecentQuotation(materialNo) { + return new Promise((resolve, reject) => { + // 使用AJAX请求从服务器获取最近的报价信息 + $.ajax({ + url: prefix + '/queryLatestRecentQuotation', // 假设这是你的API路径 + type: 'GET', + data: { materialNo: materialNo, customerCode: $("#customerCode").val() }, + success: function (data) { + resolve(data); // 成功时解析数据 + }, + error: function (jqXHR, textStatus, errorThrown) { + reject(new Error('查找最新报价数据失败')); // 失败时抛出错误 + } + }); + }); } function insertRow() { var url = ctx + "erp/material/select"; @@ -502,6 +605,19 @@ function toPercentage(numerator, denominator) { return (numerator / denominator) * 100 + '%'; } + + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#customerCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = prefix + '/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html index d27fcc3e..9048c2b3 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html @@ -24,6 +24,9 @@ var options = { url: prefix + "/recentQuotationHistoryList", modalName: "客户报价历史", + showSearch: false, + showRefresh: false, + showToggle: false, queryParams: { materialCode: materialCode, customerCode: customerCode diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html index 375f1517..532f4474 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskModifyApply.html @@ -269,6 +269,8 @@ } } }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', align: 'center',}, {field: 'materialNum',align: 'center',title: '物料的数量', @@ -439,46 +441,143 @@ } } - function doSubmit(index, layero,uniqueId){ + function doSubmit(index, layero, uniqueId) { console.log(uniqueId); var iframeWin = window[layero.find('iframe')[0]['name']]; - var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; - console.log("rowData: "+rowData); - let enterpriseSum = $("#enterpriseSum").val(); - $("#enterpriseSum").val((enterpriseSum==''?0:enterpriseSum) + 1); - var timestamp = new Date().getTime(); - var totalNum = $("#bootstrap-table-Quote-child2").bootstrapTable('getData').length; - $("#bootstrap-table-Quote-child2").bootstrapTable('insertRow', { - index: totalNum, - row: { - id:'', - quoteId:$("#supplierCode").val(), - materialId:rowData.id, - materialCode: rowData.materialNo, - materialName: rowData.materialName, - materialType: rowData.materialType, - describe: rowData.describe, - brand: rowData.brand, - photoUrl: rowData.photoUrl, - unit: rowData.unit, - processMethod: rowData.processMethod, - countTax: '', - usdTax: '', - materialSole: "", - materialNum: "", - materialNoRmb: "", - materialNoUsd: "", - materialRmb: "", - materialNoRmbSum: "", - materialRmbSum: "", - materialUsd: "", - materialUsdSum: "", - materialNoUsdSum: "", - remark: "", + var selectedRows = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections'); + + if (selectedRows.length === 0) { + $.modal.alertError("请选择至少一条物料信息"); + return; + } + + var existingData = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData'); + var promises = []; + + // 存储要插入的新行 + var newRows = []; + + // 遍历选中的每一行物料信息 + for (var i = 0; i < selectedRows.length; i++) { + var rowData = selectedRows[i]; + + // 检查是否已经存在相同的物料 + var isDuplicate = false; + for (var j = 0; j < existingData.length; j++) { + if (existingData[j].materialCode === rowData.materialNo) { + isDuplicate = true; + break; + } + } + + if (!isDuplicate) { + // 如果不存在,则准备插入新行,并发起查询请求 + promises.push(queryRecentQuotation(rowData.materialNo).then(function (quotationData) { + // 将查询结果赋值给 newRows 中的相应字段 + return { + materialId: rowData.id, + materialCode: rowData.materialNo, + materialName: rowData.materialName, + materialType: rowData.materialType, + describe: rowData.describe, + brand: rowData.brand, + unit: rowData.unit, + processMethod: rowData.processMethod, + photoUrl: rowData.photoUrl, + countTax: '', + usdTax: '', + materialNum: "", + materialSole: "", + recentQuotationRMB: quotationData.data.materialRmb || '', + recentQuotationUSD: quotationData.data.materialUsd || '', + materialRmb: "", + materialNoRmb: "", + materialNoUsd: "", + materialUsd: "", + materialUsdSum: "", + materialNoUsdSum: "", + materialNoRmbSum: "", + materialRmbSum: "", + createBy: "", + createTime: "", + updateBy: "", + updateTime: "", + remark: "", + }; + }).catch(function (error) { + // 返回一个默认对象以保证数据结构一致 + return { + materialId: rowData.id, + materialCode: rowData.materialNo, + materialName: rowData.materialName, + materialType: rowData.materialType, + describe: rowData.describe, + brand: rowData.brand, + unit: rowData.unit, + processMethod: rowData.processMethod, + photoUrl: rowData.photoUrl, + countTax: '', + usdTax: '', + materialNum: "", + materialSole: "", + recentQuotationRMB: '', + recentQuotationUSD: '', + materialRmb: "", + materialNoRmb: "", + materialNoUsd: "", + materialUsd: "", + materialUsdSum: "", + materialNoUsdSum: "", + materialNoRmbSum: "", + materialRmbSum: "", + createBy: "", + createTime: "", + updateBy: "", + updateTime: "", + remark: "", + }; + })); + } else { + $.modal.alertError("不能选择已添加过的相同料号"); + } + } + + // 使用Promise.all等待所有查询完成 + Promise.all(promises).then(function (rows) { + newRows = rows.filter(row => !!row); // 清除可能的null或undefined + if (newRows.length > 0) { + // 批量插入新行 + for (var k = 0; k < newRows.length; k++) { + $("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', { index: 1, row: newRows[k] }); + } } - }) - layer.close(index); + layer.close(index); + }).catch(function (error) { + console.error('Some requests failed:', error); + layer.close(index); + }); } + + // 查找最新的报价数据 + function queryRecentQuotation(materialNo) { + return new Promise((resolve, reject) => { + // 使用AJAX请求从服务器获取最近的报价信息 + $.ajax({ + url: prefix + '/queryLatestRecentQuotation', // 假设这是你的API路径 + type: 'GET', + data: { materialNo: materialNo, customerCode: $("#customerCode").val() }, + success: function (data) { + resolve(data); // 成功时解析数据 + }, + error: function (jqXHR, textStatus, errorThrown) { + reject(new Error('查找最新报价数据失败')); // 失败时抛出错误 + } + }); + }); + } + + + function insertRow() { var url = ctx + "erp/material/select"; var options = { 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 b506e85d..003dd549 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwjlVerify.html @@ -164,14 +164,6 @@
-
-
- 选择报价信息 - - 添加物料 - -
-
@@ -247,92 +239,28 @@ } }, { title: '对外售价',field: 'materialSole', - editable: { - type: 'number', - mode: 'inline', - title: '对外售价', - validate: function (value) { - if (!value) { - return '对外售价不能为空'; - } - if (isNaN(value)) { - return '对外售价必须为数字'; - } - } + }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); } }, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', align: 'center',}, {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', - editable:{ - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(RMB)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的不含税单价(美元)', field: 'materialNoUsd', align: 'center', - editable: { - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(美元)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'}, @@ -523,6 +451,18 @@ } } + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#customerCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = prefix + '/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwzgVerify.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwzgVerify.html index 7b620d69..d38ea836 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwzgVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskYwzgVerify.html @@ -166,14 +166,6 @@
-
-
- 选择报价信息 - - 添加物料 - -
-
@@ -269,92 +261,28 @@ } }, { title: '对外售价',field: 'materialSole', - editable: { - type: 'number', - mode: 'inline', - title: '对外售价', - validate: function (value) { - if (!value) { - return '对外售价不能为空'; - } - if (isNaN(value)) { - return '对外售价必须为数字'; - } - } + }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); } }, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', align: 'center',}, {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', - editable:{ - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(RMB)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的不含税单价(美元)', field: 'materialNoUsd', align: 'center', - editable: { - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(美元)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'}, @@ -482,6 +410,17 @@ } } + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#customerCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = prefix + '/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file 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 79c69432..4e466ee8 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/taskZozjVerify.html @@ -168,14 +168,6 @@
-
-
- 选择报价信息 - - 添加物料 - -
-
@@ -250,92 +242,28 @@ } }, { title: '对外售价',field: 'materialSole', - editable: { - type: 'number', - mode: 'inline', - title: '对外售价', - validate: function (value) { - if (!value) { - return '对外售价不能为空'; - } - if (isNaN(value)) { - return '对外售价必须为数字'; - } - } + }, + { title: '最新报价(RMB)',field: 'recentQuotationRMB',align: 'center',}, + { title: '最新报价(美元)',field: 'recentQuotationUSD',align: 'center',}, + { title: '最新报价历史',align: 'center', + + formatter: function (value, row, index) { + var actions = []; + actions.push('最新报价历史 '); + return actions.join(''); } }, {title: '国内税率',field: 'countTax',align: 'center',}, { title: '美元汇率',field: 'usdTax', 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: 'materialNoRmb', align: 'center', - editable:{ - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '1'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(RMB)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的不含税单价(美元)', field: 'materialNoUsd', align: 'center', - editable: { - type: 'text', // 使用'text'类型,因为我们需自定义验证小数 - mode: 'inline', - enabled: function() { - return ($("#commonCurrency_add").val() === '2'); // 当货币类型为2时启用 - }, - title: '物料的不含税单价(美元)', - validate: function(value) { - // 验证是否为空 - if (!value) { - return '金额不能为空'; - } - // 尝试转换为浮点数并检查是否成功 - var num = parseFloat(value); - if (isNaN(num)) { - return '请输入有效的数字'; - } - // 检查小数点后是否有超过两位的数字 - var decimalPart = num.toString().split('.')[1]; // 获取小数部分 - if (decimalPart && decimalPart.length > 2) { - return '请输入精确到小数点后两位的数字'; - } - } - } }, {title: '物料的含税单价(RMB)',field: 'materialRmb',align: 'center'}, {title: '物料的含税总价(RMB)',field: 'materialNoRmbSum',align: 'center'}, @@ -455,6 +383,18 @@ $.operate.save(prefix + "/complete/" + taskId, $('#form-customerQuote-zozj').serialize()); } } + + //最新报价历史 + function recentQuotationHistory(materialCode){ + var customerCode = $("#customerCode").val(); + var queryParams = new URLSearchParams(); + queryParams.append("materialCode", materialCode); + queryParams.append("customerCode", encodeURIComponent(customerCode)); + var url = prefix + '/recentQuotationHistory?'+queryParams.toString(); + + $.modal.open("最新报价历史", url); + } + \ No newline at end of file