多单位版国产化地质资料管理系统
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
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
<%@ 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%>">
    <meta name="viewport" charset="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>表单配置</title>
    <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/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/scripts/ResizeScroll.js"></script>
    <script type="text/javascript" src="static/plugins/jquery-easyui-edatagrid/jquery.edatagrid.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 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%;
        }
 
        body {
            overflow: hidden;
        }
    </style>
</head>
<body>
<div id="allView" class="easyui-tabs" style="width:100%; height:100%" data-options="tabPosition:'left'">
    <div title="基本信息" class="pt-form viewBody">
        <form id="form1" method="post">
            <div class="form-unit1">基本信息</div>
            <table style="width: 100%; margin-bottom:10px;">
                <tr>
                    <td class="tbtitle">
                        <em class="pt-color-danger">*</em> 表单名称:
                    </td>
                    <td>
                        <input id="formName" name="formName" class="easyui-textbox" type="text"
                               data-options="required:true,width:'610' " value="${form.formName}"/>
                        <input type="hidden" class="easyui-textbox" id="formId" name="formId" value="${form.formId}"/>
                    </td>
                </tr>
 
                <tr>
                    <td class="tbtitle">
                        <em class="pt-color-danger">*</em> 所属模块:
                    </td>
                    <td>
                        <input id="moduleName" name="moduleName" class="easyui-textbox" type="text" style="width:610px;"
                               value="${form.moduleName}"/>
                        <input type="hidden" id="moduleId" name="moduleId" class="easyui-textbox" type="text"
                               value="${form.moduleId}"/>
                    </td>
                </tr>
                <tr style="display:none">
                    <td class="tbtitle">排序:</td>
                    <td>
                        <input id="sortNum" name="sortNum" class="easyui-numberspinner" style="width:610px;"
                               value="${form.sortNum}">
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">表单类型:</td>
                    <td>
                        <input class="easyui-radiobutton" name="formType" value="0" label="PC端"
                               data-options="checked:true">
                        <input class="easyui-radiobutton" name="formType" value="1" label="手机端">
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">前端视图类型:</td>
                    <td>
                        <input class="easyui-radiobutton" name="frontViewType" value="0" label="默认"
                               data-options="checked:true,onChange:frontViewTypeChange">
                        <input class="easyui-radiobutton" name="frontViewType" value="1" label="自定义"
                               data-options="onChange:frontViewTypeChange">
                    </td>
                </tr>
                <tr style="display: none" id="tr_frontViewName">
                    <td class="tbtitle"><em class="pt-color-danger">*</em>前端视图名称:</td>
                    <td>
                        <input id="frontViewName" name="frontViewName" value="${form.frontViewName}"
                               class="easyui-textbox" type="text" style="width:610px;"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">表单风格:</td>
                    <td>
                        <input class="easyui-radiobutton" name="formStyle" value="0" label="普通模式"
                               data-options="checked:true">
                        <input class="easyui-radiobutton" name="formStyle" value="1" label="极简模式">
                        <input class="easyui-radiobutton" name="formStyle" value="2" label="统一保存模式">
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">附件列表展示风格:</td>
                    <td>
                        <input class="easyui-radiobutton" name="attachListStyle" value="0" label="默认"
                               data-options="checked:true">
                        <input class="easyui-radiobutton" name="attachListStyle" value="1" label="列表条目显示">
                        <input class="easyui-radiobutton" name="attachListStyle" value="2" label="不显示">
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">
                        <em class="pt-color-danger">*</em> 主业务表名:
                    </td>
                    <td>
                        <input id="mainTableName" name="mainTableName" class="easyui-textbox" type="text"
                               style="width:610px;"
                               data-options="required:true,buttonText:'选表',prompt:'请选择表...',onClickButton:selectTable"
                               value="${form.mainTableName}"/>
                        <input id="mainTableId" name="mainTableId" class="easyui-textbox" type="hidden"
                               value="${form.mainTableId}"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">是否启用扫描上传:</td>
                    <td>
                        <input id="enableScanUpload" name="enableScanUpload" type="hidden"
                               value="${form.enableScanUpload}"/>
                        <input id="enableScanUploadText" class="easyui-switchbutton"
                               data-options="onText:'是',offText:'否',onChange:setEnableValue"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">保存后自动关闭:</td>
                    <td>
                        <input id="enableAutoClose" name="enableAutoClose" type="hidden"
                               value="${form.enableAutoClose}"/>
                        <input id="enableAutoCloseText" class="easyui-switchbutton"
                               data-options="onText:'是',offText:'否',onChange:setEnableValue"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">是否保留字段数据:</td>
                    <td>
                        <input id="enableKeepColumnData" name="enableKeepColumnData" type="hidden"
                               value="${form.enableKeepColumnData}"/>
                        <input id="enableKeepColumnDataText" class="easyui-switchbutton"
                               data-options="onText:'是',offText:'否',onChange:setEnableValue"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">是否隐藏流程信息:</td>
                    <td>
                        <input id="enableHideFlowInfo" name="enableHideFlowInfo" type="hidden"
                               value="${form.enableHideFlowInfo}"/>
                        <input id="enableHideFlowInfoText" class="easyui-switchbutton"
                               data-options="onText:'是',offText:'否',onChange:setEnableValue"/>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">是否关联其他表:</td>
                    <td>
                        <input id="enableOtherTables" name="enableOtherTables" type="hidden"
                               value="${form.enableOtherTables}"/>
                        <input id="enableOtherTablesText" class="easyui-switchbutton"
                               data-options="onText:'是',offText:'否',onChange:setEnableValue"/>
                    </td>
                </tr>
                <tr style="display:none;" id="tr1">
                    <td class="tbtitle">关联表名:</td>
                    <td>
                        <input id="otherTablesName" name="otherTablesName" value="${form.otherTablesName}"
                               class="easyui-textbox" type="text" style="width:610px;"
                               data-options="buttonText:'选表',prompt:'请选择表...',onClickButton:selectTable"/>
                    </td>
                </tr>
                <tr style="display:none;" id="tr2">
                    <td class="tbtitle">查询字段:</td>
                    <td>
                        <input id="selectColumnsName" name="selectColumnsName" value="${form.selectColumnsName}"
                               class="easyui-textbox" type="text" style="width:610px; height:60px;"
                               data-options="buttonText:'选字段',prompt:'请选择字段...',multiline:true,onClickButton:selectColumn"/>
                    </td>
                </tr>
                <tr style="display:none;" id="tr3">
                    <td class="tbtitle">关联关系:</td>
                    <td>
                        <pre id="editorRelationSql" style="height:100px; width:610px;"></pre>
                        <textarea rows="2" cols="20" id="relationSql" name="relationSql"
                                  style="display: none;">${form.relationSql}</textarea>
                        <div id="relationSqlDefaultHtml" style="display:none"></div>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">引入JS/CSS文件:</td>
                    <td>
                        <pre id="editorImportFileUrl" style="height:150px; width:610px;"></pre>
                        <textarea rows="2" cols="20" id="importFileUrl" name="importFileUrl"
                                  style="display: none;">${form.importFileUrl}</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">自定义样式:</td>
                    <td>
                        <pre id="editorCustomStyle" style="height:150px; width:610px;"></pre>
                        <textarea rows="2" cols="20" id="customStyle" name="customStyle"
                                  style="display: none;">${form.customStyle}</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">自定义脚本:</td>
                    <td>
                        <pre id="editorCustomJs" style="height:200px; width:610px;"></pre>
                        <textarea rows="2" cols="20" id="customJs" name="customJs"
                                  style="display: none;">${form.customJs}</textarea>
                    </td>
                </tr>
                <tr>
                    <td class="tbtitle">自定义表达式:
                        <i class="fa fa-exclamation-circle pt-color-warning easyui-tooltip"
                           title="可使用的变量:</br>jdbcTemplate,request,user,keyId</br>form,view,formData,formColumnList</br>formData的使用:</br>var fieldValue=formData['fieldName'];</br>formData['fieldName']=fieldValue;"
                           data-options="position: 'right',
                                     onShow: function(){
                                        var t = $(this);
                                        t.tooltip('tip').css({
                                            backgroundColor: '#eb9814',
                                            borderColor: '#d38f23',
                                            color: '#fff',
                                            width: '260px',
                                            lineHeight:'24px'
                                        });
 
                                        t.tooltip('tip').unbind().bind('mouseenter', function(){
                                            t.tooltip('show');
                                        }).bind('mouseleave', function(){
                                            t.tooltip('hide');
                                        });
                                    }"></i>
                    </td>
                    <td>
                        <pre id="editorCustomExpression" style="height:200px; width:610px;"></pre>
                        <textarea rows="2" cols="20" id="customExpression" name="customExpression"
                                  style="display: none;">${form.customExpression}</textarea>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div title="页签配置" class="viewBody" style="padding:10px 20px;">
        <table id="t_subtab"></table>
        <div id="subtab_toolbar" class="clear">
            <div class="pull-right">
                <a href="javascript:;" onclick="selectFormSubtab();" class="pt-btn pt-btn-success">
                    <i class="fa fa-plus"></i>
                    新增
                </a>
                <a onclick="deleteFormSubtabClick();" class="pt-btn pt-btn-danger">
                    <i class="fa fa-trash-o"></i>
                    删除
                </a>
                <a href="javascript:;" class="pt-btn pt-btn-info" onclick="enableSort(this,'t_subtab')">
                    <i class="fa fa-retweet"></i>
                    排序
                </a>
                <a href="javascript:;" onclick='t_subtab.datagrid("reload");' class="pt-btn pt-btn-purple">
                    <i class="fa fa-refresh"></i>
                    刷新
                </a>
            </div>
        </div>
    </div>
    <div title="操作配置" class="viewBody" style="padding:10px 20px;">
        <table id="t_operation"></table>
        <div id="operation_toolbar" class="clear">
            <div class="pull-right">
                <a href="javascript:;" onclick="selectFormOperation();" class="pt-btn pt-btn-success">
                    <i class="fa fa-plus"></i>
                    新增
                </a>
                <a onclick="deleteFormOperationClick();" class="pt-btn pt-btn-danger">
                    <i class="fa fa-trash-o"></i>
                    删除
                </a>
                <a href="javascript:;" class="pt-btn pt-btn-info" onclick="enableSort(this,'t_operation')">
                    <i class="fa fa-retweet"></i>
                    排序
                </a>
                <a href="javascript:;" onclick='t_operation.datagrid("reload");' class="pt-btn pt-btn-purple">
                    <i class="fa fa-refresh"></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-primary" onclick="doSave();">确定</button>
        <button type="reset" class="pt-btn pt-btn-default" onclick="closeWindow();">关闭</button>
    </div>
