Browse Source

[fix] 销售管理

修改销售估计的业务添加物料页面:修改新增物料的前端方法:支持多选物料添加,新增选择添加物料的时候进行判断,如果当前列表已经存在相同料号的物料,进行提示并过滤相同料号的物料
去掉物料选择页面限制为单选的条件
dev
liuxiaoxu 3 weeks ago
parent
commit
bbb5a30997
  1. 71
      ruoyi-admin/src/main/resources/templates/sales/estimate/add.html
  2. 1
      ruoyi-admin/src/main/resources/templates/sales/estimate/estimateMaterialSelect.html

71
ruoyi-admin/src/main/resources/templates/sales/estimate/add.html

@ -356,39 +356,62 @@
$.table.init(options);
});
function estimateDoSubmit(index, layero,uniqueId){
//逻辑新增一行物料数据
function estimateDoSubmit(index, layero, uniqueId) {
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-estimateMaterialSelect-table').bootstrapTable('getSelections')[0];
var selectedRows = iframeWin.$('#bootstrap-estimateMaterialSelect-table').bootstrapTable('getSelections');
if (selectedRows.length === 0) {
$.modal.alertError("请选择至少一条物料信息");
return;
}
var existingData = $("#bootstrap-table").bootstrapTable('getData');
//判断是否重复
var rows = $("#bootstrap-table").bootstrapTable('getData').length;
for(var i=0;i<rows;i++){
var data = $("#bootstrap-table").bootstrapTable('getData')[i];
// 存储要插入的新行
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].materialNo === rowData.materialNo) {
isDuplicate = true;
break;
}
}
if(data.materialNo == rowData.materialNo){
if (!isDuplicate) {
// 如果不存在,则准备插入新行
newRows.push({
materialNo: rowData.materialNo,
materialPhotourl: rowData.photoUrl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.describe,
materialBrand: rowData.brand,
materialUnit: rowData.unit,
materialProcessMethod: rowData.processMethod,
materialDeptType: rowData.warehouseDept,
materialNum: 0
});
} else {
$.modal.alertError("不能选择已添加过的相同物料");
return;
}
}
console.log("rowData: "+rowData);
$("#bootstrap-table").bootstrapTable('insertRow', {
index:1,
row: {
materialNo:rowData.materialNo,
materialPhotourl:rowData.photoUrl,
materialName: rowData.materialName,
materialType: rowData.materialType,
materialDescribe: rowData.describe,
materialBrand: rowData.brand,
materialUnit: rowData.unit,
materialProcessMethod: rowData.processMethod,
materialDeptType: rowData.warehouseDept,
materialNum: 0
// 批量插入新行
if (newRows.length > 0) {
$("#bootstrap-table").bootstrapTable('insertRow', { index: 1, row: newRows[0] });
for (var k = 1; k < newRows.length; k++) {
$("#bootstrap-table").bootstrapTable('insertRow', { index: 1, row: newRows[k] });
}
})
}
getTotalAmount();
layer.close(index);
}

1
ruoyi-admin/src/main/resources/templates/sales/estimate/estimateMaterialSelect.html

@ -42,7 +42,6 @@
showRefresh: false,
showToggle: false,
clickToSelect: true, // 点击选中行
singleSelect: true, // 单选
url: prefix + "/getEstimateMaterialList",
modalName: "物料信息",
columns: [{

Loading…
Cancel
Save