data.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {% for v in data['list'] %}
  2. {% if 'device' in v and v['device'] %}
  3. {%set num=0 %}
  4. {% for value in v['device'] %}
  5. {% if value['hardware_type'] not in (6,7) %}
  6. {%set num=num+1 %}
  7. {% end %}
  8. {% end %}
  9. {% if num > 0 %}
  10. <div class="pannel">
  11. <h2>{{v['name']}}</h2>
  12. <div class="ul3 clearfix">
  13. {% for value in v['device'] %}
  14. {% if value['hardware_type'] == 5 %}
  15. <dl>
  16. {% if 'noset' not in data %}
  17. <dd class="controller"></dd>
  18. {% end %}
  19. {% if value['value'] == '1' %}
  20. <dt>连接</dt>
  21. {% else %}
  22. <dt>断开</dt>
  23. {% end %}
  24. <dd class="tit">{{value['name']}}</dd>
  25. </dl>
  26. {% elif value['hardware_type'] == 2 or value['hardware_type'] == 4 %}
  27. {%set v = float(value['value']) %}
  28. <dl>
  29. {% if 'noset' not in data %}
  30. <dd class="controller">{% if value['status'] == False %}<em class="error">离线</em>{% elif value['max'] != None and v > value['max'] %}<em class="error">上限超标</em>{% elif value['min'] != None and v < value['min'] %}<em class="error">下限超标</em>{% else %}<em>正常</em>{% end %}<a href="javascript:;" onclick="Farm.Page('{{value['typeName']}}限制设置', '/device/update_device?id={{value['id']}}')" class="icons ico-setting"></a>
  31. </dd>
  32. {% end %}
  33. <dt>{{value['value']}}</dt>
  34. <dd class="tit" {% if 'stat' in data and data['stat'] %}style="cursor: pointer;" onclick="Farm.ShowChart('{{loadUrl}}&device={{value['id']}}')"{% end %}>{{value['name']}}({{value['unit']}})</dd>
  35. </dl>
  36. {% elif value['hardware_type'] == 3 and value['unit'] == 'button' %}
  37. <dl class="button">
  38. {% if 'noset' not in data %}
  39. <dd class="controller">{% if value['status'] == False %}<em class="error">离线</em>{% end %}</dd>
  40. {% end %}
  41. {%set layer = '' %}
  42. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  43. {%set layer = value['exp'] %}
  44. {% end %}
  45. <dt>
  46. <button {% if layer %}data-hint="{{layer}}"{% end %} onclick="Farm.Button(this, '/device/update', '{{value['id']}}', 1, '#button_down_{{value['id']}}')" id="button_up_{{value['id']}}" class="btn-switch {% if layer and value['cxnum'] in (1,4) %}hint--top hint--error hint--always {% end %} {% if value['exp'] == '-1' and value['cxnum'] in (1,4) %}loading{% end %} {% if value['value'] in ('2','3') %}disabled{% end %} {% if value['value'] in ('1','4') %}open{% end %} {% if value['status'] == False %}disabled{% end %}">升</button>
  47. <button {% if layer %}data-hint="{{layer}}"{% end %} onclick="Farm.Button(this, '/device/update', '{{value['id']}}', 5)" id="button_stop_{{value['id']}}" class="btn-switch {% if layer and value['cxnum'] == 5 %}hint--top hint--error hint--always {% end %} {% if value['exp'] == '-1' and value['cxnum'] == 5 %}loading{% end %} {% if value['value'] == '5' %}open{% end %} {% if value['status'] == False %}disabled{% end %}">停</button>
  48. <button {% if layer %}data-hint="{{layer}}"{% end %} onclick="Farm.Button(this, '/device/update', '{{value['id']}}', 2, '#button_up_{{value['id']}}')" id="button_down_{{value['id']}}" class="btn-switch {% if layer and value['cxnum'] in (2,3) %}hint--top hint--error hint--always {% end %} {% if value['exp'] == '-1' and value['cxnum'] in (2,3) %}loading{% end %} {% if value['value'] in ('1','4') %}disabled{% end %} {% if value['value'] in ('2','3') %}open{% end %} {% if value['status'] == False %}disabled{% end %}">降</button>
  49. </dt>
  50. <dd class="tit">{{value['name']}}</dd>
  51. </dl>
  52. {% elif value['hardware_type'] == 3 %}
  53. <dl>
  54. {% if 'noset' not in data %}
  55. <dd class="controller">{% if value['status'] == False %}<em class="error">离线</em>{% end %}</dd>
  56. {% end %}
  57. {%set layer = '' %}
  58. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  59. {%set layer = value['exp'] %}
  60. {% end %}
  61. <dt>
  62. <p href="javascript:;" {% if layer %}data-hint="{{layer}}"{% end %} data-status="{% if value['value'] == '1' %}2{% else %}1{% end %}" onclick="Farm.Switch(this, '/device/update', '{{value['id']}}')" class="{% if layer %}hint--top hint--error hint--always {% end %} {% if value['exp'] != '-1' and value['exp'] != '1' %}data-layer{% end %} btn-switch {% if value['exp'] == '-1' %}loading{% end %} {% if value['value'] == '1' %}open{% end %} {% if value['status'] == False %}disabled{% end %}"><i></i></p>
  63. </dt>
  64. <dd class="tit">{{value['name']}}</dd>
  65. </dl>
  66. {% end %}
  67. {% end %}
  68. </div>
  69. </div>
  70. {% end %}
  71. {% end %}
  72. {% end %}