liuyg
2021-06-08 014b6f61629bf2b282e117c92b2678a92668b49d
搜索
2 files modified
118 ■■■■■ changed files
widgets/searchL/Widget.html 2 ●●● patch | view | raw | blame | history
widgets/searchL/Widget.js 116 ●●●●● patch | view | raw | blame | history
widgets/searchL/Widget.html
@@ -3,7 +3,7 @@
        style="border-radius: 5px 0 0px 5px;width:4.7rem;background-color: #3E9FFC;color: #fff;">关键字</div>
    <div id="i-f-zb" class="input-font" style="width:3.5rem">坐标</div>
    <!-- <input type="text" placeholder="输入关键字以搜索" class="input-sm /> -->
    <input id="local_data" autocomplete="off" data-provide="typeahead" type="text" class="input-sms"
    <input id="local_data" autocomplete="off" value="鄱阳湖" data-provide="typeahead" type="text" class="input-sms"
        placeholder="输入关键字以搜索" />
    <div id="inputTwo">
        <input id="local_data1" autocomplete="off" data-provide="typeahead" type="text" class="input-sms1"
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 //表格