1
Surpriseplus
2022-10-14 6d536dea3cec157947947aa075bebde4305f29b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!DOCTYPE html>
<html lang="zh">
 
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
    <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="./css/jquery/font-awesome.min.css">
 
    <link rel="stylesheet" type="text/css" href="css/demo.css">
    <script type="text/javascript" src="./external/polyfill.min.js"></script>
    <script src="./external/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="./external/jszip.min.js"></script>
    <script type="text/javascript" src="./external/FileSaver.js"></script>
    <script type="text/javascript" src="./scripts/excel-gen.js"></script>
 
    <style>
        body,
        html {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            padding: 0;
            background: rgba(0, 0, 0, 1);
            color: white;
        }
        
        span {
            color: #fff;
        }
        
        .contentbg {
            background: rgb(43, 43, 43);
        }
        
        #test_table tr {
            color: #fff;
            background: #000;
        }
        
        #test_tbody tr {
            background: transparent;
        }
        
        .inputStyle {
            background: #000;
        }
        
        .btnStyle {
            background: transparent;
            color: #fff;
            border-color: #fff;
        }
        
        .btnStyle:hover {
            color: #333;
            background-color: #e6e6e6;
            border-color: #adadad;
        }
        
        .delbtn {
            width: 50px;
            height: 20px;
            display: inline-block;
            font-size: 12px;
            border: 1px solid #adadad;
            border-radius: 4px;
            display: none;
        }
        
        .btn-success:active:focus {
            background-color: #e6e6e6 !important;
            border-color: #adadad !important;
        }
        
        .container {
            width: 100%;
            height: 100%;
            position: absolute;
        }
    </style>
</head>
 
