19 changed files with 902 additions and 29 deletions
@ -0,0 +1,224 @@ |
|||||
|
<!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-returnAfterStorageDetail-edit" th:object="${qualityRefundsExchanges}"> |
||||
|
<input name="refundsExchangesId" th:field="*{refundsExchangesId}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">退换货单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="refundsExchangesCode" th:field="*{refundsExchangesCode}" class="form-control" type="text"> |
||||
|
</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="deliveryInspectionTime" th:value="${#dates.format(qualityRefundsExchanges.deliveryInspectionTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
||||
|
<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"> |
||||
|
<input name="qualityRemark" th:field="*{qualityRemark}" class="form-control" type="text"> |
||||
|
</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 + "quality/refundsExchanges" |
||||
|
var refundsExchangesCode = /*[[${refundsExchangesCode}]]*/ ''; |
||||
|
|
||||
|
var qualityRefundsExchanges = [[${qualityRefundsExchanges}]]; |
||||
|
|
||||
|
$("input[name='deliveryInspectionTime']").datetimepicker({ |
||||
|
format: "yyyy-mm-dd", |
||||
|
minView: "month", |
||||
|
autoclose: true |
||||
|
}); |
||||
|
|
||||
|
$("#form-returnAfterStorageDetail-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
// 新增提交 |
||||
|
function submitHandler() { |
||||
|
// 获取表单数据 |
||||
|
const refundsExchangesData = $("#form-refundsExchanges-add").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 { |
||||
|
"materialNo": item.materialNo, // 假设id对应materialId |
||||
|
"materialPhotourl": item.materialPhotourl, // 假设quantity是物料数量字段 |
||||
|
"materialName": item.materialName, |
||||
|
"materialType": item.materialType, |
||||
|
"materialDescribe": item.materialDescribe, |
||||
|
"materialUnit": item.materialUnit, |
||||
|
"materialBrand": item.materialBrand, |
||||
|
"materialProcessMethod":item.materialProcessMethod, |
||||
|
"refundsExchangesNum":item.refundsExchangesNum |
||||
|
// ...其他字段 |
||||
|
}; |
||||
|
}); |
||||
|
|
||||
|
// 将全局变量 refundsExchangesCode 添加到要提交的数据中 |
||||
|
const combinedData = Object.assign({}, refundsExchangesData, { |
||||
|
refundsExchangesDetails: materialDataList, |
||||
|
refundsExchangesCode: refundsExchangesCode // 直接使用全局变量 |
||||
|
}); |
||||
|
// 合并表单数据和表格数据 |
||||
|
console.log(combinedData) |
||||
|
// 使用 JSON.stringify() 序列化数据 |
||||
|
const jsonData = JSON.stringify(combinedData); |
||||
|
// 发送 AJAX 请求到后端接口 |
||||
|
$.operate.saveJson(prefix + "/add", jsonData); |
||||
|
} |
||||
|
|
||||
|
//物料信息展示列表 |
||||
|
$(function() { |
||||
|
var options = { |
||||
|
modalName: "选择物料", |
||||
|
url: ctx + "quality/refundsExchanges/getMaterialListByRefundsExchangesCode", |
||||
|
queryParams: queryParams, |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
pagination: false, // 设置不分页 |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '退换货单号', |
||||
|
field: 'refundsExchangesCode', |
||||
|
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: '品质报告', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
// 这里直接使用row对象获取refundsExchangesCode,假设它是存在的 |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="qualityReport(\'' + row.materialNo + '\', \'' + refundsExchangesCode + '\')"><i class="fa fa-plus"></i>报告</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '退换数', |
||||
|
field: 'refundsExchangesNum', |
||||
|
} |
||||
|
] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}) |
||||
|
|
||||
|
function queryParams(params) { |
||||
|
var curParams = { |
||||
|
// 传递参数查询参数 |
||||
|
refundsExchangesCode: qualityRefundsExchanges.refundsExchangesCode |
||||
|
}; |
||||
|
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, |
||||
|
materialPhotourl:rowData.materialPhotourl, |
||||
|
materialName: rowData.materialName, |
||||
|
materialType: rowData.materialType, |
||||
|
materialDescribe: rowData.materialDescribe, |
||||
|
materialBrand: rowData.materialBrand, |
||||
|
materialUnit: rowData.materialUnit, |
||||
|
materialProcessMethod: rowData.materialProcessMethod, |
||||
|
makeTotal:rowData.makeTotal |
||||
|
} |
||||
|
}) |
||||
|
layer.close(index); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/*品质报告*/ |
||||
|
function qualityReport(materialNo, refundsExchangesCode) { |
||||
|
var queryParams = new URLSearchParams(); |
||||
|
queryParams.append('materialNo', materialNo); |
||||
|
queryParams.append('refundsExchangesCode', encodeURIComponent(refundsExchangesCode)); |
||||
|
|
||||
|
var url = ctx + 'quality/refundsExchanges/qualityReport?' + queryParams.toString(); |
||||
|
$.modal.open("品质报告", url); |
||||
|
} |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,195 @@ |
|||||
|
<!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 { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.supplier-value span { |
||||
|
margin-right: 10px; |
||||
|
} |
||||
|
|
||||
|
.info-separator::after { |
||||
|
content: "-"; |
||||
|
margin: 0 5px; |
||||
|
} |
||||
|
</style> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-qualityRefundsExchanges-edit" th:object="${qualityRefundsExchanges}"> |
||||
|
<input name="refundsExchangesId" th:field="*{refundsExchangesId}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">退换货单号:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="refundsExchangesCode" th:field="*{refundsExchangesCode}" class="form-control" type="text"> |
||||
|
</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"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">品质单入库类型:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="warehouseStorageType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}"> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></option> |
||||
|
</select> |
||||
|
</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 refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]] |
||||
|
|
||||
|
var prefix = ctx + "quality/refundsExchanges"; |
||||
|
$("#form-qualityRefundsExchanges-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/returnBeforeStorageDetail", $('#form-qualityRefundsExchanges-edit').serialize()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
$(function() { |
||||
|
// 假设refundsExchangesCode已经定义或者可以通过某种方式获取到 |
||||
|
var refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]]; // 这里需要实际赋值,比如从前端某个地方读取 |
||||
|
|
||||
|
$.getJSON(prefix + "/detailListGroupedBySupplier?refundsExchangesCode=" + refundsExchangesCode, 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(); |
||||
|
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: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '供应商ID', |
||||
|
field: 'supplierCode', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '料号', |
||||
|
field: 'materialNo' |
||||
|
}, { |
||||
|
title: '物料名称', |
||||
|
field: 'materialName' |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料类型', |
||||
|
field: 'materialType', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料图片地址', |
||||
|
field: 'materialPhotourl', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料描述', |
||||
|
field: 'materialDescribe', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料品牌', |
||||
|
field: 'materialBrand', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料单位', |
||||
|
field: 'materialUnit', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料加工方式', |
||||
|
field: 'materialProcessMethod', |
||||
|
}, |
||||
|
{ |
||||
|
title: '订单数', |
||||
|
field: 'makeTotal', |
||||
|
}, |
||||
|
{ |
||||
|
title: '品质已合格数', |
||||
|
field: 'qualityHasqualifiedNum', |
||||
|
}, |
||||
|
{ |
||||
|
title: '本次到货数', |
||||
|
field: 'thisArrivedNum', |
||||
|
editable:{ |
||||
|
type:'text' |
||||
|
}, |
||||
|
required:true |
||||
|
}, |
||||
|
{ |
||||
|
title: '品质报告', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
// 这里直接使用row对象获取supplierCode,假设它是存在的 |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="qualityReport(\'' + row.materialNo + '\', \'' + row.supplierCode + '\')"><i class="fa fa-plus"></i>报告</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '品质不合格数', |
||||
|
field: 'qualityUnqualifiedNum', |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
$tableWrapper.append($header).append($table); |
||||
|
$('#tablesContainer').append($tableWrapper); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/*品质报告*/ |
||||
|
function qualityReport(materialNo, supplierCode) { |
||||
|
var queryParams = new URLSearchParams(); |
||||
|
queryParams.append('materialNo', materialNo); |
||||
|
queryParams.append('supplierCode', encodeURIComponent(supplierCode)); |
||||
|
|
||||
|
var url = ctx + 'quality/qualityOrder/qualityReport?' + queryParams.toString(); |
||||
|
$.modal.open("品质报告", url); |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue