data.html 5.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. {% if value['value'] %}
  28. {%set v = float(value['value']) %}
  29. {% else %}
  30. {%set v = 0 %}
  31. {%set value['value'] = 0 %}
  32. {% end %}
  33. <dl>
  34. {% if 'noset' not in data %}
  35. <dd class="controller">{% if not value['status'] %}<em class="error">离线</em>{% elif value['max'] != None and value['max'] and v > value['max'] %}<em class="error">上限超标</em>{% elif value['min'] != None and value['min'] 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>
  36. </dd>
  37. {% end %}
  38. <dt>{{value['value']}}</dt>
  39. <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>
  40. </dl>
  41. {% elif value['hardware_type'] == 3 and value['unit'] == 'button' %}
  42. <dl class="button">
  43. {% if 'noset' not in data %}
  44. <dd class="controller">{% if not value['status'] %}<em class="error">离线</em>{% end %}</dd>
  45. {% end %}
  46. {%set layer = '' %}
  47. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  48. {%set layer = value['exp'] %}
  49. {% end %}
  50. <dt>
  51. <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 not value['status'] %}disabled{% end %}">升</button>
  52. <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 not value['status'] %}disabled{% end %}">停</button>
  53. <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 not value['status'] %}disabled{% end %}">降</button>
  54. </dt>
  55. <dd class="tit">{{value['name']}}</dd>
  56. </dl>
  57. {% elif value['hardware_type'] == 3 %}
  58. <dl>
  59. {% if 'noset' not in data %}
  60. <dd class="controller">{% if not value['status'] %}<em class="error">离线</em>{% end %}</dd>
  61. {% end %}
  62. {%set layer = '' %}
  63. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  64. {%set layer = value['exp'] %}
  65. {% end %}
  66. <dt>
  67. <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 not value['status'] %}disabled{% end %}"><i></i></p>
  68. </dt>
  69. <dd class="tit">{{value['name']}}</dd>
  70. </dl>
  71. {% end %}
  72. {% end %}
  73. </div>
  74. </div>
  75. {% end %}
  76. {% end %}
  77. {% end %}