shuishen
2021-06-15 4d8ef5d02421b1bb60f575e56b75d43a1ea4c2bb
widgets/searchL/Widget.js
@@ -75,6 +75,11 @@
                  }
               } else {
                  if (that.searchDatas[0] && that.searchDatas[1]) {
                     that.map.camera.flyTo({
                        // destination: Cesium.Cartesian3.fromDegrees(Number(lng), Number(lat), Number(gaodu))
                        destination: Cesium.Cartesian3.fromDegrees(Number(that.searchDatas[0]), Number(that.searchDatas[1]), Number(8000))
                     });
                  } else {
                     layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
                        //得到各种内置组件
@@ -90,6 +95,31 @@
            $(".searchColce").click(function () {
               $('.searchLMain').hide();
               that.map.entities.removeAll();
            })
            $("#local_data").keyup(function (e) {
               console.log(e);
               that.getInputData();
               if (e.keyCode == 13 && typeof that.searchDatas == 'string') {
                  var han = /^[\u4e00-\u9fa5]+$/;
                  if (han.test(that.searchDatas) || that.searchDatas == '  ') {
                     that.getData(0, that.searchDatas);
                     $('.searchLMain').show();
                     $('.searchLMain').find('ul.layui-tab-title li:eq(0)').addClass('layui-this').siblings().removeClass('layui-this');
                     $('.searchLMain').find('div.layui-tab-content > div.layui-tab-item:eq(0)').addClass('layui-show').siblings().removeClass('layui-show');
                  } else {
                     layui.use(function () { //亦可加载特定模块:layui.use(['layer', 'laydate', function(){
                        //得到各种内置组件
                        var layer = layui.layer //弹层
                        // layer.msg('请先填写关键字', { icon: 1, time: 1000, shift: 6 });
                        layer.tips('请先填写关键字', '.searchImg', {
                           tips: [2, '#FF5722']
                        });
                     })
                     $('.searchLMain').hide();
                  }
               }
            })
         },
@@ -236,6 +266,7 @@
            })
         },
         beginLayUi: function (data = 1, data1 = 1, data2 = 1) {
            // console.log(data,data1,data2)
            var that = this;
            layui.use(function () {
               var element = layui.element
@@ -246,7 +277,7 @@
                  table.render({
                     elem: '#test'
                     // , url: './data'
                     // , url: './data'全景
                     , page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
                        // layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                        layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -257,9 +288,9 @@
                     }
                     , cols: [[
                        { field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
                        , { field: 'remarks', width: 95, align: 'center', unresize: true, title: '图层属性1' }
                        , { field: 'createTime', width: 95, align: 'center', unresize: true, title: '图层属性2' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '名称' }
                        , { field: 'protectArea', width: 95, align: 'center', unresize: true, title: '所属保护区' }
                        , { field: 'remarks', width: 95, align: 'center', unresize: true, title: '备注' }
                        , { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable' }
                     ]],
                     data: data,
@@ -283,9 +314,10 @@
                  });
               }
               if (data1 != 1) {
                  table.render({
                     elem: '#test1'
                     // , url: './data'
                     // , url: './data'//监控
                     , page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
                        // layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                        layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -296,9 +328,9 @@
                     }
                     , cols: [[
                        { field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
                        , { field: 'protectName', width: 95, align: 'center', unresize: true, title: '图层属性1' }
                        , { field: 'serviceUrl', width: 95, align: 'center', unresize: true, title: '图层属性2' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '站点' }
                        , { field: 'protectName', width: 95, align: 'center', unresize: true, title: '所属保护区' }
                        , { field: 'remark', width: 95, align: 'center', unresize: true, title: '备注' }
                        , { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable1' }
                     ]],
                     data: data1,
@@ -365,7 +397,7 @@
                  table.render({
                     elem: '#test2'
                     // , url: './data'
                     // , url: './data'//检测
                     , page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
                        // layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                        layout: ['count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
@@ -376,9 +408,9 @@
                     }
                     , cols: [[
                        { field: 'tableId', width: 59, align: 'center', unresize: true, title: '序号' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '图层名称' }
                        , { field: 'stcd', width: 95, align: 'center', unresize: true, title: '图层属性1' }
                        , { field: 'createTime', width: 95, align: 'center', unresize: true, title: '图层属性2' }
                        , { field: 'name', width: 90, align: 'center', unresize: true, title: '站点' }
                        , { field: 'wetlandName', width: 95, align: 'center', unresize: true, title: '所属保护区' }
                        , { field: 'remark', width: 95, align: 'center', unresize: true, title: '备注' }
                        , { fixed: 'right', align: 'center', unresize: true, title: '操作', toolbar: '#demoTable2' }
                     ]],
                     data: data2,
@@ -389,6 +421,7 @@
                     , limit: 10 //每页默认显示的数量
                  });
                  table.on('tool(test2)', function (obj) { //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值"
                     var data = obj.data //获得当前行数据
                        , layEvent = obj.event; //获得 lay-event 对应的值
@@ -409,23 +442,15 @@
                     }
                  });
               }
               that.addTitle();
               //…
            });
         },
         setdefaultTime: function () {
            //获取当前时间7天前
            var date = new Date();
            var date1 = new Date(+new Date() + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
            var myDate = date.setDate(date.getDate() - 7);
            var date2 = new Date(+new Date(myDate) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
            console.log([date1, date2], 123456789);
            //设置value
            $('#test-startDate-1').val(date1);
            $('#test-endDate-1').val(date2);
            that.times = [date1, date2];
            var stcd = $('.jimu-widget-searchTabaPopup').find('#userMyStcd').val();
            // that.getOurData(that.times, stcd);//默认7天时间完成
         addTitle: function () {
            let tdom = $("[data-field]");
            for (var i = 0; i < tdom.length; i++) {
               $(tdom[i]).attr("title", $(tdom[i]).text())
            }
         },
         setXiangqing(obj) {
            var str = '';
@@ -505,9 +530,9 @@
            $('#test-endDate-1').val(date1);
            window.defultEchartsTimes = [date2, date1];
            // var time = setTimeout(() => {
               $('.jimu-widget-searchTabaPopup').find('#query').click();
               // clearTimeout(time);
               // time = null;
            $('.jimu-widget-searchTabaPopup').find('#query').click();
            // clearTimeout(time);
            // time = null;
            // }, 500);
            var str = '',