js初始化對象

來源:互聯網
上載者:User

標籤:關係   log   open   module   sel   elm   rectangle   lis   att   

 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         };
View Code

 

js初始化對象

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.