</div>
 
</body>
<script>
    //窗口参数,用于弹窗传递
    var params = {
        callBack: null
    };
    var editor_RelationSql,
        editor_ImportFileUrl,
        editor_CustomStyle,
        editor_CustomJs,
        editor_CustomExpression;
    var t_operation = null;
    var t_subtab = null;
    $(function () {
        editor_RelationSql = ace.edit("editorRelationSql");
        editor_RelationSql.setTheme("ace/theme/monokai");
        editor_RelationSql.session.setMode("ace/mode/sql");
        editor_RelationSql.setFontSize(16);
        editor_RelationSql.session.setValue($("#relationSql").val());
 
        editor_ImportFileUrl = ace.edit("editorImportFileUrl");
        editor_ImportFileUrl.setTheme("ace/theme/monokai");
        editor_ImportFileUrl.session.setMode("ace/mode/html");
        editor_ImportFileUrl.setFontSize(16);
        editor_ImportFileUrl.session.setValue($("#importFileUrl").val());
 
        editor_CustomStyle = ace.edit("editorCustomStyle");
        editor_CustomStyle.setTheme("ace/theme/monokai");
        editor_CustomStyle.session.setMode("ace/mode/css");
        editor_CustomStyle.setFontSize(16);
        editor_CustomStyle.session.setValue($("#customStyle").val());
 
        editor_CustomJs = ace.edit("editorCustomJs");
        editor_CustomJs.setTheme("ace/theme/monokai");
        editor_CustomJs.session.setMode("ace/mode/javascript");
        editor_CustomJs.setFontSize(16);
        editor_CustomJs.session.setValue($("#customJs").val());
 
        editor_CustomExpression = ace.edit("editorCustomExpression");
        editor_CustomExpression.setTheme("ace/theme/monokai");
        editor_CustomExpression.session.setMode("ace/mode/javascript");
        editor_CustomExpression.setFontSize(16);
        editor_CustomExpression.session.setValue($("#customExpression").val());
 
        new ResizeScroll({
            "id": ".pt-form",
            "height": "506"
        });
        initEnableCheck();
 
        getOperationTable();
        getSubtabTable();
    });
 
    //表单页签
    function getSubtabTable() {
        t_subtab = $("#t_subtab").datagrid({
            rownumbers: true,
            fitColumns: true,
            method: "get",
            checkOnSelect: false,
            selectOnCheck: false,
            url: 'config/form/getSubtabByFormId?formId=${form.formId}',
            toolbar: "#subtab_toolbar",
            emptyMsg: "没有找到匹配的记录",
            columns: [[
                {
                    field: 'ck',
                    checkbox: true
                },
                {
                    field: 'subtabName',
                    title: '显示名称',
                    width: 80
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    width: 70
                },
                {
                    field: 'lastModifyUserName',
                    title: '创建人',
                    width: 50
                },
                {
                    field: 'id',
                    title: '操作',
                    width: 50,
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value) {
                            return '<a href="javadcript:;" onclick=\'deleteFormSubtab("' + value + '");\' class="pt-color-danger"><i class="fa fa-trash-o" title="删除"></i></a>';
 
                        } else {
                            return "";
                        }
 
                    }
                }
            ]],
            onLoadSuccess: function (data) {
            }
        });
    }
 
    //增加表单页签操作
    function selectFormSubtab() {
        var moduleId = '${form.moduleId}';
        wcp.picker.selectSubtab({
            title: "请选择页签",
            multiSelect: true,
            subtabPosition: 0,
            moduleId: moduleId,
            layerOpener: window
        }, function (rows) {
            var subtabIdList = new Array();
            $.each(rows, function (index, value) {
                subtabIdList.push(value.subtabId);
            });
            wcp.ui.setBusy("body", wcp.ajax({
                url: "config/form/saveFormSubtab?formId=${form.formId}",
                data: JSON.stringify(subtabIdList),
            }).done(function (result) {
                top.wcp.notify.success("保存成功!");
                //刷新数据
                $('#t_subtab').datagrid('reload');
            }));
        });
    }
 
    //删除表单页签
    function deleteFormSubtabClick() {
        //获取dg选中的数据行
        var checkRows = $("#t_subtab").datagrid("getChecked");
        if (checkRows.length == 0) {
            wcp.message.info("请选择需要删除的表单页签!");
        } else {
            var ids = new Array();
            $.each(checkRows, function (index, value) {
                ids.push(value.id);
            });
            deleteFormSubtabs(ids);
        }
    }
 
    //删除单个表单页签事件
    function deleteFormSubtab(subtabId) {
        deleteFormSubtabs([subtabId]);
    }
 
    //删除表单页签事件
    function deleteFormSubtabs(subtabIds) {
        layer.confirm("确定要删除选择的表单页签吗?", {
            icon: 3,
            title: '提示'
        }, function (index) {
            wcp.ui.setBusy("body", wcp.ajax({
                url: "config/form/deleteFormSubtab",
                data: JSON.stringify(subtabIds),
            }).done(function (result) {
                wcp.notify.success('删除成功!');
                //刷新数据
                $('#t_subtab').datagrid('reload');
            }));
        });
    }
 
    //操作
    function getOperationTable() {
        t_operation = $("#t_operation").datagrid({
            rownumbers: true,
            fitColumns: true,
            method: "get",
            checkOnSelect: false,
            selectOnCheck: false,
            url: 'config/form/getFormOperationByFormId?formId=${form.formId}',
            toolbar: "#operation_toolbar",
            emptyMsg: "没有找到匹配的记录",
            columns: [[
                {
                    field: 'ck',
                    checkbox: true
                },
                {
                    field: 'displayName',
                    title: '显示名称',
                    width: 80
                },
                {
                    field: 'operationName',
                    title: '操作名称'
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    width: 70
                },
                {
                    field: 'lastModifyUserName',
                    title: '创建人',
                    width: 50
                },
                {
                    field: 'id',
                    title: '操作',
                    width: 50,
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value) {
                            return '<a href="javadcript:;" onclick=\'deleteFormOperation("' + value + '");\' class="pt-color-danger"><i class="fa fa-trash-o" title="删除"></i></a>';
 
                        } else {
                            return "";
                        }
 
                    }
                }
            ]],
            onLoadSuccess: function (data) {
            }
        });
    }
 
    //删除表单操作
    function deleteFormOperationClick() {
        //获取dg选中的数据行
        var checkRows = $("#t_operation").datagrid("getChecked");
        if (checkRows.length == 0) {
            wcp.message.info("请选择需要删除的行!");
        } else {
            var ids = new Array();
            $.each(checkRows, function (index, value) {
                ids.push(value.id);
            });
            deleteFormOperations(ids);
        }
    }
 
    //删除单个表单事件
    function deleteFormOperation(id) {
        deleteFormOperations([id]);
    }
 
    //删除表单事件
    function deleteFormOperations(ids) {
        layer.confirm("确定要删除选择的操作吗?", {
            icon: 3,
            title: '提示'
        }, function (index) {
            wcp.ui.setBusy("body", wcp.ajax({
                url: "config/form/deleteFormOperation",
                data: JSON.stringify(ids),
            }).done(function (result) {
                wcp.notify.success('删除成功!');
                //刷新数据
                $('#t_operation').datagrid('reload');
            }));
        });
    }
 
    //增加表单操作
    function selectFormOperation() {
        var formId = '${form.formId}';
        var moduleId = '${form.moduleId}';
        wcp.picker.selectOperation({
            title: "请选择操作",
            multiSelect: true,
            operationPosition: 1,
            moduleId: moduleId,
            layerOpener: window
        }, function (rows) {
            var operationIdList = new Array();
            $.each(rows, function (index, value) {
                operationIdList.push(value.operationId);
            });
            wcp.ui.setBusy("body", wcp.ajax({
                url: "config/form/saveFormOperation?formId=" + formId,
                data: JSON.stringify(operationIdList),
            }).done(function (result) {
                top.wcp.notify.success("保存成功!");
                //刷新数据
                $('#t_operation').datagrid('reload');
            }));
        });
    }
 
    function enableSort(obj, tname) {
        var oA = $(obj);
        var tip = $.trim(oA.text());
        switch (tname) {
            case "t_operation":
                if (tip == "排序") {
                    oA.html('<i class="fa fa-retweet"></i>保存排序');
                    t_operation.datagrid("enableDnd");
                } else {
                    oA.html('<i class="fa fa-retweet"></i>排序');
                    if (tip == "保存排序") {
                        //保存表格中排序
                        saveSortNum(tname, 'config/form/saveOperationSortNum');
                    }
                }
                break;
            case "t_subtab":
                if (tip == "排序") {
                    oA.html('<i class="fa fa-retweet"></i>保存排序');
                    t_subtab.datagrid("enableDnd");
                } else {
                    oA.html('<i class="fa fa-retweet"></i>排序');
                    if (tip == "保存排序") {
                        //保存表格中排序
                        saveSortNum(tname, 'config/form/saveSubtabSortNum');
                    }
                }
                break;
        }
    }
 
    //保存列排序号
    function saveSortNum(dataGridId, postUrl) {
        var data = $('#' + dataGridId).datagrid('getRows');
        var Ids_SortNums = new Array();
        $.each(data, function (i, row) {
            Ids_SortNums.push(row.id + "_" + (i + 1));
        });
        wcp.ui.setBusy("body", wcp.ajax({
            url: postUrl,
            data: JSON.stringify(Ids_SortNums),
        }).done(function (result) {
            $('#' + dataGridId).datagrid('reload');
            top.wcp.notify.success("保存排序成功!");
        }));
    }
 
    //前端视图类型切换
    function frontViewTypeChange(checked) {
        if (checked) {
            var value = $(this).val();
            if (value == "0") {
                $("#tr_frontViewName").hide();
                $("#frontViewName").textbox('textbox').validatebox({
                    required: false
                });
            } else {
                $("#tr_frontViewName").show();
                $("#frontViewName").textbox('textbox').validatebox({
                    required: true
                });
            }
        }
    }
 
    //初始化选择项
    function initEnableCheck() {
        //初始化是否选择
        if ("${form.enableOtherTables}" == "true") {
            $('#enableOtherTablesText').switchbutton("check");
            //$('#tb_otherTable').show();
            $('#tr1').show();
            $('#tr2').show();
            $('#tr3').show();
 
        } else {
            $('#enableOtherTablesText').switchbutton("uncheck");
            //$('#tb_otherTable').hide();
            $('#tr1').hide();
            $('#tr2').hide();
            $('#tr3').hide();
 
        }
        if ("${form.enableAutoClose}" == "true") {
            $('#enableAutoCloseText').switchbutton("check");
        } else {
            $('#enableAutoCloseText').switchbutton("uncheck");
        }
        if ("${form.enableScanUpload}" == "true") {
            $('#enableScanUploadText').switchbutton("check");
        } else {
            $('#enableScanUploadText').switchbutton("uncheck");
        }
        if ("${form.enableKeepColumnData}" == "true") {
            $('#enableKeepColumnDataText').switchbutton("check");
        } else {
            $('#enableKeepColumnDataText').switchbutton("uncheck");
        }
        if ("${form.enableHideFlowInfo}" == "true") {
            $('#enableHideFlowInfoText').switchbutton("check");
        } else {
            $('#enableHideFlowInfoText').switchbutton("uncheck");
        }
        //初始化radiobutton
        $("input[radiobuttonName='formType'][value='${form.formType}']").radiobutton('check');
        $("input[radiobuttonName='frontViewType'][value='${form.frontViewType}']").radiobutton('check');
        $("input[radiobuttonName='formStyle'][value='${form.formStyle}']").radiobutton('check');
        $("input[radiobuttonName='attachListStyle'][value='${form.attachListStyle}']").radiobutton('check');
    }
 
    //关联其他表
    function setEnableValue(checked) {
        $('#' + this.id.replace("Text", "")).val(checked);
        if (checked) {
            if (this.id == "enableOtherTablesText") {
                $('#tr1').show();
                $('#tr2').show();
                $('#tr3').show();
            }
 
        } else {
            if (this.id == "enableOtherTablesText") {
                $('#tr1').hide();
                $('#tr2').hide();
                $('#tr3').hide();
            }
        }
    }
 
    //选择表、关联表
    function selectTable() {
        var multiSelect = true;
        var iptId = this.id;
        if (iptId == "mainTableName") {
            multiSelect = false;
        }
        var moduleId = '${form.moduleId}';
        if (iptId == 'otherTablesName') {
            moduleId = '';
        }
        wcp.picker.selectTable({
            title: "请选择表",
            multiSelect: multiSelect,
            moduleId: moduleId,
            layerOpener: window
        }, function (rows) {
            var selectedTables = "";
            var selectedTableIds = "";
            $.each(rows, function (index, value) {
                selectedTables += value.tableName + ',';
                selectedTableIds += value.tableId + ',';
            });
            selectedTables = selectedTables.substr(0, selectedTables.length - 1);
            selectedTableIds = selectedTableIds.substr(0, selectedTableIds.length - 1);
            $('#' + iptId).textbox("setValue", selectedTables);
            $('#mainTableId').textbox("setValue", selectedTableIds);
        });
    }
 
    //选择关联字段
    function selectColumn() {
        var tableNames = $('#otherTablesName').val().replace(';', ',');
        if (tableNames == '') {
            tableNames = $('#mainTableName').val();
        } else {
            tableNames = $('#mainTableName').val() + ',' + tableNames;
        }
        var idName = this.id;
        var multiSelect = true;
        wcp.picker.selectTableColumn({
            title: "请选择字段",
            tableName: tableNames,
            multiSelect: multiSelect,
            layerOpener: window
        }, function (rows) {
            var selectedColumns = "";
            $.each(rows, function (index, value) {
                selectedColumns += value.columnName + ',';
            });
            selectedColumns = selectedColumns.substr(0, selectedColumns.length - 1);
            $('#' + idName).textbox("setValue", selectedColumns);
        });
    }
 
    //确定按钮事件
    function doSave() {
        //验证表单信息
        var isValid = $('#form1').form('validate');
        if (!isValid) {
            wcp.notify.error('表单验证有误,请检查表单输入项!');
            return false;
        }
 
        $("#relationSql").val(editor_RelationSql.getValue().replace(/(^\s*)|(\s*$)/g, ""));
        $("#importFileUrl").val(editor_ImportFileUrl.getValue().replace(/(^\s*)|(\s*$)/g, ""));
        $("#customStyle").val(editor_CustomStyle.getValue().replace(/(^\s*)|(\s*$)/g, ""));
        $("#customJs").val(editor_CustomJs.getValue().replace(/(^\s*)|(\s*$)/g, ""));
        $("#customExpression").val(editor_CustomExpression.getValue().replace(/(^\s*)|(\s*$)/g, ""));
 
        var formData = $("#form1").serializeObject();
 
        wcp.ui.setBusy("body", wcp.ajax({
            url: "config/form/saveForm",
            data: JSON.stringify(formData),
        }).done(function (result) {
            //判断是否需要执行回调函数
            if (params.callBack) {
                params.callBack();
            }
            //关闭窗口
            closeWindow();
            top.wcp.notify.success("保存成功!");
        }));
    }
 
    //关闭窗口事件
    function closeWindow() {
        var index = top.layer.getFrameIndex(window.name); //获取窗口索引
        top.layer.close(index);
    }
</script>
 
</html>