多单位版国产化地质资料管理系统
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
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
 
<!DOCTYPE HTML>
<html>
<head>
    <base href="<%=basePath%>">
 
    <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/material-teal.css" 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-easyui/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/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/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/scripts/ResizeScroll.js"></script>
    <style>
        html, body {
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
 
        /* .panel-body{}
            .ptbody table td {font-size: 16px; color:#000;}
            .ptbody table td p{margin-bottom: 10px;}
            .pt-form-btn{bottom: 0;}
            .datagrid-header td{ font-weight: 700;} */
        .icheck {
            background: url(static/images/flow/check.png) no-repeat;
            width: 14px;
            height: 14px;
            display: inline-block;
            vertical-align: -2px;
            margin-right: 6px;
            cursor: pointer;
        }
 
        .xuanzhong {
            background: url(static/images/flow/check1.png) no-repeat;
        }
    </style>
</head>
 
<body>
<div class="" style="padding:10px 30px 0;">
    <div class="clear">
        <form id="form_fieldRight" method="post">
            <div style="margin-bottom:10px;">
                <input type="hidden" id="configId" name="configId" value="${config.configId }"/>
                <input type="hidden" id="formId" name="formId" value="${config.formId }"/>
                <input class="easyui-textbox" type="text" style="width:500px;" id="configName" name="configName"
                       required="true"
                       data-options="label:'字段权限名称',labelAlign:'right',labelWidth:100,prompt:'请输入字段权限名称...'"
                       value="${config.configName }"/>
            </div>
        </form>
 
    </div>
 
    <table id="dg_formfield" title="字段权限列表" style="width:100%;height:350px;">
    </table>
 
    <script type="text/javascript">
        $(function () {
            var dg_formfield = $('#dg_formfield').datagrid({
                url: "config/flowDefinition/getFlowFieldsRightItems?formId=${config.formId}&configId=${config.configId}",
                fitColumns: true,
                columns: [[
                    {
                        field: 'fieldName',
                        title: '字段名称',
                        width: 200
                    },
                    {
                        field: 'fieldDisplayName',
                        title: '字段显示名称',
                        width: 200
                    },
                    {
                        field: 'enableSetRight',
                        title: '<i id="enableSetRightall" class="icheck" onclick="selectAll(this,\'enableSetRightck\');"></i>启用权限',
                        width: 120,
                        align: 'center',
                        formatter: function (value, record) {
                            return "<input id=\"chk_enableSetRight_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"enableSetRightck\"  onclick='enableSetRightCheck(this)'/>"
                        }
                    },
                    {
                        field: 'fieldEdit',
                        title: '<i id="editall" class="icheck" onclick="selectAll(this,\'editck\');"></i>编辑',
                        width: 80,
                        align: 'center',
                        formatter: function (value, record) {
                            var enableSetRight = "true";
                            if (record.enableSetRight == null || record.enableSetRight == false) {
                                enableSetRight = "false";
                            }
                            return "<input id=\"chk_edit_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"editck\" onclick='return " + enableSetRight + ";'/>"
                        }
                    },
                    {
                        field: 'fieldRequired',
                        title: '<i class="icheck" id="requiredall" onclick="selectAll(this,\'requiredck\');"></i>必填',
                        width: 80,
                        align: 'center',
                        formatter: function (value, record) {
                            var enableSetRight = "true";
                            if (record.enableSetRight == null || record.enableSetRight == false) {
                                enableSetRight = "false";
                            }
                            return "<input id=\"chk_required_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"requiredck\" onclick='return " + enableSetRight + ";'/>"
                        }
                    },
                    {
                        field: 'fieldHidden',
                        title: '<i class="icheck" id="hiddenall" onclick="selectAll(this,\'hiddenck\');"></i>隐藏',
                        width: 80,
                        align: 'center',
                        formatter: function (value, record) {
                            var enableSetRight = "true";
                            if (record.enableSetRight == null || record.enableSetRight == false) {
                                enableSetRight = "false";
                            }
                            return "<input id=\"chk_hidden_" + record.itemId + "\" type=\"checkbox\" " + (value ? "checked" : "") + " name=\"hiddenck\" onclick='return " + enableSetRight + ";'/>"
                        }
                    }
                ]],
                onCheckAll: function (rows) {
                    return false;
                }
            });
 
            $(".datagrid-btable input[type=checkbox]").click(function () {
                ckfun(this);
            })
 
        });
 
        //启用、关闭权限设置
        function enableSetRightCheck(e) {
            if (e.checked == true) {
                $("#" + e.id.replace('enableSetRight', 'edit')).removeAttr("onclick");
                $("#" + e.id.replace('enableSetRight', 'required')).removeAttr("onclick");
                $("#" + e.id.replace('enableSetRight', 'hidden')).removeAttr("onclick");
            } else {
                $("#" + e.id.replace('enableSetRight', 'edit')).attr("onclick", "return false");
                $("#" + e.id.replace('enableSetRight', 'required')).attr("onclick", "return false");
                $("#" + e.id.replace('enableSetRight', 'hidden')).attr("onclick", "return false");
            }
        }
 
        function ckfun(obj) {
            var trs = $(obj).closest("tr").find("input[type=checkbox]");
            // if (obj.name == "editck") {
            //     if ($(obj).prop("checked")) {
            //         trs.eq(3).prop("checked", false);
            //     }
            //
            // } else
            if (obj.name == "requiredck") {
                if ($(obj).prop("checked")) {
                    trs.eq(1).prop("checked", true);
                    trs.eq(3).prop("checked", false);
                }
            }
            // else if (obj.name == "hiddenck") {
            //     if ($(obj).prop("checked")) {
            //         trs.eq(0).prop("checked", false);
            //         trs.eq(1).prop("checked", false);
            //         trs.eq(2).prop("checked", false);
            //     }
            // }
            checkAll();
        }
 
        function checkAll() { //检查全选的情况
            $(".icheck").each(function (i, elem) {
 
                var name = elem.id.replace("all", "ck");
 
                $(elem).addClass("xuanzhong");
                $("[name=" + name + "]").each(function (index, ckelem) {
 
                    if (!$(ckelem).prop("checked")) {
                        $(elem).removeClass("xuanzhong");
                        return false;
                    }
 
                })
            })
 
        }
 
        function selectAll(obj, checkName) {
            if ($(obj).hasClass("xuanzhong")) {
                $("input[name=" + checkName + "]").each(function (index, elem) {
                    $(elem).prop("checked", false);
                    ckfun(elem);
                })
                $(obj).removeClass("xuanzhong");
            } else {
                $("input[name=" + checkName + "]").each(function (index, elem) {
                    $(elem).prop("checked", true);
                    ckfun(elem);
 
                })
                $(obj).addClass("xuanzhong");
            }
            return false;
        }
    </script>
 
    <br/>
 
 
</div>
 
<div class="pt-form-btn" style="bottom:0;">
    <div class="form-group">
        <button class="pt-btn pt-btn-primary" onclick="save();">确定</button>
        <button class="pt-btn pt-btn-default" onclick="cancel();">取消</button>
    </div>
 
</div>
 
<script>
    function cancel() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }
 
    //保存
    function save() {
        if (!$("#form_fieldRight").form('validate')) {
            wcp.notify.warn('请填写字段权限配置名称!');
            return;
        }
 
        var rows = $("#dg_formfield").datagrid("getRows");
        $.each(rows, function (i, elem) {
            elem.enableSetRight = $("#chk_enableSetRight_" + elem.itemId).prop("checked");
            elem.fieldEdit = $("#chk_edit_" + elem.itemId).prop("checked");
            elem.fieldRequired = $("#chk_required_" + elem.itemId).prop("checked");
            elem.fieldHidden = $("#chk_hidden_" + elem.itemId).prop("checked");
        })
 
        var config = $("#form_fieldRight").serializeObject();
 
        wcp.ui.setBusy("body", wcp.ajax({
            url: "config/flowDefinition/saveFlowFieldsRight",
            contentType: 'application/x-www-form-urlencoded',
            data: {
                configStr: JSON.stringify(config),
                itemsStr: JSON.stringify(rows)
            }
        }).done(function (result) {
            config = result;
            top.wcp.notify.success("保存成功!");
            //保存后,如果是新的,加入到选择项中 返回名称和id。
            parent.document.getElementById("hidden_fieldRightId").value = config.configId;
            parent.document.getElementById("hidden_fieldRightName").value = config.configName;
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(index);
            parent.retFieldRight();
        }));
    }
</script>
</body>
</html>