data.html 4.9 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="form-group-head">{{v['name']}}</div>
  11. <ul>
  12. {% for value in v['device'] %}
  13. {% if value['hardware_type'] == 5 %}
  14. <li class="form-input">
  15. <a href="javascript:;">
  16. <i class="ico ico-6"></i><span>{{value['name']}}</span><p>{% if value['value'] == '1' %}<span>连接</span>{% else %}<span class="error">断开</span>{% end %}</p>
  17. </a>
  18. </li>
  19. {% elif value['hardware_type'] == 4 %}
  20. {% if value['value'] %}
  21. {%set v = float(value['value']) %}
  22. {% else %}
  23. {%set v = 0 %}
  24. {%set value['value'] = 0 %}
  25. {% end %}
  26. <li class="form-input">
  27. <a href="/device/update_device?type={{data['input']['type']}}&id={{data['input']['id']}}&device_id={{value['id']}}">
  28. <i class="ico ico-7"></i><span>{{value['name']}}</span><p><span>{{value['value']}}{{value['unit']}}</span><i>&gt;</i></p>
  29. </a>
  30. </li>
  31. {% elif value['hardware_type'] == 2 %}
  32. {% if value['value'] %}
  33. {%set v = float(value['value']) %}
  34. {% else %}
  35. {%set v = 0 %}
  36. {%set value['value'] = 0 %}
  37. {% end %}
  38. <li class="form-input">
  39. <a href="/device/update_device?type={{data['input']['type']}}&id={{data['input']['id']}}&device_id={{value['id']}}">
  40. <span>{{value['name']}}<b class="txt-block">{{value['value']}}</b><u class="degree">{{value['unit']}}</u></span><p>{% if value['status'] == False %}<span class="disable">离线</span>{% elif value['max'] != None and value['max'] and v > value['max'] %}<span class="error">上限超标</span>{% elif value['min'] != None and value['min'] and v < value['min'] %}<span class="error">下限超标</span>{% else %}<span>正常</span>{% end %}<i>&gt;</i></p>
  41. </a>
  42. </li>
  43. {% elif value['hardware_type'] == 3 and value['unit'] == 'button' %}
  44. <li class="form-input buttons">
  45. {%set layer = '' %}
  46. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  47. {%set layer = value['exp'] %}
  48. {% end %}
  49. <label><span>{{value['name']}}</span>
  50. {% if value['status'] == False %}<span class="disable">离线</span>{% end %}
  51. <p>
  52. <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 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>
  53. <button {% if layer %}data-hint="{{layer}}"{% end %} onclick="Farm.Button(this, '/device/update', '{{value['id']}}', 5)" id="button_stop_{{value['id']}}" class="btn 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>
  54. <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 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>
  55. </p>
  56. </label>
  57. </dt>
  58. </li>
  59. {% elif value['hardware_type'] == 3 %}
  60. <li class="form-input">
  61. {%set layer = '' %}
  62. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  63. {%set layer = value['exp'] %}
  64. {% end %}
  65. <label><span>{{value['name']}}</span>
  66. {% if value['status'] == False %}<span class="disable">离线</span>{% end %}
  67. <p><a 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--left hint--error hint--always {% end %} {% if value['exp'] != '-1' and value['exp'] != '1' %}data-layer{% end %} btn btn-switch {% if value['exp'] == '-1' %}loading{% end %} {% if value['value'] == '1' %}open{% end %} {% if value['status'] == False %}disabled{% end %}"><i></i></a></p></label>
  68. </li>
  69. {% end %}
  70. {% end %}
  71. </ul>
  72. {% end %}
  73. {% end %}
  74. {% end %}