|
|
@ -1,7 +1,7 @@ |
|
|
|
<!DOCTYPE html> |
|
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
|
|
|
<head> |
|
|
|
<th:block th:include="include :: header('修改开发修改单')" /> |
|
|
|
<th:block th:include="include :: header('开发修改单详情')" /> |
|
|
|
<th:block th:include="include :: select2-css" /> |
|
|
|
<th:block th:include="include :: datetimepicker-css" /> |
|
|
|
<th:block th:include="include :: bootstrap-editable-css" /> |
|
|
@ -9,314 +9,492 @@ |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-developModifyOrder-detail" th:object="${erpDevelopModifyorder}"> |
|
|
|
<input name="developOrderId" th:field="*{developOrderId}" type="hidden"> |
|
|
|
<input id="developOrderId" name="developOrderId" th:field="*{developOrderId}" type="text" hidden> |
|
|
|
<input id="developOrderCode" name="developOrderCode" th:field="*{developOrderCode}" type="text" hidden> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">开发修改单号:</label> |
|
|
|
<label class="col-sm-4 control-label is-required">生产单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<input name="developOderCode" th:field="*{developOderCode}" class="form-control" type="text"> |
|
|
|
<select class="form-control" th:field="*{makeNo}" id="makeNo" name="makeNo" required disabled> |
|
|
|
<!-- 这里动态生成生产单号选项 --> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
|
<div class="row"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label is-required">生产单号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select id="makeNo" name="developOderCode" class="form-control" type="text" required> |
|
|
|
<option value="">请选择</option> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">修改完成时间:</label> |
|
|
|
<div class="input-group date"> |
|
|
|
<input name="updateInfoTime" class="form-control" placeholder="yyyy-MM-dd" type="text"> |
|
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label is-required">修改完成时间:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<div class="input-group date"> |
|
|
|
<input name="updateFinishTime" th:value="${#dates.format(erpDevelopModifyorder.updateFinishTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" disabled> |
|
|
|
<span class="input-group-addon"><i class="fa fa-calendar"></i></span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</form> |
|
|
|
<div class="container"> |
|
|
|
<div class="form-row"> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择开发修改单物料</span> |
|
|
|
<a class="btn btn-success" onclick="insertRow()"> |
|
|
|
<i class="fa fa-plus"></i> 添加修改物料 |
|
|
|
</a> |
|
|
|
<div class="form-row my-5"> <!-- 添加my-4类 --> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择开发修改物料</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-sub-table-developModify"></table> |
|
|
|
<table id="bootstrap-table-developModify"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
|
<div class="form-row"> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择采购物料</span> |
|
|
|
<a class="btn btn-success" onclick="insertRow2()"> |
|
|
|
<i class="fa fa-plus"></i> 添加修改物料 |
|
|
|
</a> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-4 control-label is-required">修改前说明:</label> |
|
|
|
<div class="col-sm-6"> |
|
|
|
<textarea id="beforeUpdateRemark" name="beforeUpdateRemark" class="form-control" required disabled>[[*{beforeUpdateRemark}]]</textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-sub-table-material"></table> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-4 control-label is-required">修改后说明:</label> |
|
|
|
<div class="col-sm-6"> |
|
|
|
<textarea id="afterUpdateRemark" name="afterUpdateRemark" class="form-control" required disabled>[[*{afterUpdateRemark}]]</textarea> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="container"> |
|
|
|
<div class="form-row"> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择通知人</span> |
|
|
|
<a class="btn btn-success" onclick="insertRow3()"> |
|
|
|
<i class="fa fa-plus"></i> 添加通知人 |
|
|
|
</a> |
|
|
|
<div class="btn-group-sm" role="group"> |
|
|
|
<span>选择采购物料</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="row"> |
|
|
|
<div class="col-sm-12 select-table table-striped"> |
|
|
|
<table id="bootstrap-sub-table-biztoitem"></table> |
|
|
|
<table id="bootstrap-table-purchase"></table> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<!-- <div class="container">--> |
|
|
|
<!-- <div class="form-row">--> |
|
|
|
<!-- <div class="btn-group-sm" role="group">--> |
|
|
|
<!-- <span>选择通知人</span>--> |
|
|
|
<!-- <a class="btn btn-success" onclick="insertBiztoitem()">--> |
|
|
|
<!-- <i class="fa fa-plus"></i> 添加通知人--> |
|
|
|
<!-- </a>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- <div class="row">--> |
|
|
|
<!-- <div class="col-sm-12 select-table table-striped">--> |
|
|
|
<!-- <table id="bootstrap-table-biztoitem"></table>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
<!-- </div>--> |
|
|
|
</div> |
|
|
|
<th:block th:include="include :: footer" /> |
|
|
|
<th:block th:include="include :: bootstrap-table-editable-js" /> |
|
|
|
<th:block th:include="include :: select2-js" /> |
|
|
|
<th:block th:include="include :: datetimepicker-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 + "erp/developModifyOrder"; |
|
|
|
$("#form-developModifyOrder-detail").validate({ |
|
|
|
focusCleanup: true |
|
|
|
$("#form-developModifyOrder-detail").validate({ focusCleanup: true}); |
|
|
|
|
|
|
|
$("input[name='updateFinishTime']").datetimepicker({ |
|
|
|
format: "yyyy-mm-dd", |
|
|
|
minView: "month", |
|
|
|
autoclose: 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 |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 新增提交 |
|
|
|
function submitHandler() { |
|
|
|
// 获取表单数据 |
|
|
|
const developModifyOrderData = $("#form-developModifyOrder-detail").serializeArray().reduce((obj, item) => { |
|
|
|
obj[item.name] = item.value; |
|
|
|
return obj; |
|
|
|
}, {}); |
|
|
|
|
|
|
|
var beforeUpdateRemark = $("#beforeUpdateRemark").val(); |
|
|
|
|
|
|
|
var afterUpdateRemark = $("#afterUpdateRemark").val(); |
|
|
|
|
|
|
|
// 开发修改物料 |
|
|
|
var developModifyTable = $('#bootstrap-table-developModify').bootstrapTable('getData'); |
|
|
|
|
|
|
|
// 采购修改物料 |
|
|
|
var purchaseTable = $('#bootstrap-table-purchase').bootstrapTable('getData'); |
|
|
|
|
|
|
|
// 将表数据转换成与developModifyOrderData格式一致的数组 |
|
|
|
var developModifyMaterialDataList = developModifyTable.map(function(item) { |
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"materialNo": item.materialNo, |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialType": item.materialType, |
|
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
// ...其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 将表数据转换成与developModifyOrderData格式一致的数组 |
|
|
|
var purchaseMaterialDataList = purchaseTable.map(function(item) { |
|
|
|
// 根据实际字段名调整 |
|
|
|
return { |
|
|
|
"developOrderDetailId":item.developOrderDetailId, |
|
|
|
"materialNo": item.materialNo, |
|
|
|
"materialName": item.materialName, |
|
|
|
"materialType": item.materialType, |
|
|
|
"materialPhotourl": item.materialPhotourl, |
|
|
|
"materialDescribe": item.materialDescribe, |
|
|
|
"materialBrand": item.materialBrand, |
|
|
|
"materialUnit": item.materialUnit, |
|
|
|
"materialProcessMethod": item.materialProcessMethod, |
|
|
|
"bomId":item.bomId, |
|
|
|
"materialNum":item.materialNum |
|
|
|
// ...其他字段 |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
const combinedData = Object.assign({}, developModifyOrderData, { |
|
|
|
developModifyorderMaterialVoList: developModifyMaterialDataList, |
|
|
|
developModifyorderDetailList:purchaseMaterialDataList, |
|
|
|
beforeUpdateRemark:beforeUpdateRemark, |
|
|
|
afterUpdateRemark:afterUpdateRemark |
|
|
|
}); |
|
|
|
// 合并表单数据和表格数据 |
|
|
|
console.log(combinedData) |
|
|
|
// 使用 JSON.stringify() 序列化数据 |
|
|
|
const jsonData = JSON.stringify(combinedData); |
|
|
|
// 发送 AJAX 请求到后端接口 |
|
|
|
$.operate.saveJson(prefix + "/detail", jsonData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*加载所有的关联生产单号*/ |
|
|
|
loadAllMakeNos(); |
|
|
|
/*加载所有的关联生产单号*/ |
|
|
|
function loadAllMakeNos(){ |
|
|
|
var url = ctx + 'system/makeorder/getAllMakeNos'; |
|
|
|
$.ajax({ |
|
|
|
type:'GET',//请求类型 |
|
|
|
url:url,//后端接口url |
|
|
|
dataType:'json', //预期服务器返回数据类型 |
|
|
|
success: function (data){ |
|
|
|
if (data && Array.isArray(data)){ |
|
|
|
var selectElement = $('#makeNo'); //获取生产编号下拉框元素 |
|
|
|
//清空下拉框现有选项 |
|
|
|
selectElement.empty(); |
|
|
|
//遍历返回的数据,添加下拉框的选项 |
|
|
|
$.each(data,function (index,item){ |
|
|
|
//赋值遍历数据中的makeNo到下拉框中 |
|
|
|
selectElement.append('<option value="'+item.makeNo+'">'+item.makeNo+'</option>'); |
|
|
|
}) |
|
|
|
}else { |
|
|
|
$.modal.error("数据为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 点击选择物料按钮 |
|
|
|
function insertDevelopModify() { |
|
|
|
var selectedMakeNo = $("#makeNo").val(); |
|
|
|
if (!selectedMakeNo) { |
|
|
|
$.modal.alertWarning("请先选择生产单号。"); |
|
|
|
return; |
|
|
|
} |
|
|
|
var encodedMakeNo = encodeURIComponent(selectedMakeNo); |
|
|
|
var url = prefix + '/developModifyMaterialSelect?makeNo=' + encodedMakeNo; |
|
|
|
var options = { |
|
|
|
id: "bootstrap-sub-table-developModify", |
|
|
|
// url: prefix + "/getDevelopModifyOrderList", |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: developModifyDoSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
//物料信息展示列表 |
|
|
|
$(function() { |
|
|
|
var options = { |
|
|
|
id:'bootstrap-table-developModify', |
|
|
|
url: prefix+'/getDevelopModifyMaterialById', |
|
|
|
queryParams: developModifyQueryParams, |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
columns: [ |
|
|
|
{checkbox: true}, |
|
|
|
{field: 'index',align: 'center', title: "序号", |
|
|
|
formatter: function (value, row, index) { |
|
|
|
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index)); |
|
|
|
return columnIndex + $.table.serialNumber(index); |
|
|
|
} |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
modalName: "选择物料", |
|
|
|
columns: [{ |
|
|
|
checkbox: true |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '料号', |
|
|
|
field: 'materialNo', |
|
|
|
}, |
|
|
|
{title: '物料索引id',field: 'materialId',align: 'center',visible: false}, |
|
|
|
{title: '料号',field: 'materialCode',align: 'center'}, |
|
|
|
{title: '物料名称',field: 'materialName',align: 'center'}, |
|
|
|
{title: '图片',field: 'photoUrl', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
if(value == null || value == ""){ |
|
|
|
value = ""; |
|
|
|
return "<img src='' herf='' />"; |
|
|
|
} |
|
|
|
return $.table.imageView(value); |
|
|
|
} |
|
|
|
{ |
|
|
|
title: '图片', |
|
|
|
field: 'materialPhotourl', |
|
|
|
}, |
|
|
|
{title: '物料类型',field: 'materialType',align: 'center', |
|
|
|
{ |
|
|
|
title: '物料名称', |
|
|
|
field: 'materialName', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '物料类型', |
|
|
|
field: 'materialType', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '描述',field: 'describe',align: 'center'}, |
|
|
|
{title: '品牌',field: 'brand',align: 'center'}, |
|
|
|
{ title: '单位',field: 'unit',align: 'center', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(sysUnitClassDatas, value); |
|
|
|
} |
|
|
|
{ |
|
|
|
title: '品牌', |
|
|
|
field: 'materialBrand', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '描述', |
|
|
|
field: 'materialDescribe', |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '单位', |
|
|
|
field: 'materialUnit', |
|
|
|
}, |
|
|
|
{title: '半成品类型',field: 'processMethod',align: 'center', |
|
|
|
|
|
|
|
{ |
|
|
|
field: 'materialProcessMethod', |
|
|
|
align: 'center', |
|
|
|
title: '物料加工方式', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ title: '对外售价',field: 'materialSole',}, |
|
|
|
{title: '国内税率',field: 'countTax',align: 'center',}, |
|
|
|
{ title: '美元汇率',field: 'usdTax', align: 'center',}, |
|
|
|
{field: 'materialNum',align: 'center',title: '物料的数量',}, |
|
|
|
{ title: '物料的不含税单价(RMB)',field: 'materialNoRmb',align: 'center',}, |
|
|
|
{title: '物料的不含税单价(美元)',field: 'materialNoUsd',align: 'center',}, |
|
|
|
{title: '修改详情',align: 'center', |
|
|
|
formatter:function formatterForm(value, row, index) { |
|
|
|
// 这里的代码会为每行生成一个表单 |
|
|
|
var form = $('<form></form>').append( |
|
|
|
$('<input/>', { type: 'text', value: row.name, name: 'name', placeholder: 'Name' }), |
|
|
|
$('<input/>', { type: 'email', value: row.email, name: 'email', placeholder: 'Email' }), |
|
|
|
$('<button/>', { type: 'submit' }).text('Submit') |
|
|
|
); |
|
|
|
form.on('submit', function(e) { |
|
|
|
e.preventDefault(); // 阻止表单默认提交行为 |
|
|
|
var formData = form.serializeArray(); // 序列化表单数据为数组 |
|
|
|
console.log(formData); // 在控制台输出表单数据 |
|
|
|
// 这里可以添加代码处理表单提交,例如发送到服务器等 |
|
|
|
}); |
|
|
|
return form; // 返回生成的表单HTML |
|
|
|
}}, |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(options); |
|
|
|
}) |
|
|
|
function developModifyQueryParams(params) { |
|
|
|
var curParams = { |
|
|
|
// 传递参数查询参数 |
|
|
|
developOrderId: $("#developOrderId").val() |
|
|
|
}; |
|
|
|
console.log(curParams); |
|
|
|
return curParams; |
|
|
|
} |
|
|
|
|
|
|
|
var option1 = { |
|
|
|
id: "bootstrap-sub-table-material", |
|
|
|
// url: prefix + "/list", |
|
|
|
function developModifyDoSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-developModifyMaterialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
|
|
|
|
//判断是否重复 |
|
|
|
var rows = $("#bootstrap-table-developModify").bootstrapTable('getData').length; |
|
|
|
|
|
|
|
if (rows > 0){ |
|
|
|
$.modal.alertError("每次只能修改一条物料!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// for(var i=0;i<rows;i++){ |
|
|
|
// var data = $("#bootstrap-table-developModify").bootstrapTable('getData')[i]; |
|
|
|
// if(data.materialNo==rowData.materialNo){ |
|
|
|
// $.modal.alertError("不能选择已添加过的相同物料"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-table-developModify").bootstrapTable('insertRow', { |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
materialNo:rowData.materialCode, |
|
|
|
materialPhotourl:rowData.photoUrl, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
materialDescribe: rowData.describe, |
|
|
|
materialBrand: rowData.brand, |
|
|
|
materialUnit: rowData.unit, |
|
|
|
materialProcessMethod: rowData.processMethod, |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
|
|
|
|
// 逻辑删除前端的一行数据 |
|
|
|
function removeDevelopModify(materialNo){ |
|
|
|
$("#bootstrap-table-developModify").bootstrapTable('remove', { |
|
|
|
field: 'materialNo', |
|
|
|
values: materialNo |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 点击选择采购物料按钮 |
|
|
|
function insertPurchase() { |
|
|
|
var url = prefix + '/purchaseMaterialSelect'; |
|
|
|
var options = { |
|
|
|
title: '选择物料', |
|
|
|
url: url, |
|
|
|
callBack: purchaseDoSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
} |
|
|
|
|
|
|
|
// 选择采购物料 |
|
|
|
$(function(){ |
|
|
|
var options = { |
|
|
|
id: 'bootstrap-table-purchase', |
|
|
|
url: prefix+'/getDevelopModifyDetailMaterialByCode', |
|
|
|
queryParams: purchaseQueryParams, |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
modalName: "bom", |
|
|
|
uniqueId: "id", |
|
|
|
pagination: false, // 设置不分页 |
|
|
|
sidePagination: "client", |
|
|
|
detailView: true, |
|
|
|
height: $(window).height() - 100, |
|
|
|
//指定父id列 |
|
|
|
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) { |
|
|
|
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> '); |
|
|
|
return actions.join(''); |
|
|
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
|
|
|
} |
|
|
|
}] |
|
|
|
}; |
|
|
|
$.table.init(option1); |
|
|
|
|
|
|
|
var option2 = { |
|
|
|
id: "bootstrap-sub-table-biztoitem", |
|
|
|
// url: prefix + "/list", |
|
|
|
showSearch: false, |
|
|
|
showRefresh: false, |
|
|
|
showToggle: false, |
|
|
|
showColumns: false, |
|
|
|
modalName: "通知人", |
|
|
|
detailView: true, |
|
|
|
height: $(window).height() - 100, |
|
|
|
//指定父id列 |
|
|
|
columns: [ |
|
|
|
{checkbox: false}, |
|
|
|
{title: '通知人',field: 'item', }, |
|
|
|
{title: '确认时间',field: 'materialNo', }, |
|
|
|
{title: '操作',align: 'center', |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialUnit', |
|
|
|
align: 'center', |
|
|
|
title: '单位', |
|
|
|
formatter: function(value, row, index) { |
|
|
|
return $.table.selectDictLabel(sysUnitClassDatas, value); |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialBrand', |
|
|
|
align: 'center', |
|
|
|
title: '品牌' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialDescribe', |
|
|
|
align: 'center', |
|
|
|
title: '描述' |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialProcessMethod', |
|
|
|
align: 'center', |
|
|
|
title: '物料加工方式', |
|
|
|
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> '); |
|
|
|
return actions.join(''); |
|
|
|
return $.table.selectDictLabel(processMethodDatas, value); |
|
|
|
} |
|
|
|
}] |
|
|
|
}, |
|
|
|
{ |
|
|
|
field: 'materialNum', |
|
|
|
align: 'center', |
|
|
|
title: '订单数量', |
|
|
|
}, |
|
|
|
] |
|
|
|
}; |
|
|
|
$.table.init(option2); |
|
|
|
$.table.init(options); |
|
|
|
}) |
|
|
|
initAllLevelTable = function(index, row, $detail) { |
|
|
|
$("#"+"all_level_table_"+row.id).bootstrapTable({ |
|
|
|
url: prefix + "/allLevelList", |
|
|
|
|
|
|
|
initChildTable = function(index, row, $detail) { |
|
|
|
var parentRow = row; |
|
|
|
var parentRowIndex = index; |
|
|
|
var childTableId = 'child_table_' + index; |
|
|
|
var childFormTableId = 'child_form_table_' + index; |
|
|
|
var childTableFormId = 'child_table_form_' + index; |
|
|
|
// $detail.html('<form id="'+childTableFormId+'"><table id="'+childTableId+'"></table><table id="'+childFormTableId+'"></table></form>'); |
|
|
|
$detail.html('<table id="' + childTableId + '"></table><table id="' + childFormTableId + '"></table>'); |
|
|
|
// BOM展示 |
|
|
|
$('#' + childTableId).bootstrapTable({ |
|
|
|
url: ctx + "erp/bom/allLevelList", |
|
|
|
method: 'post', |
|
|
|
sidePagination: "server", |
|
|
|
contentType: "application/x-www-form-urlencoded", |
|
|
|
queryParams : { |
|
|
|
parentId: row.id |
|
|
|
queryParams: { |
|
|
|
parentId: parentRow.bomId |
|
|
|
}, |
|
|
|
columns: [{ |
|
|
|
field: 'id', |
|
|
|
title: '主键id' |
|
|
|
title: '主键id', |
|
|
|
visible: false |
|
|
|
}, |
|
|
|
{ |
|
|
|
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 |
|
|
|
} |
|
|
|
} |
|
|
@ -324,29 +502,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 |
|
|
|
} |
|
|
|
} |
|
|
@ -354,21 +531,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 |
|
|
|
} |
|
|
|
} |
|
|
@ -376,18 +569,28 @@ |
|
|
|
{ |
|
|
|
field: 'lossRate', |
|
|
|
title: '损耗率', |
|
|
|
formatter: function (value,row,index){ |
|
|
|
if (value == null || value == ''){ |
|
|
|
return "/"; |
|
|
|
} |
|
|
|
return value + "%"; |
|
|
|
} |
|
|
|
// formatter: function (value,row,index){ |
|
|
|
// if (value == null || value == ''){ |
|
|
|
// return '/'; |
|
|
|
// }else{ |
|
|
|
// 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; |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
@ -399,126 +602,72 @@ |
|
|
|
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 insertRow() { |
|
|
|
var url = ctx + "system/makeorder/selectMakeorder"; |
|
|
|
var options = { |
|
|
|
title: '选择生产物料', |
|
|
|
url: url, |
|
|
|
data: { |
|
|
|
"materialType": $("#makeNo").val() |
|
|
|
}, |
|
|
|
callBack: doSubmit |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
}); |
|
|
|
} |
|
|
|
function insertRow2() { |
|
|
|
var url = ctx + "erp/material/select"; |
|
|
|
var options = { |
|
|
|
title: '选择料号', |
|
|
|
url: url, |
|
|
|
callBack: doSubmit2 |
|
|
|
|
|
|
|
function purchaseQueryParams(params) { |
|
|
|
var curParams = { |
|
|
|
// 传递参数查询参数 |
|
|
|
developOrderCode: $("#developOrderCode").val() |
|
|
|
}; |
|
|
|
$.modal.openOptions(options); |
|
|
|
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-select-table').bootstrapTable('getSelections')[0]; |
|
|
|
var totalNum = $("#bootstrap-sub-table-developModify").bootstrapTable('getData').length; |
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-sub-table-developModify").bootstrapTable('insertRow',{ |
|
|
|
index: 1, |
|
|
|
row: { |
|
|
|
id:rowData.id, |
|
|
|
bomNo:rowData.bomNo, |
|
|
|
materialNo: rowData.materialNo, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
describe: rowData.describe, |
|
|
|
processMethod: rowData.processMethod, |
|
|
|
unit: rowData.unit, |
|
|
|
brand: rowData.brand, |
|
|
|
level: "1", |
|
|
|
lossRate:'', |
|
|
|
useNum:'' |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
function doSubmit2(index, layero,uniqueId){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function purchaseDoSubmit(index, layero,uniqueId){ |
|
|
|
console.log(uniqueId); |
|
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
|
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; |
|
|
|
var totalNum = $("#bootstrap-sub-table-material").bootstrapTable('getData').length; |
|
|
|
var rowData = iframeWin.$('#bootstrap-purchaseMaterialSelect-table').bootstrapTable('getSelections')[0]; |
|
|
|
|
|
|
|
//判断是否重复 |
|
|
|
var rows = $("#bootstrap-table-purchase").bootstrapTable('getData').length; |
|
|
|
|
|
|
|
if (rows > 0){ |
|
|
|
$.modal.alertError("每次只能修改一条物料!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
// for(var i=0;i<rows;i++){ |
|
|
|
// var data = $("#bootstrap-table-developModify").bootstrapTable('getData')[i]; |
|
|
|
// if(data.materialNo==rowData.materialNo){ |
|
|
|
// $.modal.alertError("不能选择已添加过的相同物料"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
console.log("rowData: "+rowData); |
|
|
|
$("#bootstrap-sub-table-material").bootstrapTable('insertRow',{ |
|
|
|
index: 1, |
|
|
|
$("#bootstrap-table-purchase").bootstrapTable('insertRow', { |
|
|
|
index:1, |
|
|
|
row: { |
|
|
|
id:rowData.id, |
|
|
|
bomNo:rowData.bomNo, |
|
|
|
materialNo: rowData.materialNo, |
|
|
|
bomId:rowData.bomId, |
|
|
|
materialNo:rowData.materialNo, |
|
|
|
materialPhotourl:rowData.materialPhotourl, |
|
|
|
materialName: rowData.materialName, |
|
|
|
materialType: rowData.materialType, |
|
|
|
describe: rowData.describe, |
|
|
|
processMethod: rowData.processMethod, |
|
|
|
unit: rowData.unit, |
|
|
|
brand: rowData.brand, |
|
|
|
level: "1", |
|
|
|
lossRate:'', |
|
|
|
useNum:'' |
|
|
|
materialDescribe: rowData.describe, |
|
|
|
materialBrand: rowData.brand, |
|
|
|
materialUnit: rowData.unit, |
|
|
|
materialProcessMethod:rowData.processMethod, |
|
|
|
materialNum:'0' |
|
|
|
} |
|
|
|
}) |
|
|
|
layer.close(index); |
|
|
|
} |
|
|
|
function remove(id){ |
|
|
|
$("#bootstrap-sub-table-developModify").bootstrapTable('remove', { |
|
|
|
field: 'id', |
|
|
|
values: id |
|
|
|
}) |
|
|
|
} |
|
|
|
function removeRow(id){ |
|
|
|
$("#bootstrap-sub-table-material").bootstrapTable('remove', { |
|
|
|
field: 'id', |
|
|
|
values: id |
|
|
|
|
|
|
|
// 逻辑删除前端的一行数据 |
|
|
|
function removePurchase(materialNo){ |
|
|
|
$("#bootstrap-table-purchase").bootstrapTable('remove', { |
|
|
|
field: 'materialNo', |
|
|
|
values: materialNo |
|
|
|
}) |
|
|
|
} |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/detail", $('#form-developModifyOrder-detail').serialize()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |