|
@ -27,9 +27,6 @@ |
|
|
<label class="col-sm-3 control-label">物料类型:</label> |
|
|
<label class="col-sm-3 control-label">物料类型:</label> |
|
|
<div class="col-sm-8"> |
|
|
<div class="col-sm-8"> |
|
|
<select disabled id="selectMaterialType" name = "materialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}"> |
|
|
<select disabled id="selectMaterialType" name = "materialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}"> |
|
|
<optgroup> |
|
|
|
|
|
<option value=""></option> |
|
|
|
|
|
</optgroup> |
|
|
|
|
|
<optgroup th:each="child: ${childList}" th:label="${child.name}"> |
|
|
<optgroup th:each="child: ${childList}" th:label="${child.name}"> |
|
|
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}" th:field="*{materialType}"></option> |
|
|
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}" th:field="*{materialType}"></option> |
|
|
</optgroup> |
|
|
</optgroup> |
|
@ -88,7 +85,14 @@ |
|
|
<th:block th:include="include :: select2-js" /> |
|
|
<th:block th:include="include :: select2-js" /> |
|
|
<script th:inline="javascript"> |
|
|
<script th:inline="javascript"> |
|
|
var prefix = ctx + "erp/bom"; |
|
|
var prefix = ctx + "erp/bom"; |
|
|
// var erpBom = [[${erpBom}]]; |
|
|
var erpBom = [[${erpBom}]]; |
|
|
|
|
|
var materialType1 = [[${erpBom.materialType}]]; |
|
|
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
|
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
|
|
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
|
|
var bomLevelSelectDatas = [[${@dict.getTypeSelect('bomLevel')}]]; |
|
|
|
|
|
$("#form-bom-edit").validate({ focusCleanup: true}); |
|
|
function selMaterialTb(){ |
|
|
function selMaterialTb(){ |
|
|
var options = { |
|
|
var options = { |
|
|
title: '物料选择', |
|
|
title: '物料选择', |
|
@ -97,23 +101,12 @@ |
|
|
}; |
|
|
}; |
|
|
$.modal.openOptions(options); |
|
|
$.modal.openOptions(options); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function doSubmit(index, layero){ |
|
|
function doSubmit(index, layero){ |
|
|
var body = layer.getChildFrame('body', index); |
|
|
var body = layer.getChildFrame('body', index); |
|
|
$("#treeId").val(body.find('#treeId').val()); |
|
|
$("#treeId").val(body.find('#treeId').val()); |
|
|
$("#treeName").val(body.find('#treeName').val()); |
|
|
$("#treeName").val(body.find('#treeName').val()); |
|
|
layer.close(index); |
|
|
layer.close(index); |
|
|
} |
|
|
} |
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
|
|
var sysUnitClassDatas = [[${@dict.getType('sys_unit_class')}]]; |
|
|
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
|
|
var bomLevelSelectDatas = [[${@dict.getTypeSelect('bomLevel')}]]; |
|
|
|
|
|
var processMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
|
|
|
|
|
|
|
|
$("#form-bom-edit").validate({ |
|
|
|
|
|
focusCleanup: true |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function submitHandler() { |
|
|
function submitHandler() { |
|
|
if ($.validate.form()) { |
|
|
if ($.validate.form()) { |
|
|
var formData = $("#form-bom-edit").serializeArray(); |
|
|
var formData = $("#form-bom-edit").serializeArray(); |
|
@ -134,66 +127,7 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$(function() { |
|
|
$(function() { |
|
|
|
|
|
$("#selectMaterialType").val(materialType1); |
|
|
// $("#selectMaterialType").val([erpBom.materialType]).trigger("change"); |
|
|
|
|
|
// $("#selectProcessMethod").val([erpBom.processMethod]).trigger("change"); |
|
|
|
|
|
// $("#selectUnit").val([erpBom.unit]).trigger("change"); |
|
|
|
|
|
|
|
|
|
|
|
$("#selMaterialNo").select2({ |
|
|
|
|
|
theme: "select2", |
|
|
|
|
|
allowClear: true, |
|
|
|
|
|
placeholder: "请选择一个料号", |
|
|
|
|
|
ajax:{ |
|
|
|
|
|
type: "post", |
|
|
|
|
|
url:ctx+"erp/material/list", |
|
|
|
|
|
dataType:"json", |
|
|
|
|
|
delay:250, |
|
|
|
|
|
data:function(params){ |
|
|
|
|
|
var searchVal = params.term; |
|
|
|
|
|
var obj = { |
|
|
|
|
|
params:{ |
|
|
|
|
|
materialNo: searchVal |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
return obj; |
|
|
|
|
|
/*return { |
|
|
|
|
|
materialNo: params.term, |
|
|
|
|
|
// page: params.page || 1 |
|
|
|
|
|
};*/ |
|
|
|
|
|
}, |
|
|
|
|
|
cache:true, |
|
|
|
|
|
processResults: function (res, params) { |
|
|
|
|
|
var resultList = res.rows; |
|
|
|
|
|
var options = []; |
|
|
|
|
|
for(var i= 0, len=resultList.length;i<len;i++){ |
|
|
|
|
|
var option = resultList[i]; |
|
|
|
|
|
option.id = resultList[i]["materialNo"]; |
|
|
|
|
|
option.text = resultList[i]["materialNo"]; |
|
|
|
|
|
options.push(option); |
|
|
|
|
|
} |
|
|
|
|
|
return { |
|
|
|
|
|
results: options, |
|
|
|
|
|
pagination: { |
|
|
|
|
|
// more:res["data"]["more"] |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
escapeMarkup: function (markup) { return markup; }, |
|
|
|
|
|
// minimumInputLength: 1 |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
var materialNo = $("#materialNo").val(); |
|
|
|
|
|
$("#selMaterialNo").val([materialNo]).trigger("change"); |
|
|
|
|
|
|
|
|
|
|
|
$('#selMaterialNo').on('select2:select', function (e) { |
|
|
|
|
|
var data = e.params.data; |
|
|
|
|
|
$("input[name='materialName']").val(data.materialName); |
|
|
|
|
|
$("input[name='brand']").val(data.brand); |
|
|
|
|
|
$("textarea[name='describe']").val(data.describe); |
|
|
|
|
|
$("#selectMaterialType").val([data.materialType]).trigger("change"); |
|
|
|
|
|
$("#selectProcessMethod").val([data.processMethod]).trigger("change"); |
|
|
|
|
|
$("#selectUnit").val([data.unit]).trigger("change"); |
|
|
|
|
|
}); |
|
|
|
|
|
var options = { |
|
|
var options = { |
|
|
url: prefix + "/oneLevelList", |
|
|
url: prefix + "/oneLevelList", |
|
|
id: 'bootstrap-sub-table-1', |
|
|
id: 'bootstrap-sub-table-1', |
|
@ -317,7 +251,6 @@ |
|
|
] |
|
|
] |
|
|
}; |
|
|
}; |
|
|
$.table.init(options); |
|
|
$.table.init(options); |
|
|
|
|
|
|
|
|
function optFormatter(value, row, index) { |
|
|
function optFormatter(value, row, index) { |
|
|
var actions = []; |
|
|
var actions = []; |
|
|
actions.push('<a class="btn btn-search btn-xs optRow" href="javascript:void(0)"><i class="fa fa-search"></i>选择</a> '); |
|
|
actions.push('<a class="btn btn-search btn-xs optRow" href="javascript:void(0)"><i class="fa fa-search"></i>选择</a> '); |
|
@ -338,8 +271,6 @@ |
|
|
curParams.parentId = $("#id").val(); |
|
|
curParams.parentId = $("#id").val(); |
|
|
return curParams; |
|
|
return curParams; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
function doSubmit(index, layero,uniqueId){ |
|
|
console.log(uniqueId); |
|
|
console.log(uniqueId); |
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
|
var iframeWin = window[layero.find('iframe')[0]['name']]; |
|
@ -363,11 +294,8 @@ |
|
|
processMethod: rowData.processMethod, |
|
|
processMethod: rowData.processMethod, |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layer.close(index); |
|
|
layer.close(index); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* 新增表格行 */ |
|
|
/* 新增表格行 */ |
|
|
function insertRow(){ |
|
|
function insertRow(){ |
|
|
// var uuidStr = uuid(); |
|
|
// var uuidStr = uuid(); |
|
|