xyq_imageList.html 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {% load staticfiles %}
  2. <div class="nullData" style="display:none">暂无数据</div>
  3. <!-- <div style="margin-bottom:10px;text-align:right">
  4. <a class="refresh" href="ybq_pest_data?imei={{imei}}" class="pestBtn">
  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="{{ i.addr }}" title="path: {{ i.addr }}">
  13. <img src="{{ 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. <!-- <div> -->
  23. <label class="imgcheckbox">
  24. <input type="checkbox" class="check" onclick="checkAllSelect()" value="2014" name="check_box_list">
  25. <span></span>
  26. </label>
  27. <!-- </div> -->
  28. </div>
  29. {% endfor %}
  30. </div>
  31. <script src="{% static '/lib/js/jquery.magnific-popup.js' %}" type="text/javascript"></script>
  32. <script src="{% static '/js/reportmanage/ybq_imageList.js' %}?versions=0.5.4" type="text/javascript"></script>
  33. <script>
  34. var topicid = []; //imei数组
  35. // 单个复选框
  36. function checkAllSelect() {
  37. $('.check').each(function () {
  38. if ($(this).prop("checked") == true) {
  39. if (!contains(topicid, $(this).parents('.imgParent').find('img').attr('src'))) {
  40. topicid.push($(this).parents('.imgParent').find('img').attr('src'));
  41. }
  42. } else {
  43. removeByValue(topicid, $(this).parents('.imgParent').find('img').attr('src'));
  44. }
  45. });
  46. console.log(topicid)
  47. }
  48. //移除数组元素
  49. function removeByValue(arr, val) {
  50. for (var i = 0; i < arr.length; i++) {
  51. if (arr[i] == val) {
  52. arr.splice(i, 1);
  53. break;
  54. }
  55. }
  56. }
  57. //判断数组中是否包含元素
  58. function contains(arr, obj) {
  59. var i = arr.length;
  60. while (i--) {
  61. if (arr[i] === obj) {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. // 刷新页面
  68. function reload(){
  69. var page = $('.layui-laypage-curr em').eq(1).html() || 1;
  70. $.ajax({
  71. url: 'xyq_image_list?imei=' + $('#imei').val() + '&page=' + page,
  72. type: 'get',
  73. success: function (data) {
  74. $('#imgList').html('');
  75. $('#imgList').html(data);
  76. if ($('.content').height() > 750) {
  77. $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
  78. } else {
  79. $('#iframe-main', parent.document).css('height', '750px')
  80. }
  81. canceldelimg(document.getElementById('canceldel'))
  82. }
  83. })
  84. }
  85. </script>