data.html 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. {%set v = float(value['value']) %}
  21. <li class="form-input">
  22. <a href="/device/update_device?type={{data['input']['type']}}&id={{data['input']['id']}}&device_id={{value['id']}}">
  23. <i class="ico ico-7"></i><span>{{value['name']}}</span><p><span>{{value['value']}}{{value['unit']}}</span><i>&gt;</i></p>
  24. </a>
  25. </li>
  26. {% elif value['hardware_type'] == 2 %}
  27. {%set v = float(value['value']) %}
  28. <li class="form-input">
  29. <a href="/device/update_device?type={{data['input']['type']}}&id={{data['input']['id']}}&device_id={{value['id']}}">
  30. <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 v > value['max'] %}<span class="error">上限超标</span>{% elif value['min'] != None and v < value['min'] %}<span class="error">下限超标</span>{% else %}<span>正常</span>{% end %}<i>&gt;</i></p>
  31. </a>
  32. </li>
  33. {% elif value['hardware_type'] == 3 and value['unit'] == 'button' %}
  34. <li class="form-input buttons">
  35. {%set layer = '' %}
  36. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  37. {%set layer = value['exp'] %}
  38. {% end %}
  39. <label><span>{{value['name']}}</span>
  40. {% if value['status'] == False %}<span class="disable">离线</span>{% end %}
  41. <p>
  42. <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>
  43. <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>
  44. <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>
  45. </p>
  46. </label>
  47. </dt>
  48. </li>
  49. {% elif value['hardware_type'] == 3 %}
  50. <li class="form-input">
  51. {%set layer = '' %}
  52. {% if value['exp'] != '-1' and value['exp'] != '1' and value['exp'] != 'None' and value['exp'] %}
  53. {%set layer = value['exp'] %}
  54. {% end %}
  55. <label><span>{{value['name']}}</span>
  56. {% if value['status'] == False %}<span class="disable">离线</span>{% end %}
  57. <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>
  58. </li>
  59. {% end %}
  60. {% end %}
  61. </ul>
  62. {% end %}
  63. {% end %}
  64. {% end %}