ybq_imageList.html 3.2 KB

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