select.html 1.2 KB

12345678910111213141516171819202122232425262728
  1. {% if Demeter.isset('span') == 0 %}<label><span>选择设备:</span></label>{% end %}
  2. <div class="flex-cont">
  3. <div class="scroller">
  4. <ul>
  5. {% for v in data['gateway'] %}
  6. <li tab-id="{{v['id']}}" id="gateway_{{v['id']}}"><a href="javascript:;">{{v['name']}}</a></li>
  7. {% end %}
  8. </ul>
  9. </div>
  10. <div class="scroller tab-cont">
  11. {% for k,v in enumerate(data['gateway']) %}
  12. <ul tab-cont-id="{{v['id']}}" {% if k == 0 %}style="display: block;"{% else %}style="display: none;"{% end %}>
  13. {% if data['device'] and v['id'] in data['device'] %}
  14. {% for d in data['device'][v['id']] %}
  15. <li><label><input type="checkbox" name="update_devices" ids="update_devices" value="{{d['id']}}" data-parent="{{v['id']}}" {% if 'devices' in data['info'] and d['id'] in data['info']['devices'] %}checked{% end %}><span>{{d['name']}}</span></label></li>
  16. {% end %}
  17. {% end %}
  18. </ul>
  19. {% end %}
  20. </div>
  21. </div>
  22. <script type="text/javascript">
  23. $('.scroller').on('click','[tab-id]',function(){
  24. var tabid = $(this).attr('tab-id');
  25. $('.tab-cont [tab-cont-id="'+tabid+'"]').show().siblings().hide();
  26. })
  27. </script>