|
|
@ -8,38 +8,36 @@ |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-picking-add"> |
|
|
|
<form class="form-horizontal m" id="form-picking-add" th:object="${erpDevelopModifyorder}"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">开发修改单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="developOrder" class="form-control" type="text"> |
|
|
|
<input name="developOrderCode" th:field="*{developOrderCode}" 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 id="makeNo" name="makeNo" class="form-control" type="text" required> |
|
|
|
<option value="">请选择</option> |
|
|
|
</select> |
|
|
|
<input name="makeNo" th:field="*{makeNo}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">业务员:</label> |
|
|
|
<label class="col-sm-3 control-label">领料员:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="userName" class="form-control" type="text"> |
|
|
|
<input name="pickingUser" th:field="*{pickingUser}" 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="types" class="form-control" type="text"> |
|
|
|
<input name="orderType" th:field="*{orderType}" 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-sub-table-material"></table> |
|
|
|
<table id="bootstrap-table-picking"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -48,139 +46,307 @@ |
|
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
|
<th:block th:include="include :: select2-js" /> |
|
|
|
<script th:inline="javascript"> |
|
|
|
var prefix = ctx + "erp/developModifyOrder"; |
|
|
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
var levelDatas = [[${@dict.getType('bomLevel')}]]; |
|
|
|
var bomLevelSelectDatas = [[${@dict.getTypeSelect('bomLevel')}]]; |
|
|
|
|
|
|
|
|
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
var loginName = [[${@permission.getPrincipalProperty('loginName')}]]; |
|
|
|
var userName = [[${@permission.getPrincipalProperty('userName')}]]; |
|
|
|
var prefix = ctx + "system/picking" |
|
|
|
$("#form-picking-add").validate({focusCleanup: true}); |
|
|
|
$(function () { |
|
|
|
$("#makeNo").select2({ |
|
|
|
theme: "bootstrap", |
|
|
|
allowClear: true, |
|
|
|
placeholder: "请选择生产单号", |
|
|
|
ajax: { |
|
|
|
url: ctx + "/system/makeorder/getAllMakeNos", |
|
|
|
dataType: 'json', |
|
|
|
type: "POST", |
|
|
|
delay: 250, |
|
|
|
processResults: function (res, params) { |
|
|
|
var options = []; |
|
|
|
if(res.code==0){ |
|
|
|
var resultList = res.data; |
|
|
|
console.log(resultList); |
|
|
|
for(var i= 0, len=resultList.length;i<len;i++){ |
|
|
|
var option = resultList[i]; |
|
|
|
option.id = resultList[i]["makeNo"]; |
|
|
|
option.text = resultList[i]["makeNo"]; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
results: options |
|
|
|
}; |
|
|
|
|
|
|
|
var prefix = ctx + "erp/developModifyorderPicking" |
|
|
|
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
|
// 获取表单数据 |
|
|
|
const developModifyorderData = $("#form-picking-add").serializeArray().reduce((obj, item) => { |
|
|
|
obj[item.name] = item.value; |
|
|
|
return obj; |
|
|
|
}, {}); |
|
|
|
|
|
|
|
|
|
|
|
var parentTable = $("#bootstrap-table-picking").bootstrapTable("getData"); |
|
|
|
|
|
|
|
var parentDataList = parentTable.map(function(item) { |
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"developOrderDetailId":item.developOrderDetailId, |
|
|
|
"bomId": item.bomId, |
|
|
|
"materialNo": item.materialNo, |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialType": item.materialType, |
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
"materialNum": item.materialNum, |
|
|
|
"availableStockNum": item.availableStockNum, |
|
|
|
"pickNum": item.pickNum, |
|
|
|
"hasPickNum": item.hasPickNum, |
|
|
|
"warehouseDept": item.warehouseDept, |
|
|
|
// ..其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
// 在需要收集所有子表数据的地方调用此函数 |
|
|
|
var allSubData = getAllSubTablesData(); |
|
|
|
|
|
|
|
// 将表数据转换成与complaintNoticeData格式一致的数组 |
|
|
|
var childDataList = allSubData.map(function(item) { |
|
|
|
|
|
|
|
// 验证表格元素是否存在 |
|
|
|
var $tableElement = $('#' + item.tableId); |
|
|
|
var bomId; |
|
|
|
|
|
|
|
if ($tableElement.length > 0) { |
|
|
|
var parentRow = $tableElement.data('parentRow'); |
|
|
|
if (parentRow && parentRow.bomId) { |
|
|
|
bomId = parentRow.bomId; |
|
|
|
} else { |
|
|
|
// 处理 parentRow 为空或不包含 bomId 的情况 |
|
|
|
console.error('主表没有BomId:', parentRow); |
|
|
|
// 可以在这里提供一个默认值 |
|
|
|
bomId = null; // 或者使用某个默认值 |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 处理表格元素不存在的情况 |
|
|
|
console.error('没有找到BomId字段:', item.tableId); |
|
|
|
// 可以在这里提供一个默认值 |
|
|
|
bomId = null; // 或者使用某个默认值 |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"id":item.id, |
|
|
|
"bomId": bomId, // 获取主表的 bomId |
|
|
|
"bomNo":item.bomNo, |
|
|
|
"materialNo": item.materialNo, |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialType": item.materialType, |
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
"materialBrand": item.brand, |
|
|
|
"materialDescribe": item.describe, |
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
"materialNum": item.materialNum, |
|
|
|
"availableStockNum": item.availableStockNum, |
|
|
|
"pickNum": item.pickNum, |
|
|
|
"hasPickNum": item.hasPickNum, |
|
|
|
"warehouseDept": item.warehouseDept, |
|
|
|
"useNum": item.useNum, |
|
|
|
"lossRate":item.lossRate, |
|
|
|
"sortNo":item.sortNo, |
|
|
|
// ..其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
var option1 = { |
|
|
|
id: "bootstrap-sub-table-material", |
|
|
|
// url: prefix + "/list", |
|
|
|
|
|
|
|
// 合并表单数据和表格数据 |
|
|
|
const combinedData = Object.assign({}, developModifyorderData, |
|
|
|
{ developModifyorderPickingDetails: childDataList, |
|
|
|
developModifyorderDetailList: parentDataList |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
console.log(combinedData) |
|
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
|
// 发送 AJAX 请求到后端接口 |
|
|
|
$.operate.saveJson(prefix + "/add", jsonData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$("#form-picking-add").validate({focusCleanup: true}); |
|
|
|
// 选择采购物料 |
|
|
|
$(function(){ |
|
|
|
var options = { |
|
|
|
id: 'bootstrap-table-picking', |
|
|
|
url: ctx + "erp/developModifyOrder/showPickingDevelopModifyorderDetailList", |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
modalName: "bom", |
|
|
|
uniqueId: "id", |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
sidePagination: "client", |
|
|
|
detailView: true, |
|
|
|
height: $(window).height() - 100, |
|
|
|
//指定父id列 |
|
|
|
queryParams: queryParams, |
|
|
|
onExpandRow : function(index, row, $detail) { |
|
|
|
$detail.html('<table class="table-container" id="all_level_table_'+row.id+'"></table>').find('table'); |
|
|
|
// 多阶 |
|
|
|
initAllLevelTable(index,row,$detail); |
|
|
|
// $.table.bootstrapTable('resetView'); |
|
|
|
initChildTable(index, row, $detail); |
|
|
|
}, |
|
|
|
columns: [ |
|
|
|
{checkbox: false}, |
|
|
|
{title: 'bom号',field: 'bomNo', }, |
|
|
|
{title: '关联料号',field: 'materialNo', }, |
|
|
|
{field: 'photoUrl',title: '图片',formatter: function(value, row, index) {return $.table.imageView(value);}}, |
|
|
|
{title: '物料名称',field: 'materialName', }, |
|
|
|
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value);}}, |
|
|
|
{field: 'processMethod', title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, |
|
|
|
{field: 'unit',title: '单位',}, |
|
|
|
{ title: '品牌',field: 'brand', }, |
|
|
|
{title: '描述',field: 'describe'}, |
|
|
|
{field: 'num',title: '订单数量',}, |
|
|
|
{field: 'parentId',title: '父级id',visible:false}, |
|
|
|
{title: '操作',align: 'center', |
|
|
|
{ |
|
|
|
field: 'developOrderDetailId', |
|
|
|
title: '主键id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomId', |
|
|
|
title: 'bom主键Id', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNo', |
|
|
|
align: 'center', |
|
|
|
title: '料号' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialName', |
|
|
|
align: 'center', |
|
|
|
title: '物料名称', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
align: 'center', |
|
|
|
title: '物料类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialUnit', |
|
|
|
align: 'center', |
|
|
|
title: '单位', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialBrand', |
|
|
|
align: 'center', |
|
|
|
title: '品牌' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialDescribe', |
|
|
|
align: 'center', |
|
|
|
title: '描述' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialProcessMethod', |
|
|
|
align: 'center', |
|
|
|
title: '物料加工方式', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNum', |
|
|
|
align: 'center', |
|
|
|
title: '订单数量', |
|
|
|
editable:true |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'availableStockNum', |
|
|
|
title: '可用库存数', |
|
|
|
visible: shouldVisibleFields |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'hasPickNum', |
|
|
|
title: '已领料数', |
|
|
|
visible: shouldVisibleFields |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'pickNum', |
|
|
|
title: '本次领料数', |
|
|
|
visible: shouldVisibleFields, |
|
|
|
editable:true |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'warehouseDept', |
|
|
|
align: 'center', |
|
|
|
title: '入库部门', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
var actions = []; |
|
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="remove(\'' + row.id + '\')"><i class="fa fa-eye"></i> 删除</a> '); |
|
|
|
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removePurchase(\'' + row.materialNo + '\')"><i class="fa fa-remove"></i>删除</a> '); |
|
|
|
return actions.join(''); |
|
|
|
} |
|
|
|
}] |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(option1); |
|
|
|
}); |
|
|
|
initAllLevelTable = function(index, row, $detail) { |
|
|
|
$("#"+"all_level_table_"+row.id).bootstrapTable({ |
|
|
|
// url: prefix + "/allLevelList", |
|
|
|
$.table.init(options); |
|
|
|
}) |
|
|
|
|
|
|
|
initChildTable = function(index, row, $detail) { |
|
|
|
var parentRow = row; |
|
|
|
var childTableId = 'child_table_'+index; |
|
|
|
$detail.html('<table id="'+childTableId+'"></table>'); |
|
|
|
// 将 parentRow 保存为表格的数据属性 |
|
|
|
$('#' + childTableId).data('parentRow', parentRow); |
|
|
|
// BOM展示 |
|
|
|
$('#' + childTableId).bootstrapTable({ |
|
|
|
url: ctx + "erp/bom/allLevelList", |
|
|
|
method: 'post', |
|
|
|
sidePagination: "server", |
|
|
|
contentType: "application/x-www-form-urlencoded", |
|
|
|
queryParams : { |
|
|
|
parentId: row.id |
|
|
|
}, |
|
|
|
columns: [{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id' |
|
|
|
queryParams: { |
|
|
|
parentId: parentRow.bomId |
|
|
|
}, |
|
|
|
columns: [ |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomId', |
|
|
|
title: 'BOM的Id', |
|
|
|
visible: false, |
|
|
|
formatter: function (value, row, index) { |
|
|
|
var parentRow = $('#' + childTableId).data('parentRow'); // 从表格的数据属性中获取 parentRow |
|
|
|
var curIndex = row.sortNo - 1; |
|
|
|
return '<input class="hidden form-control" data-id="bomId_' + curIndex + '" name="developModifyorderPickingDetails[' + curIndex + '].bomId" value="' + parentRow.bomId + '">'; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'level', |
|
|
|
title: '层级', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
title: '阶层', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectDictLabel(levelDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'bomNo', |
|
|
|
title: 'bom号', |
|
|
|
formatter:function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
title: 'BOM号', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'photoUrl', |
|
|
|
title: '图片', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.imageView(value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNo', |
|
|
|
title: '料号', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'photoUrl', |
|
|
|
title: '图片', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.imageView(value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialName', |
|
|
|
title: '物料名称', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
@ -188,29 +354,28 @@ |
|
|
|
{ |
|
|
|
field: 'materialType', |
|
|
|
title: '物料类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'describe', |
|
|
|
title: '描述', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'brand', |
|
|
|
title: '品牌', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
@ -218,21 +383,37 @@ |
|
|
|
{ |
|
|
|
field: 'unit', |
|
|
|
title: '单位', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'processMethod', |
|
|
|
title: '加工方式', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'warehouseDept', |
|
|
|
align: 'center', |
|
|
|
title: '入库部门', visible: false, |
|
|
|
formatter: function (value, row, index) { |
|
|
|
return $.table.selectDictLabel(warehouseDates, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'useNum', |
|
|
|
title: '用量', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
formatter: function (value, row, index) { |
|
|
|
if (value == null || value == '') { |
|
|
|
return '/'; |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
return value |
|
|
|
} |
|
|
|
} |
|
|
@ -240,64 +421,90 @@ |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
title: '损耗率', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return "/"; |
|
|
|
} |
|
|
|
return value + "%"; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'processMethod', |
|
|
|
title: '半成品类型', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
field: 'materialNum', |
|
|
|
title: '订单用量', |
|
|
|
formatter: function (value, row, index) { |
|
|
|
// 获取父行的materialNum值,如果不存在则为0 |
|
|
|
var materialNum = parentRow.materialNum || 0; |
|
|
|
// 获取当前行的useNum值,如果不存在则为0 |
|
|
|
var useNum = row.useNum || 0; |
|
|
|
|
|
|
|
// 计算结果 |
|
|
|
var result = materialNum * useNum; |
|
|
|
|
|
|
|
// 如果result为0且materialNum或useNum为null/undefined,则返回空字符串 |
|
|
|
return (materialNum === 0 || useNum === 0) && (parentRow.materialNum === null || row.useNum === null) ? '' : result; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'parentId', |
|
|
|
title: '父级id', |
|
|
|
visible: false, |
|
|
|
field: 'availableStockNum', |
|
|
|
title: '可用库存数', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
title: '已领料数', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'pickNum', |
|
|
|
title: '本次领料数', |
|
|
|
editable:true |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'sortNo', |
|
|
|
title: '排序', |
|
|
|
visible: false |
|
|
|
}] |
|
|
|
}); |
|
|
|
}; |
|
|
|
initChildSonTable = function(index, row, $detail) { |
|
|
|
var childSonTable = $detail.html('<table style="table-layout:fixed"></table>').find('table'); |
|
|
|
$(childSonTable).bootstrapTable({ |
|
|
|
// url: prefix + "/subList", |
|
|
|
method: 'post', |
|
|
|
detailView: true, |
|
|
|
sidePagination: "server", |
|
|
|
contentType: "application/x-www-form-urlencoded", |
|
|
|
queryParams : {parentId: row.id}, |
|
|
|
onExpandRow : function(index, row, $detail) {initChildSonTable(index, row, $detail);}, |
|
|
|
columns: [ |
|
|
|
{field: 'id',title: '主键id'}, |
|
|
|
{field: 'level',title: '层级',formatter: function(value, row, index) {return $.table.selectDictLabel(levelDatas, value);}}, |
|
|
|
{field: 'bomNo',title: 'bom号',formatter:function (value,row,index){if (value == null || value == ''){return '/'; }else{ return value;}}}, |
|
|
|
{field: 'photoUrl',title: '图片',formatter:function (value,row,index){if (value == null || value == ''){ return '/';}else{return $.table.imageView(value);}}}, |
|
|
|
{field: 'materialNo',title: '料号',}, |
|
|
|
{field: 'materialName',title: '物料名称',}, |
|
|
|
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}}, |
|
|
|
{field: 'describe',title: '描述',}, |
|
|
|
{field: 'brand',title: '品牌',}, |
|
|
|
{field: 'unit',title: '单位',}, |
|
|
|
{field: 'lossRate',title: '损耗率(%)',formatter:function (value,row,index){return value + '%';}}, |
|
|
|
{field: 'processMethod',title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}}, |
|
|
|
{field: 'useNum',title: '订单用量',}, |
|
|
|
{field: 'parentId',title: '父级id',visible: false,}, |
|
|
|
] |
|
|
|
}], |
|
|
|
// 当所有数据被加载时触发 |
|
|
|
onLoadSuccess: function (data) { |
|
|
|
|
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/add", $('#form-picking-add').serialize()); |
|
|
|
|
|
|
|
function queryParams(params) { |
|
|
|
var curParams = { |
|
|
|
// 传递参数查询参数 |
|
|
|
developOrderCode: $("#developOrderCode").val() |
|
|
|
}; |
|
|
|
console.log(curParams); |
|
|
|
return curParams; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var shouldVisibleFields = false; // 假设这是你的条件 |
|
|
|
|
|
|
|
visibleField(); |
|
|
|
//判断是否显示主表的字段 |
|
|
|
function visibleField() { |
|
|
|
var parentLength = $("#bootstrap-table-picking").bootstrapTable("getData").length; |
|
|
|
for (let i = 0; i < parentLength; i++) { |
|
|
|
var sonData = $('#'+"child_table_" + i).bootstrapTable("getData"); |
|
|
|
if (sonData.length < 0){ |
|
|
|
shouldVisibleFields = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 获取所有子表数据的函数 |
|
|
|
function getAllSubTablesData() { |
|
|
|
var allSubData = []; |
|
|
|
// 获取所有被展开的行 |
|
|
|
var parentLength = $("#bootstrap-table-picking").bootstrapTable("getData").length; |
|
|
|
for (let i = 0; i < parentLength; i++) { |
|
|
|
var childTableId = "child_table_" + i; |
|
|
|
var sonData = $('#' + childTableId).bootstrapTable("getData"); |
|
|
|
|
|
|
|
// 循环获取子表中存在的行数据,每个行数据转换添加到allSubData数组中 |
|
|
|
sonData.forEach(function (item) { |
|
|
|
item.tableId = childTableId; |
|
|
|
allSubData.push(item); |
|
|
|
}); |
|
|
|
} |
|
|
|
return allSubData; |
|
|
|
} |
|
|
|
</script> |
|
|
|
</body> |
|
|
|