Browse Source
出库单 新增退换货-出库 按钮 新增退换货---出库页面refundsExchangesOutWarehouse.html 新增退换货---出库后端查询页面接口 新增退换货---出库后端修改保存接口 新增退换货-出库 查询供应商物料详情列表接口dev
liuxiaoxu
5 months ago
9 changed files with 310 additions and 2 deletions
@ -0,0 +1,216 @@ |
|||
<!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" /> |
|||
<style> |
|||
|
|||
.supplier-value span { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
</style> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-refundsExchangesOutWarehouse-edit" th:object="${warehouseOutOrder}"> |
|||
<input name="outOrderId" th:field="*{outOrderId}" type="hidden"> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">出库单号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="outOrderCode" th:field="*{outOrderCode}" 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"> |
|||
<select name="warehouseOrderType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_order_type')}" disabled> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseOrderType}"></option> |
|||
</select> |
|||
</div> |
|||
</div> |
|||
<div class="form-group"> |
|||
<label class="col-sm-3 control-label">关联单号:</label> |
|||
<div class="col-sm-8"> |
|||
<input name="relatedOrderCode" th:field="*{relatedOrderCode}" 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="applyName" th:field="*{applyName}" class="form-control" type="text" disabled> |
|||
</div> |
|||
</div> |
|||
|
|||
|
|||
<div class="container"> |
|||
<!--供应商物料相关--> |
|||
<div class="row"> |
|||
<div class="col-sm-12" id="tablesContainer"> |
|||
<!-- 表格将在这里动态生成 --> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</form> |
|||
</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 outOrderCode = [[${warehouseOutOrder.outOrderCode}]] |
|||
|
|||
var prefix = ctx + "warehouse/warehouseOutOrder"; |
|||
$("#form-refundsExchangesOutWarehouse-edit").validate({ |
|||
focusCleanup: true |
|||
}); |
|||
|
|||
//生成的不同table的id集合 |
|||
var tableDatas = []; |
|||
|
|||
function submitHandler() { |
|||
const warehouseStorageOrderData = $("#form-refundsExchangesOutWarehouse-edit").serializeArray().reduce((obj, item) => { |
|||
obj[item.name] = item.value; |
|||
return obj; |
|||
}, {}); |
|||
// 初始化一个数组用于存放所有表格的数据 |
|||
let allMaterialDataList = []; |
|||
for(let i in tableDatas){ |
|||
$('#' + tableDatas[i]).each(function() { |
|||
const tableData = $(this).bootstrapTable('getData'); |
|||
console.log(JSON.stringify(tableData)); |
|||
// 将表数据转换成与qualityReportData格式一致的数组 |
|||
var materialDataList = tableData.map(function (item) { |
|||
// 根据实际字段名调整 |
|||
return { |
|||
"supplierCode": item.supplierCode, |
|||
"materialNo": item.materialNo, |
|||
"actualOutOrderSum":item.actualOutOrderSum, |
|||
"outOrderDetailId":item.outOrderDetailId, |
|||
"outOrderCode":item.outOrderCode, |
|||
// ...其他字段 |
|||
}; |
|||
}); |
|||
allMaterialDataList = allMaterialDataList.concat(materialDataList); |
|||
}); |
|||
} |
|||
|
|||
const combinedData = Object.assign({}, warehouseStorageOrderData, { |
|||
warehouseOutOrderDetailList: allMaterialDataList |
|||
}); |
|||
// 合并表单数据和表格数据 |
|||
// 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 + "/refundsExchangesOutWarehouse", jsonData); |
|||
} |
|||
|
|||
$(function() { |
|||
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|||
var outOrderCode = [[${warehouseOutOrder.outOrderCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
|||
|
|||
$.getJSON(prefix + "/refundsExchangesDetailList?outOrderCode=" + outOrderCode, function(data) { |
|||
for (var supplierCode in data) { |
|||
if (data.hasOwnProperty(supplierCode)) { |
|||
var supplierData = data[supplierCode]; |
|||
createTableForSupplier(supplierCode, supplierData); |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
function createTableForSupplier(supplierCode, supplierData) { |
|||
var tableId = 'bootstrap-table-' + supplierCode.replace(/[^a-z0-9]/gi, '_').toLowerCase(); |
|||
tableDatas.push(tableId); |
|||
var $tableWrapper = $('<div class="table-responsive mt-3"></div>'); |
|||
|
|||
// 确保supplierData至少有一条记录,并从中提取供应商详细信息 |
|||
var supplierInfo = supplierData.length > 0 ? supplierData[0] : {}; // 默认为空对象,以防数据不存在 |
|||
|
|||
// 构建含有额外供应商信息的标题字符串 |
|||
var headerTitle ='供应商'+'</br>'+supplierCode + ' - ' + (supplierInfo.supplierName || 'N/A') + |
|||
' </br> ' + (supplierInfo.deliveryName || 'N/A') + |
|||
' - ' + (supplierInfo.deliveryNumber || 'N/A') + |
|||
' - ' + (supplierInfo.deliveryAddress || 'N/A'); |
|||
|
|||
var $header = $('<h4>' + headerTitle + '</h4>'); |
|||
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); |
|||
|
|||
$table.bootstrapTable({ |
|||
data: supplierData, |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
title: '出库单详情ID', |
|||
field: 'outOrderDetailId', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '出库单号', |
|||
field: 'outOrderCode', |
|||
visible: false |
|||
}, |
|||
|
|||
{ |
|||
title: '料号', |
|||
field: 'materialNo', |
|||
}, |
|||
{ |
|||
title: '图片', |
|||
field: 'materialPhotourl', |
|||
}, |
|||
{ |
|||
title: '物料名称', |
|||
field: 'materialName', |
|||
}, |
|||
{ |
|||
title: '物料类型', |
|||
field: 'materialType', |
|||
}, |
|||
{ |
|||
title: '描述', |
|||
field: 'materialDescribe', |
|||
}, |
|||
{ |
|||
title: '品牌', |
|||
field: 'materialBrand', |
|||
}, |
|||
{ |
|||
title: '单位', |
|||
field: 'materialUnit', |
|||
}, |
|||
{ |
|||
title: '加工方式', |
|||
field: 'materialProcessMethod', |
|||
}, |
|||
{ |
|||
title: '订单数量', |
|||
field: 'makeNum', |
|||
}, |
|||
{ |
|||
title: '已出库数', |
|||
field: 'hasOutOrderSum', |
|||
}, |
|||
{ |
|||
title: '申请出库数', |
|||
field: 'applyOutOrderSum', |
|||
}, |
|||
{ |
|||
title: '实际出库数', |
|||
field: 'actualOutOrderSum', |
|||
editable:true |
|||
} |
|||
|
|||
] |
|||
}); |
|||
|
|||
$tableWrapper.append($header).append($table); |
|||
$('#tablesContainer').append($tableWrapper); |
|||
} |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue