|
@@ -29,6 +29,7 @@
|
|
|
<option value ="">暂无产品,请到生产产品列表添加产品</option>
|
|
|
</#if>
|
|
|
</select>
|
|
|
+ <input type="hidden" value="${ptsComponents.produceId!''}" name="oldProduceId" id="oldProduceId">
|
|
|
</span> </div>
|
|
|
</div>
|
|
|
|
|
@@ -79,6 +80,7 @@
|
|
|
<label for="sex-2">正常使用</label>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <input type="hidden" value="${ptsComponents.componentsStatus!''}" name="oldComponentsStatus" id="oldComponentsStatus">
|
|
|
</div>
|
|
|
|
|
|
<div class="row cl">
|
|
@@ -228,31 +230,57 @@
|
|
|
focusCleanup:true,
|
|
|
success:"valid",
|
|
|
submitHandler:function(form){
|
|
|
+ var produceId = $("#produceId").val();
|
|
|
+ var oldProduceId = $("#oldProduceId").val();
|
|
|
+ var componentsStatus=$('input:radio[name="componentsStatus"]:checked').val();
|
|
|
+ var oldComponentsStatus = $("#oldComponentsStatus").val();
|
|
|
+ if(produceId != oldProduceId || componentsStatus != oldComponentsStatus){
|
|
|
+ layer.confirm('修改产品或零件状态后会影响到以往的BOM清单,是否修改?',function(index){
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ data: $("#form-parts-update").serialize(),
|
|
|
+ url: "${path}/admin/machineParts/update_machineParts",
|
|
|
+ async: false,
|
|
|
+ success: function(data){
|
|
|
+ if (data.returnCode == 200) {
|
|
|
+ layer.msg('修改成功!', {icon: 1, time: 2000});
|
|
|
+ window.location.href = '${path}/admin/machineParts/_parts_list'
|
|
|
+ }else if(data.returnCode == 501){
|
|
|
+ layer.msg('该零件已保存,不能重复!', {icon: 2, time: 2000});
|
|
|
+ }else{
|
|
|
+ layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
+ layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ $.ajax({
|
|
|
+ cache: true,
|
|
|
+ type: "POST",
|
|
|
+ data: $("#form-parts-update").serialize(),
|
|
|
+ url: "${path}/admin/machineParts/update_machineParts",
|
|
|
+ async: false,
|
|
|
+ success: function(data){
|
|
|
+ if (data.returnCode == 200) {
|
|
|
+ layer.msg('修改成功!', {icon: 1, time: 2000});
|
|
|
+ window.location.href = '${path}/admin/machineParts/_parts_list'
|
|
|
+ }else if(data.returnCode == 501){
|
|
|
+ layer.msg('该零件已保存,不能重复!', {icon: 2, time: 2000});
|
|
|
+ }else{
|
|
|
+ layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
+ layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
- //$(form).ajaxSubmit();
|
|
|
- //var index = parent.layer.getFrameIndex(window.name);
|
|
|
- //parent.$('.btn-refresh').click();
|
|
|
- //parent.layer.close(index);
|
|
|
- $.ajax({
|
|
|
- cache: true,
|
|
|
- type: "POST",
|
|
|
- data: $("#form-parts-update").serialize(),
|
|
|
- url: "${path}/admin/machineParts/update_machineParts",
|
|
|
- async: false,
|
|
|
- success: function(data){
|
|
|
- if (data.returnCode == 200) {
|
|
|
- layer.msg('修改成功!', {icon: 1, time: 2000});
|
|
|
- window.location.href = '${path}/admin/machineParts/_parts_list'
|
|
|
- }else if(data.returnCode == 501){
|
|
|
- layer.msg('该零件已保存,不能重复!', {icon: 2, time: 2000});
|
|
|
- }else{
|
|
|
- layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
- }
|
|
|
- },
|
|
|
- error: function(XmlHttpRequest, textStatus, errorThrown){
|
|
|
- layer.msg('修改失败!', {icon: 2, time: 2000});
|
|
|
- }
|
|
|
- });
|
|
|
|
|
|
}
|
|
|
});
|