bzy_imageList.html 3.4 KB

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