多单位版国产化地质资料管理系统
zhai
2025-12-18 3c6f6c1e3016e38146a4c46be6e7b625c35591f2
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
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
<%@ 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 href="static/plugins/ueditor-formdesign/css/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
    <!--[if lte IE 6]>
    <link rel="stylesheet" type="text/css" href="static/plugins/ueditor-formdesign/css/bootstrap/css/bootstrap-ie6.css">
    <![endif]-->
    <!--[if lte IE 7]>
    <link rel="stylesheet" type="text/css" href="static/plugins/ueditor-formdesign/css/bootstrap/css/ie.css">
    <![endif]-->
    <link href="static/plugins/ueditor-formdesign/css/site.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/theme/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/slimScroll/jquery.slimscroll.min.js"></script>
    <script type="text/javascript" src="static/scripts/ResizeScroll.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>
        a:hover {
            color: #fff;
            text-decoration: none;
        }
 
        .alert {
            margin: 10px 20px 16px 20px;
        }
 
        .row {
            position: relative;
        }
 
        .span2 {
            position: absolute;
            left: 20px;
            top: 0px;
        }
 
        .span10 {
            width: 100%;
        }
 
        .pt-custom-list {
            margin: 0;
        }
 
        .pt-custom-list p {
            line-height: 38px;
            margin: 0 0 8px 0;
            padding: 0 0 0 20px;
            background: #f9f9f9;
            cursor: pointer;
            border: 1px solid #d4d4d4;
            border-radius: 4px;
        }
 
        .pt-custom-list p:hover {
            background-color: #f3f2f2;
        }
 
        .pt-custom-list p:active {
            background-color: #e8e8e8;
        }
 
        .pt-custom-list p .fa {
            font-size: 18px;
            margin-right: 6px;
        }
    </style>
    <script>
 
    </script>
</head>
 
<body>
<div>
    <div class="pt-main-top clear">
        <div class="pt-nav">
                <span class="pt-title-icon"> <i class="fa fa-gears"></i>
                </span>
            <div class="pt-title">
 
                <div>
                    <h4>表单设计</h4>
                </div>
            </div>
 
        </div>
        <div class="pt-box-tools">
            <a href="javascript:;" class="pt-btn pt-btn-warning" onclick="leipiFormDesign.exec('preview');">
                <i class="fa fa-eye"></i> 预览
            </a>
            <a href="javascript:;" class="pt-btn pt-btn-primary" onclick="leipiFormDesign.fnCheckForm('save');">
                <i class="fa fa-save"></i> 保存
            </a>
        </div>
    </div>
    <form method="post" id="saveform" name="saveform">
        <input type="hidden" name="fields" id="fields" value="0">
        <input id="txtFormId" type="hidden" value="${form.formId}"/>
        <div class="alert">
            <button type="button" class="close" data-dismiss="alert">&times;</button>
            <strong>提醒:</strong>单选框和复选框,如:
            <code>{|-</code>
            选项
            <code>-|}</code>
            两边边界是防止误删除控件,程序会把它们替换为空,请不要手动删除!
        </div>
        <div class="row">
            <div class="span2">
                <div class="pt-custom-list clear">
                    <p class="item" onclick="leipiFormDesign.exec('leipi_template');">
                        <i class="fa fa-table"></i> <span>表单模板</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('text');">
                        <i class="fa fa-text-width"></i> <span>文本框</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('textarea');">
                        <i class="fa fa-pencil-square-o"></i> <span>多行文本框</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('radios');">
                        <i class="fa fa-dot-circle-o"></i> <span>单选框组</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('checkboxs');">
                        <i class="fa fa-check-square-o"></i> <span>复选框组</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('select');">
                        <i class="fa fa-caret-square-o-down"></i> <span>下拉菜单</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('listctrl');">
                        <i class="fa fa-list-alt"></i>
                        <span>列表</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('datetime');">
                        <i class="fa fa-clock-o"></i> <span>日期时间框</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('person');">
                        <i class="fa fa-user"></i> <span>人员选择</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('upload');">
                        <i class="fa fa-upload"></i> <span>上传文件</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('resource');">
                        <i class="fa fa-columns"></i> <span>资源选择</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('serial');">
                        <i class="fa fa-sort-numeric-asc"></i> <span>流水号</span>
                    </p>
                    <p class="item" onclick="leipiFormDesign.exec('formula');">
                        <i class="fa fa-superscript"></i> <span>公式字段</span>
                    </p>
                </div>
            </div>
 
            <div style="margin:0 40px 0 180px;">
                <div class="span10">
                    <script id="myFormDesign" type="text/plain" style="width:100%;">${form.formContentModel}</script>
                </div>
            </div>
        </div>
        <!--end row-->
    </form>
    <div class="mb10"></div>
    <!-- <div class="pt-form-btn-frame">
