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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:layout="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" layout:decorator="MasterPage/Layout.Empty">
<head>
    <meta charset="UTF-8" />
    <title>资源新增或修改</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport" />
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/css/portlet.css'}" />
    <link th:href="@{${pubzyWebRoot} + 'ext-4.2.1.883/resources/css/ext-all-neptune.css'}" rel="stylesheet" type="text/css" />
    <link th:href="@{${pubzyWebRoot} + 'zTree/css/metroStyle/metroStyle.css'}" rel="stylesheet" type="text/css" />
    <link href="/js/jqUI/jquery-ui.min.css"  rel="stylesheet" type="text/css" />
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/portlet/portlet.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/ext-all.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/locale/ext-lang-zh_CN.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'ext-4.2.1.883/PagingToolbar.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'media/js/jquery.form-3.51.0.js'}"></script>
 
    <script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.all.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.core.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.exedit.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.excheck.js'}"></script>
    <script src="/js/jqUI/jquery-ui.min.js"></script>
    <style type="text/css">
        body {
            padding: 0;
            background-color: white !important;
            box-sizing: border-box;
            overflow-x: hidden;
        }
        .form-control {
            padding: 0.3rem 0.7rem;
            height: 34px;
            display: inline-block;
        }
        .control-label {
            padding-top: 0 !important;
            width: 94px;
            float: left;
            line-height: 30px;
            padding-right: 1em;
        }
        .control-group {
            margin-bottom: 1em;
        }
        .controls {
            margin-left: 94px;
        }
        .row {
            margin-left: 0;
            margin-right: 0;
        }
        .col-sm-3,
        .col-sm-6,
        .col-sm-12 {
            padding-left: 0;
            padding-right: 0;
        }
        .fade {
            display: none;
        }
        .in.fade {
            display: block;
        }
        .control-group error {
            border-color: #b94a48;
        }
        #button {
            color: #fff !important;
            background-color: #039cfd !important;
            border-color: #039cfd !important;
        }
        img {
            cursor: pointer;
        }
        .nav-tabs > .active > a, .nav-tabs > .active > a:hover, .nav-tabs > .active > a:focus {
            color: #555;
            cursor: default;
            background-color: #fff;
            border: 1px solid #ddd;
            border-bottom-color: transparent;
        }
        .x-grid-view {
            overflow: hidden !important;
        }
        .x-body{
            overflow-x: hidden;
        }
 
        .ui-widget-content.ui-widget {
            max-height: 450px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
 
    <script th:inline="javascript">
        /*<![CDATA[*/
        var flag = [[${flag}]];
        var resourceid=[[${resourceid}]];
        var lanbaseurl = [[${lanbaseurl}]];
        /*]]>*/
        jQuery(function() {
            initZtree();
        })
 
        //加载目录树
        function initZtree() {
            var data = {
                title: $("#title").val(),
                datasources: $("#datasources").val()
            }
            /**
             * zTree配置
             */
            var setting = {
                view: {
                    selectedMulti: false,
                    showTitle : true
                },
                check: {
                    enable: false
                },
                data: {
                    simpleData: {
                        enable: true
                    },
                    key: {
                        title:"title"//1 json中要有一个key是 title就可以了
                    },
                },
                async: {
                    enable: true,
                    url: "/res/common/getResourceSelectTree?flag=" + flag + '&resourceid=' + resourceid,
                    autoParam: ["id=parentid"],
                    otherParam:data
                },
                callback: {
                    onClick: ztreeonClick
                }
            };
            var zNodes = {
                id: 0,
                name: "资源目录",
                pId: -1,
                isParent: true,
                title:"",
                iconOpen:"/image/classicons/folderOpen.png",//update:dsh(2018/12/05)
                iconClose:"/image/classicons/folder.png"
            };
            var treeObj = $.fn.zTree.init($("#menuTree"), setting, zNodes); //初始化zTree
            treeObj.reAsyncChildNodes(treeObj.getNodes()[0], "refresh", false); //强行异步加载父节点的子节点。
        }
        //树点击事件
        function ztreeonClick(event, treeId, treeNode, clickFlag){
            if(treeNode.isParent == false && treeNode.id.indexOf("_") != -1) {
                var id = treeNode.id.split('_')[1];
                var name = treeNode.name;
                if (flag == "zbcx") {
                    queding(id,name);
                } else if (flag == "gltc") {
                    AddBusinessRef(id,name);
                }
            }
        }
 
        function queding(id,name) {
            //获取那个被选中
            var str = id;
            if (str != "") {
                    $.ajax({
                        url: '/res/queryaround/insert',
                        type: 'post',
                        dataType:'text',
                        data: {resourceid:resourceid,ZiYuanIdStr: str},
                        success: function (data) {
                            if(data=="1"){
                                alert('添加成功');
                                parent.ZYMLZiYuanStore.loadPage(1); //重新查询并跳转到第一页
                                parent.winparpostMsg();//跨域回调
                                closeLayer();
                            } else{
                                alert('添加失败');
                            }
                        }
                    })
                }
        }
 
        function AddBusinessRef(id,name){
            var selectModel;
            var str = id;
            if (str != "") {
                // if (confirm("确定添加吗?")) {
                    $.ajax({
                        url: '/res/businessref/insertSelective',
                        type: 'post',
                        data: {
                            'resourceids':str,
                            'resourceid':resourceid
                        },
                        success: function (data) {
                            if (data == 1) {
                                alert("添加成功!");
                                window.parent.Search();
                                closeLayer();
                            }
                            else {
                                alert(data.msg);
                            }
                        }
                    })
                // }
            }
        }
 
        //关闭窗口
        function closeLayer(){
            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
            parent.layer.close(index);
        }
 
    </script>
    <script>
        function findPinyinByKeyWord(){
            var title = $("#title").val();
 
            $("#title").autocomplete({
                source: '/res/common/findPinyinByKeyWord?keyWord='+encodeURI(encodeURI(title)) + "&flag=" + flag + '&resourceid=' + resourceid,  //请求的url
                minLength: 1
            });
        }
    </script>
</head>
<body layout:fragment="content">
<div class="portlet box ltblue" style="margin-bottom: 0px !important;border:none;width:100%;">
    <input type="hidden" id="flag" th:value="${flag}" />
    <input type="hidden" id="resMainInfoId" th:value="${resourceid}" />
    <!--<div class="portlet-title">-->
        <!--<div class="caption">-->
            <!--<i class="icon-reorder"></i>查询区-->
        <!--</div>-->
        <!--<div class="tools"></div>-->
    <!--</div>-->
    <div class="portlet-body form">
        <div id="tabBase" class="row">
            <form id="SearchForm" style="width: 100%;">
                <div class="row">
                    <div class="col-sm-6">
                        <label class="control-label">资源名称:</label>
                        <div class="controls">
                            <input type="text" class="form-control col-sm-11" id="title" name="title" onkeyup="findPinyinByKeyWord()" onclick="findPinyinByKeyWord()" placeholder="输入资源名称或拼音首字母查询" value="" />
                        </div>
                    </div>
                    <div class="col-sm-6">
                        <label class="control-label">数据来源:</label>
                        <div class="controls">
                            <select id="datasources" name="datasources" class="form-control col-sm-11">
                                <option value="">--请选择--</option>
                                <option th:each="item:${DataSourceList}" th:value="${item.key}" th:text="${item.value}"></option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row" style="margin-top: 6px">
                    <div class="col-sm-6">
                        <!--<a class="btn btn-primary-outline" onclick="add();"><i class="fa fa-plus"></i>&nbsp;新增</a>-->
                    </div>
                    <div class="col-sm-6" style="text-align: right;">
                        <a class="btn btn-primary-outline" onclick="initZtree();"><i class="fa fa-search"></i>&nbsp;查询</a>
                        <!--<a class="btn btn-primary-outline" onclick="Clear();"><i class="fa fa-trash-o"></i>&nbsp;清除</a>-->
                        <!--<a class="btn btn-primary-outline" onclick="addResourceSelect();" style="margin-right:32px;"><i class="fa fa-plus"></i>&nbsp;确定</a>-->
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<!--<div id="grid" style="width: 100%;float: left"></div>-->
<div class='my-ztree' style="height: 397px;overflow-y:auto;border-top: 1px solid #f5f5f5;">
    <ul id='menuTree' class='ztree'></ul>
</div>
</body>
<!--<script src="/js/common/resource_select.js"></script>-->
</html>