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
<form class="form-horizontal" id="swmxform" method="post" xmlns:th="http://www.w3.org/1999/xhtml">
    <div class="portlet box ltblue">
        <div class="portlet-title">
            <!--//alert ykm 2019/02/25-->
            <span th:text="${resourcename}"></span>信息
            <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">服务地址</label>
                        <div class="controls input-icon">
                            <input th:value="${resExt3d.serverurl}" id="serverurl" name="serverurl" class="form-control col-sm-10" style="width:83%"/>
                            <button type="button" class="btn btn-primary" style="vertical-align: baseline;" onclick="openDialog('filepath')">
                                <i class="fa fa-upload"></i> 上传
                            </button>
                            <input type="file" id="filepath" name="filepath" style="display: none;"/>
                        </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">
                            <input  th:value="${resExt3d.servertype}" id="servertype" name="servertype" class="form-control col-sm-9" maxchar="30"/>
                            <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="${resExt3d.layername}"  id="layername" name="layername" class="form-control col-sm-9" maxchar="100"/>
                            <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" style="display: none">
                <div class="col-sm-6">
                    <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%"/>
                            <!--<a class="btn btn-primary" onclick="getToken(1)" style="vertical-align:baseline;padding: 0.375rem 0.65rem; width:9%;">获取</a>-->
                            <button type="button" class="btn btn-primary" onclick="getToken(1)" style="vertical-align: top;margin-left: 2px;"> 获取 </button>
                        </div>
                    </div>
                </div>
 
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="control-group">
                        <label class="control-label">扩展属性</label>
                        <div class="controls input-icon">
                            <textarea th:text="${resExt3d.extattribute}" id="extattribute" name="extattribute" type="text" class="form-control col-sm-11" rows="3" cols="20" style="height: 100px;" maxchar="500"></textarea>
                            <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>
    </div>
    <div class="form-actions navbar-fixed-bottom" style="z-index: 0;">
        <div style="float: left;">
            <button class="btn btn-primary" id="addSWMXSave" type="button">
                <i class="fa fa-check"></i> 保存
            </button>
            <button th:if="${not #lists.isEmpty(resMainInfoId)}" class="btn btn-danger" id="SWMXDelete" 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="100" />
                <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" id="close" type="button" onclick="colseLayer()">
             <i class="fa fa-remove"></i> 关闭
         </button>
    </div>
</div>
 
<script>
    //设置一些右边有按钮的文本框的宽度(让它们在不同分辨率下可以对齐,暂时使用JS实现,后面有时间再使用CSS实现) ccr add 2018-12-30
    function setInputWidthFor3D() {
        var sInputWidth = $("#servertype").width(); //获取参照文本框的宽度
        $("#token").width(sInputWidth - 63); //TOKEN
    }
 
    $(function () {
        cheackForm("swmxform");
 
        //设置文本框宽度 ccr add 2018-12-30
        setInputWidthFor3D();
        //页面大小改变事件 ccr add 2018-12-30
        $(window).resize(function() {
            setTimeout("setInputWidthFor3D();", 500);
        });
    });
    //复制弹框
    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();
    }
</script>
<script th:inline="javascript">
    var resMainInfoId = $("#resMainInfoId").val();
    var admin = [[${admin}]];
    var auditstatus = [[${resMainInfo.auditstatus}]];
    var ipHost = [[${ipHost}]];
    var gisHost = [[${gisHost}]];
    $('#addSWMXSave').on('click', function() {
        //判断当前用户是否是管理员,是管理员或是未提交的资源才可以修改资源相关信息
        if(admin == true || auditstatus == 0 || auditstatus == null) {
            if ($('#swmxform').valid()) {
                $('#swmxform').ajaxSubmit({
                    url: '/res/resExt3D/insertSelectiveAndUpdate?resourceid=' + resMainInfoId,
                    type: 'post',
                    dataType: 'text',
                    data: {},
                    success: function (data) {
                        if (data == "1") {
                            alert("保存成功!");
                            // parent.FTabPages.resetTab();
                            reloadExt("Ext3D");
                        }
                        else {
                            alert("保存失败!");
                        }
                    },
                    error: function (e) {
                        alert(e.message);
                    }
                });
            }
            else {
                // alert("您输入的信息存在错误,请更正后再提交!");
            }
        }
        else {
            alert("注销后才可以对该资源进行修改!");
        }
    });
    $("#SWMXDelete").click(function() {
        if(confirm("删除扩展信息,确定删除吗?")) {
            $.ajax({
                url: '/res/resExt3D/deleteByPrimaryKey?resourceid=' + resMainInfoId,
                type: 'post',
                dataType: 'json',
                data: {},
                success: function (data) {
                    if (data == "1") {
                        alert("删除成功!");
                        // parent.FTabPages.resetTab();
                        reloadExt("Ext3D");
                    }
                    else {
                        alert("删除失败!");
                    }
                },
                error: function (e) {
                    alert(e.message)
                }
            });
        }
    });
 
    function openDialog(id){
        document.getElementById(id).click();
        if(document.getElementById(id).value!='') {
            var formdata = new FormData();
            formdata.append('file', $('#filepath')[0].files[0]);
            $.ajax({
                url: "/res/resExt3D/fileUpload3D",
                type: "POST",
                data: formdata,
                cache: false,
                async: false,
                processData: false,  // 告诉jQuery不要去处理发送的数据
                contentType: false,  // 告诉jQuery不要去设置Content-Type请求头
                success: function (data) {
                    var json=eval('('+data+')');
                    if (json.result == '0') {
                        alert("上传失败");
                    }
                    else{
                        $('#servertype').val(json.FileType);
                        $('#serverurl').val(json.Path);
                        $('#layername').val(json.Filename);
                        alert("上传成功");
                    }
                }
            });
        }
    }
    
  //复制
    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":"Ext3D"
             },
             success: function (data) {
                 if(data != 0){
                     alert("复制成功!")
                     parent.location.href = "/res/ResManage/ResRegister/ResEdit?resMainInfoId=" + data;
                 }
             },
             error: function (e) {
                 alert(e.message)
             }
         });
    }
</script>