Browse Source
修改销售估价列表页面:新增采购成本按钮,新增打开采购成本页面js方法 新增 采购成本前端页面 修改 根据销售估价详情ID获取销售估价详情物料价格集合后端接口:新增多个成本价格字段 销售估价实体类新增 销售估价详情物料集合 销售估价Controller层新增 新增Bom销售估价-采购后端接口;新增修改保存销售估价-采购后端接口:同时修改三个表格的数据; 销售估价详情物料新增查询所有详情物料价格后端接口 新增 物料详情子表包括form表单的数据Vo类dev
liuxiaoxu
4 months ago
11 changed files with 822 additions and 11 deletions
@ -0,0 +1,40 @@ |
|||
package com.ruoyi.sales.domain.VO; |
|||
|
|||
import com.ruoyi.sales.domain.SalesEstimateDetailMaterial; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
//物料详情子表包括form表单的数据
|
|||
@Data |
|||
public class SalesEstimateDetailMaterialVo extends SalesEstimateDetailMaterial { |
|||
/** 不含税运输成本(RMB) */ |
|||
private BigDecimal noTaxShippingCosts; |
|||
|
|||
/** 不含税服务成本(RMB) */ |
|||
private BigDecimal noTaxServiceCosts; |
|||
|
|||
/** 不含税开发成本(RMB) */ |
|||
private BigDecimal noTaxDevelopCosts; |
|||
|
|||
/** 不含税人工成本(RMB) */ |
|||
private BigDecimal noTaxLaborCosts; |
|||
|
|||
/** 不含税推广成本(RMB) */ |
|||
private BigDecimal noTaxPromotionalCosts; |
|||
|
|||
/** 不含税业务成本(RMB) */ |
|||
private BigDecimal noTaxBusinessCosts; |
|||
|
|||
/** 不含税管理成本(RMB) */ |
|||
private BigDecimal noTaxManagesCosts; |
|||
|
|||
/** 不含税总物料成本(RMB) */ |
|||
private BigDecimal noTaxMaterialCosts; |
|||
|
|||
/** 不含税经营成本(RMB) */ |
|||
private BigDecimal noTaxOperatingCosts; |
|||
|
|||
/** 含税经营成本(RMB) */ |
|||
private BigDecimal taxOperatingCosts; |
|||
} |
@ -0,0 +1,614 @@ |
|||
<!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-add" 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"> |
|||
<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"> |
|||
</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" id="materialSum_add" type="number" readonly/> |
|||
<label class=" col-sm-2">数量合计:</label><input class="col-sm-4" name="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 salesEstimateDetailVo = [[${salesEstimateDetailVo}]]; |
|||
var salesEstimate = [[${salesEstimate}]]; |
|||
|
|||
$("#form-estimate-add").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
function submitHandler() { |
|||
if ($.validate.form()) { |
|||
// 获取表单数据 |
|||
const estimateData = $("#form-estimate-add").serializeArray().reduce((obj, item) => { |
|||
obj[item.name] = item.value; |
|||
return obj; |
|||
}, {}); |
|||
|
|||
//设置一个标志来跟踪任何错误 |
|||
var hasError = false; |
|||
|
|||
// 销售估价物料 |
|||
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData'); |
|||
|
|||
|
|||
// 将表数据转换成与estimateData格式一致的数组 |
|||
var estimateMaterialDataList = estimateMaterialTable.map(function(item) { |
|||
// 根据实际字段名调整 |
|||
return { |
|||
"estimateDetailId": item.estimateDetailId, |
|||
"noTaxDevelopCosts": null, // 初始化为 null 或 0 |
|||
"noTaxShippingCosts": null, |
|||
"noTaxServiceCosts": null, |
|||
// ...其他字段 |
|||
}; |
|||
}); |
|||
|
|||
$('.form-inline[data-index]').each(function () { |
|||
var index = $(this).data('index'); // 获取数据索引 |
|||
var noTaxDevelopCosts = $('#noTaxDevelopCosts' + index).val(); |
|||
var noTaxShippingCosts = $('#noTaxShippingCosts' + index).val(); |
|||
var noTaxServiceCosts = $('#noTaxServiceCosts' + index).val(); |
|||
|
|||
// 检查成本值是否为空或仅为0 |
|||
if (!noTaxDevelopCosts && noTaxDevelopCosts !== '0') { |
|||
$.modal.alertWarning("开发成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的开发成本"); |
|||
hasError = true; |
|||
return; // 退出循环,阻止进一步处理 |
|||
} |
|||
if (!noTaxShippingCosts && noTaxShippingCosts !== '0') { |
|||
$.modal.alertWarning("运输成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的运输成本"); |
|||
hasError = true; |
|||
return; // 退出循环,阻止进一步处理 |
|||
} |
|||
if (!noTaxServiceCosts && noTaxServiceCosts !== '0') { |
|||
$.modal.alertWarning("服务成本不能为空,请填写第 " + (parseInt(index) + 1) + " 行的服务成本"); |
|||
hasError = true; |
|||
return; // 退出循环,阻止进一步处理 |
|||
} |
|||
|
|||
|
|||
// 更新 estimateMaterialDataList 中对应的记录 |
|||
estimateMaterialDataList[index].noTaxDevelopCosts = noTaxDevelopCosts; |
|||
estimateMaterialDataList[index].noTaxShippingCosts = noTaxShippingCosts; |
|||
estimateMaterialDataList[index].noTaxServiceCosts = noTaxServiceCosts; |
|||
}); |
|||
|
|||
if (hasError) { |
|||
return; // 存在错误,阻止提交 |
|||
} |
|||
|
|||
// 在需要收集所有子表数据的地方调用此函数 |
|||
var allSubData = getAllSubTablesData(); |
|||
|
|||
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|||
var childDataList = allSubData.map(function(item) { |
|||
|
|||
// 根据实际字段名调整 |
|||
return { |
|||
"estimateDetailMaterialId":item.estimateDetailMaterialId, |
|||
"noTaxPurchaseRmb": item.noTaxPurchaseRmb, |
|||
"taxPurchaseRmb": item.taxPurchaseRmb, |
|||
// ..其他字段 |
|||
}; |
|||
}); |
|||
|
|||
|
|||
const combinedData = Object.assign({}, estimateData, { |
|||
salesEstimateDetailList: estimateMaterialDataList, |
|||
estimateDetailMaterialList: childDataList, |
|||
// ...其他字段 |
|||
}); |
|||
// 合并表单数据和表格数据 |
|||
console.log(combinedData) |
|||
// 使用 JSON.stringify() 序列化数据 |
|||
const jsonData = JSON.stringify(combinedData); |
|||
// 发送 AJAX 请求到后端接口 |
|||
$.operate.saveJson(prefix + "/purchaseAdd", jsonData); |
|||
} |
|||
} |
|||
|
|||
$("input[name='pricingDate']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
autoclose: true |
|||
}); |
|||
|
|||
|
|||
|
|||
$(function() { |
|||
var options = { |
|||
url: prefix + "/getEstimateDetailList", |
|||
id:'bootstrap-table', |
|||
queryParams:queryParams, |
|||
showSearch: false, |
|||
showRefresh: false, |
|||
showToggle: false, |
|||
showColumns: false, |
|||
modalName: "销售估价详情", |
|||
detailView: true, |
|||
onExpandRow : function(index, row, $detail) { |
|||
initChildTable(index, row, $detail); |
|||
}, |
|||
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', |
|||
}, |
|||
{ |
|||
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 |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function(value, row, index) { |
|||
var actions = []; |
|||
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeMaterialRow(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|||
return actions.join(''); |
|||
} |
|||
}], |
|||
onEditableSave:function(field, row, oldValue, $el){ |
|||
// 确保getTotalAmount函数存在且正确引用 |
|||
getTotalAmount(); |
|||
}, |
|||
|
|||
}; |
|||
$.table.init(options); |
|||
}); |
|||
|
|||
|
|||
initChildTable = function(index, row, $detail) { |
|||
var parentRow = row; |
|||
var childTableId = 'child_table_'+index; |
|||
$detail.html('<table id="'+childTableId+'"></table>'); |
|||
$('#'+childTableId).bootstrapTable({ |
|||
url: prefix + "/getEstimateDetailMaterialList", |
|||
method: 'post', |
|||
sidePagination: "server", |
|||
contentType: "application/x-www-form-urlencoded", |
|||
queryParams : { |
|||
estimateDetailId:parentRow.estimateDetailId |
|||
}, |
|||
columns: [ |
|||
{ |
|||
title: '销售估价详情物料ID', |
|||
field: 'estimateDetailMaterialId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '销售估价详情ID', |
|||
field: 'estimateDetailId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '不含税开发成本', |
|||
field: 'noTaxDevelopCosts', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '不含税运输成本', |
|||
field: 'noTaxShippingCosts', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '不含税服务成本', |
|||
field: 'noTaxServiceCosts', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '物料名称', |
|||
field: 'materialName', |
|||
}, |
|||
{ |
|||
title: '物料类型', |
|||
field: 'materialType', |
|||
formatter: function(value, row, index) { |
|||
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|||
} |
|||
}, |
|||
{ |
|||
title: '物料单位', |
|||
field: 'materialUnit', |
|||
}, |
|||
{ |
|||
title: '物料描述', |
|||
field: 'materialDescribe', |
|||
}, |
|||
{ |
|||
title: '用量', |
|||
field: 'useNum', |
|||
}, |
|||
{ |
|||
title: '不含税采购单价(RMB)', |
|||
field: 'noTaxPurchaseRmb', |
|||
editable: { |
|||
type: 'text', |
|||
title: '不含税单价', |
|||
validate: function (value, row, index) { |
|||
if (!value) { |
|||
return '不含税采购单价不能为空'; |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
title: '含税采购单价(RMB)', |
|||
field: 'taxPurchaseRmb', |
|||
editable: { |
|||
type: 'text', |
|||
title: '含税单价', |
|||
validate: function (value, row, index) { |
|||
if (!value) { |
|||
return '含税采购单价不能为空'; |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
align: 'center', |
|||
formatter: function (value, row, index) { |
|||
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="deleteRow(\'' + row.shippingDeviceId + '\')"><i class="fa fa-remove"></i>删除</a>'; |
|||
} |
|||
} |
|||
], |
|||
|
|||
onLoadSuccess: function(data) { |
|||
// 初始化成本数据为一个空对象 |
|||
var costs = {}; |
|||
|
|||
// 如果 data 是一个对象,将其转换为单元素数组 |
|||
if (typeof data === 'object' && !Array.isArray(data)) { |
|||
data = [data]; |
|||
} |
|||
|
|||
// 检查数据是否有效 |
|||
if (data.length > 0 && data[0].rows && data[0].rows.length > 0) { |
|||
// 使用第一条数据 |
|||
var firstRow = data[0].rows[0]; |
|||
costs.noTaxDevelopCosts = firstRow.noTaxDevelopCosts || ''; |
|||
costs.noTaxShippingCosts = firstRow.noTaxShippingCosts || ''; |
|||
costs.noTaxServiceCosts = firstRow.noTaxServiceCosts || ''; |
|||
} else { |
|||
// 如果没有数据,设置所有成本字段为空字符串 |
|||
costs.noTaxDevelopCosts = ''; |
|||
costs.noTaxShippingCosts = ''; |
|||
costs.noTaxServiceCosts = ''; |
|||
} |
|||
|
|||
// 动态生成 form 表单 |
|||
var formHtml = '<form class="form-inline" data-index="' + index + '">'; |
|||
formHtml += '<h3>运输、服务、开发成本</h3>'; |
|||
formHtml += '<div class="form-group">'; |
|||
formHtml += '<label for="noTaxDevelopCosts' + index + '">不含税开发成本(RMB):</label>'; |
|||
formHtml += '<input type="text" class="form-control" id="noTaxDevelopCosts' + index + '" name="noTaxDevelopCosts' + index + '" value="' + costs.noTaxDevelopCosts + '">'; |
|||
formHtml += '</div>'; |
|||
formHtml += '<div class="form-group">'; |
|||
formHtml += '<label for="noTaxShippingCosts' + index + '">不含税运输成本(RMB):</label>'; |
|||
formHtml += '<input type="text" class="form-control" id="noTaxShippingCosts' + index + '" name="noTaxShippingCosts' + index + '" value="' + costs.noTaxShippingCosts + '">'; |
|||
formHtml += '</div>'; |
|||
formHtml += '<div class="form-group">'; |
|||
formHtml += '<label for="noTaxServiceCosts' + index + '">不含税服务成本(RMB):</label>'; |
|||
formHtml += '<input type="text" class="form-control" id="noTaxServiceCosts' + index + '" name="noTaxServiceCosts' + index + '" value="' + costs.noTaxServiceCosts + '">'; |
|||
formHtml += '</div>'; |
|||
formHtml += '</form>'; |
|||
|
|||
// 将 form 表单添加到子表下面 |
|||
$detail.append(formHtml); |
|||
} |
|||
}); |
|||
|
|||
}; |
|||
|
|||
|
|||
|
|||
function queryParams(params) { |
|||
var curParams = { |
|||
// 传递参数查询参数 |
|||
salesEstimateCode: salesEstimate.salesEstimateCode |
|||
}; |
|||
return curParams; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// 逻辑删除前端的一行数据 |
|||
function removeMaterialRow(materialNo){ |
|||
$("#bootstrap-table").bootstrapTable('remove', { |
|||
field: 'materialNo', |
|||
values: materialNo |
|||
}) |
|||
getTotalAmount(); |
|||
} |
|||
|
|||
|
|||
//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); |
|||
|
|||
} |
|||
|
|||
|
|||
function getAllSubTablesData() { |
|||
var allSubData = []; |
|||
// 获取所有被展开的行 |
|||
var parentLength = $("#bootstrap-table").bootstrapTable("getData").length; |
|||
for (let i = 0; i < parentLength; i++) { |
|||
var childTableId = "child_table_" + i; |
|||
var sonData = $('#' + childTableId).bootstrapTable("getData"); |
|||
|
|||
// 确保 sonData 是一个数组 |
|||
if (!Array.isArray(sonData)) { |
|||
sonData = []; // 如果 sonData 不是数组,将其转换为空数组 |
|||
} |
|||
|
|||
// 循环获取子表中存在的行数据,每个行数据转换添加到allSubData数组中 |
|||
sonData.forEach(function (item) { |
|||
item.tableId = childTableId; |
|||
allSubData.push(item); |
|||
}); |
|||
} |
|||
return allSubData; |
|||
} |
|||
|
|||
|
|||
// $(function() { |
|||
// $('#bootstrap-table').on('load-success.bs.table', function(e, data) { |
|||
// // 页面加载成功后,遍历所有行并初始化子表 |
|||
// $('#bootstrap-table').bootstrapTable('getSelections').forEach(function(row) { |
|||
// var $detail = $('#bootstrap-table').bootstrapTable('getRowDetail', row.fieldId); |
|||
// var estimateDetailId = row.estimateDetailId; |
|||
// if ($detail.length) { |
|||
// // 预加载子表数据 |
|||
// $detail.bootstrapTable({ |
|||
// url: prefix + "/getEstimateDetailMaterialList" + "?estimateDetailId=" + estimateDetailId, |
|||
// // 隐藏子表 |
|||
// initHidden: true, |
|||
// onLoadSuccess: function() { |
|||
// // 隐藏子表 |
|||
// $detail.hide(); |
|||
// }, |
|||
// // 子表其他配置 |
|||
// }); |
|||
// } |
|||
// }); |
|||
// }); |
|||
// |
|||
// // 重写 onExpandRow 方法 |
|||
// $('#bootstrap-table').bootstrapTable({ |
|||
// onExpandRow: function(index, row, $detail) { |
|||
// // 展开行时显示子表 |
|||
// $detail.show(); |
|||
// }, |
|||
// // 其他主表配置 |
|||
// }); |
|||
// }); |
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue