|
|
@ -7,11 +7,11 @@ |
|
|
|
</head> |
|
|
|
<body class="white-bg"> |
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
|
|
|
<form class="form-horizontal m" id="form-CompantFixedAssets-add"> |
|
|
|
<form class="form-horizontal m" id="form-compantFixedAssets-add"> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">料号:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="materialCode" class="form-control m-b" > |
|
|
|
<select id="compant_materialCode" name="materialCode" class="form-control m-b" > |
|
|
|
<option value=""></option> |
|
|
|
</select> |
|
|
|
</div> |
|
|
@ -19,7 +19,7 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-3 control-label">物料名称:</label> |
|
|
|
<div class="col-sm-8"> |
|
|
|
<select name="materialName" class="form-control m-b" > |
|
|
|
<select id="compant_materialName" name="materialName" class="form-control m-b" > |
|
|
|
<option value=""></option> |
|
|
|
</select> |
|
|
|
</div> |
|
|
@ -163,58 +163,75 @@ |
|
|
|
<th:block th:include="include :: select2-js" /> |
|
|
|
<script th:inline="javascript"> |
|
|
|
var prefix = ctx + "financial/compantFixedAssets" |
|
|
|
$("#form-CompantFixedAssets-add").validate({focusCleanup: true}); |
|
|
|
$("#form-compantFixedAssets-add").validate({focusCleanup: true}); |
|
|
|
//获取物料料号,物料名称 |
|
|
|
$(function(){ |
|
|
|
$.ajax({ |
|
|
|
url: ctx + "erp/material/getMaterialSelList", |
|
|
|
type: "POST", |
|
|
|
dataType: 'json', |
|
|
|
delay: 250, |
|
|
|
success: function (res, params) { |
|
|
|
if (res.data.length > 0) { |
|
|
|
var usertData = res.data; |
|
|
|
for (let i in usertData) { |
|
|
|
$("#form-CompantFixedAssets-add select[name='materialCode']").append( |
|
|
|
"<option value='" + usertData[i].materialNo + "'>" + usertData[i].materialNo + "</option>"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$.modal.msgError(res.msg); |
|
|
|
$("#compant_materialCode").select2({ |
|
|
|
theme: "bootstrap", |
|
|
|
allowClear: true, |
|
|
|
placeholder: "请选择物料", |
|
|
|
ajax:{ |
|
|
|
type: "post", |
|
|
|
url:ctx + "erp/material/getMaterialSelList", |
|
|
|
dataType:"json", |
|
|
|
delay:250, |
|
|
|
cache:true, |
|
|
|
processResults: function (res, params) { |
|
|
|
var resultList = res.data; |
|
|
|
var options = []; |
|
|
|
for(let i in resultList){ |
|
|
|
var option = resultList[i]; |
|
|
|
option.id = resultList[i]["materialNo"]; |
|
|
|
option.text = resultList[i]["materialNo"]; |
|
|
|
option.title = resultList[i]["materialName"]; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
return {results: options,pagination: {}}; |
|
|
|
}, |
|
|
|
}); |
|
|
|
$.ajax({ |
|
|
|
url: ctx + "erp/material/getMaterialSelList", |
|
|
|
type: "POST", |
|
|
|
dataType: 'json', |
|
|
|
delay: 250, |
|
|
|
success: function (res, params) { |
|
|
|
if (res.data.length > 0) { |
|
|
|
var usertData = res.data; |
|
|
|
for (let i in usertData) { |
|
|
|
$("#form-CompantFixedAssets-add select[name='materialName']").append( |
|
|
|
"<option value='" + usertData[i].materialName + "'>" + usertData[i].materialName + "</option>"); |
|
|
|
escapeMarkup: function (markup) { return markup; }, |
|
|
|
// minimumInputLength: 1 |
|
|
|
} |
|
|
|
} else { |
|
|
|
$.modal.msgError(res.msg); |
|
|
|
}); |
|
|
|
$("#compant_materialName").select2({ |
|
|
|
theme: "bootstrap", |
|
|
|
allowClear: true, |
|
|
|
placeholder: "请选择物料", |
|
|
|
ajax:{ |
|
|
|
type: "post", |
|
|
|
url:ctx + "erp/material/getMaterialSelList", |
|
|
|
dataType:"json", |
|
|
|
delay:250, |
|
|
|
cache:true, |
|
|
|
processResults: function (res, params) { |
|
|
|
var resultList = res.data; |
|
|
|
var options = []; |
|
|
|
for(let i in resultList){ |
|
|
|
var option = resultList[i]; |
|
|
|
option.id = resultList[i]["materialName"]; |
|
|
|
option.text = resultList[i]["materialName"]; |
|
|
|
option.title = resultList[i]["materialNo"]; |
|
|
|
options.push(option); |
|
|
|
} |
|
|
|
return {results: options, pagination: {}}; |
|
|
|
},escapeMarkup: function (markup) { return markup; }, |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
$("#form-CompantFixedAssets-add select[materialCode]").on('select2:select', function (e){ |
|
|
|
var data = e.params.data; |
|
|
|
$("#form-CompantFixedAssets-add input[name='materialCode']").val(data.materialNo); |
|
|
|
$("#form-CompantFixedAssets-add input[name='materialName']").val(data.materialName); |
|
|
|
$("#compant_materialCode").on('select2:select', function (e){ |
|
|
|
var dataObj = e.params.data; |
|
|
|
console.log(dataObj); |
|
|
|
$("#compant_materialName").val(dataObj.materialName).trigger('change'); |
|
|
|
}); |
|
|
|
$("#form-CompantFixedAssets-add select[materialName]").on('select2:select', function (e){ |
|
|
|
var data = e.params.data; |
|
|
|
$("input[name='materialCode']").val(data.materialNo); |
|
|
|
$("input[name='materialName']").val(data.materialName); |
|
|
|
|
|
|
|
$("#compant_materialName").on('select2:select', function (e){ |
|
|
|
var dataObj = e.params.data; |
|
|
|
console.log(dataObj); |
|
|
|
$("#compant_materialCode").val(dataObj.materialNo).trigger('change'); |
|
|
|
}); |
|
|
|
function submitHandler() { |
|
|
|
if ($.validate.form()) { |
|
|
|
$.operate.save(prefix + "/add", $('#form-CompantFixedAssets-add').serialize()); |
|
|
|
$.operate.save(prefix + "/add", $('#form-compantFixedAssets-add').serialize()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|