Browse Source

[feat] 销售管理

销售估价工程添加bom页面,前端新增删除方法,删除成功后自动刷新table数据
销售估价Controller新增根据销售估价详情ID删除一行数据后端接口
dev
liuxiaoxu 4 months ago
parent
commit
921045d728
  1. 12
      ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java
  2. 44
      ruoyi-admin/src/main/resources/templates/sales/estimate/engineeringAdd.html

12
ruoyi-admin/src/main/java/com/ruoyi/sales/controller/SalesEstimateController.java

@ -246,6 +246,18 @@ public class SalesEstimateController extends BaseController
}
/**
* 销售估价添加Bom-工程 删除物料
*/
@Log(title = "销售估价", businessType = BusinessType.DELETE)
@PostMapping("/removeEstimateDetailMaterial")
@ResponseBody
public AjaxResult removeEstimateDetailMaterial(Long estimateDetailMaterialId)
{
return toAjax(estimateDetailMaterialService.deleteSalesEstimateDetailMaterialById(estimateDetailMaterialId));
}
/**
* 新增采购成本 销售估价-采购

44
ruoyi-admin/src/main/resources/templates/sales/estimate/engineeringAdd.html

@ -320,7 +320,8 @@
$.table.init(options);
});
// 存储子表的状态
var childTableStates = {};
initChildTable = function(index, row, $detail) {
var parentRow = row;
var childTableId = 'child_table_'+index;
@ -339,6 +340,11 @@
field: 'estimateDetailId',
visible: false
},
{
title: '销售估价详情物料ID',
field: 'estimateDetailMaterialId',
visible: false
},
{
title: '物料名称',
field: 'materialName',
@ -366,12 +372,13 @@
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>';
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeDetailMaterialRow(\'' + row.estimateDetailMaterialId + '\')"><i class="fa fa-remove"></i>删除</a>';
}
}
],
});
// 设置子表的初始状态为展开
childTableStates[index] = true;
// 动态生成 form 表单
var formHtml = '<form class="form-inline" data-index="' + index + '">';
formHtml += '<h3>运输、服务、开发成本</h3>';
@ -421,6 +428,37 @@ function queryParams(params) {
}
//删除子表物料的数据
function removeDetailMaterialRow(estimateDetailMaterialId) {
$.modal.confirm("确定删除该条销售估价详情物料信息吗?", function() {
var url = prefix + "/removeEstimateDetailMaterial";
var data = { "estimateDetailMaterialId": estimateDetailMaterialId };
$.operate.submit(url, "post", "json", data, function(result) {
if (result.success) {
$.modal.msgSuccess(result.msg);
// 获取子表的实例
var childTableId = 'child_table_' + index;
var $childTable = $('#' + childTableId);
// 刷新子表
$childTable.bootstrapTable('refresh');
// 检查子表是否有数据
if ($childTable.bootstrapTable('getData').length === 0) {
// 如果没有数据则收起子表
$childTable.closest('.detail-row').find('.detail-icon').click();
childTableStates[index] = false; // 更新子表状态
}
} else {
$.modal.msgError(result.msg);
}
});
});
}
//form计算模块
function getTotalAmount(){
let getData = $('#bootstrap-table').bootstrapTable('getData');

Loading…
Cancel
Save