2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
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
<style type="text/css">
    td {
        border: 1px solid #ccc;
    }
 
    #tbGKList input {
        text-align: center;
        width: 100%;
        min-height: 30px;
    }
</style>
<input type="text" type="hidden" id="hidsharprotocol" name="hidsharprotocol" class="form-control col-sm-9" th:value="${resMainInfo.sharprotocol}" />
<form class="form-horizontal" id="mainform" method="post" xmlns:th="http://www.w3.org/1999/xhtml">
    <div class="portlet box ltblue">
        <div class="portlet-title">
            服务地址
            <div class="caption">
                <i class="fa fa-reorder"></i>
            </div>
            <div class="tools">
                <a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div style="width:100%;text-align: center;">
                <div style="text-align:center;height:40px;line-height:40px;font-size:15px;margin-top:5px;">
 
                </div>
                <table id="tbGKList" style="width:80%;margin:auto">
                    <tr style="text-align:center;height:30px;width:100%;background-color: transparent;color:#999;">
                        <td style="width:27%;background-color:#DDD;color:#666">地理参考信息</td>
                        <td style="width:47%;background-color:#DDD;color:#666">服务路径</td>
                        <td style="width:16%;background-color:#DDD;color:#666">操作
                            <!--<button id="btnAddNewRow" onclick="AddRow2();" type="button" class="btn ltblue" style="float:right;margin-right:10%;background-color: #3398fe !important;color:#fff;border-radius:0;">-->
                            <!--<i class="icon-plus"></i> 新增行-->
                            <!--</button>-->
                            <img id="tdOper" src="/image/Plus.gif" onclick="AddRow2()" style="cursor:pointer;"/>
                        </td>
                    </tr>
                    <tr th:each="resExtMapUrl:${resExtMapUrlList}">
                        <input name="urlid" type="hidden" th:value="${resExtMapUrl.urlid}" />
                        <td>
                            <select disabled="disabled" name="typeandurl" class="col-sm-12" style="border:none;padding:0.3rem 0.7rem;" onchange="DisabledOption()">
                                <option value=''>--请选择--</option>
                                <option th:each="item:${typeandurlList}" th:value="${item.key}" th:text="${item.value}" th:selected="(${resExtMapUrl.typeandurl}==${item.key})?'true':'false'"></option>
                            </select>
                        </td>
                        <td>
                            <input type="text" readonly="readonly" name="serverurl" class="m-warp span12" style="border:0px;" th:value="${resExtMapUrl.serverurl}" onblur="TextBlur(this)" onfocus="TextFocus(this)"/>
                        </td>
                        <td style="text-align:center;">
                            <img src="/image/edit.gif" alt="编辑" style="cursor:pointer;margin-top:2px;" onclick="showEditModal(this)" />
                            <img src="/image/wrong.gif" alt="删除" style="cursor:pointer;" onclick="DeleteRowData2(this)" />
                            <img src="/image/down.gif"  onclick="Downrow(this)" style="cursor:pointer;"/>
                            <img src="/image/up.gif" onclick="Uprow(this)" style="cursor:pointer;"/>
                            <a th:if="${resExtMapUrl.esbid}==null" name="esbbtn" style="cursor: pointer;vertical-align:sub;" onclick="showEsbAgent(this)"><span>注册</span></a>
                            <a th:if="${resExtMapUrl.esbid}!=null" style="cursor: pointer;vertical-align:sub;" onclick="showEsbAgent(this)"><span>更新</span></a>
                            <input type="hidden" name="esbid" th:value="${resExtMapUrl.esbid}"  />
                            <input type="hidden" name="oldserverurl" th:value="${resExtMapUrl.oldserverurl}"  />
                            <input type="hidden" name="hidcontextpath" th:value="${resExtMapUrl.contextpath}"  />
                            <input type="hidden" name="hidagentserverurl" th:value="${resExtMapUrl.agentserverurl}" />
                        </td>
                    </tr>
                    <tr th:if="${resExtMapUrlList.size()==0}">
                        <td>
                            <select name="typeandurl" class="form-control col-sm-12" style="border:none;padding:0.3rem 0.7rem;" onchange="DisabledOption()">
                                <option value=''>--请选择--</option>
                                <option th:each="item:${typeandurlList}" th:value="${item.key}" th:text="${item.value}"></option>
                            </select>
                        </td>
                        <td>
                            <input type="text" name="serverurl" class="m-warp span12" style="border:0px;" value="--" onblur="TextBlur(this)" onfocus="TextFocus(this)"/>
                        </td>
                        <td style="text-align:center;">
                            <img src="/image/wrong.gif" alt="删除" style="cursor:pointer;" onclick="DeleteRowData2(this)"/>
                            <img src="/image/down.gif" onclick="Downrow(this)" style="cursor:pointer;"/>
                            <img src="/image/up.gif" onclick="Uprow(this)" style="cursor:pointer;"/>
                        </td>
                    </tr>
                    <tr th:if="${resExtMapUrlList.size()==0}">
                        <td>
                            <select name="typeandurl" class="form-control col-sm-12" style="border:none;padding:0.3rem 0.7rem;" onchange="DisabledOption()">
                                <option value=''>--请选择--</option>
                                <option th:each="item:${typeandurlList}" th:value="${item.key}"
                                        th:text="${item.value}"></option>
                            </select>
                        </td>
                        <td>
                            <input type="text" name="serverurl" class="m-warp span12" style="border:0px;" value="--" onblur="TextBlur(this)" onfocus="TextFocus(this)"/>
                        </td>
                        <td style="text-align:center;">
                            <img src="/image/wrong.gif" alt="删除" style="cursor:pointer;" onclick="DeleteRowData2(this)"/>
                            <img src="/image/down.gif" onclick="Downrow(this)" style="cursor:pointer;"/>
                            <img src="/image/up.gif" onclick="Uprow(this)" style="cursor:pointer;"/>
                        </td>
                    </tr>
                    <tr th:if="${resExtMapUrlList.size()==0}">
                        <td>
                            <select name="typeandurl" class="form-control col-sm-12" style="border:none;padding:0.3rem 0.7rem;" onchange="DisabledOption()">
                                <option value=''>--请选择--</option>
                                <option th:each="item:${typeandurlList}" th:value="${item.key}" th:text="${item.value}"></option>
                            </select>
                        </td>
                        <td>
                            <input type="text" name="serverurl" class="m-warp span12" style="border:0px;" value="--" onblur="TextBlur(this)" onfocus="TextFocus(this)"/>
                        </td>
                        <td style="text-align:center;">
                            <img src="/image/wrong.gif" alt="删除" style="cursor:pointer;" onclick="DeleteRowData2(this)"/>
                            <img src="/image/down.gif" onclick="Downrow(this)" style="cursor:pointer;"/>
                            <img src="/image/up.gif" onclick="Uprow(this)" style="cursor:pointer;"/>
                        </td>
                    </tr>
                </table>
                <div style="height:20px;"></div>
            </div>
        </div>
    </div>
    <div class="portlet box ltblue">
        <div class="portlet-title">
            业务图层信息
            <div class="caption">
                <i class="fa fa-reorder"></i>
            </div>
            <div class="tools">
                <a class="collapse" onclick="portlet_body_ShowOrHide(this);"></a>
            </div>
        </div>
        <div class="portlet-body">
            <div class="row">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">发布平台<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <select id="publishsoft" name="publishsoft" class="form-control col-sm-9" required="">
                                <option value="">--请选择--</option>
                                <option th:each="item:${PublishSoftList}" th:value="${item.key}" th:text="${item.value}"
                                        th:selected="(${resExtBusinessLayer.publishsoft}==${item.key})?'true':'false'"></option>
                            </select>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">原图层名称</label>
                        <div class="controls input-icon">
                            <input th:value="${resExtBusinessLayer.layername}" id="layername" name="layername" type="text" class="form-control col-sm-9" maxchar="200"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">加载方式</label>
                        <div class="controls input-icon">
                            <select id="dataloadtype" name="dataloadtype" class="form-control col-sm-9">
                                <option value="">--请选择--</option>
                                <option th:selected="(${resExtBusinessLayer.dataloadtype}=='MODE_ONDEMAND')?'true':'false'" value="MODE_ONDEMAND">按需加载
                                </option>
                                <option th:selected="(${resExtBusinessLayer.dataloadtype}=='MODE_SNAPSHOT')?'true':'false'" value="MODE_SNAPSHOT">快照加载
                                </option>
                            </select>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" style="display: none">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">用户名</label>
                        <div class="controls input-icon">
                            <input type="text" id="username" name="username" class="form-control col-sm-9" th:value="${resMainInfo.username}" maxchar="50"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">密码</label>
                        <div class="controls input-icon">
                            <input type="text" id="password" name="password" type="password" class="form-control col-sm-9" th:value="${resMainInfo.password}" maxchar="50"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">是否代理<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <select type="text" id="espproxy" name="espproxy" class="form-control col-sm-9" required="">
                                <option value="">--请选择--</option>
                                <option th:selected="(${resMainInfo.espproxy}==0)?'true':'false'" value="0">否</option>
                                <option th:selected="(${resMainInfo.espproxy}==1)?'true':'false'" value="1">是</option>
                            </select>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6" style="display: none">
                    <div class="control-group">
                        <label class="control-label">TOKEN</label>
                        <div class="controls input-icon">
                            <input type="text" id="token" name="token" class="form-control col-sm-8" th:value="${resMainInfo.token}" style="width:65%"/>
                            <button type="button" class="btn btn-primary" onclick="getToken(0)" style="vertical-align: top;margin-left: 2px;"> 获取 </button>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" style="display: none">
                <div class="col-sm-6 expiration">
                 <div class="control-group">
                     <label class="control-label">token持续时间</label>
                     <div class="controls input-icon">
                         <input type="text" id="expiration" name="expiration" th:value="${resMainInfo.expiration}" class="form-control col-sm-9"  maxchar="50" />
                         <span class="input-warning tooltips" data-original-title="">
                             <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                         </span>
                     </div>
                 </div>
             </div>
 
         </div>
            <div class="row" style="display: none;">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">自定义高级查询</label>
                        <div class="controls input-icon">
                            <input th:value="${resExtBusinessLayer.advancequeryurl}" id="advancequeryurl" name="advancequeryurl" class="form-control col-sm-11" maxchar="500"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" style="display: none;">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">自定义查询列表</label>
                        <div class="controls input-icon">
                            <input th:value="${resExtBusinessLayer.diyqueryurl}" type="text" id="diyqueryurl" name="diyqueryurl" class="form-control col-sm-11" maxchar="500"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" style="display: none;">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">自定义气泡路径</label>
                        <div class="controls input-icon">
                            <input th:value="${resExtBusinessLayer.diybubbleurl}" id="diybubbleurl" name="diybubbleurl" class="form-control col-sm-11" maxchar="500"/>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="control-group">
                        <div class="controls input-icon">
                            <input type="button" class="btn btn-primary" value="关联图层设置" onclick="openGlWin()"/>
                            <input id="OpenZhouBian" type="button" class="btn btn-primary" value="周边查询设置" onclick="Openzhoubian()" style="margin-left: 1px;"/>
                            <input type="button" class="btn btn-primary" value="图表设置"  onclick="OpenServiceConfig()" style="margin-left: 1px;"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="zyjc" th:value="${resMainInfo.abbreviation}"/>
    <div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
        <div style="float: left;">
            <button class="btn btn-primary" id="addYeWuTuCengSave" type="button">
                <i class="fa fa-check"></i> 保存
            </button>
            <button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="YeWuTuCengDelete" type="button">
                <i class="fa fa-trash-o"></i> 删除
            </button>
            <button class="btn btn-warning" id="close" type="button" onclick="window.close()">
                <i class="fa fa-remove"></i> 关闭
            </button>
            <button th:if="${not #lists.isEmpty(resMainInfoId) and resMainInfo.auditstatus eq 2}"
                    class="btn btn-primary" id="copyRes" type="button" onclick="reflayerCopy()">
                <i class="fa fa-copy"></i> 复制
            </button>
        </div>
    </div>
</form>
<div id="resCopyInfo" style="display:none;padding:10px;">
    <div class="col-sm-10">
        <div class="control-group">
            <label class="control-label">资源名称:</label>
            <div class="controls input-icon">
                <input id="copyname" name="copyname" class="form-control col-sm-10" value="" maxchar="50"/>
                <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
            </div>
        </div>
    </div>
    <div class="col-sm-10">
        <div class="control-group">
            <label class="control-label">服务地址:</label>
            <div class="controls input-icon">
                <input id="copyurl" name="copyurl" class="form-control col-sm-10" value="" maxchar="500" />
                <span class="input-warning tooltips" data-original-title="">
                                <i class="fa-warning-sign" style="display: none;margin-left:30px;"></i>
                            </span>
            </div>
        </div>
    </div>
    <div style="margin-top:25px;float:right;">
        <button class="btn btn-primary" onclick="copyRes()" type="button">
            <i class="fa fa-check"></i> 保存
        </button>
        <button class="btn btn-warning" type="button" onclick="colseLayer()">
            <i class="fa fa-remove"></i> 关闭
        </button>
    </div>
</div>
<div id="resEditInfo" style="display:none;padding:10px;">
    <div class="col-sm-10">
        <div class="control-group">
            <label class="control-label">服务地址:</label>
            <div class="controls input-icon">
                <input id="newurl" name="newurl" class="form-control col-sm-12" value="" maxchar="500" />
            </div>
        </div>
    </div>
    <div style="margin-top:25px;float:right;">
        <button class="btn btn-primary" onclick="editUrl()" type="button">
            <i class="fa fa-check"></i> 保存
        </button>
        <button class="btn btn-warning" type="button" onclick="colseLayer()">
            <i class="fa fa-remove"></i> 关闭
        </button>
    </div>
    <input id="oldurl" type="hidden" />
    <input id="urlidhid" type="hidden" />
</div>
<div id="resEsbInfo" style="display:none;padding:10px;" xmlns:th="http://www.w3.org/1999/xhtml">
    <div class="col-sm-12">
        <div class="control-group" style="height: 55px;">
            <label class="control-label" style="padding-right:0;">上下文地址:<br />(全局唯—,必须以/开头)</label>
            <div class="controls input-icon">
                <input id="shangxiawenurl" name="shangxiawenurl" class="form-control col-sm-12" value=""/>
            </div>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="control-group">
            <label class="control-label" style="line-height:38px;">代理服务地址:</label>
            <div class="controls input-icon">
                <input id="fuwuurl" name="fuwuurl" class="form-control col-sm-12" />
            </div>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="control-group">
            <label class="control-label" style="line-height:38px;">TOKEN:</label>
            <div class="controls input-icon">
                <input id="fuwutoken" readonly="readonly" name="fuwutoken" class="form-control col-sm-12" th:value="${resMainInfo.token}" />
                
            </div>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="control-group">
            <label class="control-label" style="line-height:38px;">代理前资源路径:</label>
            <div class="controls input-icon">
                <input id="oldserverurl" name="oldserverurl" class="form-control col-sm-12" />
            </div>
        </div>
    </div>
    <div class="col-sm-12">
        <div class="control-group">
            <label class="control-label" style="line-height:38px;">代理后资源路径:</label>
            <div class="controls input-icon">
                <input id="dailihouurl" readonly="readonly" name="dailihouurl" class="form-control col-sm-12" />
            </div>
        </div>
    </div>
    <input type="hidden" id="hidesbid" />
    <div style="margin-top:25px;float:right;">
        <button class="btn btn-primary" name="esbAgentbtn" onclick="esbAgent()" type="button">
            <i class="fa fa-check"></i> 保存
        </button>
        <button class="btn btn-warning" type="button" onclick="colseLayer()">
            <i class="fa fa-remove"></i> 关闭
        </button>
    </div>
