|
@@ -160,20 +160,24 @@
|
|
|
});
|
|
|
})
|
|
|
|
|
|
-
|
|
|
var allComponents; //所有零件的集合
|
|
|
+ var staticProduceId; //产品id,用于判断产品更改
|
|
|
|
|
|
$(function () {
|
|
|
/*添加页面初始化,添加一个零件选择框*/
|
|
|
addComponents("#","");
|
|
|
|
|
|
var produceId = $("[name='produceId']").val();
|
|
|
+ staticProduceId = produceId;
|
|
|
getBomByProduce(produceId);
|
|
|
|
|
|
/*监听产品选择*/
|
|
|
$("[name='produceId']").change(function(){
|
|
|
var produceId = $(this).val();
|
|
|
getBomByProduce(produceId);
|
|
|
+
|
|
|
+ delComponent(0,"all");
|
|
|
+ addComponents("#","");
|
|
|
})
|
|
|
|
|
|
/*监听修改基础 bom单*/
|
|
@@ -187,8 +191,9 @@
|
|
|
function addComponents(componentsId,number) {
|
|
|
var tbody = $("#componentaAll");
|
|
|
|
|
|
- if(allComponents == null){ //获取零件列表
|
|
|
- var produceId = $("[name='produceId']").val();
|
|
|
+ var produceId = $("[name='produceId']").val();
|
|
|
+ if(allComponents == null || produceId != staticProduceId){ //获取零件列表
|
|
|
+ staticProduceId = produceId;
|
|
|
allComponents = listComponent(produceId);
|
|
|
}
|
|
|
var opHtml = '';
|
|
@@ -202,7 +207,7 @@
|
|
|
}
|
|
|
var html = '<tr class="text-c"> '
|
|
|
+'<td> '
|
|
|
- +'<select class="select" size="1" name="comName" style="height: 30px;"> '
|
|
|
+ +'<select class="select" size="1" name="comName" style="height: 30px;" datatype="*" errormsg="请选择零件"> '
|
|
|
+''
|
|
|
+ opHtml
|
|
|
+'</select> '
|