|
@ -129,7 +129,8 @@ |
|
|
return obj; |
|
|
return obj; |
|
|
}, {}); |
|
|
}, {}); |
|
|
|
|
|
|
|
|
|
|
|
// 设置一个标志来跟踪任何错误 |
|
|
|
|
|
var hasError = false; |
|
|
// 销售估价物料 |
|
|
// 销售估价物料 |
|
|
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
var estimateMaterialTable = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
|
|
|
|
|
@ -173,9 +174,43 @@ |
|
|
estimateMaterialDataList[index].materialGearPosition = value; // 更新料号档位 |
|
|
estimateMaterialDataList[index].materialGearPosition = value; // 更新料号档位 |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 遍历主表中的每一项 |
|
|
|
|
|
estimateMaterialTable.forEach(function(row, index) { |
|
|
|
|
|
var noTaxShippingCosts = $('#noTaxShippingCosts' + index).val(); |
|
|
|
|
|
var noTaxServiceCosts = $('#noTaxServiceCosts' + index).val(); |
|
|
|
|
|
|
|
|
|
|
|
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].noTaxShippingCosts = noTaxShippingCosts; |
|
|
|
|
|
estimateMaterialDataList[index].noTaxServiceCosts = noTaxServiceCosts; |
|
|
|
|
|
|
|
|
|
|
|
// 获取子表数据 |
|
|
|
|
|
if (row.childTableData) { |
|
|
|
|
|
// 如果子表数据存在,则合并到 estimateMaterialDataList 中 |
|
|
|
|
|
estimateMaterialDataList[index].salesEstimateDetailMaterialList = row.childTableData; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (hasError) { |
|
|
|
|
|
return; // 存在错误,阻止提交 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const combinedData = Object.assign({}, estimateData, { |
|
|
const combinedData = Object.assign({}, estimateData, { |
|
|
salesEstimateDetailList: estimateMaterialDataList, |
|
|
salesEstimateDetailList: estimateMaterialDataList, |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
// 合并表单数据和表格数据 |
|
|
// 合并表单数据和表格数据 |
|
|
console.log(combinedData) |
|
|
console.log(combinedData) |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
@ -222,6 +257,10 @@ |
|
|
showToggle: false, |
|
|
showToggle: false, |
|
|
showColumns: false, |
|
|
showColumns: false, |
|
|
modalName: "销售估价详情", |
|
|
modalName: "销售估价详情", |
|
|
|
|
|
detailView: true, |
|
|
|
|
|
onExpandRow : function(index, row, $detail) { |
|
|
|
|
|
initChildTable(index, row, $detail); |
|
|
|
|
|
}, |
|
|
editFiled:"noTaxRmb", |
|
|
editFiled:"noTaxRmb", |
|
|
columns: [ |
|
|
columns: [ |
|
|
{ |
|
|
{ |
|
@ -360,6 +399,81 @@ |
|
|
$.table.init(options); |
|
|
$.table.init(options); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 存储子表的状态 |
|
|
|
|
|
var childTableStates = {}; |
|
|
|
|
|
initChildTable = function(index, row, $detail) { |
|
|
|
|
|
var parentRow = row; |
|
|
|
|
|
var childTableId = 'child_table_'+index; |
|
|
|
|
|
$detail.html('<table id="'+childTableId+'"></table>'); |
|
|
|
|
|
$('#'+childTableId).bootstrapTable({ |
|
|
|
|
|
columns: [ |
|
|
|
|
|
{ |
|
|
|
|
|
title: '销售估价详情ID', |
|
|
|
|
|
field: 'estimateDetailId', |
|
|
|
|
|
visible: false |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
title: '销售估价详情物料ID', |
|
|
|
|
|
field: 'estimateDetailMaterialId', |
|
|
|
|
|
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: '操作', |
|
|
|
|
|
align: 'center', |
|
|
|
|
|
formatter: function (value, row, index) { |
|
|
|
|
|
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeDetailMaterialRow(\'' + row.estimateDetailMaterialId + '\')"><i class="fa fa-remove"></i>删除</a>'; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
], |
|
|
|
|
|
}).on('load-success.bs.table', function(data) { |
|
|
|
|
|
// 当子表加载完成后,将子表数据保存到主表行中 |
|
|
|
|
|
parentRow.childTableData = data.rows; |
|
|
|
|
|
}); |
|
|
|
|
|
// 设置子表的初始状态为展开 |
|
|
|
|
|
childTableStates[index] = true; |
|
|
|
|
|
// 动态生成 form 表单 |
|
|
|
|
|
var formHtml = '<form class="form-inline" data-index="' + index + '">'; |
|
|
|
|
|
formHtml += '<h3>运输、服务</h3>'; |
|
|
|
|
|
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 + '" placeholder="请输入运输成本">'; |
|
|
|
|
|
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 + '" placeholder="请输入服务成本">'; |
|
|
|
|
|
formHtml += '</div>'; |
|
|
|
|
|
formHtml += '</form>'; |
|
|
|
|
|
|
|
|
|
|
|
// 将 form 表单添加到子表下面 |
|
|
|
|
|
$detail.append(formHtml); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//逻辑新增一行物料数据 |
|
|
//逻辑新增一行物料数据 |
|
|
function estimateDoSubmit(index, layero, uniqueId) { |
|
|
function estimateDoSubmit(index, layero, uniqueId) { |
|
|
console.log(uniqueId); |
|
|
console.log(uniqueId); |
|
@ -401,7 +515,7 @@ |
|
|
materialUnit: rowData.unit, |
|
|
materialUnit: rowData.unit, |
|
|
materialProcessMethod: rowData.processMethod, |
|
|
materialProcessMethod: rowData.processMethod, |
|
|
materialDeptType: rowData.warehouseDept, |
|
|
materialDeptType: rowData.warehouseDept, |
|
|
materialNum: 0 |
|
|
materialNum: "" |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
$.modal.alertError("不能选择已添加过的相同物料"); |
|
|
$.modal.alertError("不能选择已添加过的相同物料"); |
|
|