liuyg
2021-06-08 014b6f61629bf2b282e117c92b2678a92668b49d
widgets/searchL/Widget.js
@@ -27,10 +27,14 @@
         baseClass: 'jimu-widget-searchL',
         name: 'searchL',
         layers: {},
         states: 'one',
         searchDatas: '',
         startup: function () {
            var that = this;
            //关键词&&坐标
            $("#i-f-gjz").click(function () {
               that.states = 'one';
               // console.log("gjz");
               $("#i-f-zb").css({ 'backgroundColor': '#fff', 'color': '#000' });
               $("#i-f-gjz").css({ 'backgroundColor': '#3E9FFC', 'color': '#fff' });
@@ -40,6 +44,7 @@
               $("#local_data").show();
            })
            $("#i-f-zb").click(function () {
               that.states = 'two';
               // console.log("zb");
               $("#i-f-gjz").css({ 'backgroundColor': '#fff', 'color': '#000' });
               $("#i-f-zb").css({ 'backgroundColor': '#3E9FFC', 'color': '#fff' });
@@ -50,6 +55,8 @@
            })
            $(".searchImg").click(function () {
               that.getInputData();
               that.setVal(that.searchDatas);
               $('.searchLMain').show();
            })
            $(".searchColce").click(function () {
@@ -65,85 +72,41 @@
            // }
         },
         getInputData: function () {
            if (this.states == 'one') {
               this.searchDatas = $('#local_data').val();
            } else if (this.states == 'two') {
               this.searchDatas = [$('#local_data1').val(), $('#local_data2').val()];
            }
         },
         setVal: function (val) {
            var that = this;
            if (typeof val == "string") {
               var url = 'http://171.34.76.171:8880/pyh-wetResource/GeoData/queryGeoData?name=' + val + '&protectAreald=&type=0&dataSort=1',
                  token = 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJlY2hpc2FuIiwic3ViIjoiYWRtaW4iLCJpYXQiOjE2MjMxMTYwMzYsImV4cCI6MTYyNTcwODAzNn0.p2qqmcWrC9QDLAFgu1n0eR4k4wrr3udFKKhjBqGJXAzz1jdR57agyyYMsTZPXIPkH7hviE64uHLW8T7fM_VvNw';
         onOpen: function () {
            //面板打开的时候触发 (when open this panel trigger)layui.use(function(){
            var data = [
               {
                  "id": 1,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 2,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 3,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 4,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 5,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 6,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 7,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 8,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 9,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 10,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 11,
                  "username": "东湖",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               {
                  "id": 12,
                  "username": "南矶山",
                  "style1": "属性1",
                  "style2": "属性2",
               },
               axios.get(url, {
                  headers: {
                     'token': token
                  }
               }).then((res)=>{
                  if(res.status == 200){
                     var data = res.data.data;
                     that.createData(data);
                  }else{
                     console.log('请求访问失败')
                  }
               })
            } else if (typeof val == "object") {
            ];
            }
         },
         createData:function(d){
            var data = d;
            this.beginLayUi(data);
         },
         onOpen: function () {
            //面板打开的时候触发
         },
         onClose: function () {
@@ -162,6 +125,7 @@
         },
         beginLayUi: function (data) {
            console.log(data)
            layui.use(function () {
               var element = layui.element
                  , table = layui.table //表格