liuxiaoxu
5 months ago
5 changed files with 294 additions and 0 deletions
@ -0,0 +1,242 @@ |
|||
<!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-inventoryCheck-edit" th:object="${warehouseInventoryCheck}"> |
|||
<input name="inventoryCheckId" th:field="*{inventoryCheckId}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">盘点单号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="inventoryCheckCode" th:field="*{inventoryCheckCode}" class="form-control" type="text" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">盘点人名:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="inventoryCheckName" th:field="*{inventoryCheckName}" class="form-control" type="text" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">仓库号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="warehouseCode" th:field="*{warehouseCode}" class="form-control" type="text" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">仓库名称:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="warehouseName" th:field="*{warehouseName}" class="form-control" type="text" disabled> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">盘点日期:</label> |
|||
<div class="col-sm-8"> |
|||
<div class="input-group date"> |
|||
<input name="inventoryCheckDate" th:value="${#dates.format(warehouseInventoryCheck.inventoryCheckDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled> |
|||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">备注内容:</label> |
|||
<div class="col-sm-8"> |
|||
<textarea name="remark" class="form-control" disabled>[[*{remark}]]</textarea> |
|||
</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 + "warehouse/inventoryCheck"; |
|||
|
|||
var warehouseInventoryCheck = [[${warehouseInventoryCheck}]]; |
|||
|
|||
$("#form-inventoryCheck-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
$("input[name='inventoryCheckDate']").datetimepicker({ |
|||
format: "yyyy-mm-dd", |
|||
minView: "month", |
|||
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列表 |
|||
$(function() { |
|||
var options = { |
|||
modalName: "收款凭证", |
|||
url: prefix + '/getInventoryCheckDetailList', |
|||
queryParams: queryParams, |
|||
showColumns: false, |
|||
pagination: false, |
|||
showToggle: false, |
|||
showRefresh:false, |
|||
showSearch:false, |
|||
singleSelect:true, |
|||
columns: [{ |
|||
checkbox: false |
|||
}, |
|||
{ |
|||
title: '库存盘点详情ID', |
|||
field: 'inventoryCheckDetailId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '料号', |
|||
field: 'materialNo', |
|||
}, |
|||
{ |
|||
title: '物料名称', |
|||
field: 'materialName', |
|||
}, |
|||
{ |
|||
title: '物料单位', |
|||
field: 'materialUnit', |
|||
}, |
|||
{ |
|||
title: '物料描述', |
|||
field: 'materialDescribe', |
|||
}, |
|||
{ |
|||
title: '盘点数量', |
|||
field: 'inventoryCheckNum', |
|||
}, |
|||
{ |
|||
title: '当时库存账上数量', |
|||
field: 'inventoryAccountNum', |
|||
}, |
|||
{ |
|||
title: '存放地址', |
|||
field: 'warehouseStoreAddress', |
|||
}, |
|||
{ |
|||
title: '批号', |
|||
field: 'batchNumber', |
|||
}, |
|||
{ |
|||
title: '说明', |
|||
field: 'remark', |
|||
}, |
|||
] |
|||
}; |
|||
$.table.init(options); |
|||
}) |
|||
|
|||
function queryParams(params) { |
|||
var curParams = { |
|||
// 传递参数查询参数 |
|||
inventoryCheckCode: warehouseInventoryCheck.inventoryCheckCode |
|||
}; |
|||
console.log(curParams); |
|||
return curParams; |
|||
} |
|||
|
|||
|
|||
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 |
|||
}) |
|||
} |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue