|
|
@ -26,9 +26,7 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">仓库名称:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled /> |
|
|
|
<option value="">请选择仓库名称</option> |
|
|
|
</select> |
|
|
|
<input id="stockName" name="warehouseName" class="form-control" th:field="*{warehouseName}" disabled /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
@ -84,68 +82,11 @@ |
|
|
|
autoclose: true |
|
|
|
}); |
|
|
|
|
|
|
|
// 新增提交 |
|
|
|
function submitHandler() { |
|
|
|
// 获取表单数据 |
|
|
|
const inventoryCheckData = $("#form-inventoryCheck-edit").serializeArray().reduce((obj, item) => { |
|
|
|
obj[item.name] = item.value; |
|
|
|
return obj; |
|
|
|
}, {}); |
|
|
|
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|
|
|
var table = $('#bootstrap-table').bootstrapTable('getData'); |
|
|
|
|
|
|
|
// 检查表格数据是否为空 |
|
|
|
if (table.length===0){ |
|
|
|
$.modal.alertWarning("请至少添加一条物料数据后再保存!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
console.log(table); |
|
|
|
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
|
var materialDataList = table.map(function(item) { |
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"inventoryCheckDetailId":item.inventoryCheckDetailId, |
|
|
|
"materialNo": item.materialNo, // 假设id对应materialId |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
"inventoryCheckNum": item.inventoryCheckNum, |
|
|
|
"inventoryAccountNum": item.inventoryAccountNum, |
|
|
|
"warehouseStoreAddress": item.warehouseStoreAddress, |
|
|
|
"batchNumber": item.batchNumber, |
|
|
|
"remark": item.remark, |
|
|
|
// ...其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
const combinedData = Object.assign({}, inventoryCheckData, { inventoryCheckDetails: materialDataList }); |
|
|
|
// 合并表单数据和表格数据 |
|
|
|
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|
|
|
console.log(combinedData) |
|
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
|
// 发送 AJAX 请求到后端接口 |
|
|
|
$.operate.saveJson(prefix + "/detail", jsonData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//添加物料信息 |
|
|
|
function insertRow() { |
|
|
|
var url = ctx + 'warehouse/inventoryCheck/materialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
//收款凭证table列表 |
|
|
|
//库存物料table列表 |
|
|
|
$(function() { |
|
|
|
var options = { |
|
|
|
modalName: "收款凭证", |
|
|
|
modalName: "库存物料", |
|
|
|
url: prefix + '/getInventoryCheckDetailList', |
|
|
|
queryParams: queryParams, |
|
|
|
showColumns: false, |
|
|
@ -155,7 +96,6 @@ |
|
|
|
showSearch:false, |
|
|
|
singleSelect:true, |
|
|
|
columns: [ |
|
|
|
{checkbox: false}, |
|
|
|
{title: '库存盘点详情ID', field: 'inventoryCheckDetailId', visible: false}, |
|
|
|
{title: '料号', field: 'materialNo',}, |
|
|
|
{title: '物料名称', field: 'materialName',}, |
|
|
@ -182,81 +122,6 @@ |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-materialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-table").bootstrapTable('insertRow', { |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
materialNo:rowData.materialNo, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialDescribe: rowData.materialDescribe, |
|
|
|
materialUnit: rowData.materialUnit, |
|
|
|
inventoryCheckNum : "", |
|
|
|
inventoryAccountNum : "", |
|
|
|
warehouseStoreAddress : "", |
|
|
|
batchNumber : "", |
|
|
|
remark : "" |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
|
|
|
|
// 逻辑删除前端的一行数据 |
|
|
|
function removeRow(materialNo){ |
|
|
|
$("#bootstrap-table").bootstrapTable('remove', { |
|
|
|
field: 'materialNo', |
|
|
|
values: materialNo |
|
|
|
}) |
|
|
|
} |
|
|
|
function loadWarehouseCodes() { |
|
|
|
var url = ctx + 'stock/stockInfo/getAllWarehouseCode'; |
|
|
|
$("#stockName").select2({ |
|
|
|
ajax: { |
|
|
|
theme: "bootstrap", |
|
|
|
allowClear: true, |
|
|
|
placeholder: "请选择一个料号", |
|
|
|
type: 'GET', // 请求类型 |
|
|
|
url: url, // 后端接口URL |
|
|
|
dataType: 'json', // 预期服务器返回的数据类型 |
|
|
|
data: function(params) { |
|
|
|
return { |
|
|
|
q: params.term, // 搜索关键词 |
|
|
|
page: params.page || 1 ,// 当前页码 |
|
|
|
// 其他参数 |
|
|
|
pageSize: 30 |
|
|
|
}; |
|
|
|
}, |
|
|
|
processResults: function(data, params) { |
|
|
|
params.page = params.page || 1; |
|
|
|
var options = []; |
|
|
|
for (var i = 0; i < data.length; i++) { |
|
|
|
var option = { |
|
|
|
id: data[i].stockName, |
|
|
|
text: data[i].stockName, |
|
|
|
title: data[i].stockNO |
|
|
|
}; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
var moreDataAvaliable = (params.page * 30) < data.total_count; |
|
|
|
return { |
|
|
|
// 实现下拉实现填入stockName |
|
|
|
results: options, |
|
|
|
pagination: { |
|
|
|
more: moreDataAvaliable // 是否还有更多数据 |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
$('#stockName').on('select2:select', function(e) { |
|
|
|
var data = e.params.data; |
|
|
|
$("input[name='warehouseCode']").val(data.title); |
|
|
|
}); |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |