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
| <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
| <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
| <jsp:include page="../../../initlib/initAll.jsp"></jsp:include>
| <link href="${pageContext.request.contextPath}/css/toptoolbar.css" rel="stylesheet" type="text/css" />
| <script type="text/javascript">
| var troubleTree;
| $(function(){
| troubleTree = $('#troubleTree').treegrid({
| url:"${pageContext.request.contextPath}/pms/editWctMenu/loadWctTree.do",
| idField : 'id',
| treeField : 'text',
| dataPlain: true,
| fit : true,
| striped : true,
| fitColumns : false,
| rownumbers :false,
| border : false,
| remoteSort:false,
| frozenColumns : [ [ {
| title : '编号',
| field : 'id',
| width : 150
| } ] ],
| columns : [ [
| {
| title : '菜单',
| field : 'text'
| },{
| title : '所属类型',
| field : 'menu_type',
| formatter:function(value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| var typeVal="";//attributes
| var val=attrs.menuType;
| switch(val){
| case -1:
| typeVal="通用菜单";
| break;
| case 0:
| typeVal="卷包机台菜单";
| break;
| case 1:
| typeVal="封箱机台菜单";
| break;
| case 2:
| typeVal="成型机台菜单";
| break;
| case 3:
| typeVal="发射机台菜单";
| break;
| }
| return typeVal;
| }
|
| }
| },{
| title : '链接地址',
| field : 'menu_url',
| formatter:function(value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.menuUrl;
| }
| }
| },{
| title : '图片地址',
| field : 'menu_imgPath',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.imgPath;
| }
| }
| },{
| title : '默认地址',
| field : 'menu_defaultUrl',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.attr1;
| }
| }
| },{
| title : '状态',
| field : 'menu_del',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| var del= attrs.del;
| if(del==0){
| return "<font color='green'>启用</font>";
| }
| return "<font color='red'>禁用</font>";
| }
| }
| },{
| title : '父节点',
| field : 'pid'
| }, {
| title : '序列',
| field : 'seq',
| sortable : true
| },{
| field : 'createUserName',
| title : '创建人姓名',
| align:'center',
| width : 70,
| sortable : true,
| hidden:'true',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.createUserName;
| }
| }
| },{
| field : 'createUserTime',
| title : '创建时间',
| align:'center',
| width : 150,
| sortable : true,
| hidden:'true',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.createUserTime;
| }
| }
| },{
| field : 'updateUserName',
| title : '修改人姓名',
| align:'center',
| width : 70,
| sortable : true,
| hidden:'true',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.updateUserName;
| }
| }
| },{
| field : 'updateUserTime',
| title : '最后修改时间',
| align:'center',
| width : 130,
| sortable : true,
| hidden:'true',
| formatter:function (value,row,index){
| var attrs=row.attributes;
| if(attrs!=null){
| return attrs.updateUserTime;
| }
| }
| } ] ],
| onContextMenu : function(e, row) {
| e.preventDefault();
| $(this).treegrid('unselectAll');
| $(this).treegrid('select', row.id);
| $(this).treegrid('expand',row.id);
| $('#mm').menu('show', {
| left : e.pageX,
| top : e.pageY
| });
| },
| onClickRow:function(row){
| $(this).treegrid('expand',row.id);
| }
| });
| });
| //新增wct菜单
| function appendNode(){
| //按钮是否点击标志(默认为true:可被点击)
| var isClick=true;
| var treeNode = troubleTree.treegrid('getSelected');
| if(treeNode){
| var dialog = parent.$.modalDialog({
| title : '故障树节点添加',
| width : 750,
| height : 420,
| href : '${pageContext.request.contextPath}/pms/sys/resource/addWctMenu.jsp',
| buttons : [ {
| text : '确认',
| iconCls:'icon-standard-disk',
| handler : function() {
| var f = dialog.find('#form');
| var paramsJosn=f.form("getData");
| if(treeNode && f.form("validate")){
| //未点击过则执行里面的内容
| if(isClick){
| //改变为点击无效状态
| isClick=false;
| $.post("${pageContext.request.contextPath}/pms/editWctMenu/addWctMenu.do",paramsJosn,function(json){
| //恢复点击有效状态
| isClick=true;
| if (json.success) {
| $.messager.show('提示', json.msg, 'info');
| dialog.dialog('destroy');
| $('#troubleTree').treegrid('reload');
| }else{
| $.messager.show('提示', json.msg, 'error');
| dialog.dialog('destroy');
| }
| },"JSON");
| }
| }
| }
| } ]
| });
| }
| }
|
| //编辑wct菜单
| function editNode(){
| //按钮是否点击标志(默认为true:可被点击)
| var isClick=true;
| var treeNode = troubleTree.treegrid('getSelected');
| if(treeNode){
| var dialog = parent.$.modalDialog({
| title : '故障树节点添加',
| width : 750,
| height : 420,
| href : "${pageContext.request.contextPath}/pms/editWctMenu/goToeditWctMenujsp.do?id="+treeNode.id,
| buttons : [ {
| text : '确认',
| iconCls:'icon-standard-disk',
| handler : function() {
| var f = dialog.find('#form');
| var paramsJosn=f.form("getData");
| if(treeNode && f.form("validate")){
| //未点击过则执行里面的内容
| if(isClick){
| //改变为点击无效状态
| isClick=false;
| $.post("${pageContext.request.contextPath}/pms/editWctMenu/editWctMenu.do",paramsJosn,function(json){
| //恢复点击有效状态
| isClick=true;
| if (json.success) {
| $.messager.show('提示', json.msg, 'info');
| dialog.dialog('destroy');
| $('#troubleTree').treegrid('reload');
| }else{
| $.messager.show('提示', json.msg, 'error');
| dialog.dialog('destroy');
| }
| },"JSON");
| }
| }
| }
| } ]
| });
| }
| }
|
| </script>
|
| <div class="easyui-layout" data-options="fit : true,border : false">
| <div data-options="region:'center',border:false">
| <div id="mm" class="easyui-menu" style="width:120px;">
| <div onclick="appendNode()" data-options="iconCls:'icon-add'">新增</div>
| <div onclick="editNode()" data-options="iconCls:'icon-edit'">编辑</div>
| </div>
| <table id="troubleTree"></table>
| </div>
| </div>
|
|