![](https://i-blog.csdnimg.cn/blog_migrate/5f94c2fecb4ccb2f76f50c965d122407.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/50828477840f9be8f01bb82af691c7d1.gif)
1 var safe = { 2 safe_type:<%=safe_type_tab %>, 3 detailList:<%=tempDetailList %>, 4 moduleList:<%=moduleList %>, 5 utmList:<%=utmList %>, 6 params:{type1:<%=tempValueId%>,moduleValueId:<%=moduleValueId%>}, 7 inInControl:function(){ 8 safe.bind_safe1(); 9 safe.bing_safe3(); 10 safe.bind_safe2(safe.params.type1); 11 $("#selTempList").change(function(){ 12 var tempID = $(this).val(); 13 $("#dataTempDatialTable tbody tr").remove(); 14 if(tempID!=0){ 15 safe.bind_safe2(tempID); 16 } 17 }); 18 $("#selUtNavList").change(function(){ 19 $("#hidNavModuleUrl").val($(this).attr("data-url")); 20 }); 21 22 //修改时绑定下拉对象 23 var id = getQueryString('mid'); 24 var idEdit = (id != null); 25 if(idEdit){ 26 if(safe.params.type1==1){ 27 $("#selTempList").val(safe.params.type1); 28 $("#dataTempDatialTable tbody tr").remove(); 29 safe.bind_safe2(safe.params.type1); 30 } 31 } 32 }, 33 bind_safe1:function(){ 34 var type1 = $("#selTempList"); 35 $.each(safe.safe_type.ds,function(i,item) { 36 var selTmep = safe.params.type1 == item.ID ? 'selected="selected"' : ''; 37 type1.append('<option value="'+item.ID+'" '+selTmep+'>'+item.TempName+'</option>'); 38 }); 39 }, 40 bind_safe2:function(id){ 41 var type2 = $("#dataTempDatialTable tbody"); 42 var num = 0; 43 var IsBoolutm = false; 44 var sel = ""; 45 //模框 46 $.each(safe.detailList.ds,function(i,ite) { 47 if (ite.TempID == id){ 48 ++num; 49 var htmlSelect = '<select id="selModuleList'+num+'" name="selModuleList" style="width: 200px;"></select>'; 50 51 type2.append("<tr><td>"+num+"<td>"+ite.ID+"</td><td>"+ite.RectangleName+"</td><td>"+ite.DivID+"</td><td>"+ite.Width+"</td><td>"+ite.Height+"</td><td style='width:210px;'>"+htmlSelect+"</td></tr>"); 52 53 //模块 54 var modul = $("#selModuleList"+num); 55 $.each(safe.moduleList.ds, function(j, item) { 56 //模框与模块关系列表 57 if(safe.utmList != null){ 58 $.each(safe.utmList.ds, function(k, tem) { 59 if (tem.TempDetailD == ite.ID && tem.ModuleID == item.ID) { 60 IsBoolutm = true; 61 sel = IsBoolutm ? 'selected = "selected"' : '';//编辑时默认选中对应的模块 62 } 63 }); 64 } 65 if(item.Type != 4){ 66 modul.append('<option value="'+item.ID+'" '+sel+' >'+item.DisplayName+'</option>'); 67 } 68 if(sel != "" || IsBoolutm == true){ 69 sel = ""; 70 IsBoolutm = false; 71 } 72 }); 73 } 74 }); 75 }, 76 bing_safe3:function(){ 77 var utNav = $("#selUtNavList"); 78 $.each(safe.moduleList.ds, function(i, navItem) { 79 if(navItem.Type == 4){ 80 var selModule = safe.params.moduleValueId == navItem.ID ? 'selected="selected"' : ''; 81 utNav.append('<option data-url="'+navItem.Url+'" value="'+navItem.ID+'" '+selModule+'>'+navItem.DisplayName+'</option>'); 82 } 83 }); 84 //导航url初始值 85 $("#hidNavModuleUrl").val(utNav.find("option:selected").attr("data-url")); 86 } 87 };