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
<form class="form-horizontal" id="ywjcform" 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 class="row">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">服务地址<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <!--th:value="${Res_ExtIntegrate.serverurl}"-->
                            <input  style="width:89%" id="serverurl" name="serverurl" class="form-control col-sm-11"  required="" 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-6">
                    <div class="control-group">
                        <label class="control-label">集成类型<span style="color: red;">*</span></label>
                        <div class="controls input-icon">
                            <select id="integratetype" name="integratetype" class="form-control col-sm-9" onchange="Change(this);" required="">
                                <option value="">-- 请选择 --</option>
                                <option th:selected="(${Res_ExtIntegrate.integratetype}=='页面集成')?'true':'false'"  value="页面集成">页面集成</option>
                                <option th:selected="(${Res_ExtIntegrate.integratetype}=='数据集成')?'true':'false'"  value="数据集成">数据集成</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" name="YeMianJiChengMode" style="display: none;">
                    <div class="control-group">
                        <div class="control-group">
                            <label class="control-label">页面展示模式</label>
                            <div class="controls input-icon">
                                <select id="showmodel" name="showmodel" class="form-control col-sm-9">
                                    <option value="">-- 请选择 --</option>
                                    <option th:selected="(${Res_ExtIntegrate.showmodel}=='Iframe区块')?'true':'false'"  value="Iframe区块">Iframe区块</option>
                                    <option th:selected="(${Res_ExtIntegrate.showmodel}=='侧边栏')?'true':'false'"  value="侧边栏">侧边栏</option>
                                    <option th:selected="(${Res_ExtIntegrate.showmodel}=='弹出页面')?'true':'false'"  value="弹出页面">弹出页面</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="col-sm-6" name="YeMianJiChengMode" style="display: none;">
                    <div class="control-group">
                        <label class="control-label">分辨率(宽X高)</label>
                        <div class="controls input-icon">
                            <input id="resolutionBen" style="width: 36.12%;" name="resolutionBen" th:value="${resolutionBen}" class="form-control" value="" olnynum="true" maxchar="11" />
                            X
                            <input id="resolutionEnd" style="width: 36.12%;" name="resolutionEnd" th:value="${resolutionEnd}" class="form-control" value="" olnynum="true" maxchar="11" />
                            <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-12" name="YeMianJiChengMode" style="display: none;">
                    <div class="control-group">
                        <label class="control-label"></label>
                        <div class="controls input-icon">
                            <span style="color:red;">建议分辨率(平台门户面板):宽度为 321、652、983、1314 像素,高度为 200、442 像素</span>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6" name="ShuJuJiCheng" style="display: none;">
                    <div class="control-group">
                        <label class="control-label">关联业务图层</label>
                        <div class="controls input-icon">
                            <input th:value="${Res_ExtIntegrate.reflayerid}" type="hidden" id="reflayerid" name="reflayerid" />
                            <input th:value="${reflayername}" type="text" id="reflayername" name="reflayername" readonly="readonly" class="form-control col-sm-7" />
                            <!--<a class="btn" style="background-color: #e5e5e5;vertical-align:baseline !important;color: black;" title='选择关联业务图层' id="btnSelectGlbzt" onclick="reflayer();">...</a>-->
                            <button type="button" class="btn btn-primary" id="btnSelectGlbzt" onclick="reflayer();" style="vertical-align:baseline;">设置</button>
                            <button type="button" class="btn btn-primary" onclick="javascript:$('#reflayerid').val('');$('#reflayername').val('');" style="vertical-align:baseline;">清除</button>
                            <span class="input-warning tooltips" data-original-title="">
                                <i class="icon-warning-sign" style="display: none;margin-left:34px"></i>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" name="ShuJuJiCheng" style="display: none;">
                <!--<div class="col-sm-6">-->
                    <!--<div class="control-group">-->
                        <!--<label class="control-label">JSON关联字段</label>-->
                        <!--<div class="controls input-icon">-->
                            <!--&lt;!&ndash;<input th:value="${Res_ExtIntegrate.jsonreffield}" id="jsonreffield" name="jsonreffield" type="text" class="form-control col-sm-9" />&ndash;&gt;-->
                            <!--<select id="jsonreffield" name="jsonreffield" class="form-control col-sm-9">-->
                                <!--<option value="">&#45;&#45; 请选择 &#45;&#45;</option>-->
                            <!--</select>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</div>-->
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">地图设置</label>
                        <div class="controls input-icon">
                            <input type="hidden" th:value="${Res_ExtIntegrate.refbasemapid}" id="refbasemapid" name="refbasemapid" />
                            <input th:value="${baseMapLayerName}" id="baseMapLayerName" name="baseMapLayerName" type="text" class="form-control col-sm-7" disabled="disabled" style="padding: 0.3rem 0.7rem;" />
                            <button type="button" class="btn btn-primary" onclick="sheZhi();" style="vertical-align:baseline;">设置</button>
                            <button type="button" class="btn btn-primary" onclick="diTuClear();" style="vertical-align:baseline;">清除</button>
                        </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="${Res_ExtIntegrate.reflayerfield}"  id="reflayerfield" name="reflayerfield" type="text" class="form-control col-sm-9" />-->
                            <select id="reflayerfield" name="reflayerfield" class="form-control col-sm-9">
                                <option value="">-- 请选择 --</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row" name="ShuJuJiCheng" style="display: none;">
 
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">渲染方式</label>
                        <div class="controls input-icon">
                            <select id="rendermode" name="rendermode" class="form-control col-sm-9">
                                <option value="">-- 请选择 --</option>
                                <option th:selected="(${Res_ExtIntegrate.rendermode}=='统计图')?'true':'false'"  value="统计图">统计图</option>
                                <option th:selected="(${Res_ExtIntegrate.rendermode}=='统计表')?'true':'false'"  value="统计表">统计表</option>
                                <option th:selected="(${Res_ExtIntegrate.rendermode}=='图层渲染')?'true':'false'"  value="图层渲染">图层渲染</option>
                                <option th:selected="(${Res_ExtIntegrate.rendermode}=='图层标注')?'true':'false'"  value="图层标注">图层标注</option>
                            </select>
                            <!--<button class="btn btn-primary" id="setChartBtn" onclick="setChartModal();" style="vertical-align:baseline;height: 34px;display:none;" type="button">设置</button>-->
                            <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">
                            <textarea th:text="${Res_ExtIntegrate.layerjosnclass}" id="layerjosnclass" name="layerjosnclass" class="form-control col-sm-11" rows="3" cols="70" style="height: 70px;" ></textarea>
                        </div>
                    </div>
                </div>
            </div>
 
 
            <div class="row TongJiTu">
                <div class="col-sm-6">
                    <div class="control-group">
                        <label class="control-label">宽</label>
                        <div class="controls">
                            <input th:value="${Res_ExtIntegrate.chartwidth}" type="text" disabled="true" id="chartwidth1" class="form-control col-sm-9" maxchar="11"/>
                            <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 th:value="${Res_ExtIntegrate.chartheight}" type="text" disabled="true" id="chartheight1" class="form-control col-sm-9" maxchar="11" />
                            <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 TongJiTu">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">模型</label>
                        <div class="controls">
                            <textarea th:text="${Res_ExtIntegrate.chartmodel}" disabled="true" id="chartmodel1" class="form-control col-sm-11"
                                      style="height: 285px;width: 89%;"></textarea>
                            <br /><br /><button class="btn btn-primary" id="setChartBtn" onclick="setChartModal();"style="vertical-align:baseline;height: 34px;display:none;" type="button">统计图风格配置
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
        <div style="float: left;">
            <button class="btn btn-primary" id="addYWJCSave" type="button">
                <i class="fa fa-check"></i> 保存
            </button>
            <button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="YWJCDelete" type="button">
                <i class="fa fa-trash-o"></i> 删除
            </button>
            <button class="btn btn-warning" 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 style="display: none;" id="setChartDiv">
    <form class="form-horizontal" id="modalform">
        <div class="modal-body" id="modalBody" style="overflow-y:auto;">
            <div class="row">
                <div class="control-group">
                    <div style="float: left;width: 50px;text-align: center;line-height: 35px;">
                        <label>宽</label>
                    </div>
                    <div style="float: left;width: 540px;">
                        <input type="text" id="chartwidth" name="chartwidth" class="form-control col-sm-11" olnynum="true"/>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="control-group">
                    <div style="float: left;width: 50px;text-align: center;line-height: 35px;">
                        <label>高</label>
                    </div>
                    <div style="float: left;width: 540px;">
                        <input type="text" id="chartheight" name="chartheight" class="form-control col-sm-11" olnynum="true" >
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="control-group">
                    <div style="float: left;width: 50px;text-align: center;line-height: 35px;">
                        <label>模型</label>
                    </div>
                    <div style="float: left;width: 540px;">
                        <textarea id="chartmodel" name="chartmodel" class="form-control col-sm-11" rows="6" style="height: 285px;"></textarea>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button type="button"  class="btn btn-primary" onclick="saveSetChart()">
                确定
            </button>
            <button type="button" onclick="closeLayer()" class="btn btn-default" >
                关闭
            </button>
        </div>
    </form>
</div>
<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" />
            </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" id="close" type="button" onclick="colseLayer()">
             <i class="fa fa-remove"></i> 关闭
         </button>
    </div>
</div>
<script th:inline="javascript">
    $(function () {
        var isSetChart = [[${isSetChart}]];
        var serverUrl = [[${serverUrl}]];
        cheackForm("ywjcform");
        /*<![CDATA[*/
        var integratetype = [[${Res_ExtIntegrate.integratetype}]];
        if (integratetype == "页面集成") {
            $('div[name=YeMianJiChengMode]').css('display', '');
            $('div[name=ShuJuJiCheng]').css('display', 'none');
            $(".TongJiTu").hide();
        } else if (integratetype == "数据集成") {
            $('div[name=YeMianJiChengMode]').css('display', 'none');
            $('div[name=ShuJuJiCheng]').css('display', '');
        }
 
        var reflayerid = $("#reflayerid").val();
        var reflayerfield = [[${Res_ExtIntegrate.Reflayerfield}]];
        if(reflayerid != "") {
            getGLTCFiled(reflayerid, reflayerfield);
        }
        /*]]>*/
        $("#rendermode").change(function(){
            if(serverUrl != "") {
                if ($(this).val() == "统计图") {
                    $("#setChartBtn").show();
                    // showChartMoal();
                    $(".TongJiTu").show();
                } else {
                    $("#setChartBtn").hide();
                    $(".TongJiTu").hide();
                }
            }
        });
        if(isSetChart == '1'){
            $("#setChartBtn").show();
        }
        else {
            $(".TongJiTu").hide();
        }
        $("#serverurl").val(decodeURI(serverUrl));
    });
 
    //显示模型信息
    function showChartMoal() {
        if ($("#serverurl").val() == '') {
            return false;
        }
        $(".TongJiTu").show();
        $.ajax({
            url: '/res/resExtIntegrate/getChartInfo',
            type: 'GET',
            dataType: 'text',
            data: {
                resourceid: resMainInfoId,
                serverurl: $("#serverurl").val()
            },
            timeout: 5000,
            cache: false,
            success: function (urlResult) {
                var urlList = eval("(" + urlResult + ")");
                if (urlList != null) {
                    $("#chartwidth1").val(urlList.width != null ? urlList.width : "");
                    $("#chartheight1").val(urlList.height != null ? urlList.height : "");
                    $("#chartmodel1").val(urlList.model != null ? JSON.stringify(urlList.model) : "");
                }
            },
            error: function (e) {
                console.log(e)
            }
        })
    }
 
    //底图设置弹框
    function sheZhi() {
        //弹出一个页面层
        layer.open({
            type: 2,
            title: '地图设置',
            shadeClose: true,
            shade: false,
            maxmin: false, //开启最大化最小化按钮
            area: ['600px', '500px'],
            content: 'BaseMapSelect?isNotOnlyBaseMap=yes'
        });
    }
 
    //关联业务图层弹框
    function reflayer() {
        //弹出一个页面层
        layer.open({
            type: 2,
            title: '关联业务图层',
            shadeClose: true,
            shade: false,
            maxmin: false, //开启最大化最小化按钮
            area: ['600px', '500px'],
            content: 'BusinessLayerSelect'
        });
    }
    
    function diTuClear() {
        $("#refbasemapid").val("");
        $("#baseMapLayerName").val("");
    }
    
      //复制弹框
    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 getGLTCFiled(id, reflayerfield) {
        $.ajax({
            url: "/res/resExtIntegrate/getGLTCFiled?ResourceId=" + id,
            type: 'get',
            success: function(result) {
                var data = eval(result);
                var optionList = "<option value=''>-- 请选择 --</option>";
                for(var i = 0; i < data.length; i++) {
                    if(reflayerfield != "" && reflayerfield == data[i].name) {
                        optionList += "<option value='" + data[i].name + "' selected>" + data[i].alias + "</option>";
                    } else {
                        optionList += "<option value='" + data[i].name + "'>" + data[i].alias + "</option>";
                    }
                }
                $("#reflayerfield").html(optionList);
            },
            error: function(e) {
                alert(e.message);
            }
        });
    }
