多单位版国产化地质资料管理系统
zhai
2025-12-13 fc0cc9fff4b4cbdc7cbb52b4a96c947530fcbba0
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
374
375
376
377
378
379
380
381
382
383
384
385
386
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>设置默认处理人</title>
    <!--[if !IE]><!-->
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <!--<![endif]-->
    <!--[if gt IE 8]>
    <link href="static/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
    <![endif]-->
    <link rel="stylesheet" href="static/plugins/jquery-steps/css/main.css" type="text/css">
    <link rel="stylesheet" href="static/plugins/jquery-steps/css/jquery.steps.css" 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">
 
    <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-edatagrid/jquery.edatagrid.js"></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>
    <script type="text/javascript" src="static/plugins/ace/src-noconflict/ace.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>
        .combobox-group {
            clear: both;
        }
 
        .radios label {
            line-height: 26px !important;
        }
 
        .content {
            height: 430px !important;
        }
    </style>
</head>
<body>
<div class="margin-lr">
    <div>
        <div id="right">
            <div style="height:100%">
                <table id="tb_flowCustom" singleselect="true" idfield="flowCustomId"
                       style="width: auto; height: 450px" toolbar="#toolbar">
                </table>
                <div id="toolbar">
                    <%--                    <font color="red"><b>注意:</b>无需审批的步骤,请选择跳过,且确保需审批的步骤设置默认处理人!</font>--%>
                    <div style="margin-left:2px;">
                        <button onclick="addStep()" class="pt-btn pt-btn-primary">
                            <i class="fa fa-plus"></i>
                            增加步骤
                        </button>
                        <%--  <a onclick="$('#tb_flowCustom').edatagrid('cancelRow');" class="pt-btn pt-btn-warning">
                         <i class="fa fa-scissors"></i> 取消修改--%>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        <div class="pt-form-btn" style="bottom:0px;">
            <div class="form-group">
                <button type="button" class="pt-btn pt-btn-info" onclick="doSave();">确定</button>
                <button type="reset" class="pt-btn pt-btn-default"
                        onclick="doClose();">关闭
                </button>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
