liuxiaoxu
6 months ago
7 changed files with 338 additions and 10 deletions
@ -0,0 +1,220 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|||
<head> |
|||
<th:block th:include="include :: header('入库后退货-选择供应商-无供应商')" /> |
|||
</head> |
|||
<body class="white-bg"> |
|||
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|||
<form class="form-horizontal m" id="form-afterNoConfirmSupplier-edit" th:object="${qualityRefundsExchanges}"> |
|||
<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" disabled> |
|||
</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"> |
|||
<select name="warehouseStorageType" class="form-control m-b" th:with="type=${@dict.getType('warehouse_storage_type')}" disabled> |
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{warehouseStorageType}"></option> |
|||
</select> |
|||
</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 :: bootstrap-table-editable-js" /> |
|||
<script th:inline="javascript"> |
|||
var refundsExchangesCode = [[${qualityRefundsExchanges.refundsExchangesCode}]] |
|||
|
|||
var qualityRefundsExchanges = [[${qualityRefundsExchanges}]]; |
|||
|
|||
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 submitHandler() { |
|||
// 获取表单数据 |
|||
// const afterNoConfirmSupplierData = $("#form-afterNoConfirmSupplier-edit").serializeArray(); |
|||
// 获取表单数据 |
|||
const afterNoConfirmSupplierData = $("#form-afterNoConfirmSupplier-edit").serializeArray().reduce((obj, item) => { |
|||
obj[item.name] = item.value; |
|||
return obj; |
|||
}, {}); |
|||
// 获取bootstrap-table的数据,这里假设你使用bootstrap-table的API获取所有数据 |
|||
var table = $('#bootstrap-table').bootstrapTable('getData'); |
|||
|
|||
// 将表数据转换成与afterNoConfirmSupplierData格式一致的数组 |
|||
var materialDataList = table.map(function(item) { |
|||
// 根据实际字段名调整 |
|||
return { |
|||
"refundsExchangesDetailId":item.refundsExchangesDetailId, |
|||
"materialNo": item.materialNo, // 假设id对应materialId |
|||
"materialPhotourl": item.materialPhotourl, // 假设quantity是物料数量字段 |
|||
"materialName": item.materialName, |
|||
"materialType": item.materialType, |
|||
"materialUnit": item.materialUnit, |
|||
"materialBrand": item.materialBrand, |
|||
"materialDescribe": item.materialDescribe, |
|||
"snCode": item.snCode, |
|||
"complaintProblem": item.complaintProblem, |
|||
// "emergencyDegree": item.emergencyDegree, |
|||
"adverseReportUrl": item.adverseReportUrl, |
|||
// ...其他字段 |
|||
}; |
|||
}); |
|||
|
|||
// 合并表单数据和表格数据 |
|||
//const combinedData = Object.assign({}, ...afterNoConfirmSupplierData.map(item => ({ [item.name]: item.value })), ...materialData); |
|||
const combinedData = Object.assign({}, afterNoConfirmSupplierData, { refundsExchangesDetails: materialDataList }); |
|||
|
|||
console.log(combinedData) |
|||
// 使用 JSON.stringify() 序列化数据 |
|||
const jsonData = JSON.stringify(combinedData); |
|||
// 发送 AJAX 请求到后端接口 |
|||
$.operate.saveJson(prefix + "/afterNoConfirmSupplier", jsonData); |
|||
} |
|||
|
|||
|
|||
//物料信息展示列表 |
|||
$(function() { |
|||
var options = { |
|||
url: ctx + "quality/refundsExchanges/getAfterMaterialListByCode", |
|||
showSearch: false, |
|||
showRefresh: false, |
|||
showToggle: false, |
|||
showColumns: false, |
|||
pagination: false, // 设置不分页 |
|||
queryParams: queryParams, |
|||
modalName: "选择物料", |
|||
columns: [{ |
|||
checkbox: true |
|||
}, |
|||
{ |
|||
title: '供应商ID', |
|||
field: 'supplierCode', |
|||
visible: false |
|||
}, |
|||
{ |
|||
title: '退换货详情Id', |
|||
field: 'refundsExchangesDetailId', |
|||
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', |
|||
}, |
|||
{ |
|||
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', |
|||
}, |
|||
{ |
|||
title: '选择供应商ID', |
|||
field: 'supplierCode', |
|||
}, |
|||
{ |
|||
title: '选择供应商名称', |
|||
field: 'supplierName', |
|||
}, |
|||
{ |
|||
title: '退货联系人', |
|||
field: 'customerContact', |
|||
}, |
|||
{ |
|||
title: '联系人电话', |
|||
field: 'contactNumber', |
|||
}, |
|||
{ |
|||
title: '退货地址', |
|||
field: 'supplierAddress', |
|||
} |
|||
] |
|||
}; |
|||
$.table.init(options); |
|||
}) |
|||
|
|||
function queryParams(params) { |
|||
var curParams = { |
|||
// 传递参数查询参数 |
|||
refundsExchangesCode: qualityRefundsExchanges.refundsExchangesCode |
|||
}; |
|||
console.log(curParams); |
|||
return curParams; |
|||
} |
|||
|
|||
|
|||
</script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue