多单位版国产化地质资料管理系统
zs
2025-12-18 4f0d9bde31a80f6279e26466250da7716eec627f
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<html>
<head>
    <base href="<%=basePath%>">
    <meta name="viewport" charset="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>验收问题选择</title>
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <link href="static/plugins/jquery-easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="static/styles/initialize.css" type="text/css">
    <link rel="stylesheet" href="static/styles/common.css" type="text/css">
    <link rel="stylesheet" href="static/plugins/layer/skin/default/layer.css" type="text/css">
 
    <script type="text/javascript" src="static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="static/scripts/easyuiExtend.js"></script>
    <script type="text/javascript" src="static/scripts/jquery-extend.js"></script>
    <script type="text/javascript" src="static/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="static/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui-datagrid-dnd/datagrid-dnd.js"></script>
    <script src="static/plugins/ace/src-noconflict/ace.js" type="text/javascript"></script>
    <script src="static/plugins/jquery.redirect.js" type="text/javascript"></script>
    <!-- 弹窗加载组件 -->
    <script type="text/javascript" src="static/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="static/plugins/spinjs/spin.js"></script>
    <script type="text/javascript" src="static/plugins/spinjs/jquery.spin.js"></script>
    <script type="text/javascript" src="static/plugins/jquery.blockUI.js"></script>
    <!-- wcp组件 -->
    <script type="text/javascript" src="static/wcp/scripts/wcp.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.layer.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.blockUI.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.spin.js"></script>
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.jquery.js"></script>
 
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/plugins/json2.js"></script>
    <![endif]-->
    <script type="text/javascript" src="static/wcp/scripts/libs/wcp.infoPicker.js"></script>
    <style>
        html, body {
            height: 100%;
        }
 
        .left {
            width: 48%;
            float: left;
            text-align: center;
            padding-top: 10px;
        }
 
        .search {
            clear: both;
        }
 
        .right {
            width: 48%;
            float: left;
            text-align: center;
            padding-top: 10px;
        }
 
        .s-choose-frame {
            height: 30px;
            line-height: 30px;
            margin-bottom: 10px;
        }
 
        .s-choose {
            display: inline-block;
            border: 1px solid #D4D4D4;
            border-radius: 2px;
        }
 
        .s-choose a {
            float: left;
            padding: 0 16px;
            border-right: 1px solid #d4d4d4;
            height: 30px;
            line-height: 30px;
        }
 
        .s-choose a:last-child {
            border-right: 0 none;
        }
 
        .s-choose a:hover, .s-choose a.s-choose-selected {
            background: #00c0ef;
            color: #fff;
        }
    </style>
</head>
<body>
<div>
    <div class="left">
        <div class="easyui-panel pt-tree" style="border-right: none;height: 400px">
            <ul id="ul_type"></ul>
        </div>
    </div>
    <div class="right">
        <div class="easyui-panel pt-tree" style="border-right: none;height: 400px">
            <ul id="dg_hasSelect"></ul>
        </div>
    </div>
    <div class="search">
        <div class="easyui-panel" style="padding:20px 300px; border-top:none;">
            <input class="easyui-searchbox" data-options="prompt:'请输入问题名称进行查询',searcher:doSearch"
                   style="width:100%">
        </div>
    </div>
    <div class="pt-form-btn" style="bottom:0px;">
        <div class="form-group">
            <button type="button" class="pt-btn pt-btn-primary" onclick="doSave();">确定</button>
            <button type="button" class="pt-btn pt-btn-default" onclick="doClose();">关闭</button>
            <button type="button" class="pt-btn pt-btn-danger" onclick="delAll();">删除全部</button>
        </div>
    </div>
</div>
 
