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
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8"/>
    <title></title>
 
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/assets/css/style.css'}"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'BootStrap4/expand/css/bootstrap-extract.css'}"/>
    <link th:href="@{${pubzyWebRoot} + 'media/css/pagination.css'}" type="text/css" rel="stylesheet"/>
    <link th:href="@{${pubzyWebRoot} + 'ext-4.2.1.883/resources/css/ext-all-neptune.css'}" rel="stylesheet"
          type="text/css"/>
    <link rel="stylesheet" th:href="@{${pubzyWebRoot} + 'zTree/css/metroStyle/metroStyle.css'}" />
    <link href="/js/jqUI/jquery-ui.min.css"  rel="stylesheet" type="text/css" />
    <!-- 表单样式  -->
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/jquery.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/expand/plugins/layer/layer.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/tether.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'BootStrap4/assets/js/bootstrap.min.js'}"></script>
    <script th:src="@{${pubzyWebRoot} + 'jqPaginator/jqpaginator.min.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 src="/js/jqUI/jquery-ui.min.js"></script>
    <script th:src="@{${pubzyWebRoot} + 'zTree/js/jquery.ztree.all.min.js'}"></script>
    <style>
        body {
            padding: 0;
            background-color: white !important;
        }
        .pagination > li {
            display: inline;
        }
 
        #tbSet th, td {
            white-space: nowrap;
            text-align: center !important;
        }
        .ui-widget-content.ui-widget {
            max-height: 280px;
            overflow-y: auto;
            overflow-x: hidden;
        }
    </style>
    <script th:inline="javascript">
        var zTree;
        var catlogid = [[${catlogid}]];
        jQuery(function() {
            initZtree();
        })
 
        //加载目录树
        function initZtree() {
            var selectids = $("#selectids").val();
            var data = {
                title: $("#title").val(),
                resourceclass:[[${resourceclass}]],
                catlogid:catlogid
            }
            /**
             * zTree配置
             */
            var setting = {
                view: {
                    selectedMulti: false,
                    showTitle : true
                },
                check: {
                    enable: true,
                    chkStyle: "checkbox",
                },
                data: {
                    simpleData: {
                        enable: true
                    },
                    key: {
                        title:"title"//1 json中要有一个key是 title就可以了
                    },
                },
                async: {
                    enable: true,
                    url: "/res/ResTheme/selectKongJianFuWuTree",
                    autoParam: ["id=parentid"],
                    otherParam:data
                },
                callback: {
                }
            };
            var zNodes = {
                id: 0,
                name: "资源目录",
                pId: -1,
                isParent: true,
                title:"",
                iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'
            };
            zTree = $.fn.zTree.init($("#menuTree"), setting, zNodes); //初始化zTree
            zTree.reAsyncChildNodes(zTree.getNodes()[0], "refresh", false); //强行异步加载父节点的子节点。
        }
 
        //保存资源
        function SaveSelectZY(){
            var nodes = zTree.getCheckedNodes();
            var idStr = "";
            for(var i = 0; i < nodes.length; i++) {
                if(nodes[i].isParent == false) {
                    if(idStr != "") idStr+= ",";
                    idStr += nodes[i].id.replace("ZiYuan_","");
                }
            }
            if(idStr == ""){
                alert("请选择资源!");
                return false;
            }
            $.ajax({
                type: 'post',
                url: '/res/OnemapCatalog/insertCatalogResource',
                data: {
                    ids: idStr,
                    catlogid:catlogid
                },
                success: function (data) {
                    alert(data);
                    var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(index);
                    parent.initTree(1);
                    //window.location = window.location;
                },
                error: function (data) {
                    alert("未知错误");
                    window.location = window.location;
                }
            });
        }
    </script>
</head>
<body>
<div id="rapp">
    <div>
        <div class='my-ztree' style="height: 350px;overflow-y:auto;border-top: 1px solid #f5f5f5;">
            <ul id='menuTree' class='ztree'></ul>
        </div>
        <div style="float:right;margin-right:20px;">
            <a class="btn btn-primary-outline" onclick="SaveSelectZY();">保存</a>
        </div>
    </div>
</div>
</body>
</html>