stat.html 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. {% extends "../theme.html" %}
  2. {% block content %}
  3. {%include 'inc/menu.html'%}
  4. <div class="pannel">
  5. <form id="f1" action="/device/stat" method="get">
  6. <input type="hidden" name="type" id="type" value="{{data['input']['type']}}" />
  7. <input type="hidden" name="method" id="method" value="maxmin" />
  8. <input type="hidden" name="id" id="id" value="{{data['input']['id']}}" />
  9. <select name="device" id="device">
  10. {% for v in data['device'] %}
  11. <option value="{{v['id']}}" {% if 'device' in data['search'] and data['search']['device'] == v['id'] %}selected{% end %}>{{v['name']}}</option>
  12. {% end %}
  13. </select>
  14. <select name="group" id="group" {% if 'start' in data['search'] or 'end' in data['search'] %}style="display:none;"{% end %}>
  15. {% for v in data['group'] %}
  16. <option value="{{v['id']}}" {% if 'group' in data['search'] and data['search']['group'] == v['id'] %}selected{% end %}>{{v['name']}}</option>
  17. {% end %}
  18. </select>
  19. <input type="text" name="start" id="start" readonly class="form_datetime" value="{% if 'start' in data['search'] %}{{data['search']['start']}}{% end %}" style="width:150px;">
  20. ~
  21. <input type="text" name="end" id="end" readonly class="form_datetime" value="{% if 'end' in data['search'] %}{{data['search']['end']}}{% end %}" style="width:150px;">
  22. <input type="button" onclick="stat()" value="查询">
  23. <input type="button" onclick="download()" value="下载明细报表">
  24. </form>
  25. <div class="box" id="main" style="width: 100%;height:400px;">
  26. </div>
  27. </div>
  28. {% end %}
  29. {% block script %}
  30. {%include 'chart/page.html'%}
  31. <script type="text/javascript" src="{{static_url('pc/lib/laydate/laydate.js')}}"></script>
  32. <script type="text/javascript">
  33. function download()
  34. {
  35. $('#f1').attr('action', '/device/out');
  36. $("#method").val('mx');
  37. $('#f1').submit();
  38. }
  39. function stat()
  40. {
  41. $('#f1').attr('action', '/device/stat');
  42. $("#method").val('maxmin');
  43. $('#f1').submit();
  44. }
  45. dateTheme = '#247ed0'
  46. laydate.render({
  47. elem: '#start'
  48. ,theme: dateTheme
  49. ,max: 0
  50. ,type: 'datetime'
  51. /*
  52. ,mark: {
  53. '0-9-14': '浇水'
  54. ,'0-9-26': '施肥' //每年的日期
  55. }
  56. */
  57. ,done: function(value, date){
  58. /*
  59. if(date.year === 2017 && date.month === 9 && date.date === 14){
  60. alert('我都干了什么啊');
  61. }
  62. */
  63. var start = value
  64. var end = $("#end").val()
  65. if (start || end) {
  66. $("#group").hide();
  67. } else {
  68. $("#group").show();
  69. }
  70. }
  71. });
  72. laydate.render({
  73. elem: '#end'
  74. ,theme: dateTheme
  75. //,min: $('#start').val()
  76. ,max: 0
  77. ,type: 'datetime'
  78. ,done: function(value, date){
  79. var start = $("#start").val()
  80. var end = value
  81. if (start || end) {
  82. $("#group").hide();
  83. } else {
  84. $("#group").show();
  85. }
  86. }
  87. });
  88. </script>
  89. {% end %}