<body>
 
    <div class="container contentbg">
        <div class="row">
            <div style="padding:2em 0; color:white ;">
                <label class="checkbox-inline">
                <input type="radio"  onclick="showtable(1)" checked name="inlineCheckbox"  > 点
            </label>
                <label class="checkbox-inline">
                <input type="radio"  name="inlineCheckbox"  onclick="showtable(2)"> 线
            </label>
                <label class="checkbox-inline">
                <input type="radio"   name="inlineCheckbox" onclick="showtable(3)" > 面
            </label>
                <label class="checkbox-inline">
                  <button type="button" class="btn btn-success btn-block btnStyle" id="eject"><i
                    class="fa fa-file-excel-o" aria-hidden="true"></i> 定制列</button>
                  </label>
                <label class="checkbox-inline">
                  <button type="button" class="btn btn-success btn-block btnStyle" id="generate-excel"><i
                    class="fa fa-file-excel-o" aria-hidden="true"></i> 导出</button>
                    </label>
            </div>
            <div class="col-md-12" style="padding:2em 0;">
                <div class="table-responsive">
                    <table class="table table-bordered table-striped" id="test_table">
                        <thead>
                            <tr id='test_thead'>
 
                            </tr>
                        </thead>
                        <tbody id='test_tbody'>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
 
 
    <script type="text/javascript">
        //表头
 
 
 
        showtable(1)
 
        function showtable(flag) { 
            var GUID = "";
            var listHead = null;
            if (flag == 1) {
                GUID = "1475320789798645762"; //点
                listHead = ['矿山ID', '断面ID', "经度", "纬度", '最低标准', '地基', '矿体', '灰岩', '灰岩+矿体', '含白云质角砾状灰岩', '含白云质角砾状灰岩+矿体', '燧石灰岩+矿体', '不知名'] 
            } else if (flag == 2) {
                GUID = "1476370706918961154"; //线
                listHead = ['矿山ID', '断面ID', "范围"] 
            } else if (flag == 3) {
                GUID = "1476371195844784130"; //面
                listHead = ['矿山ID', "矿山名称", "面积", "矿采标高", "勘察公司", "矿产类别"] 
            }
 
 
 
 
 
         /*   $.ajax({
                type: "GET",
                url: "http://127.0.0.1:8080/jeecg-boot/online/cgreport/api/getColumnsAndData/" + GUID + "?_t=1640744588&pageNo=1&pageSize=10",
                beforeSend: function(request) {
                    request.setRequestHeader("X-Access-Token", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NDA3NDI3NjIsInVzZXJuYW1lIjoiYWRtaW4ifQ.HiE3-7cRlXjqOhxZeIkx-SBnBETwTMJ_30cXcNQk2AI");
                },
                dataType: "json",
                success: function(result) {
 
 
                    var html = "";
                    $("#test_thead").html("");
                    $("#test_tbody").empty();
                    for (var i = 0; i < listHead.length; i++) {
                        //动态创建一个tr行标签,并且转换成jQuery对象
                        html += "<td class='headtd'>" + listHead[i] + "<button type='submit' class='btnStyle delbtn' style='margin-left: 50px;'>删除</button></td >"
                        $("#test_thead").html(html);
                    }
                    var _records = result.result.data.records;
 
                    if (flag == 1) {
                        for (var i = 0; i < _records.length; i++) {
                            //动态创建一个tr行标签,并且转换成jQuery对象
                            var trTemp = $("<tr></tr>");
                            //往行里面追加 td单元格
                            trTemp.append("<td>" + _records[i].kuangid + "</td>");
                            trTemp.append("<td>" + _records[i].lineid + "</td>");
                            trTemp.append("<td>" + _records[i].lon + "</td>");
                            trTemp.append("<td>" + _records[i].lat + "</td>");
                            trTemp.append("<td>" + _records[i].h1 + "</td>");
                            trTemp.append("<td>" + _records[i].h2 + "</td>");
                            trTemp.append("<td>" + _records[i].h3 + "</td>");
                            trTemp.append("<td>" + _records[i].h4 + "</td>");
                            trTemp.append("<td>" + _records[i].h5 + "</td>");
                            trTemp.append("<td>" + _records[i].h6 + "</td>");
                            trTemp.append("<td>" + _records[i].h7 + "</td>");
                            trTemp.append("<td>" + _records[i].h8 + "</td>");
                            trTemp.append("<td>" + _records[i].h9 + "</td>");
                            trTemp.appendTo("#test_tbody");
                        }
                    } else if (flag == 2) {
                        for (let index = 0; i < _records.length; index++) {
                            //动态创建一个tr行标签,并且转换成jQuery对象
                            var trTemp = $("<tr></tr>");
                            //往行里面追加 td单元格
                            trTemp.append("<td>" + _records[index].kuangid + "</td>");
                            trTemp.append("<td>" + _records[index].lineid + "</td>");
                            trTemp.append("<td>" + _records[index].line + "</td>");
                            trTemp.appendTo("#test_tbody");
                        }
                    } else if (flag == 3) {
                        for (let j = 0; j < _records.length; j++) {
                            //动态创建一个tr行标签,并且转换成jQuery对象
                            var trTemp = $("<tr></tr>");
                            //往行里面追加 td单元格
                            trTemp.append("<td>" + _records[j].kuangid + "</td>");
                            trTemp.append("<td>" + _records[j].kuangname + "</td>");
                            trTemp.append("<td>" + _records[j].mianji + "</td>");
                            trTemp.append("<td>" + _records[j].biaogaocai + "</td>");
                            trTemp.append("<td>" + _records[j].kanchacompany + "</td>");
                            trTemp.append("<td>" + _records[j].kuangchan + "</td>");
                            trTemp.appendTo("#test_tbody");
                        }
                    }
 
 
 
                }
            })*/
 
        }
 
 
        // 点击查询
        $("#querybtn").click(function() {
            listGenerate(listData)
        });
        // 点击显示按钮
        $("#eject").click(function() {
 
            $('.delbtn').toggle();
        });
        //点击删除当前列
        $(".delbtn").click(function() {
            var l = $("#test_table tr").length;
 
            var ind = $(this).parent().index();
 
            if (l > 1) {
                for (var i = 0; i < l; i++) {
                    $("#test_table tr").eq(i).find("td").eq(ind).remove();
                }
                $('.delbtn').toggle();
            }
 
        });
 
        //导出表格
 
        $("#generate-excel").click(function() {
            excel = new ExcelGen({
                "src_id": "test_table",
                "show_header": true
            });
            excel.generate();
        });
    </script>
 
</body>
 
</html>