folder_list.html
7.09 KB
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
<%
var headContent = {
include("/pages/template/head.html"){}
%>
<% include("/pages/includes/ztree.html"){} %>
<script type="text/javascript">
var oper;
jQuery(function($) {
// 页面方法
oper = {
width : 750,
height : 550,
form : document.form1,
list : function() {
var url = 'admin/folder/list';
this.form.action = url;
this.form.submit();
},
view : function(id) {
var url = 'admin/folder/view/'+id;
var title = '查看目录';
Iframe(url, this.width, this.height, title, false, false, false, EmptyFunc);
},
add : function(id) {
id = id||0;
var url = 'admin/folder/add/'+id;
var title = '添加目录';
Iframe(url, this.width, this.height, title);
},
edit : function(id) {
var url = 'admin/folder/edit/'+id;
var title = '修改目录';
Iframe(url, this.width, this.height, title);
},
del : function(id) {
var url = 'admin/folder/delete/'+id;
var title = '确认要删除该目录信息?';
Confirm(title, function() {
form1.action = url;
form1.submit();
});
}
};
//显示Menu索引
showMenu('page_folder');
});
//分页
var paginator = function(page) {
oper.list();
};
var zTree;
var demoIframe;
var newCount=0;
function addHoverDom(treeId, treeNode) {
var sObj = $("#" + treeNode.tId + "_span");
if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
var addStr = "<span class='button add' id='addBtn_" + treeNode.tId + "'></span>";
addStr += "<span class='button edit' id='editBtn_" + treeNode.tId + "'></span>";
addStr += "<span class='button remove' id='removeBtn_" + treeNode.tId
+ "' title='add node' onfocus='this.blur();'></span>";
sObj.after(addStr);
var addBtn = $("#addBtn_"+treeNode.tId);
if (addBtn) addBtn.bind("click", function(){
oper.add(treeNode.id);
return false;
});
var editBtn = $("#editBtn_"+treeNode.tId);
if (editBtn) editBtn.bind("click", function(){
oper.edit(treeNode.id);
return false;
});
var delBtn = $("#removeBtn_"+treeNode.tId);
if (delBtn) delBtn.bind("click", function(){
oper.del(treeNode.id);
return false;
});
};
function removeHoverDom(treeId, treeNode) {
$("#addBtn_"+treeNode.tId).unbind().remove();
$("#removeBtn_"+treeNode.tId).unbind().remove();
$("#editBtn_"+treeNode.tId).unbind().remove();
};
var setting = {
check: {
enable: false
},
view: {
addHoverDom: addHoverDom,
removeHoverDom: removeHoverDom,
dblClickExpand: false,
showLine: true,
selectedMulti: false
},
data: {
simpleData: {
enable:true,
idKey: "id",
pIdKey: "pId",
rootPId: ""
}
},
callback: {
beforeClick: function(treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj("tree");
if (treeNode.isParent) {
zTree.expandNode(treeNode);
return false;
} else {
// demoIframe.attr("src",treeNode.file + ".html");
return true;
}
}
}
};
var zNodes =[
<% for(item in folders){ %>
{id:${item.id}, pId:${item.parent_id}, name:"${item.name}", open:true} ${itemLP.index==folders.~size?"":","}
<% } %>
];
$(document).ready(function(){
var t = $("#tree");
t = $.fn.zTree.init(t, setting, zNodes);
demoIframe = $("#testIframe");
demoIframe.bind("load", loadReady);
var zTree = $.fn.zTree.getZTreeObj("tree");
// zTree.selectNode(zTree.getNodeByParam("id", 101));
});
function loadReady() {
var bodyH = demoIframe.contents().find("body").get(0).scrollHeight,
htmlH = demoIframe.contents().find("html").get(0).scrollHeight,
maxH = Math.max(bodyH, htmlH), minH = Math.min(bodyH, htmlH),
h = demoIframe.height() >= maxH ? minH:maxH ;
if (h < 530) h = 530;
}
</script>
<%
};
var bodyContent = {
%>
<div class="row" style="margin-right: 0px; margin-left: 0px; ">
<div class="col-md-2">
<ul id="tree" class="ztree" style="overflow:auto;"></ul>
</div>
<div class="col-md-10">
<form name="form1" action="" method="post" class="form-inline" role="form">
<!-- 菜单 -->
<% include("/pages/template/menu.html"){} %>
<div class="tableSearch">
<% //查询列表 %>
<div class="form-group">
<input class="form-control" type="text" name="attr.name" value="${attr.name!''}"
placeholder="请输入名称" required='required' />
</div>
<div class="form-group">
<select name="attr.status" class="form-control" >
<option value="-1">--请选择--</option>
<option value="1" ${attr.status=='1'?'selected':''}>显示</option>
<option value="2" ${attr.status=='2'?'selected':''}>隐藏</option>
</select>
</div>
<button type="button" class="btn btn-default" onclick="oper.list();" name="search">
<span class="glyphicon glyphicon-search"></span> 查 询
</button>
<button type="button" class="btn btn-default" onclick="resetForm();">
<span class="glyphicon glyphicon-refresh"></span> 重 置
</button>
<button type="button" class="btn btn-default" onclick="oper.add();">
<span class="glyphicon glyphicon-plus"></span> 新 增
</button>
</div>
<!-- 数据列表 -->
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>序号</th>
<% // 列表头部 %>
<th name="id" class="sorting">编号</th>
<th name="name" class="sorting">名称</th>
<th name="parent_id" class="sorting">父栏目</th>
<th name="`key`" class="sorting">urlkey</th>
<th name="sort" class="sorting">排序</th>
<th name="status" class="sorting">状态</th>
<th name="type" class="sorting">类型</th>
<th>地址</th>
<th>说明</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<% for(item in page.list){ %>
<tr>
<td>${itemLP.index }</td>
<% // 列表内容 %>
<td>${item.id}</td>
<td>${item.name}</td>
<td>${item.parentName!'根栏目' }</td>
<td>${item.key}</td>
<td>${item.sort}</td>
<td>
<% if(item.status==2) { %>
隐藏
<% } %>
<% if(item.status==1) { %>
显示
<% } %>
</td>
<td>${flyfox.dictValue(item.type!'' ) }</td>
<td>${item.jump_url}</td>
<td title="${item.content}">
<% if (strutil.length(item.content) > 15) { %>
${strutil.subStringTo(item.content, 0, 15)}...
<% } else { %>
${item.content}
<% } %>
</td>
<td>
<a href="javascript:void(0);" class="btn btn-sm btn-success" onclick="oper.view(${item.id});">查看</a>
<a href="javascript:void(0);" class="btn btn-sm btn-primary" onclick="oper.edit(${item.id});">修改</a>
<% if(item.id>1){ %>
<a href="javascript:void(0);" class="btn btn-sm btn-danger" onclick="oper.del(${item.id});">删除</a>
<% } %>
</td>
</tr>
<% } %>
</tbody>
</table>
<%include("/pages/includes/paginator.html"){} %>
</form>
</div>
</div>
<%}; %>
<% layout("/pages/template/_layout.html",{head:headContent,body:bodyContent}){ %>
<%} %>