| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- {% load staticfiles %}
- <div class="nullData" style="display:none">暂无数据</div>
- <!-- <div style="margin-bottom:10px;text-align:right" class="pestBtn">
- <a class="refresh" href="cbd/cbd_pest_data?imei={{imei}}">
- <i class="add">
- <img src="{% static '/img/echarts.png' %}" alt="" width="32">
- </i>查看害虫统计 </a>
- </div> -->
- <div class="popup-gallery">
- {% for i in img %}
- <div class="imgParent">
- <a class="popupA" href="{{ i.addr }}" title="path: {{ i.addr }}">
- <img src="{{ i.addr }}" width="300" height="300">
- <p>{{ i.upl_time }} </p>
- </a>
- <input type="hidden" value="{{i.equip_id}}">
- <input type="hidden" class="photoTime" value="{{i.upl_time}}">
- <!-- 管理员显示删除图片按钮 -->
- {% if current_user.is_superuser == True or current_user.is_staff == True %}
- <span class="delBtn" onclick="del($(this))"></span>
- {% else %} {% endif %}
- <a href="#test-popup" class="open-popup-link addDetial">手动添加</a>
- <a href="#lookDescribe" class="open-popup-link lookDetial">手动统计</a>
- {% if disc == '1' or role == "superuser" %}
- <a href="javascript:;" class="newAutoDiscern" onclick="newAutoDiscern(this)">
- 识别统计
- </a>
- {% else %} {% endif %}
- <!-- 最新识别 -->
- <!-- <div> -->
- <label class="imgcheckbox">
- <input type="checkbox" class="check" onclick="checkAllSelect()" value="2014" name="check_box_list">
- <span></span>
- </label>
- <!-- </div> -->
- </div>
- {% endfor %}
- </div>
- <div style="clear:both"></div>
- <input type="hidden" id="selectListPage" value="{{nums}}">
- <script src="{% static '/lib/js/jquery.magnific-popup.js' %}" type="text/javascript"></script>
- <script src="{% static '/js/reportmanage/cbd_imageList.js' %}?versions=0.5.0" type="text/javascript"></script>
- <script src="{% static '/js/reportmanage/cbd_pest_library.js' %}?versions=0.5.0" type="text/javascript"></script>
- <script>
- var parentUserName = $('#parentUserName', parent.document).html();
- // if(!(parentUserName == '云飞展示账号')){
- // $('#takephotoShowBtn').remove();
- // }
- if (!(parentUserName == 'admin' || parentUserName == 'user')) {
- $('.simulation').remove();
- } else {
- $('.simulation').show();
- }
- var topicid = []; //imei数组
- // 单个复选框
- function checkAllSelect() {
- $('.check').each(function () {
- if ($(this).prop("checked") == true) {
- if (!contains(topicid, $(this).parents('.imgParent').find('img').attr('src'))) {
- topicid.push($(this).parents('.imgParent').find('img').attr('src'));
- }
- } else {
- removeByValue(topicid, $(this).parents('.imgParent').find('img').attr('src'));
- }
- });
- console.log(topicid)
- }
- //移除数组元素
- function removeByValue(arr, val) {
- for (var i = 0; i < arr.length; i++) {
- if (arr[i] == val) {
- arr.splice(i, 1);
- break;
- }
- }
- }
- //判断数组中是否包含元素
- function contains(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) {
- return true;
- }
- }
- return false;
- }
- // 刷新页面
- function reload() {
- var page = $('.layui-laypage-curr em').eq(1).html() || 1;
- $.ajax({
- url: 'cbd_img_list?imei=' + $('#imei').val() + '&page=' + page,
- type: 'get',
- success: function (data) {
- $('#imgList').html('');
- $('#imgList').html(data);
- if ($('.content').height() > 750) {
- $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
- } else {
- $('#iframe-main', parent.document).css('height', '750px')
- }
- canceldelimg(document.getElementById('canceldel'))
- }
- })
- }
- // console.log($('#selectListPage').val())
- // 时间段查询
- function img_filter() {
- var discern = $('#discern').val();
- var selectListPage = $('#selectListPage').val();
- // console.log($('#selectListPage').val())
- var begin = $('#begin').val();
- var end = $('#end').val();
- if(!begin || !end){
- layui.use('laypage', function () {
- var layer = layui.layer;
- layer.msg('请输入时间段!')
- })
- return false;
- }
- $.ajax({
- url: 'cbd_img_list',
- type: 'get',
- limit:8,
- data: {
- imei: $('#imei').val(),
- page: 1,
- disc: discern,
- begin: begin,
- end: end
- },
- success: function (data) {
- $('#imgList').html('');
- $('#imgList').html(data);
- if ($('#selectListPage').val() > 0) {
- $('.nullData').hide();
- $('#page').parent().show();
- } else {
- $('.nullData').show();
- $('#page').parent().hide();
- }
- var datas = {
- imei: $('#imei').val(),
- page: 1,
- limit:8,
- disc: discern,
- begin: begin,
- end: end
- }
- initSearchPage($('#selectListPage').val(), 'cbd_img_list', datas);
- if ($('.content').height() > 750) {
- $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
- } else {
- $('#iframe-main', parent.document).css('height', '750px')
- }
- }
- })
- }
- //用户搜索分页
- function initSearchPage(page, url, datas) {
- layui.use('laypage', function () {
- var laypage = layui.laypage;
- laypage.render({
- elem: 'page' //注意,这里的 test1 是 ID,不用加 # 号
- // , count: 30
- , count: page
- , theme: '#428BCA'
- , layout: ['prev', 'page', 'next', 'skip']
- , jump: function (obj, first) {
- datas.page = obj.curr;
- if (!first) {
- $.ajax({
- url: url,
- type: 'get',
- data: datas,
- success: function (data) {
- $('#imgList').html('');
- $('#imgList').html(data);
- if ($('#selectListPage').val() > 0) {
- $('.nullData').hide();
- $('#page').parent().show();
- } else {
- $('.nullData').show();
- $('#page').parent().hide();
- }
- if ($('.content').height() > 750) {
- $('#iframe-main', parent.document).css('height', $('.content').height() + 20)
- } else {
- $('#iframe-main', parent.document).css('height', '750px')
- }
- }
- })
- }
- }
- });
- });
- }
- </script>
|