Browse Source

bom单管理

wangxiaoming 7 years ago
parent
commit
ceadb56de4
1 changed files with 9 additions and 4 deletions
  1. 9 4
      watero-rst-web/src/main/webapp/WEB-INF/views/pts/bom/add_bom.ftl

+ 9 - 4
watero-rst-web/src/main/webapp/WEB-INF/views/pts/bom/add_bom.ftl

@@ -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> '