</script>
<script th:inline="javascript">
    var resMainInfoId = $("#resMainInfoId").val();
 
    var admin = [[${admin}]];
    var auditstatus = [[${resMainInfo.auditstatus}]];
    $('#addYWJCSave').on('click', function() {
        //判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
        if(admin == true || auditstatus == 0 || auditstatus == null) {
            if ($('#ywjcform').valid()) {
                var rdata = {};
                //页面集成-校验分辨率
                if ($("#integratetype").val() == "页面集成") {
                    var resolution = "";
                    if ($("#resolutionBen").val() != "" && $("#resolutionEnd").val() == "") {
                        alert("请填写完整的分辨率!");
                        return false;
                    }
                    if ($("#resolutionEnd").val() != "" && $("#resolutionBen").val() == "") {
                        alert("请填写完整的分辨率!");
                        return false;
                    }
                    if ($("#resolutionEnd").val() != "" && $("#resolutionBen").val() != "") {
                        resolution = $("#resolutionBen").val() + "X" + $("#resolutionEnd").val();
                    }
                    rdata = {
                        resolution: resolution
                    };
                }
                var url = $("#serverurl").val();
                if (url != '' && url.indexOf('?') != -1) {
                    var first = url.substring(0, url.indexOf('?'));
                    var end = url.substring(url.indexOf('?'), url.length);
                    $("#serverurl").val(first + encodeURI(end));
                }
                $('#ywjcform').ajaxSubmit({
                    url: '/res/resExtIntegrate/insertSelectiveAndUpdate?resourceid=' + resMainInfoId,
                    type: 'post',
                    dataType: 'text',
                    data: rdata,
                    success: function (data) {
                        $("#serverurl").val(url);
                        if (data == "1") {
                            alert("保存成功!");
                            // parent.FTabPages.resetTab();
                            reloadExt("ExtIntegrate");
                        }
                        else {
                            alert("保存失败!");
                        }
                    },
                    error: function (e) {
                        alert(e.message);
                    }
                });
            } else {
                // alert("您输入的信息存在错误,请更正后再提交!");
            }
        }
        else {
            alert("注销后才可以对该资源进行修改!");
        }
    });
 
    $("#YWJCDelete").click(function() {
        if(confirm("删除扩展信息,确定删除吗?")){
            $.ajax({
                url: '/res/resExtIntegrate/deleteByPrimaryKey?resourceid=' + resMainInfoId,
                type: 'post',
                dataType: 'json',
                data: {},
                success: function (data) {
                    if (data == "1") {
                        alert("删除成功!");
                        // parent.FTabPages.resetTab();
                        reloadExt("ExtIntegrate");
                    }
                    else {
                        alert("删除失败!");
                    }
                },
                error: function (e) {
                    alert(e.message)
                }
            });
        }
    });
 
    /*<![CDATA[*/
    //集成类型切换
    function Change(obj) {
        if ($(obj).val() == "页面集成") {
            $('div[name=YeMianJiChengMode]').css('display', '');
            $('div[name=ShuJuJiCheng]').css('display', 'none');
            $(".TongJiTu").hide();
        } else if ($(obj).val() == "数据集成") {
            $('div[name=YeMianJiChengMode]').css('display', 'none');
            $('div[name=ShuJuJiCheng]').css('display', '');
        }
    }
    /*]]>*/
    
    //复制
    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":"ExtIntegrate"
             },
             success: function (data) {
                 if(data != 0){
                     alert("复制成功!")
                     parent.location.href = "/res/ResManage/ResRegister/ResEdit?resMainInfoId=" + data;
                 }
             },
             error: function (e) {
                 alert(e.message)
             }
         });
    }
 
    //打开设置模型
    function setChartModal(){
        if($("#serverurl").val() == ''){
            alert("请填写服务地址再设置!");
            return false;
        }
        $.ajax({
            url:'/res/resExtIntegrate/getChartInfo',
            type:'GET',
            dataType:'text',
            data:{
                resourceid:resMainInfoId,
                serverurl:$("#serverurl").val()
            },
            timeout:5000,
            cache:false,
            success:function (urlResult) {
                if(urlResult!=null){
                    layer.open({
                        type: 1,
                        title: '模型设置',
                        shadeClose: false,
                        area: ['600px', '550px'],
                        content: jQuery("#setChartDiv")
                    });
                    var urlList = eval("("+urlResult+")");
                    if(urlList != null){
                        $("#chartwidth").val(urlList.width != null ? urlList.width :"");
                        $("#chartheight").val(urlList.height != null ? urlList.height :"");
                        $("#chartmodel").val(urlList.model != null ? JSON.stringify(urlList.model):"");
                    }
                }
            },
            error:function (e) {
                console.log(e)
            }
        })
    }
 
    //保存模型
    function saveSetChart(){
        validNum($("#chartwidth").val());
        validNum($("#chartheight").val());
        $('#modalform').ajaxSubmit({
            url: '/res/resExtIntegrate/updateChartInfo',
            type: 'post',
            dataType: 'json',
            data: {'resourceid':resMainInfoId},
            success: function (data) {
                if(data == "1") {
                    alert("保存成功!");
                    closeLayer();
                } else  {
                    alert("保存失败!");
                }
            },
            error: function (e) {
                alert(e.message);
            }
        });
    }
 
    //关闭Layer
    function closeLayer(){
        $(".layui-layer-close1").click();
        showChartMoal();
    }
 
    //验证数字
    function validNum(str){
        if(str != null && str != ''){
            var reg = new RegExp("^[0-9]*$");
            if(!reg.test(str)){
                alert("请输入数字!");
                return false;
            }
        }
    }
</script>