<div class="pt-form-btn">
    <div class="form-group">
        <button type="reset" class="pt-btn pt-btn-default"  onclick="leipiFormDesign.exec('preview');">预览</button>
        <button type="submit" class="pt-btn pt-btn-primary"  onclick="leipiFormDesign.exec('save');">保存</button>
 
    </div>
</div>
</div> -->
</div>
<!--end container-->
<script type="text/javascript" charset="utf-8"
        src="static/plugins/ueditor-formdesign/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8"
        src="static/plugins/ueditor-formdesign/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8"
        src="static/plugins/ueditor-formdesign/js/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8"
        src="static/plugins/ueditor-formdesign/js/ueditor/formdesign/leipi.formdesign.v5.js"></script>
 
<script type="text/javascript" src="static/scripts/ResizeScroll.js"></script>
 
<!-- script start-->
<script type="text/javascript">
    $(function () {
        new ResizeScroll({
            "id": ".pt-custom-list",
            "fun": function () {
                var wh = $(window).height();
                return (wh - 160);
            }
        });
    });
 
    var leipiEditor = UE.getEditor('myFormDesign', {
        //allowDivTransToP: false,//阻止转换div 为p
        toolleipi: true, //是否显示,设计器的 toolbars
        textarea: 'design_content',
        enterTag: 'br',
        allowDivTransToP: false,
        //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
        toolbars: [[
            'fullscreen', 'source', '|', 'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|', 'fontfamily', 'fontsize', '|', 'indent', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'link', 'unlink', '|', 'horizontal', 'spechars', 'wordimage', '|', 'inserttable', 'deletetable', 'mergecells', 'splittocells']],
        //focus时自动清空初始化时的内容
        //autoClearinitialContent:true,
        //关闭字数统计
        wordCount: false,
        //关闭elementPath
        elementPathEnabled: false,
        autoHeightEnabled: false,
        //默认的编辑区域高度
        initialFrameHeight: $(window).height() - 200
        ///,iframeCssUrl:"css/bootstrap/css/bootstrap.css" //引入自身 css使编辑器兼容你网站css
        //更多其他参数,请参考ueditor.config.js中的配置项
    });
    var controlType,
        tableName,
        columnName,
        displayName,
        defaultValue,
        dataType,
        alignType,
        controlWidth,
        controlHeight,
        fontSize,
        customStyleName,
        enableHidden,
        enableUnique,
        enableRequired,
        enableEditable,
        enableMultiselect,
        enableJoinParent,
        enableReturnIdType,
        enableStrong,
        outputFormat,
        verifyFormat,
        sortMode,
        dataSourceType,
        dataSourceKeys,
        dataSourceSql,
        dataSourceKeywordId,
        dataSourceKeywordName,
        userSelectType,
        uploadType,
        enableAutoUpload,
        allowUploadCount,
        targetModuleId,
        targetModuleName,
        targetTableId,
        targetTableName,
        contentFrom,
        returnFunctionName,
        localRelationColumnName,
        targetRelationColumnName,
        filterSql,
        targetViewId,
        targetViewName,
        targetColumnNames,
        targetColumnTitles,
        localColumnNames,
        codingGetType,
        codingId,
        codingName,
        expression,
        enableSaveDatabase,
        itemCount,
        dateType,
        saveSelectType,
        saveSelectNameField,
        pickRangeType,
        pickRangeId,
        pickRangeNmae,
        listType,
        listHiddenParams,
        listCondition,
        listSubItemsJson,
        listDefaultRows;
 
    var number = 0; //全局变量,计数用,等于1时删除所有
    var isSaveFormColumn = false; //全局变量,用于判断是否需要保存表单列字段
    var columnNames = ""; //全局变量,用于判断是否解析过字段,每次解析完存入一个字符串
    var errorColumnNames = ""; //全局变量,存多次出现的字段
    var objList = [];
    var leipiFormDesign = {
        /*执行控件*/
        exec: function (method) {
            leipiEditor.execCommand(method);
        },
        /*
            Javascript 解析表单
            template 表单设计器里的Html内容
            fields 字段总数
        */
        parse_form: function (template, fields) {
            //正则  radios|checkboxs|select 匹配的边界 |--|  因为当使用 {} 时js报错
            var preg = /(\|-<span(((?!<span).)*leipiplugins=\"(radios|checkboxs|select)\".*?)>(.*?)<\/span>-\||<(img|input|textarea|select).*?(<\/select>|<\/textarea>|\/>))/gi,
                preg_attr = /(\w+)=\"(.?|.+?)\"/gi,
                preg_group = /<input.*?\/>/gi;
            if (!fields)
                fields = 0;
 
            var template_parse = template,
                template_data = new Array(),
                add_fields = new Object(),
                checkboxs = 0;
 
            var pno = 0;
            template.replace(preg, function (plugin, p1, p2, p3, p4, p5, p6) {
                number++;
                var parse_attr = new Array(),
                    attr_arr_all = new Object(),
                    name = '',
                    select_dot = '',
                    is_new = false,
                    dir = '',
                    select_text_dot = '';
                var p0 = plugin;
                var tag = p6 ? p6 : p4;
                //alert(tag + " \n- t1 - "+p1 +" \n-2- " +p2+" \n-3- " +p3+" \n-4- " +p4+" \n-5- " +p5+" \n-6- " +p6);
                if (tag == 'radios' || tag == 'checkboxs') {
                    plugin = p2;
                } else if (tag == 'select') {
                    plugin = plugin.replace('|-', '');
                    plugin = plugin.replace('-|', '');
                }
                controlType = null, tableName = null, columnName = null, displayName = null, defaultValue = null, dataType = null, alignType = null, controlWidth = null, controlHeight = null,
                    fontSize = null, customStyleName = null, enableHidden = null, enableUnique = null, enableRequired = null, enableEditable = null, enableMultiselect = null,enableJoinParent=null,enableReturnIdType = null, enableStrong = null, outputFormat = null,
                    verifyFormat = null, sortMode = null, dataSourceType = null, dataSourceKeys = null, dataSourceSql = null, dataSourceKeywordId = null, dataSourceKeywordName = null, userSelectType = null,
                    uploadType = null, enableAutoUpload = null, allowUploadCount = null, targetTableName = null, targetTableId = null, targetModuleName = null, targetModuleId = null, contentFrom = null, returnFunctionName = null, localRelationColumnName = null,
                    targetRelationColumnName = null, filterSql = null, targetViewId = null, targetViewName = null, targetColumnNames = null, targetColumnTitles = null, localColumnNames = null, codingGetType = null, codingId = null, codingName = null,
                    expression = null, enableSaveDatabase = null, Type = null, itemCount = null, saveSelectType = null, saveSelectNameField = null, pickRangeType = null, pickRangeId = null, pickRangeName = null, pickRangeColumn = null,
                    listType = null, listHiddenParams = null, listCondition = null, listSubItemsJson = null, listDefaultRows = null;
                plugin.replace(preg_attr, function (str0, attr, val) {
                    if (attr == 'name') {
                        if (val == 'leipiNewField') {
                            is_new = true;
                            fields++;
                            val = 'data_' + fields;
                        }
                        name = val;
                    }
 
                    if (attr == "orgitemdir") {
                        dir = val;
                    }
 
                    if (tag == 'select' && attr == 'value') {
                        if (!attr_arr_all[attr])
                            attr_arr_all[attr] = '';
                        attr_arr_all[attr] += select_dot + val;
                        select_dot = ',';
                    } else if (tag == 'select' && attr == 'text') {
                        if (!attr_arr_all[attr])
                            attr_arr_all[attr] = '';
                        attr_arr_all[attr] += select_text_dot + val;
                        select_text_dot = ',';
 
                    } else {
                        attr_arr_all[attr] = val;
                    }
                    var oField = new Object();
                    oField[attr] = val;
                    parse_attr.push(oField);
                    //设置json值
                    if (isSaveFormColumn) {
                        setFormColumnJson(attr, val.replace("&gt;", ">").replace("&lt;", "<")
                            .replace("&#39;", "'").replace("&#39;", "'"));
                    }
                })
                /*alert(JSON.stringify(parse_attr));return;*/
                if (tag == 'checkboxs') /*复选组  多个字段 */
                {
                    plugin = p0;
                    plugin = plugin.replace('|-', '');
                    plugin = plugin.replace('-|', '');
                    //var name = 'checkboxs_'+checkboxs;
                    attr_arr_all['parse_name'] = name;
                    attr_arr_all['text'] = '';
                    attr_arr_all['value'] = '';
                    attr_arr_all['content'] = '<span leipiplugins="checkboxs" name="span_' + attr_arr_all['name'] + '"  title="' + attr_arr_all['title'] + '">';
                    var dot_text = '',
                        dot_value = '',
                        index = 0;
                    p5.replace(preg_group, function (parse_group) {
                        var is_new = false,
                            option = new Object();
                        index++;
                        parse_group.replace(preg_attr, function (str0, k, val) {
                            if (k == 'text') {
                                attr_arr_all['text'] += dot_text + val;
                                dot_text = ',';
 
                            } else if (k == 'value') {
                                attr_arr_all['value'] += dot_value + val;
                                dot_value = ',';
 
                            }
                            option[k] = val;
                        });
 
                        if (!attr_arr_all['options'])
                            attr_arr_all['options'] = new Array();
                        attr_arr_all['options'].push(option);
                        //if(!option['checked']) option['checked'] = '';
                        var checked = option['checked'] != undefined ? 'checked="checked"' : '';
                        attr_arr_all['content'] += '<input type="checkbox" id="' + attr_arr_all['name'] + '_' + index + '" name="' + option['name'] + '" text="' + option['text'] + '"  value="' + option['value'] + '"  ' + checked + '/>' + option['text'] + '&nbsp;';
 
                        // if(is_new)
                        // {
                        //     var arr = new Object();
                        //     arr['name'] = option['name'];
                        //     arr['leipiplugins'] = attr_arr_all['leipiplugins'];
                        //     add_fields[option['name']] = arr;
 
                        // }
                        if (dir == "1") {
                            attr_arr_all['content'] += '<br/>';
                        }
 
                    });
                    if (dir == "1") {
                        var contentLength = attr_arr_all['content'].length;
                        attr_arr_all['content'] = attr_arr_all['content'].substr(0, contentLength - 5); //去掉最后的<br/>
                    }
                    attr_arr_all['content'] += '</span>';
 
                    //parse
                    template = template.replace(plugin, attr_arr_all['content']);
                    template = template.replace('{|-', '');
                    template = template.replace('-|}', '');
                    template_parse = template_parse.replace(plugin, '{' + name + '}');
                    template_parse = template_parse.replace('{|-', '');
                    template_parse = template_parse.replace('-|}', '');
                    template_data[pno] = attr_arr_all;
                    //checkboxs++;
 
                } else if (name) {
                    if (tag == 'radios') /*单选组  一个字段*/
                    {
                        plugin = p0;
                        plugin = plugin.replace('|-', '');
                        plugin = plugin.replace('-|', '');
                        attr_arr_all['value'] = '';
                        attr_arr_all['text'] = '';
                        var dataoptions = "";
                        if (attr_arr_all['dataoptions'] != undefined) {
                            dataoptions = attr_arr_all['dataoptions'];
                        }
                        attr_arr_all['content'] = '<span leipiplugins="radios" name="span_' + attr_arr_all['name']
                            + '" title="' + attr_arr_all['title'] + '" dataoptions="' + dataoptions + '">';
                        var dot = '';
                        var dottext = '';
                        var index = 0;
                        p5.replace(preg_group, function (parse_group) {
                            var option = new Object();
                            index++;
                            parse_group.replace(preg_attr, function (str0, k, val) {
                                if (k == 'value') {
                                    attr_arr_all['value'] += dot + val;
                                    dot = ',';
                                }
 
 
                                if (k == 'text') {
                                    attr_arr_all['text'] += dottext + val;
                                    dottext = ',';
                                }
                                option[k] = val;
                            });
                            option['name'] = attr_arr_all['name'];
                            if (!attr_arr_all['options'])
                                attr_arr_all['options'] = new Array();
                            attr_arr_all['options'].push(option);
                            //if(!option['checked']) option['checked'] = '';
                            var checked = option['checked'] != undefined ? 'checked="checked"' : '';
                            var itemdataoptions = "";
                            if (option['dataoptions'] != undefined) {
                                itemdataoptions = option['dataoptions'];
                            }
                            attr_arr_all['content'] += '<input type="radio" id="' + attr_arr_all['name'] + '_' + index + '" name="' + attr_arr_all['name'] + '" text="' + option['text'] + '" value="' + option['value'] + '" data-options="' + itemdataoptions + '"  ' + checked + '/>' + option['text'] + '&nbsp;';
                            if (dir == "1") {
                                attr_arr_all['content'] += '<br/>';
                            }
 
                        });
                        if (dir == "1") {
                            var contentLength = attr_arr_all['content'].length;
                            attr_arr_all['content'] = attr_arr_all['content'].substr(0, contentLength - 5);
                        }
                        attr_arr_all['content'] += '</span>';
 
                    } else {
 
                        //attr_arr_all['content'] = is_new ? plugin.replace(/leipiNewField/,name) : plugin;
                        var r2 = / *org[a-z]+="[^"]*"/g; //去掉org开头的属性
                        var temp_plugin = plugin.replace(r2, "");
                        attr_arr_all['content'] = temp_plugin;
                    }
                    //attr_arr_all['itemid'] = fields;
                    //attr_arr_all['tag'] = tag;
                    template = template.replace(plugin, attr_arr_all['content']);
                    template = template.replace('{|-', '');
                    template = template.replace('-|}', '');
                    template_parse = template_parse.replace(plugin, '{' + name + '}');
                    template_parse = template_parse.replace('{|-', '');
                    template_parse = template_parse.replace('-|}', '');
                    if (is_new) {
                        var arr = new Object();
                        arr['name'] = name;
                        arr['leipiplugins'] = attr_arr_all['leipiplugins'];
                        add_fields[arr['name']] = arr;
                    }
                    template_data[pno] = attr_arr_all;
                }
                pno++;
                //--------表单字段保存至后台---------
                if (columnName != null) {
                    if ("," + columnNames + ",".indexOf("," + columnName.columnName + ",") > -1) {
                        errorColumnNames += columnName.columnName + ",";
                    } else {
                        columnNames += columnName.columnName + ",";
                        var obj = $.extend({}, controlType, tableName, columnName, displayName, defaultValue, dataType, alignType, controlWidth, controlHeight,
                            fontSize, customStyleName, enableHidden, enableUnique, enableRequired, enableEditable, enableMultiselect,enableJoinParent,enableReturnIdType, enableStrong, outputFormat,
                            verifyFormat, sortMode, dataSourceType, dataSourceKeys, dataSourceSql, dataSourceKeywordId, dataSourceKeywordName, userSelectType,
                            uploadType, enableAutoUpload, allowUploadCount, targetTableName, targetTableId, targetModuleName, targetModuleId, contentFrom, returnFunctionName, localRelationColumnName,
                            targetRelationColumnName, filterSql, targetViewId, targetViewName, targetColumnNames, targetColumnTitles, localColumnNames, codingGetType, codingId, codingName,
                            expression, enableSaveDatabase, dateType, itemCount, saveSelectType, saveSelectNameField, pickRangeType, pickRangeId, pickRangeName, pickRangeColumn, listType, listHiddenParams, listCondition, listSubItemsJson, listDefaultRows);
                        objList.push(obj);
                    }
                }
            })
            number = 0;
 
            var parse_form = new Object({
                'fields': fields, //总字段数
                'template': template, //完整html
                'parse': template_parse, //控件替换为{data_1}的html
                'data': template_data, //控件属性
                'add_fields': add_fields //新增控件
            });
            return parse_form; //JSON.stringify(parse_form);
        },
        /*type  =  save 保存设计 versions 保存版本  close关闭 */
        fnCheckForm: function (type) {
            if (leipiEditor.queryCommandState('source'))
                leipiEditor.execCommand('source'); //切换到编辑模式才提交,否则有bug
 
            if (leipiEditor.hasContents()) {
                leipiEditor.sync(); /*同步内容*/
 
                //alert("你点击了保存,这里可以异步提交,请自行处理....");
                //return false;
                //--------------以下仅参考-----------------------------------------------------------------------------------------------------
                var type_value = '',
                    formid = 0,
                    fields = $("#fields").val(),
                    formeditor = '';
 
                if (typeof type !== 'undefined') {
                    type_value = type;
                }
                //获取表单设计器里的内容
                formeditor = leipiEditor.getContent();
                //解析表单设计器控件
                isSaveFormColumn = true;
 
                columnNames = "";
                errorColumnNames = "";
                objList = []; //清空数据
                var parse_form = this.parse_form(formeditor, fields);
 
                //--------------表单模板(用于设计表单时加载)、解析后的表单html-------------------------------------------------------------------
                if (formeditor.indexOf("<form") == -1 || formeditor.indexOf("formData") == -1) {
                    formeditor = "<form id=\"formData\">" + formeditor + "</form>";
                }
                var template = parse_form["template"];
                if (template.indexOf("<form") == -1 || template.indexOf("formData") == -1) {
                    template = "<form id=\"formData\">" + template + "</form>";
                }
                var obj = {
                    'formId': '${form.formId}',
                    'formContentHtml': template,
                    'formContentModel': formeditor
                };
 
                //if(errorColumnNames=="")
                //{
                //        wcp.notify.warn("存在多个字段:"+errorColumnNames+",请检查表单字段!");
                //}
                //---------------------------------------保存表单列-------------------------------------------------------------
                wcp.ajax({
                    type: 'POST',
                    contentType: "application/json; charset=utf-8",
                    url: "config/form/saveFormColumn?formId=${form.formId}&number=" + number,
                    dataType: 'json',
                    data: JSON.stringify(objList),
                    beforeSend: function (XMLHttpRequest) {
                        wcp.ui.setBusy();
                    }
                }).done(function (data) {
                    //保存
                    wcp.ajax({
                        url: "config/form/saveFormHtml",
                        data: JSON.stringify(obj),
                    }).done(function (result) {
                        wcp.ui.clearBusy();
                        wcp.notify.success("保存成功!");
                    }).fail(function (msg) {
                        console.log("error:" + msg);
                        wcp.ui.clearBusy();
                    });
                }).fail(function (msg) {
                    console.log("error:" + msg);
                    wcp.ui.clearBusy();
                })
            } else {
                wcp.notify.warn('表单内容不能为空!');
                return false;
            }
        },
        /*预览表单*/
        fnReview: function () {
            if (leipiEditor.queryCommandState('source'))
                leipiEditor.execCommand('source'); /*切换到编辑模式才提交,否则部分浏览器有bug*/
 
            if (leipiEditor.hasContents()) {
                leipiEditor.sync(); /*同步内容*/
 
                //  alert("你点击了预览,请自行处理....");
                // return false;
 
                //获取表单设计器里的内容
                formeditor = leipiEditor.getContent();
                //解析表单设计器控件
                isSaveFormColumn = false;
                var fields = $("#fields").val();
                var parse_form = this.parse_form(formeditor, fields);
                console.log(parse_form);
 
                win_parse = window.open('', '', "menubar=0,toolbar=0,status=0,resizable=1,left=0,top=0,scrollbars=1,width=" + (screen.availWidth - 10) + ",height=" + (screen.availHeight - 50) + "\"");
 
                win_parse.document.write(parse_form["template"]);
                win_parse.focus();
                return false;
 
                //--------------以下仅参考---------------------------------
 
 
                /*设计form的target 然后提交至一个新的窗口进行预览
                document.saveform.target="mywin";
                window.open('','mywin',"menubar=0,toolbar=0,status=0,resizable=1,left=0,top=0,scrollbars=1,width=" +(screen.availWidth-10) + ",height=" + (screen.availHeight-50) + "\"");
 
                document.saveform.action="/index.php?s=/index/preview.html";
                document.saveform.submit(); //提交表单
                */
            } else {
                wcp.notify.warn('表单内容不能为空!');
                return false;
            }
        }
    };
 
    //生成表单列json串
    var leipipluginsval = "";
 
    function setFormColumnJson(attr, val) {
        //alert(leipipluginsval);
        switch (attr) {
            case "leipiplugins":
                leipipluginsval = val;
                controlType = {
                    'controlType': val
                };
                break;
            case "name":
            case "orgname":
                //if(leipipluginsval=="checkboxs"||leipipluginsval=="radios"||leipipluginsval=="resource"||leipipluginsval=="select")
                //{
                columnName = {
                    'columnName': val
                };
                //}
                if (columnName == null) {
                    columnName = {
                        'columnName': val
                    };
                }
                break;
            case "orgtablename":
                tableName = {
                    'tableName': val
                };
                break;
            case "orgdisplayname":
            case "title":
                displayName = {
                    'displayName': val
                };
                if (displayName == null) {
                    displayName = {
                        'displayName': val
                    };
                }
                break;
            case "orgtargetmoduleid":
                targetModuleId = {
                    'targetModuleId': val
                };
                break;
            case "orgtargetmodulename":
                targetModuleName = {
                    'targetModuleName': val
                };
                break;
            case "orgtargettableid":
                targetTableId = {
                    'targetTableId': val
                };
                break;
            case "orgtargettablename":
                targetTableName = {
                    'targetTableName': val
                };
                break;
            case "orgvalue":
            case "orgdefaultvalue": //下拉菜单默认值,公式获取
                if (leipipluginsval == "formula") {
                    expression = {
                        'expression': val
                    };
                } else {
                    defaultValue = {
                        'defaultValue': val
                    };
                }
                break;
            case "orgedit":
                enableEditable = {
                    'enableEditable': val
                };
                break;
            case "orghide":
                enableHidden = {
                    'enableHidden': val
                };
                break;
            case "orgunique":
                enableUnique = {
                    'enableUnique': val
                };
                break;
            case "orgrequired":
                enableRequired = {
                    'enableRequired': val
                };
                break;
            case "orgmulti":
                enableMultiselect = {
                    'enableMultiselect': val
                };
                break;
            case "orgjoinparent":
                enableJoinParent = {
                    'enableJoinParent': val
                };
                break;
            case "orgreturnidtype":
                enableReturnIdType = {
                    'enableReturnIdType': val
                };
                break;
            case "orgdatasource":
                //if (leipipluginsval == "resource") {
                contentFrom = {
                    'contentFrom': val
                };
                dataSourceType = {
                    'dataSourceType': val
                };
 
                break;
            case "orgkeyvalue":
                dataSourceKeywordName = {
                    'dataSourceKeywordName': val
                };
                break;
            case "orgkeyid":
                dataSourceKeywordId = {
                    'dataSourceKeywordId': val
                };
                break;
            case "orgsql":
                if (leipipluginsval == "resource") {
                    filterSql = {
                        'filterSql': val
                    };
                } else {
                    dataSourceSql = {
                        'dataSourceSql': val
                    };
                }
                break;
            case "orgtype":
                if (leipipluginsval == "datetime") //日期控件
                {
                    dateType = {
                        'dateType': val
                    };
                } else if (leipipluginsval == "person") //人员选择控件
                {
                    userSelectType = {
                        'userSelectType': val
                    };
                } else if (leipipluginsval == "upload") //上传类型
                {
                    uploadType = {
                        'uploadType': val
                    };
                } else if (leipipluginsval == "serial") //流水号
                {
                    codingGetType = {
                        'codingGetType': val
                    };
                } else {
                    dataType = {
                        'dataType': val
                    };
                }
                break;
            case "orgfontsize":
                fontSize = {
                    'fontSize': val
                };
                break;
            case "orgcss":
                customStyleName = {
                    'customStyleName': val
                };
                break;
            case "orgalign":
                alignType = {
                    'alignType': val
                };
                break;
            case "orgheight":
                if (val != "") {
                    controlHeight = {
                        'controlHeight': val
                    };
                }
                break;
            case "orgwidth":
                controlWidth = {
                    'controlWidth': val
                };
                break;
            case "orgcss":
                customStyleName = {
                    'customStyleName': val
                };
                break;
            case "orgzz":
                verifyFormat = {
                    'verifyFormat': val
                };
                break;
            case "orgprintf":
                outputFormat = {
                    'outputFormat': val
                };
                break;
            case "orgitemdir":
                sortMode = {
                    'sortMode': val
                };
                break;
            case "orgrich":
                enableStrong = {
                    'enableStrong': val
                };
                break;
            case "orgautoupload":
                enableAutoUpload = {
                    'enableAutoUpload': val
                };
                break;
            case "orgnum":
                allowUploadCount = {
                    'allowUploadCount': val
                };
                break;
            case "orgnumber":
                codingId = {
                    'codingId': val
                };
                break;
            case "orgfunname":
                returnFunctionName = {
                    'returnFunctionName': val
                };
                break;
            case "orgsourcerelfield":
                localRelationColumnName = {
                    'localRelationColumnName': val
                };
                break;
            case "orgtargetrelfield":
                targetRelationColumnName = {
                    'targetRelationColumnName': val
                };
                break;
            case "orgtargetrelfield":
                targetRelationColumnName = {
                    'targetRelationColumnName': val
                };
                break;
            case "orgsourcefields":
                localColumnNames = {
                    'localColumnNames': val
                };
                break;
            case "orgtargetfields":
                targetColumnNames = {
                    'targetColumnNames': val
                };
                break;
            case "orgtargetfieldtitles":
                targetColumnTitles = {
                    'targetColumnTitles': val
                };
                break;
            case "title":
                if (leipipluginsval == "resource") {
                    displayName = {
                        'displayName': val
                    };
                }
                break;
            case "orgview":
                targetViewId = {
                    'targetViewId': val
                };
                break;
            case "orgsavedatabase":
                enableSaveDatabase = {
                    'enableSaveDatabase': val
                };
                break;
            case "orgitemdircount":
                itemCount = {
                    'itemCount': val
                };
                break;
            case "saveselecttype":
                saveSelectType = {
                    'saveSelectType': val
                };
                break;
            case "saveselectnamefield":
                saveSelectNameField = {
                    'saveSelectNameField': val
                };
                break;
            case "orgpickrangetype":
                pickRangeType = {
                    'pickRangeType': val
                };
                break;
            case "orgpickrangename":
                pickRangeName = {
                    'pickRangeName': val
                };
                break;
            case "orgpickrangecolumn":
                pickRangeColumn = {
                    'pickRangeColumn': val
                };
                break;
            case "orgpickrangeid":
                pickRangeId = {
                    'pickRangeId': val
                };
                break;
            case "orglisttype":
                listType = {
                    'listType': val
                };
                break;
            case "orghiddenparams":
                listHiddenParams = {
                    'listHiddenParams': val
                };
                break;
            case "orgcondition":
                listCondition = {
                    'listCondition': val
                };
                break;
            case "orgdefaultrows":
                listDefaultRows = {
                    'listDefaultRows': val
                };
                break;
            case "orgsubitems":
                listSubItemsJson = {
                    'listSubItemsJson': val
                };
        }
    }
</script>
<style>
    .edui-default .edui-bubble .edui-popup-content {
        background-color: #fff;
        border: 1px solid #d4d4d4;
        margin-top: 2px;
        padding: 6px 0 4px 6px;
    }
 
    .edui-default span.edui-clickable {
        margin-right: 6px;
        text-decoration: none;
    }
 
    .pt-color-success {
        color: #00a65a !important;
    }
 
    .pt-color-danger {
        color: #dd4b39 !important;
    }
 
    .edui-default .fa {
        margin-right: 4px;
    }
</style>
</body>
</html>