loop.html 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. {% extends "../../theme.html" %}
  2. {% block content %}
  3. {%include 'menu.html'%}
  4. <div class="pannel">
  5. <div class="ul5">
  6. {% for v in data['list'] %}
  7. <dl>
  8. <dt>{{v['looptype']}}:{{v['loop']}}{{v['hour']}}:{{v['minute']}}
  9. <div class="right r-btns">
  10. {% if v['status'] == True %}
  11. <a href="javascript:;" onclick="Farm.Cancel(this, '{{v['id']}}', '/device/update_set_loop?id={{v['id']}}')" class="link primary">取消设置</a>
  12. {% else %}
  13. {{v['cdates']}} <a href="javascript:;" onclick="Farm.Recovery(this, '{{v['id']}}', '/device/update_set_loop?id={{v['id']}}')" class="link primary">恢复</a>
  14. {% end %}
  15. </div>
  16. </dt>
  17. <dt>{{v['oper']}}
  18. </dt>
  19. {% for dv in v['device'] %}
  20. <dd>{{dv['name']}}</dd>
  21. {% end %}
  22. </dl>
  23. {% end %}
  24. </div>
  25. </div>
  26. {%set url = data['url']['loop'] %}
  27. {%include '../../inc/page.html'%}
  28. {% end %}
  29. {% block script %}
  30. <script type="text/javascript">
  31. Array.prototype.indexOf = function(val) {
  32. for (var i = 0; i < this.length; i++) {
  33. if (this[i] == val) return i;
  34. }
  35. return -1;
  36. };
  37. Array.prototype.remove = function(val) {
  38. var index = this.indexOf(val);
  39. if (index > -1) {
  40. this.splice(index, 1);
  41. }
  42. };
  43. function looptype(e) {
  44. var value = e.val();
  45. if (value == 1) {
  46. $(".day-cont").hide();
  47. } else if (value == 2) {
  48. $(".day-cont").eq(0).show();
  49. $(".day-cont").eq(1).hide();
  50. } else if (value == 3) {
  51. $(".day-cont").eq(0).hide();
  52. $(".day-cont").eq(1).show();
  53. }
  54. }
  55. function set(e, id) {
  56. var i = e.find('i');
  57. var c = i.attr('class');
  58. var v = [];
  59. var val = $('#update_loop').val();
  60. if (val) {
  61. v = val.split(',');
  62. }
  63. if (c.indexOf('checked') == -1) {
  64. i.addClass('checked');
  65. v.push(id);
  66. } else {
  67. i.removeClass('checked');
  68. v.remove(id);
  69. }
  70. $("#update_loop").val(v.join(','));
  71. }
  72. </script>
  73. {% end %}