|
@ -3,6 +3,7 @@ |
|
|
<head> |
|
|
<head> |
|
|
<th:block th:include="include :: header('暂收-采购单(采购入库)详情')" /> |
|
|
<th:block th:include="include :: header('暂收-采购单(采购入库)详情')" /> |
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
|
|
|
<th:block th:include="include :: bootstrap-editable-css"/> |
|
|
<style> |
|
|
<style> |
|
|
|
|
|
|
|
|
.supplier-value span { |
|
|
.supplier-value span { |
|
@ -35,6 +36,39 @@ |
|
|
</select> |
|
|
</select> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-4 control-label">供应商ID:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="supplierCode" th:field="*{supplierCode}" class="form-control" type="text" readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-4 control-label">供应商名称:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="supplierName" th:field="*{supplierName}" class="form-control" type="text" readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-4 control-label">联系人:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="customerContact" th:field="*{customerContact}" class="form-control" type="text" readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-4 control-label">联系人电话:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text" readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="form-group"> |
|
|
|
|
|
<label class="col-sm-4 control-label">联系人地址:</label> |
|
|
|
|
|
<div class="col-sm-8"> |
|
|
|
|
|
<input name="supplierAddress" th:field="*{supplierAddress}" class="form-control" type="text" readonly> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
<div class="form-group"> |
|
|
<label class="col-sm-4 control-label">到货时间:</label> |
|
|
<label class="col-sm-4 control-label">到货时间:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
@ -74,11 +108,11 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<!--物料信息--> |
|
|
<div class="container"> |
|
|
<div class="container"> |
|
|
<!--供应商物料相关--> |
|
|
|
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col-sm-12" id="tablesContainer"> |
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
<!-- 表格将在这里动态生成 --> |
|
|
<table id="bootstrap-table"></table> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -100,61 +134,61 @@ |
|
|
focusCleanup: true |
|
|
focusCleanup: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
//生成的不同table的id集合 |
|
|
|
|
|
var tableDatas = []; |
|
|
|
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
function submitHandler() { |
|
|
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { |
|
|
if ($.validate.form()) { |
|
|
obj[item.name] = item.value; |
|
|
|
|
|
return obj; |
|
|
|
|
|
}, {}); |
|
|
const storageOrderData = $("#form-temporaryPurchaseWarehouse-edit").serializeArray().reduce((obj, item) => { |
|
|
// 初始化一个数组用于存放所有表格的数据 |
|
|
obj[item.name] = item.value; |
|
|
let allMaterialDataList = []; |
|
|
return obj; |
|
|
for(let i in tableDatas){ |
|
|
}, {}); |
|
|
$('#' + tableDatas[i]).each(function() { |
|
|
|
|
|
const tableData = $(this).bootstrapTable('getData'); |
|
|
|
|
|
console.log(JSON.stringify(tableData)); |
|
|
var table = $('#bootstrap-table').bootstrapTable("getData"); |
|
|
// 将表数据转换成与qualityReportData格式一致的数组 |
|
|
|
|
|
var materialDataList = tableData.map(function (item) { |
|
|
var materialDataList = table.map(function(item) { |
|
|
// 根据实际字段名调整 |
|
|
// 根据实际字段名调整 |
|
|
return { |
|
|
return { |
|
|
"supplierCode": item.supplierCode, |
|
|
"supplierCode": item.supplierCode, |
|
|
"materialNo": item.materialNo, |
|
|
"supplierName":item.supplierName, |
|
|
"materialName": item.materialName, |
|
|
"customerContact":item.customerContact, |
|
|
"materialType": item.materialType, |
|
|
"contactNumber":item.contactNumber, |
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
"supplierAddress":item.supplierAddress, |
|
|
"materialDescribe": item.materialDescribe, |
|
|
"materialNo": item.materialNo, |
|
|
"materialBrand": item.materialBrand, |
|
|
"materialName": item.materialName, |
|
|
"materialUnit": item.materialUnit, |
|
|
"materialType": item.materialType, |
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
"notifyHasArrivedNum": item.notifyHasArrivedNum, |
|
|
"materialDescribe": item.materialDescribe, |
|
|
"actualHasArrivedNum": item.actualHasArrivedNum, |
|
|
"materialBrand": item.materialBrand, |
|
|
"temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, |
|
|
"materialUnit": item.materialUnit, |
|
|
"hasStorageNum": item.hasStorageNum, |
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
"notifyArriveNum": item.notifyArriveNum, |
|
|
"notifyHasArrivedNum": item.notifyHasArrivedNum, |
|
|
"actualArriveNum": item.actualArriveNum, |
|
|
"actualHasArrivedNum": item.actualHasArrivedNum, |
|
|
"temporaryQualifiedNum": item.temporaryQualifiedNum, |
|
|
"temporaryHasQualifiedNum": item.temporaryHasQualifiedNum, |
|
|
"temporaryRemark": item.temporaryRemark, |
|
|
"hasStorageNum": item.hasStorageNum, |
|
|
"temporaryReportUrl": item.temporaryReportUrl, |
|
|
"notifyArriveNum": item.notifyArriveNum, |
|
|
// ...其他字段 |
|
|
"actualArriveNum": item.actualArriveNum, |
|
|
}; |
|
|
"temporaryQualifiedNum": item.temporaryQualifiedNum, |
|
|
}); |
|
|
"temporaryRemark": item.temporaryRemark, |
|
|
allMaterialDataList = allMaterialDataList.concat(materialDataList); |
|
|
"temporaryReportUrl": item.temporaryReportUrl, |
|
|
|
|
|
// ...其他字段 |
|
|
|
|
|
}; |
|
|
}); |
|
|
}); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const combinedData = Object.assign({}, storageOrderData, { |
|
|
const combinedData = Object.assign({}, storageOrderData, { |
|
|
warehouseStorageOrderDetailList: allMaterialDataList |
|
|
warehouseStorageOrderDetailList: materialDataList, |
|
|
}); |
|
|
}); |
|
|
// 合并表单数据和表格数据 |
|
|
// 合并表单数据和表格数据 |
|
|
// const combinedData = Object.assign({}, ...complaintNoticeData.array(item => ({ [item.name]: item.value })), ...materialData); |
|
|
console.log(combinedData) |
|
|
console.log(combinedData) |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
// 发送 AJAX 请求到后端接口 |
|
|
// 发送 AJAX 请求到后端接口 |
|
|
$.operate.saveJson(prefix + "/temporaryPurchase", jsonData); |
|
|
$.operate.saveJson(prefix + "/temporaryPurchaseWarehouse", jsonData); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
$("input[name='arrivedTime']").datetimepicker({ |
|
|
format: "yyyy-mm-dd", |
|
|
format: "yyyy-mm-dd", |
|
|
minView: "month", |
|
|
minView: "month", |
|
@ -167,38 +201,17 @@ |
|
|
autoclose: true |
|
|
autoclose: true |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
$(function() { |
|
|
$(function() { |
|
|
// 假设qualityOrderCode已经定义或者可以通过某种方式获取到 |
|
|
var options = { |
|
|
var warehouseStorageCode = [[${warehouseStorageOrder.warehouseStorageCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
|
|
modalName: "选择物料", |
|
|
|
|
|
url: prefix + "/temporaryPurchaseDetailList", |
|
|
$.getJSON(prefix + "/temporaryPurchaseDetailList?warehouseStorageCode=" + warehouseStorageCode, function(data) { |
|
|
queryParams: queryParams, |
|
|
for (var supplierCode in data) { |
|
|
showSearch: false, |
|
|
if (data.hasOwnProperty(supplierCode)) { |
|
|
showRefresh: false, |
|
|
var supplierData = data[supplierCode]; |
|
|
showToggle: false, |
|
|
createTableForSupplier(supplierCode, supplierData); |
|
|
showColumns: false, |
|
|
} |
|
|
pagination: false, // 设置不分页 |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
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.customerContact || 'N/A') + |
|
|
|
|
|
' - ' + (supplierInfo.contactNumber || 'N/A') + |
|
|
|
|
|
' - ' + (supplierInfo.supplierAddress || 'N/A'); |
|
|
|
|
|
|
|
|
|
|
|
var $header = $('<h4>' + headerTitle + '</h4>'); |
|
|
|
|
|
var $table = $('<table id="' + tableId + '" class="table table-striped table-bordered"></table>'); |
|
|
|
|
|
|
|
|
|
|
|
$table.bootstrapTable({ |
|
|
|
|
|
data: supplierData, |
|
|
|
|
|
columns: [{ |
|
|
columns: [{ |
|
|
checkbox: true |
|
|
checkbox: true |
|
|
}, |
|
|
}, |
|
@ -241,6 +254,7 @@ |
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
title: '入库部门', |
|
|
title: '入库部门', |
|
|
field: 'materialDeptType', |
|
|
field: 'materialDeptType', |
|
@ -259,7 +273,6 @@ |
|
|
{ |
|
|
{ |
|
|
title: '暂收已合格数', |
|
|
title: '暂收已合格数', |
|
|
field: 'temporaryHasQualifiedNum', |
|
|
field: 'temporaryHasQualifiedNum', |
|
|
visible: false, |
|
|
|
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '已入库数', |
|
|
title: '已入库数', |
|
@ -276,12 +289,13 @@ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
title: '暂收数量', |
|
|
title: '暂收合格数量', |
|
|
field: 'temporaryQualifiedNum', |
|
|
field: 'temporaryQualifiedNum', |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
|
title: '暂收备注', |
|
|
title: '暂收备注', |
|
|
field: 'temporaryRemark', |
|
|
field: 'temporaryRemark', |
|
|
|
|
|
editable: true, |
|
|
visible: false, |
|
|
visible: false, |
|
|
}, |
|
|
}, |
|
|
{ |
|
|
{ |
|
@ -289,14 +303,21 @@ |
|
|
field: 'temporaryReportUrl', |
|
|
field: 'temporaryReportUrl', |
|
|
visible: false, |
|
|
visible: false, |
|
|
}] |
|
|
}] |
|
|
}); |
|
|
}; |
|
|
|
|
|
$.table.init(options); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
$tableWrapper.append($header).append($table); |
|
|
function queryParams(params) { |
|
|
$('#tablesContainer').append($tableWrapper); |
|
|
var curParams = { |
|
|
|
|
|
// 传递参数查询参数 |
|
|
|
|
|
warehouseStorageCode: warehouseStorageCode |
|
|
|
|
|
}; |
|
|
|
|
|
return curParams; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据仓库ID查询仓库名称 |
|
|
//根据仓库ID查询仓库名称 |
|
|
$(document).ready(function() { |
|
|
$(document).ready(function() { |
|
|
// 初始化时默认加载仓库ID列表 |
|
|
// 初始化时默认加载仓库ID列表 |
|
|