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