</body>
<script>
    var param = {
        callBack: null,
        backOne: null,
        haveSelected: ""
    };
    $(function () {
        //绑定已选择项,前端js传参数,必须加延迟,否则传参易丢失
        setTimeout(function () {
            bindHasSelect();
        }, 500);
        // 延迟初始化待选列表,确保依赖项已准备就绪
        setTimeout(function () {
            initWaitSelectUser("");
        }, 1000);
        // bindHasSelect();
 
    });
 
    function bindHasSelect() {
        //已选
        $('#dg_hasSelect').datagrid({
            fitColumns: true,
            nowrap: true,
            rownumbers: true,
            height: 385,
            idField: "id",
            emptyMsg: "没有找到匹配的记录",
            toolbar: "#hasToolbar",
            // frozenColumns:[[{field:'ck',checkbox:true}]],
            columns: [[
                {
                    field: 'question',
                    title: '名称',
                    width: 400
                },
                {
                    field: 'id',
                    title: '操作',
                    width: 100,
                    align: 'center',
                    formatter: function (value, row, index) {
                        return '<a onclick="delTableRow(\'' + row.type + '\',\'' + value + '\',' + index + ');" class="pt-color-danger">删除</a>';
                    }
                }
 
            ]],
            onLoadSuccess: function () {
                // new ResizeScroll({
                //     "id": "#dg_hasSelect",
                //     "height": "341"
                // });
            }
        });
 
        if (param.haveSelected != null && param.haveSelected != "") {
 
            var haveSelectedMinerals = param.haveSelected.split(',');
            $.each(haveSelectedMinerals, function (index, haveSelectedMineral) {
                var id = haveSelectedMineral.split('-')[0];
                var question = haveSelectedMineral.split('-')[1];
                $('#dg_hasSelect').datagrid("appendRow", {
                    id: id,
                    question: question
                });
            });
        }
    }
 
    function initWaitSelectUser(question) {
        debugger;
        $('#ul_type').datagrid({
            url: "gdMisManage/getCheckQuestion?question=" + question,
            fitColumns: true,
            nowrap: true,
            rownumbers: true,
            height: 385,
            idField: "id",
            emptyMsg: "没有找到匹配的记录",
            toolbar: "#midToolbar",
            sortOrder: "asc",
            frozenColumns: [[{
                field: 'ck',
                checkbox: true
            }]],
            columns: [[
                {
                    field: 'id',
                    title: '主键',
                    width: 1,
                    hidden: true
                },
                {
                    field: 'question',
                    title: '问题',
                    width: 400
                }
            ]],
            onCheck: function (index, row) {
                debugger;
                var state = false;
                var hasRows = $('#dg_hasSelect').datagrid("getRows");
                if (hasRows != null) {
                    for (var i = 0; i < hasRows.length; i++) {
                        if (row.id == hasRows[i].id) {
                            state = true;
                            break;
                        }
                    }
                }
 
                if (!state) {
                    // if (!multiSelect) {
                    //     $('#dg_hasSelect').datagrid("loadData", []);
                    // }
                    $('#dg_hasSelect').datagrid("appendRow", {
                        id: row.id,
                        question: row.question
                    });
                }
            },
            onUncheck: function (index, row) {
                var hasRows = $('#dg_hasSelect').datagrid("getRows");
                if (hasRows != null) {
                    for (var i = 0; i < hasRows.length; i++) {
                        if (hasRows[i].id == row.id) {
                            $('#dg_hasSelect').datagrid("deleteRow", i);
                            break;
                        }
                    }
                }
            },
            onCheckAll: function (rows) {
                debugger;
                var hasRows = $('#dg_hasSelect').datagrid("getRows");
                debugger;
                for (var j = 0; j < rows.length; j++) {
                    var state = false;
                    if (hasRows != null) {
                        for (var i = 0; i < hasRows.length; i++) {
                            if (hasRows[i].id == rows[j].id) {
                                state = true;
                                break;
                            }
                        }
                    }
 
                    if (state != true) {
                        $('#dg_hasSelect').datagrid("appendRow", {
                            id: rows[j].id,
                            question: rows[j].question,
                        });
                    }
                }
            },
            onUncheckAll: function (rows) {
                var hasRows = $('#dg_hasSelect').datagrid("getRows");
                if (hasRows != null && hasRows.length > 0) {
                    for (var j = 0; j < rows.length; j++) {
                        for (var i = 0; i < hasRows.length; i++) {
                            if (hasRows[i].id == rows[j].id) {
                                $('#dg_hasSelect').datagrid("deleteRow", i);
                                break;
                            }
                        }
                    }
                }
            },
            loadFilter: function (data) {
                // console.info("userload"+data);
                return data;
            },
            onLoadSuccess: function () {
                // new ResizeScroll({
                //     "id": "#ul_type",
                //     "height": "341"
                // });
            }
        });
    }
 
    //查询数据
    function doSearch(value) {
        debugger;
        if (value != '') {
            // $('#ul_type').datagrid("clearChecked");
            initWaitSelectUser(value)
        }
    }
 
    //保存选中项
    function doSave() {
 
        var selectMineral = "";
        var hasRows = $('#dg_hasSelect').datagrid("getRows");
        var exist = false;
        $.each(hasRows, function (index, row) {
            var id = row.id;
            var question = row.question;
            var select = id + "-" + question;
            selectMineral = selectMineral + select + ",";
        });
        if (selectMineral != "") {
            selectMineral = selectMineral.substring(0, selectMineral.length - 1).trim();
        }
        if (param.backOne) {
            param.backOne(selectMineral);
        }
        doClose();
    }
 
    //删除已选中的行
    function delTableRow(type, id, index) {
        $("#dg_hasSelect").datagrid('deleteRow', index);
 
        //刷新已选区,重新生成行号,不然会出错
        var hasRows = $('#dg_hasSelect').datagrid("getRows");
        for (var i = 0; i < hasRows.length; i++) {
            $("#dg_hasSelect").datagrid('refreshRow', i);
        }
 
        //刷新待选区,去掉待选区中的对应的选择项
        var waitRows = $('#ul_type').datagrid("getRows");
        if (waitRows != null) {
            for (var i = 0; i < waitRows.length; i++) {
                if (waitRows[i].id == id) {
                    $('#ul_type').datagrid("uncheckRow", i);
                    break;
                }
 
            }
        }
    }
 
    //已选取的全部删除
    function delAll() {
        $('#dg_hasSelect').datagrid("loadData", []);
        $('#ul_type').datagrid("clearChecked");
    }
 
    function doClose() { //关闭按钮事件
        var index = top.layer.getFrameIndex(window.name); //获取窗口索引
        top.layer.close(index);
    }
</script>
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
</html>