Browse Source
销售估价新增业务添加详情页面 销售估价新增业务添加详情按钮,新增打开业务添加详情js方法 销售估价Controller层:新增销售估价-业务详情后端接口;新增保存销售估价-业务详情后端接口;新增通用保存销售估价方法后端接口dev
5 changed files with 458 additions and 5 deletions
@ -0,0 +1,405 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('业务新增销售估价详情')" /> |
||||
|
<th:block th:include="include :: datetimepicker-css" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-estimate-addDetail" th:object="${salesEstimate}"> |
||||
|
<input name="salesEstimateId" th:field="*{salesEstimateId}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">业务员:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="businessMembers" id="businessMembers" th:field="*{businessMembers}" class="form-control" type="text" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">定价日期:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="input-group date"> |
||||
|
<input name="pricingDate" th:value="${#dates.format(salesEstimate.pricingDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled> |
||||
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">客户ID:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="enterpriseCode" th:field="*{enterpriseCode}" class="form-control" type="text" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">客户名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="enterpriseName" th:field="*{enterpriseName}" class="form-control" type="text" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label is-required">估价币种:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="commonCurrency" id="commonCurrency_add" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" disabled> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" required></option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label is-required">美元汇率:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<div class="input-group"> |
||||
|
<input name="usdRate" th:field="*{usdRate}" id="usdRate_add" class="form-control" type="text" required readonly> |
||||
|
<span class="input-group-addon">%</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-4 control-label">备注信息:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="remark" th:field="*{remark}" class="form-control" type="text" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="container"> |
||||
|
<h4 class="form-header h4">计算</h4> |
||||
|
<div class="col-xs-12 form-row"> |
||||
|
<label class=" col-sm-2">物料合计:</label><input class="col-sm-4" name="materialSum" th:field="*{materialSum}" id="materialSum_add" type="number" readonly/> |
||||
|
<label class=" col-sm-2">数量合计:</label><input class="col-sm-4" name="enterpriseSum" th:field="*{enterpriseSum}" id="enterpriseSum_add" type="number" readonly/> |
||||
|
</div> |
||||
|
<div class="col-xs-12 form-row"> |
||||
|
<label class="col-sm-2"> 不含税单价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="noTaxRmb" id="noTaxRmb_add" type="number" readonly/> |
||||
|
<label class="col-sm-2"> 不含税总价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="allNoTaxRmb" id="allNoTaxRmb_add" type="number" readonly/> |
||||
|
</div> |
||||
|
<div class="col-xs-12 form-row"> |
||||
|
<label class="col-sm-2"> 含税单价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="taxRmb" id="taxRmb_add" type="number" readonly/> |
||||
|
<label class="col-sm-2"> 含税总价(RMB):</label><input placeholder="RMB" class="col-sm-4" name="allTaxRmb" id="allTaxRmb_add" type="number" readonly/> |
||||
|
</div> |
||||
|
<div class="col-xs-12"> |
||||
|
<label class="col-sm-2">不含税单价(USD):</label><input placeholder="美元" class="col-sm-4" name="noTaxDollar" id="noTaxDollar_add" type="number" readonly/> |
||||
|
<label class="col-sm-2">不含税总价(USD):</label><input placeholder="美元" class="col-sm-4" name="allNoTaxDollar" id="allNoTaxDollar_add" type="number" readonly/> |
||||
|
</div> |
||||
|
<div class="col-xs-12 form-row"> |
||||
|
<label class="col-sm-2">含税单价(USD):</label><input placeholder="美元" class="col-sm-4" name="taxDollar" id="taxDollar_add" type="number" readonly/> |
||||
|
<label class="col-sm-2">含税总价(USD):</label><input placeholder="美元" class="col-sm-4" name="allTaxDollar" id="allTaxDollar_add" type="number" readonly/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
|
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<th:block th:include="include :: datetimepicker-js" /> |
||||
|
<th:block th:include="include::bootstrap-table-editable-js"/> |
||||
|
<script th:inline="javascript"> |
||||
|
var prefix = ctx + "sales/estimate" |
||||
|
var materialGearPositionDatas = [[${@dict.getType('material_gear_position')}]]; |
||||
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
||||
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
||||
|
|
||||
|
var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; |
||||
|
|
||||
|
|
||||
|
$("#form-estimate-addDetail").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
var data = $("#form-estimate-addDetail").serialize(); |
||||
|
$.operate.save(prefix + "/addDetail", data) |
||||
|
} |
||||
|
|
||||
|
$("input[name='pricingDate']").datetimepicker({ |
||||
|
format: "yyyy-mm-dd", |
||||
|
minView: "month", |
||||
|
autoclose: true |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
$(function() { |
||||
|
$("#businessMembers").val(loginName); |
||||
|
var options = { |
||||
|
url: prefix + "/getEstimateDetailList", |
||||
|
id:'bootstrap-table', |
||||
|
queryParams:queryParams, |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
modalName: "销售估价详情", |
||||
|
editFiled:"noTaxRmb", |
||||
|
columns: [ |
||||
|
{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '销售估价详情ID', |
||||
|
field: 'estimateDetailId', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '料号', |
||||
|
field: 'materialNo', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料名称', |
||||
|
field: 'materialName', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料类型', |
||||
|
field: 'materialType', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '图片地址', |
||||
|
field: 'materialPhotoUrl', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料单位', |
||||
|
field: 'materialUnit', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料品牌', |
||||
|
field: 'materialBrand', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料描述', |
||||
|
field: 'materialDescribe', |
||||
|
}, |
||||
|
{ |
||||
|
title: '加工方式', |
||||
|
field: 'materialProcessMethod', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(processMethodDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '料号档位', |
||||
|
field: 'materialGearPosition', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(materialGearPositionDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料数量', |
||||
|
field: 'materialNum', |
||||
|
editable: true, |
||||
|
}, |
||||
|
{ |
||||
|
title: '不含税单价', |
||||
|
field: 'noTaxRmb', |
||||
|
}, |
||||
|
{ |
||||
|
title: '含税单价', |
||||
|
field: 'taxRmb', |
||||
|
}, |
||||
|
{ |
||||
|
title: '不含税总价', |
||||
|
field: 'allNoTaxRmb', |
||||
|
}, |
||||
|
{ |
||||
|
title: '含税总价', |
||||
|
field: 'allTaxRmb', |
||||
|
}, |
||||
|
{ |
||||
|
title: '含税单价', |
||||
|
field: 'taxDollar', |
||||
|
}, |
||||
|
{ |
||||
|
title: '不含税单价', |
||||
|
field: 'noTaxDollar', |
||||
|
}, |
||||
|
{ |
||||
|
title: '含税总价', |
||||
|
field: 'allTaxDollar', |
||||
|
}, |
||||
|
{ |
||||
|
title: '不含税总价', |
||||
|
field: 'allNoTaxDollar', |
||||
|
}, |
||||
|
{ |
||||
|
title: '入库部门', |
||||
|
field: 'warehouseDept', |
||||
|
visible:false |
||||
|
}], |
||||
|
onEditableSave:function(field, row, oldValue, $el){ |
||||
|
// 确保getTotalAmount函数存在且正确引用 |
||||
|
getTotalAmount(); |
||||
|
}, |
||||
|
|
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
function queryParams(params) { |
||||
|
var curParams = { |
||||
|
// 传递参数查询参数 |
||||
|
salesEstimateCode: salesEstimate.salesEstimateCode |
||||
|
}; |
||||
|
return curParams; |
||||
|
} |
||||
|
|
||||
|
// 逻辑删除前端的一行数据 |
||||
|
function removeMaterialRow(materialNo){ |
||||
|
$("#bootstrap-table").bootstrapTable('remove', { |
||||
|
field: 'materialNo', |
||||
|
values: materialNo |
||||
|
}) |
||||
|
getTotalAmount(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 假设的加载客户编号列表函数 |
||||
|
function loadCustomerIds() { |
||||
|
var url = ctx + 'system/customer/getCustomers'; |
||||
|
|
||||
|
$.ajax({ |
||||
|
type: 'GET', // 请求类型 |
||||
|
url: url, // 后端接口URL |
||||
|
dataType: 'json', // 预期服务器返回的数据类型 |
||||
|
success: function(data) { |
||||
|
if (data && Array.isArray(data)) { |
||||
|
var selectElement = $('#enterpriseCode'); // 获取客户编号下拉框元素 |
||||
|
|
||||
|
// 清空下拉框现有选项 |
||||
|
selectElement.empty(); |
||||
|
|
||||
|
// 添加默认选项(如果需要) |
||||
|
selectElement.append('<option value="">请选择客户编号</option>'); |
||||
|
|
||||
|
// 遍历返回的数据,添加为下拉框的选项 |
||||
|
$.each(data, function(index, item) { |
||||
|
// 假设item有id和name两个属性,分别代表客户ID和客户编号 |
||||
|
selectElement.append('<option value="' + item.customerId + '">' + item.customerId + '</option>'); |
||||
|
}); |
||||
|
} else { |
||||
|
$.modal.errMsg("数据为空"); |
||||
|
} |
||||
|
}, |
||||
|
// error: function(jqXHR, textStatus, errorThrown) { |
||||
|
// console.error('Failed to fetch customer IDs: ' + textStatus + ', ' + errorThrown); |
||||
|
// } |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//获取客户信息 |
||||
|
$(document).ready(function() { |
||||
|
// 初始化时默认加载客户编号列表 |
||||
|
loadCustomerIds(); |
||||
|
|
||||
|
// 监听客户编号下拉框的变化 |
||||
|
$('#enterpriseCode').on('change', function() { |
||||
|
var selectedEnterpriseCode = $(this).val(); // 获取选中的客户ID |
||||
|
if (selectedEnterpriseCode) { |
||||
|
// 发起Ajax请求获取客户名称 |
||||
|
$.ajax({ |
||||
|
type: 'GET', |
||||
|
url: ctx +'system/customer/getCustomerNameByEnterpriseCode/' + selectedEnterpriseCode, // 替换为你的实际API路径 |
||||
|
dataType: 'json', // 假设返回的数据格式是JSON |
||||
|
success: function(data) { |
||||
|
console.log(data); |
||||
|
// 将获取到的客户名称填充到输入框 |
||||
|
if(data.data == null){ |
||||
|
// 如果返回的数据有问题,可以给出提示或处理 |
||||
|
$.modal.msgError("未能获取到客户名称!"); |
||||
|
} |
||||
|
$('input[name="enterpriseName"]').val(data.data.customerName); |
||||
|
}, |
||||
|
error: function(jqXHR, textStatus, errorThrown) { |
||||
|
console.error('Error:', textStatus, errorThrown); |
||||
|
$.modal.msgError("查询客户名称时发生错误!"); |
||||
|
} |
||||
|
}); |
||||
|
} else { |
||||
|
// 如果没有选择客户ID,清空客户名称输入框 |
||||
|
$('input[name="enterpriseName"]').val(''); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// $(document).ready(function() { |
||||
|
// // 监听表格中的物料数量输入框的变化 |
||||
|
// $('#bootstrap-table').on('input', '.material-num-input', function() { |
||||
|
// getTotalAmount(); |
||||
|
// }); |
||||
|
// |
||||
|
// // 初始加载时也计算一次 |
||||
|
// getTotalAmount(); |
||||
|
// }); |
||||
|
// |
||||
|
// function getTotalAmount() { |
||||
|
// let getData = $('#bootstrap-table').bootstrapTable('getData'); |
||||
|
// let enterpriseSum = 0; |
||||
|
// |
||||
|
// // 计算物料数量总和 |
||||
|
// enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0); |
||||
|
// |
||||
|
// // 更新页面上的输入框 |
||||
|
// $("#enterpriseSum_add").val(enterpriseSum); |
||||
|
// } |
||||
|
|
||||
|
|
||||
|
|
||||
|
//form计算模块 |
||||
|
function getTotalAmount(){ |
||||
|
let getData = $('#bootstrap-table').bootstrapTable('getData'); |
||||
|
var materialSum = 0; |
||||
|
var enterpriseSum = 0; |
||||
|
var noTaxRmb = 0; |
||||
|
var taxRmb = 0; |
||||
|
var allNoTaxRmb = 0; |
||||
|
var allTaxRmb = 0; |
||||
|
var noTaxDollar = 0; |
||||
|
var taxDollar = 0; |
||||
|
var allNoTaxDollar = 0; |
||||
|
var allTaxDollar = 0; |
||||
|
materialSum = getData.length; |
||||
|
|
||||
|
enterpriseSum = getData.reduce((sum, item) => sum + (parseInt(item.materialNum) || 0), 0); |
||||
|
for(var i=0;i<getData.length;i++){ |
||||
|
noTaxRmb += parseFloat(getData[i].noTaxRmb) || 0; |
||||
|
taxRmb += parseFloat(getData[i].taxRmb) || 0; |
||||
|
allNoTaxRmb += parseFloat(getData[i].allNoTaxRmb) || 0; |
||||
|
allTaxRmb += parseFloat(getData[i].allTaxRmb) || 0; |
||||
|
noTaxDollar += parseFloat(getData[i].noTaxDollar) || 0; |
||||
|
taxDollar += parseFloat(getData[i].taxDollar) || 0; |
||||
|
allNoTaxDollar += parseFloat(getData[i].allNoTaxDollar) || 0; |
||||
|
allTaxDollar += parseFloat(getData[i].allTaxDollar) || 0; |
||||
|
} |
||||
|
noTaxRmb = noTaxRmb.toFixed(2); |
||||
|
taxRmb = taxRmb.toFixed(2); |
||||
|
allNoTaxRmb = allNoTaxRmb.toFixed(2); |
||||
|
allTaxRmb = allTaxRmb.toFixed(2); |
||||
|
noTaxDollar = noTaxDollar.toFixed(2); |
||||
|
taxDollar = taxDollar.toFixed(2); |
||||
|
allNoTaxDollar = allNoTaxDollar.toFixed(2); |
||||
|
allTaxDollar = allTaxDollar.toFixed(2); |
||||
|
$("input[name='materialSum']").val(materialSum); |
||||
|
$("input[name='enterpriseSum']").val(enterpriseSum); |
||||
|
$("input[name='noTaxRmb']").val(noTaxRmb); |
||||
|
$("input[name='taxRmb']").val(taxRmb); |
||||
|
$("input[name='allNoTaxRmb']").val(allNoTaxRmb); |
||||
|
$("input[name='allTaxRmb']").val(allTaxRmb); |
||||
|
$("input[name='noTaxDollar']").val(noTaxDollar); |
||||
|
$("input[name='taxDollar']").val(taxDollar); |
||||
|
$("input[name='allNoTaxDollar']").val(allNoTaxDollar); |
||||
|
$("input[name='allTaxDollar']").val(allTaxDollar); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue