bzy_imageList.html 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {% load staticfiles %}
  2. <div class="nullData" style="display:none">暂无数据</div>
  3. <!-- <div style="margin-bottom:10px;text-align:right" class="pestBtn">
  4. <a class="refresh" href="cbd_pest_data?imei={{imei}}">
  5. <i class="add">
  6. <img src="{% static '/img/echarts.png' %}" alt="" width="32">
  7. </i>查看害虫统计 </a>
  8. </div> -->
  9. <div class="popup-gallery">
  10. {% for i in img %}
  11. <div class="imgParent">
  12. {% if i.addr|slice:':4' == 'http' %}
  13. <a class="popupA" href="{{ i.addr }}" title="path: {{ i.addr }}">
  14. <img src="{{ i.addr }}" width="300" height="300">
  15. <p>{{ i.upl_time }} </p>
  16. </a>
  17. {% else %}
  18. <a class="popupA" href="bzy/{{ i.addr }}" title="path: bzy/{{ i.addr }}">
  19. <img src="bzy/{{ i.addr }}" width="300" height="300">
  20. <p>{{ i.upl_time }} </p>
  21. </a>
  22. {% endif %}
  23. <input type="hidden" value="{{i.equip_id}}">
  24. <!-- 管理员显示删除图片按钮 -->
  25. {% if current_user.is_superuser == True or current_user.is_staff == True %}
  26. <span class="delBtn" onclick="del($(this))"></span>
  27. {% else %}
  28. {% endif %}
  29. <a href="#test-popup" class="open-popup-link addDetial">图片描述</a>
  30. <!-- <a href="#lookDescribe" class="open-popup-link lookDetial">查看描述</a> -->
  31. <!-- <a href="javascript:;" onclick="autoSeeWormType(this)" class="autoSee">自动识别</a> -->
  32. <!-- <div> -->
  33. <label class="imgcheckbox">
  34. <input type="checkbox" class="check" onclick="checkAllSelect()" value="2014" name="check_box_list">
  35. <span></span>
  36. </label>
  37. <!-- </div> -->
  38. </div>
  39. {% endfor %}
  40. </div>
  41. <div style="clear:both"></div>
  42. <script src="{% static '/lib/js/jquery.magnific-popup.js' %}" type="text/javascript"></script>
  43. <script src="{% static '/js/reportmanage/bzy_imageList.js' %}?versions=0.5.4" type="text/javascript"></script>
  44. <script>
  45. var topicid = []; //imei数组
  46. // 单个复选框
  47. function checkAllSelect() {
  48. $('.check').each(function () {
  49. if ($(this).prop("checked") == true) {
  50. if (!contains(topicid, $(this).parents('.imgParent').find('img').attr('src'))) {
  51. topicid.push($(this).parents('.imgParent').find('img').attr('src'));
  52. }
  53. } else {
  54. removeByValue(topicid, $(this).parents('.imgParent').find('img').attr('src'));
  55. }
  56. });
  57. console.log(topicid)
  58. }
  59. //移除数组元素
  60. function removeByValue(arr, val) {
  61. for (var i = 0; i < arr.length; i++) {
  62. if (arr[i] == val) {
  63. arr.splice(i, 1);
  64. break;
  65. }
  66. }
  67. }
  68. //判断数组中是否包含元素
  69. function contains(arr, obj) {
  70. var i = arr.length;
  71. while (i--) {
  72. if (arr[i] === obj) {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. // 刷新页面
  79. function reload(){
  80. var page = $('.layui-laypage-curr em').eq(1).html() || 1;
  81. $.ajax({
  82. url: 'bzy/bzy_img_list?imei=' + $('#imei').val() + '&page=' + page,
  83. type: 'get',
  84. success: function (data) {
  85. $('#imgList').html('');
  86. $('#imgList').html(data);
  87. if ($('.content').height() > 750) {
  88. $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
  89. } else {
  90. $('#iframe-main', parent.document).css('height', '750px')
  91. }
  92. canceldelimg(document.getElementById('canceldel'))
  93. }
  94. })
  95. }
  96. </script>