</div>
<script>
    //设置一些右边有按钮的文本框的宽度(让它们在不同分辨率下可以对齐,暂时使用JS实现,后面有时间再使用CSS实现) ccr add 2018-12-30
    function setInputWidthForBusinessLayer() {
        var sInputWidth = $("#publishsoft").width(); //获取参照文本框的宽度
        $("#token").width(sInputWidth - 63); //TOKEN
    }
 
    $(function () {
        cheackForm("mainform");
 
        //设置文本框宽度 ccr add 2018-12-30
        setInputWidthForBusinessLayer();
        //页面大小改变事件 ccr add 2018-12-30
        $(window).resize(function() {
            setTimeout("setInputWidthForBusinessLayer();", 500);
        });
    });
 
 
    function OpenServiceConfig() {
        var url = "/res/common/serviceconfig?resourceid=" + $("#resMainInfoId").val();
        // winPro.openFullwin(url,"图表设置","yes");
        openFullWindow(url, "图表设置");
    }
 
 
    function Openzhoubian() {
        var resMainInfoId = $("#resMainInfoId").val();
        var action = "周边查询"
        var url = "/res/common/resource_set_zbcx?resourceid=" + resMainInfoId;
        //window.open(url, '_blank', 'location=yes,scrollbars=yes,status=yes');
        layer.open({
            type: 2,
            title: '周边查询',
            id: 'zhoubian',
            shadeClose: true,
            shade: 0.7,
            maxmin: false, //开启最大化最小化按钮
            area: ['950px', '630px'],
            content: url
        });
    }
 
 
 
    //复制弹框
    function reflayerCopy() {
        //弹出一个页面层
        layer.open({
            type: 1,
            title: '复制',
            shadeClose: true,
            shade: false,
            maxmin: false, //开启最大化最小化按钮
            area: ['650px', '215px'],
            content: jQuery("#resCopyInfo")
        });
    }
 
    //关闭复制弹框
    function colseLayer() {
        $(".layui-layer-close1").click();
    }
 
    //打开关联图层设置窗口
    function openGlWin() {
        //window.open("../../common/resource_set_gltc?resourceid=" + $("#resMainInfoId").val(), "_blank", "modal=true");
 
        layer.open({
            type: 2,
            title: '关联图层',
            id: 'guanlian',
            shadeClose: true,
            shade: 0.7,
            maxmin: false, //开启最大化最小化按钮
            area: ['950px', '630px'],
            content: "../../common/resource_set_gltc?resourceid=" + $("#resMainInfoId").val()
        });
    }