<script>
    //定义页面全局变量
    var t_flowCustomData = null;
    //窗口参数,用于弹窗传递
    var params = {
        securityCode: null,
        variables: null,
        callBack: null
    };
    var removeRows = [];
    var columns = [];
    $(function () {
        setTimeout(function () {
            t_flowCustomData = $('#tb_flowCustom').edatagrid({
                rownumbers: true,
                pagination: false,
                fitColumns: true,
                remoteSort: false,
                method: "POST",
                url: "flowCustom/getFlowCustomList?flowDefinitionId=${flowDefinitionId}&taskId=${taskId}&keyId=${keyId}",
                queryParams: params.variables,
                saveUrl: "",
                updateUrl: "",
                destroyUrl: "",
                columns: [[
                    {
                        field: 'userTaskName',
                        title: '步骤名称',
                        width: 100,
                        align: 'center'
                    },
                    {
                        field: 'defaultUserNames',
                        title: '默认处理人',
                        width: 180,
                        editor: "setDefaultUser",
                        align: 'center'
                    },
                    {
                        field: 'allowSkip',
                        title: '删除',
                        width: 100,
                        align: 'center',
                        formatter: function (value, row, index) {
                            var ret = "";
                            if (value == true) {
                                ret = '<a style="cursor:pointer" onclick=\'deleteStep(' + index + ');\' class="pt-color-danger"> <i class="fa fa-trash-o"></i>删除</a>';
                            }
                            return ret;
                        }
                    }
                ]],
                onClickRow: onClickRow,
                onDblClickCell: function (index, field, value) {
                    //双击第一行避免编辑
                    $('#tb_flowCustom').datagrid('endEdit', index);
                },
                onBeforeSave: function (rowIndex) {
 
                },
                onSave: function (index, row) {
 
                },
                onDestroy: function (index, row) {
                },
                onEdit: function (index, row) {
                }
            });
        }, 100)
    });
 
    //添加节点后刷新
    function reloadData() {
        removeRows = [];
        $('#tb_flowCustom').datagrid('reload');
        if (params.callBack) {
            params.callBack();
        }
    }
 
    //删除步骤
    function deleteStep(index) {
        var rows = $('#tb_flowCustom').datagrid('getRows');
        removeRows.push(rows[index]);
        rows[index].enableSkip = true;
        endEditing();
        $('#tb_flowCustom').datagrid('deleteRow', index);
        rows = $('#tb_flowCustom').datagrid('getRows');
        $("#tb_flowCustom").datagrid('loadData', rows);
    }
 
    //增加步骤
    function addStep() {
        var userTaskIds = "";
        for (i = 0; i < removeRows.length; i++) {
            userTaskIds += removeRows[i].userTaskId + ",";
        }
        userTaskIds = userTaskIds.substr(0, userTaskIds.length - 1);
        var url = "flowCustom/selectFlowStep?flowDefinitionId=${flowDefinitionId}&keyId=${keyId}&userTaskIds=" + userTaskIds;
        top.layer.open({
            title: "增加步骤",
            type: 2,
            area: ['300px', '450px'],
            fixed: false, //不固定
            content: url,
            success: function (layero, index) {
                var body = window.top.layer.getChildFrame('body', index);
                var iframeWin = window.top[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象
                //将参数和回调函数传给子页面
                iframeWin.params.callBack = reloadData;
            }
        });
    }
 
    $.extend($.fn.datagrid.defaults.editors, {
        setDefaultUser: {
            init: function (container, options) {
                var selectedRowIndex = $(container).closest(".datagrid-row").attr("datagrid-row-index");
                var rows = $('#tb_flowCustom').datagrid('getRows');
                var roleIdsRange = rows[selectedRowIndex].roleIdsRange;
                var multiSelect = rows[selectedRowIndex].multiSelect;
                var input = $("<div><input readonly=\"readonly\" id=\"txt_defaultUserNames_" + selectedRowIndex + "\" class=\"datagrid-editable-input\" style=\"width:200px; height:28px;\"></input><input type=\"hidden\"  id=\"txt_defaultUserIds_" + selectedRowIndex + "\"  />" +
                    "&nbsp;<a  style=\"width: 40px;cursor:pointer\" class=\"pt-color-primary\" onclick=\"selectDefaultUsers('txt_defaultUserNames_" + selectedRowIndex + "','txt_defaultUserIds_" + selectedRowIndex + "','" + roleIdsRange + "'," + multiSelect + ")\"><i class=\"fa fa-user\" title=\"用户设置\"></i>选择</a> </div>").appendTo(container);
                mergeCellsByField("tb_flowCustom", "MainBody");
                return input;
            },
            getValue: function (target) {
                return $($(target).children()[0]).val();
            },
            setValue: function (target, value) {
                $($(target).children()[0]).val(value);
                var a = $('#tb_flowCustom').datagrid('getSelected');
                if (a.defaultUserIds) {
                    $($(target).children()[1]).val(a.defaultUserIds.replace("</p>", ""));
                }
            },
            resize: function (target, width) {
                $(target)._outerWidth(width);
            }
        }
    });
    var editIndex = undefined;
 
    function onClickRow(index) {
        //alert(index);
        var row = $('#tb_flowCustom').datagrid('getSelected');
        if (editIndex != index) {
            if (endEditing()) {
                if (index > 0) {
                    $('#tb_flowCustom').datagrid('selectRow', index)
                        .datagrid('beginEdit', index);
                    editIndex = index;
                }
            } else {
 
                $('#tb_flowCustom').datagrid('selectRow', editIndex);
            }
        }
    }
 
    function endEditing() {
        if (editIndex == undefined) {
            return true
        }
        if ($('#tb_flowCustom').datagrid('validateRow', editIndex)) {
            var userids = $("#txt_defaultUserIds_" + editIndex).val();
            $('#tb_flowCustom').datagrid('getRows')[editIndex]['defaultUserIds'] = userids;
            $('#tb_flowCustom').datagrid('endEdit', editIndex);
            editIndex = undefined;
            return true;
        } else {
            return false;
        }
    }
 
    /**
     * EasyUI DataGrid根据字段动态合并单元格
     * 参数 tableID 要合并table的id
     * 参数 colList 要合并的列,用逗号分隔(例如:"name,department,office");
     */
    function mergeCellsByField(tableID, colList) {
        var ColArray = colList.split(",");
        var tTable = $("#" + tableID);
        var TableRowCnts = tTable.datagrid("getRows").length;
        var tmpA;
        var tmpB;
        var PerTxt = "";
        var CurTxt = "";
        var alertStr = "";
        for (j = ColArray.length - 1; j >= 0; j--) {
            PerTxt = "";
            tmpA = 1;
            tmpB = 0;
 
            for (i = 0; i <= TableRowCnts; i++) {
                if (i == TableRowCnts) {
                    CurTxt = "";
                } else {
                    CurTxt = tTable.datagrid("getRows")[i][ColArray[j]];
                }
                if (PerTxt == CurTxt) {
                    tmpA += 1;
                } else {
                    tmpB += tmpA;
 
                    tTable.datagrid("mergeCells", {
                        index: i - tmpA,
                        field: ColArray[j],  //合并字段
                        rowspan: tmpA,
                        colspan: null
                    });
                    tTable.datagrid("mergeCells", { //根据ColArray[j]进行合并
                        index: i - tmpA,
                        field: "Ideparture",
                        rowspan: tmpA,
                        colspan: null
                    });
 
                    tmpA = 1;
                }
                PerTxt = CurTxt;
            }
        }
    }
 
 
    //选择默认处理人
    function selectDefaultUsers(nameElement, idElement, roleIdsRange, multiSelect) {
        var hasSelectNames = $("#" + nameElement).val();
        var hasSelectIds = $("#" + idElement).val();
        if (roleIdsRange == null || roleIdsRange == "null") {
            roleIdsRange = "";
        }
        wcp.picker.selectUser({
            title: "请选择默认处理人",
            selectRole: true,
            pickRangeType: 3,
            pickRangeId: roleIdsRange,
            classificationCode: params.securityCode,
            multiSelect: multiSelect,
            idElement: idElement,
            nameElement: nameElement,
            hasSelectIds: hasSelectIds,
            hasSelectNames: hasSelectNames,
            layerOpener: window
        }, function () {
            endEditing();
        });
    }
 
    //确定按钮事件
    function doSave() {
        $('#tb_flowCustom').edatagrid('saveRow');
        endEditing();
        var flowCustoms = [];
        var flowCustomsExist = $('#tb_flowCustom').datagrid("getRows");
        for (a = 0; a < flowCustomsExist.length; a++) {
            flowCustoms.push(flowCustomsExist[a]);
        }
        for (j = 0; j < removeRows.length; j++) {
            flowCustoms.push(removeRows[j]);
        }
        for (i = 0; i < flowCustoms.length; i++) {
            if (flowCustoms[i].hasOwnProperty('isNewRecord')) {
                delete flowCustoms[i].isNewRecord;
            }
        }
        wcp.ui.setBusy("body", wcp.ajax({
            url: "flowCustom/saveFlowCustom",
            data: JSON.stringify(flowCustoms),
        }).done(function (result) {
            if (params.callBack) {
                params.callBack();
            }
            var index = top.layer.getFrameIndex(window.name); //获取窗口索引
            top.layer.close(index);
            top.wcp.notify.success("保存成功!");
        }));
    }
 
    function doClose() { //关闭按钮事件
        var index = top.layer.getFrameIndex(window.name); //获取窗口索引
        top.layer.close(index);
    }
</script>
</html>