</script>
<script th:inline="javascript">
    var removedOpts = [];
    /*<![CDATA[*/
    var typeandurlListJson = [[${typeandurlListJson}]];
    var typeandurlList = eval(typeandurlListJson);
    var typeandurladdrowlist = [];
    var esbHost = [[${esbHost}]];
    var esbUrl = [[${esbUrl}]];
    var oldesbids = [[${oldesbids}]];
    var newesbidList = [];
    var ipHost = [[${ipHost}]];
    var gisHost = [[${gisHost}]];
    var srHost = [[${srHost}]];
    var srUrl = [[${srUrl}]];
    /*]]>*/
 
    $(function () {
        DisabledOption();
    });
 
    /*<![CDATA[*/
    var resMainInfoId = $("#resMainInfoId").val();
 
    var admin = [[${admin}]];
    var auditstatus = [[${resMainInfo.auditstatus}]];
    $('#addYeWuTuCengSave').on('click', function () {
        //判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
        if(admin == true || auditstatus == 0 || auditstatus == null) {
            if ($('#mainform').valid()) {
                var str1 = "";
                var isCheckUrl = true;
                var regStr = /^(http|https):\/\/.+$/;
                var re = new RegExp(regStr);
                $("#tbGKList").find('tr').each(function (i, item) {
                    if (i != 0 && $(item).find("[name=typeandurl]").val() != "" && $(item).find("[name=serverurl]").val() != "" && $(item).find("[name=serverurl]").val() != "--") {
                        var typeandurl = $(item).find("[name=typeandurl]").val();
                        var serverurl = $(item).find("[name=serverurl]").val();
                        debugger;
                        var esbid = ($(item).find("[name=esbid]").val() != "" && $(item).find("[name=esbid]").val() != undefined) ? $(item).find("[name=esbid]").val() : 0;
                        if (isCheckUrl && !re.test(serverurl)) {
                            isCheckUrl = false;
                        }
                        if(esbid != 0){
                            newesbidList.push(esbid);
                        }
                        var oldserverurl = ($(item).find("[name=oldserverurl]").val() && $(item).find("[name=oldserverurl]").val() != undefined)
                            ?$(item).find("[name=oldserverurl]").val():""
                        str1 += typeandurl + "," + serverurl + "," + esbid + "," + oldserverurl + "|";
                    }
                });
                if (!isCheckUrl) {
                    alert("请输入正确的服务地址!");
                    return false;
                }
                //过滤esbid,删除不存在的esb服务
                selectNewEsbids();
                $('#mainform').ajaxSubmit({
                    url: '/res/ResExtBusinessLayer/insertSelectiveAndUpdate?resourceid=' + resMainInfoId,
                    type: 'post',
                    dataType: 'text',
                    data: {'extMapUrlStr': str1},
                    success: function (data) {
                        if (data == "1") {
                            alert("保存成功!");
                            reloadExt("ExtBusinessLayer");
                        } else {
                            alert("保存失败!");
                        }
                    },
                    error: function (e) {
                        alert(e.message);
                    }
                });
            } else {
                // alert("您输入的信息存在错误,请更正后再提交!");
            }
        }
        else {
            alert("注销后才可以对该资源进行修改!");
        }
    });
 
    //新增行
    function AddRow2() {
        debugger;
        typeandurladdrowlist.splice(0, typeandurladdrowlist.length);
        typeandurlList.forEach(function (item, i) {
            typeandurladdrowlist.push(item);
        });
     /*    $('#tbGKList').find('tr').each(function (i, item) {
            var optVal = $(item).find("[name=typeandurl]").val();
            if (i != 0 && optVal != "") {
                typeandurladdrowlist.forEach(function (item, i) {
                    if (item.key == optVal) {
                        typeandurladdrowlist.splice(i, 1);
                    }
                });
            }
        }); */
        var html = "<tr><td>" +
            // "<input type='text' name='typeandurl' class='m-warp span12' style='border:0px;' value='--' onblur='TextBlur(this)' onfocus='TextFocus(this)'/>" +
            "<select name='typeandurl' class='form-control col-sm-12' style='border:none;padding:0.3rem 0.7rem;' onchange='DisabledOption();'>" +
            "<option value=''>--请选择--</option>";
        typeandurladdrowlist.forEach(function (value, i) {
            html += "<option value='" + value.key + "'>" + value.value + "</option>";
        });
 
        html += "</select>" +
            "</td><td><input type='text' name='serverurl' class='m-warp span12' style='border:0px;' value='--' onblur='TextBlur(this)' onfocus='TextFocus(this)'/></td>"
            + "<td style='text-align:center;'>"
            + "<img src='" + "/image/wrong.gif" + "' alt='删除' style='cursor:pointer;' onclick='DeleteRowData2(this)' /><img src=\"/image/down.gif\"  onclick=\"Downrow(this)\" style=\"cursor:pointer;\"/>\n" +
            "                            <img src=\"/image/up.gif\" onclick=\"Uprow(this)\" style=\"cursor:pointer;\"/></td></tr>";
        $("#tbGKList").append(html);
    }
    /*]]>*/
 
    $("#YeWuTuCengDelete").click(function () {
        if (confirm("删除扩展信息,确定删除吗?")) {
            $.ajax({
                url: '/res/ResExtBusinessLayer/deleteByPrimaryKey?resourceid=' + resMainInfoId,
                type: 'post',
                dataType: 'json',
                data: {},
                success: function (data) {
                    if (data == "1") {
                        alert("删除成功!");
                        // parent.FTabPages.resetTab();
                        reloadExt("ExtBusinessLayer");
                    } else {
                        alert("删除失败!");
                    }
                },
                error: function (e) {
                    alert(e.message)
                }
            })
        }
    });
 
    //鼠标失去焦点事件
    function TextBlur(obj) {
        if (obj.value == '') {
            obj.value = '--';
            obj.style.color = '#999';
        }
    }
 
    //鼠标得到焦点事件
    function TextFocus(obj) {
        if (obj.value == '--') {
            obj.value = '';
            obj.style.color = '#000';
        }
    }
 
    /*<![CDATA[*/
    //删除协议与地址行数据
    function DeleteRowData2(obj) {
        var tbList = document.getElementById("tbGKList");
        var temRow = obj.parentNode.parentNode;
        var select = temRow.children[0].children[0];
        $('#tbGKList').find('tr').each(function (i, item) {
            if (i != 0 && $(select).val() != '') {
                $(item).find('[name=typeandurl]').append("<option value='" + $(select).val() + "'>" + $(select).find('option:selected').text() + "</option>");
            }
        });
        tbList.deleteRow(temRow.rowIndex);
    }
    /*]]>*/
 
    /*<![CDATA[*/
    function Downrow(obj) {
        var index = obj.parentElement.parentElement.rowIndex;
        var table = $("#tbGKList")[0];
        if (index < table.rows.length - 1 && index > 0) {
            switchRow(table, parseInt(index), parseInt(index) + 1);
        }
    }
 
    //向上移动
    function Uprow(obj) {
        var index = obj.parentElement.parentElement.rowIndex;
        var table = $("#tbGKList")[0];
        if (index > 1) {
            switchRow(table, parseInt(index), parseInt(index) - 1);
        }
    }
 
    // 两行交换
    function switchRow(table, frow, trow) {
        for (var i = 0; i < table.rows[0].cells.length; i++) {
            switch (i) {
                case 0:
                    var tempArray = [];
                    var fselect = table.rows[frow].cells[i].children[0];
                    for (var j = 0; j < fselect.options.length; j++) {
                        tempArray.push({value: fselect.options[j].value, text: fselect.options[j].text});
                    }
                    var selectedindex = fselect.selectedIndex;
                    var tselect = table.rows[trow].cells[i].children[0];
                    //清空下拉框选项
                    for (var j = fselect.options.length - 1; j >= 0; j--) {
                        fselect.options[j] = null;
                    }
                    //交换下拉框选项
                    for (var j = 0; j < tselect.options.length; j++) {
                        fselect.options.add(new Option(tselect.options[j].text, tselect.options[j].value));
                    }
                    fselect.selectedIndex = tselect.selectedIndex;
                    for (var j = tselect.options.length - 1; j >= 0; j--) {
                        tselect.options[j] = null;
                    }
                    tempArray.forEach(function (item, i, arr) {
                        tselect.options.add(new Option(item.text, item.value));
                    })
                    tselect.selectedIndex = selectedindex;
                    break;
                case 1:
                    var temp = "";
                    var ftext = table.rows[frow].cells[i].children[0];
                    var ttext = table.rows[trow].cells[i].children[0];
                    temp = ftext.value;
                    ftext.value = ttext.value;
                    ttext.value = temp;
                case 2:
                    var temp = "";
                    var ftext = $(table.rows[frow].cells[i]);
                    var ttext = $(table.rows[trow].cells[i]);
                    temp = ftext.html();
                    ftext.html(ttext.html());
                    ttext.html(temp);
            }
        }
    }
    /*]]>*/
 
    //复制
    function copyRes() {
        if ($("#copyname").val() == "") {
            alert("资源名称不能为空!");
            return false;
        }
        if($("#copyurl").val() == ""){
            alert("服务地址不能为空!");
            return false;
        }
        $.ajax({
            url: '/res/ZiYuan/copyMainInfoAndKZ',
            type: 'post',
            dataType: 'json',
            data: {
                "resourceid": resMainInfoId,
                "copyname": $("#copyname").val(),
                "copyurl": $("#copyurl").val(),
                "type": "ExtBusinessLayer"
            },
            success: function (data) {
                if (data != 0) {
                    alert("复制成功!")
                    parent.location.href = "/res/ResManage/ResRegister/ResEdit?resMainInfoId=" + data;
                }
            },
            error: function (e) {
                alert(e.message)
            }
        });
    }
    //弹出编辑服务地址
    function showEditModal(obj) {
        layer.open({
            type: 1,
            title: '修改服务地址',
            shadeClose: true,
            shade: false,
            maxmin: false, //开启最大化最小化按钮
            area: ['650px', '170px'],
            content: jQuery("#resEditInfo")
        });
        $("#newurl").val($(obj).parent().parent().find("[name=serverurl]").val());
        $("#oldurl").val($(obj).parent().parent().find("[name=serverurl]").val());
        $("#urlidhid").val($(obj).parent().parent().find("[name=urlid]").val());
        $(obj).parent().attr("urlid",$(obj).parent().parent().find("[name=urlid]").val());
    }
    //修改服务路径
    function editUrl(){
        var regStr = /^(http|https):\/\/.+$/;
        if($("#newurl").val() == ""){
            alert("服务地址不能为空!");
            return false;
        }
        var re = new RegExp(regStr);
        if(!re.test($("#newurl").val())){
            alert("请输入正确的服务地址!");
            return false;
        }
        updateServerUrl(1,'');
    }
    //更新服务地址
    function updateServerUrl(isUpdateDiy,dailihouurl,esbid){
        $.ajax({
            url: '/res/ResExtMapUrl/updateUrlByPrimaryKey',
            type: 'post',
            dataType: 'text',
            data: {
                'urlid': $("#urlidhid").val(),
                'oldurl':$("#oldurl").val(),
                'serverurl':isUpdateDiy == 1 ? $("#newurl").val() : dailihouurl,
                'resourceid':$("#resMainInfoId").val(),
                'isUpdateDiy':isUpdateDiy,
                'esbid':(esbid!=undefined && esbid >0)?esbid:"",
                'oldserverurl':$("#oldserverurl").val(),
                'contextpath':$("#shangxiawenurl").val(),
                'agentserverurl':$("#fuwuurl").val()
            },
            success: function (data) {
                var json = eval('(' + data + ')');
                if (json.result == "1") {
                    alert(($("#hidesbid").val() != "" || isUpdateDiy == 1)?"更新成功":"注册成功");
                    $("[name=esbAgentbtn]").hide();
                    if(isUpdateDiy == 0){
                        $("#dailihouurl").val(dailihouurl);
                    }else{
                        colseLayer();
                    }
                    var newurl = isUpdateDiy == 1 ? $("#newurl").val() : dailihouurl;
                    $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").prev().find("[name=serverurl]").val(newurl);
                    if(esbid != undefined && esbid >0){
                        $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=esbid]").val(esbid);
                        $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=esbbtn]").text("更新");
                        $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=oldserverurl]").val($("#oldserverurl").val());
                        $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=hidagentserverurl]").val($("#fuwuurl").val());
                        $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=hidcontextpath]").val($("#shangxiawenurl").val());
                        if($("#hidesbid").val() == ""){
                            oldesbids += (oldesbids != null && oldesbids != "") ? (","+esbid):esbid;
                            $("#tbGKList").find("td[urlid="+$("#urlidhid").val()+"]").find("[name=oldserverurl]").val($("#oldserverurl").val());
                        }
                    }
                } else {
                    alert(text+"失败!");
                }
            },
            error: function (e) {
                console.log(e.message);
            }
        });
    }
</script>