FnaBudgetLeftAjax.jsp
20.7 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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<%@page import="weaver.fna.general.FnaBudgetLeftRuleSet"%><%@page import="weaver.systeminfo.SystemEnv"%><%@page import="weaver.general.BaseBean"%><%@page import="org.apache.commons.lang.StringEscapeUtils"%><%@page import="org.json.JSONObject"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %><%@ page import="weaver.general.Util" %><%@ page import="java.util.*,java.sql.Timestamp" %><%@ page import="weaver.general.GCONST" %><%@page import="weaver.hrm.HrmUserVarify"%><%@page import="weaver.hrm.User"%><jsp:useBean id="rs1" class="weaver.conn.RecordSet" scope="page" /><jsp:useBean id="rs2" class="weaver.conn.RecordSet" scope="page" /><jsp:useBean id="rs3" class="weaver.conn.RecordSet" scope="page" /><%
StringBuffer result = new StringBuffer();
User user = HrmUserVarify.getUser (request , response) ;
if(user == null){
}else{
BaseBean bb = new BaseBean();
int userId = user.getUID();
boolean canView = HrmUserVarify.checkUserRight("BudgetAuthorityRule:readOnly", user);//预算编制只读权限
boolean canEdit = (HrmUserVarify.checkUserRight("FnaBudget:View", user) ||
HrmUserVarify.checkUserRight("FnaBudgetEdit:Edit", user) ||
HrmUserVarify.checkUserRight("BudgetAuthorityRule:edit", user));//财务预算维护、预算编制权限
boolean isAllowCmpEdit = FnaBudgetLeftRuleSet.isAllowCmp(user.getUID());
List<String> allowSubCmpIdEdit_list = new ArrayList<String>();
boolean allowSubCmpIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpId(user.getUID(), allowSubCmpIdEdit_list);
List<String> allowDepIdEdit_list = new ArrayList<String>();
boolean allowDepIdEdit = FnaBudgetLeftRuleSet.getAllowDepId(user.getUID(), allowDepIdEdit_list);
List<String> allowSubCmpIdTreeView_list_1 = new ArrayList<String>();
if(!allowSubCmpIdEdit && allowSubCmpIdEdit_list.size() > 0){
allowSubCmpIdTreeView_list_1 = FnaBudgetLeftRuleSet.recursiveSuperiorSubCmp(allowSubCmpIdEdit_list);
}
List<String> allowSubCmpIdTreeView_list_2 = new ArrayList<String>();
if(!allowDepIdEdit && allowDepIdEdit_list.size() > 0){
allowSubCmpIdTreeView_list_2 = FnaBudgetLeftRuleSet.recursiveSuperiorSubCmp_by_depIds(allowDepIdEdit_list);
}
List<String> allowDepIdTreeView_list_1 = new ArrayList<String>();
if(!allowDepIdEdit && allowDepIdEdit_list.size() > 0){
allowDepIdTreeView_list_1 = FnaBudgetLeftRuleSet.recursiveSuperiorDep(allowDepIdEdit_list);
}
if(canView || canEdit){
String id = Util.null2String(request.getParameter("id2"));
String name = Util.null2String(request.getParameter("name"));
//String level = Util.null2String(request.getParameter("level"));
String otherParam = Util.null2String(request.getParameter("otherParam"));
//System.out.println("id="+id+";name="+name+";otherParam="+otherParam);
String _searchStr_lowerCase = Util.null2String(request.getParameter("_searchStr_lowerCase"));
if(!"".equals(_searchStr_lowerCase)){
List depIdList = new ArrayList();
List subCmpIdByDepList = new ArrayList();
int idx = 0;
String sql1 = "WITH allsub(id,departmentname,supdepid,canceled,subcompanyid1) \n" +
" as ( \n" +
" SELECT id,departmentname,supdepid,canceled,subcompanyid1 FROM HrmDepartment dep "+
" where 1=1 \n" +
" and departmentname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%' \n" +
" UNION ALL SELECT a.id,a.departmentname,a.supdepid,a.canceled,a.subcompanyid1 FROM HrmDepartment a,allsub b where a.id = b.supdepid \n" +
" ) select distinct * from allsub tb";
if("oracle".equals(rs2.getDBType())){
sql1 = "select distinct dep.id, dep.departmentname, dep.supdepid, dep.canceled, dep.subcompanyid1 \n" +
" from HrmDepartment dep\n" +
" start with 1=1 \n" +
" and dep.departmentname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%'\n" +
" connect by prior dep.supdepid = dep.id";
}else if("mysql".equals(rs2.getDBType())){
sql1 = "select DISTINCT tl.lv, t.id, t.departmentname, t.supdepid, t.canceled, t.subcompanyid1 from (\n" +
" select @id idlist, @lv:=@lv+1 lv,\n" +
" (select @id:=group_concat(supdepid separator ',') from HrmDepartment where find_in_set(id,@id)) sub\n" +
" from HrmDepartment,(select @id:=group_concat(id separator ','),@lv:=0 from HrmDepartment _t where _t.departmentname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%') vars\n" +
" where @id is not null) tl,HrmDepartment t\n" +
" where find_in_set(t.id,tl.idlist) \n" +
" order by tl.lv asc";
}
//new BaseBean().writeLog(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("departmentname");
String _type = "d";
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
int supdepid = Util.getIntValue(rs1.getString("supdepid"), 0);
int subcompanyid1 = Util.getIntValue(rs1.getString("subcompanyid1"), 0);
if(!allowDepIdEdit && !allowDepIdEdit_list.contains(_id)){
continue;
}
if(canceled == 1){
String sql2 = "select count(*) cnt from FnaBudgetInfo a where a.status <> 0 and a.organizationtype = 2 and a.budgetorganizationid = "+_id;
rs2.executeSql(sql2);
if(!(rs2.next() && rs2.getInt("cnt") > 0)){
continue;
}
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if(depIdList.contains(_id+"")){
continue;
}else{
depIdList.add(_id+"");
}
if(subCmpIdByDepList.contains(subcompanyid1+"")){
}else{
subCmpIdByDepList.add(subcompanyid1+"");
}
if(idx>0){
result.append(",");
}
String pId = "d_"+supdepid;
if(supdepid <= 0){
pId = "s_"+subcompanyid1;
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name)+","+
"pId:"+JSONObject.quote(pId)+","+
"icon:"+JSONObject.quote("")+
"}");
idx++;
}
//**********************************************************************************************
List subCmpIdList = new ArrayList();
sql1 = "WITH allsub(id,subcompanyname,supsubcomid,canceled) \n" +
" as ( \n" +
" SELECT id,subcompanyname,supsubcomid,canceled FROM HrmSubCompany \n" +
" where 1=1 \n" +
" and subcompanyname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%' "+
" UNION ALL SELECT a.id,a.subcompanyname,a.supsubcomid,a.canceled FROM HrmSubCompany a,allsub b where a.id = b.supsubcomid \n" +
" ) select distinct * from allsub tb";
if("oracle".equals(rs2.getDBType())){
sql1 = "select distinct a.id, a.subcompanyname, a.supsubcomid, a.canceled\n" +
" from hrmsubcompany a\n" +
" start with 1=1 \n" +
" and a.subcompanyname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%'\n" +
" connect by prior a.supsubcomid = a.id";
}else if("mysql".equals(rs2.getDBType())){
sql1 = "select DISTINCT tl.lv, t.id, t.subcompanyname, t.supsubcomid, t.canceled from (\n" +
" select @id idlist, @lv:=@lv+1 lv,\n" +
" (select @id:=group_concat(supsubcomid separator ',') from hrmsubcompany where find_in_set(id,@id)) sub\n" +
" from hrmsubcompany,(select @id:=group_concat(id separator ','),@lv:=0 from hrmsubcompany _t where _t.subcompanyname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%') vars\n" +
" where @id is not null) tl,hrmsubcompany t\n" +
" where find_in_set(t.id,tl.idlist) \n" +
" order by tl.lv asc";
}
//new BaseBean().writeLog(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("subcompanyname");
String _type = "s";
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
int supsubcomid = Util.getIntValue(rs1.getString("supsubcomid"), 0);
if(!allowSubCmpIdEdit && !allowSubCmpIdEdit_list.contains(_id)){
continue;
}
if(canceled == 1){
String sql2 = "select count(*) cnt from FnaBudgetInfo a where a.status <> 0 and a.organizationtype = 1 and a.budgetorganizationid = "+_id;
rs2.executeSql(sql2);
if(!(rs2.next() && rs2.getInt("cnt") > 0)){
//System.out.println("continue1");
continue;
}
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if(subCmpIdList.contains(_id+"")){
continue;
}else{
subCmpIdList.add(_id+"");
}
if(idx>0){
result.append(",");
}
String pId = "s_"+supsubcomid;
if(supsubcomid <= 0){
pId = "c_0";
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name)+","+
"pId:"+JSONObject.quote(pId)+","+
"icon:"+JSONObject.quote("/images/treeimages/Home_wev8.gif")+
"}");
idx++;
}
//new BaseBean().writeLog("");
//new BaseBean().writeLog("");
//new BaseBean().writeLog("");
int subCmpIdByDepListLen = subCmpIdByDepList.size();
for(int i=0;i<subCmpIdByDepListLen;i++){
String _id = (String)subCmpIdByDepList.get(i);
sql1 = "WITH allsub(id,subcompanyname,supsubcomid,canceled) \n" +
" as ( \n" +
" SELECT id,subcompanyname,supsubcomid,canceled FROM HrmSubCompany \n" +
" where id = "+_id+" "+
" UNION ALL SELECT a.id,a.subcompanyname,a.supsubcomid,a.canceled FROM HrmSubCompany a,allsub b where a.id = b.supsubcomid \n" +
" ) select distinct * from allsub tb";
if("oracle".equals(rs2.getDBType())){
sql1 = "select distinct a.id, a.subcompanyname, a.supsubcomid, a.canceled\n" +
" from hrmsubcompany a\n" +
" start with a.id = "+_id+"\n" +
" connect by prior a.supsubcomid = a.id";
}else if("mysql".equals(rs2.getDBType())){
sql1 = "select DISTINCT tl.lv, t.id, t.subcompanyname, t.supsubcomid, t.canceled from (\n" +
" select @id idlist, @lv:=@lv+1 lv,\n" +
" (select @id:=group_concat(supsubcomid separator ',') from hrmsubcompany where find_in_set(id,@id)) sub\n" +
" from hrmsubcompany,(select @id:="+_id+",@lv:=0) vars\n" +
" where @id is not null) tl,hrmsubcompany t\n" +
" where find_in_set(t.id,tl.idlist) \n" +
" order by tl.lv asc";
}
//new BaseBean().writeLog(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id1 = rs1.getString("id");
String _name = rs1.getString("subcompanyname");
String _type = "s";
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
int supsubcomid = Util.getIntValue(rs1.getString("supsubcomid"), 0);
if(canceled == 1){
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if(subCmpIdList.contains(_id1+"")){
continue;
}else{
subCmpIdList.add(_id1+"");
}
if(idx>0){
result.append(",");
}
String pId = "s_"+supsubcomid;
if(supsubcomid <= 0){
pId = "c_0";
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id1)+","+
"id2:"+JSONObject.quote(_type+"_"+_id1)+","+
"name:"+JSONObject.quote(_name)+","+
"pId:"+JSONObject.quote(pId)+","+
"icon:"+JSONObject.quote("/images/treeimages/Home_wev8.gif")+
"}");
idx++;
}
}
//**********************************************************************************************
sql1 = "select '0' as id, companyname as name, 'c' as type from hrmcompany";
//new BaseBean().writeLog(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("name");
String _type = rs1.getString("type");
if(result.length() == 0){
String sql2 = "select count(*) cnt from hrmcompany where companyname like '%"+StringEscapeUtils.escapeSql(_searchStr_lowerCase)+"%' ";
rs2.execute(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
}else{
continue;
}
}
if(idx>0){
result.append(",");
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name));
result.append(",pId:"+JSONObject.quote(""));
result.append(",icon:"+JSONObject.quote("/images/treeimages/global_wev8.gif"));
result.append("}");
idx++;
}
}else if("".equals(id)){//初始化组织架构树
int idx = 0;
String sql1 = "select '0' as id, companyname as name, 'c' as type from hrmcompany";
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("name");
String _type = rs1.getString("type");
if(!isAllowCmpEdit
&& !allowSubCmpIdEdit && allowSubCmpIdEdit_list.size()==0
&& !allowDepIdEdit && allowDepIdEdit_list.size()==0){
continue;
}
if(idx>0){
result.append(",");
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name));
result.append(",isParent:true");
result.append(",icon:"+JSONObject.quote("/images/treeimages/global_wev8.gif"));
result.append("}");
idx++;
}
}else{
String idType = id.split("_")[0];
id = id.split("_")[1];
//System.out.println("idType="+idType+";id="+id);
if("c".equalsIgnoreCase(idType)){//展开分部后,显示该目录下的下级组织架构
int idx = 0;
String sql1 = "select a.id, a.subcompanyname as name, a.showorder, 's' as type, a.canceled \n" +
" from HrmSubCompany a \n" +
" where (a.supsubcomid = 0 or a.supsubcomid = '' or a.supsubcomid is null) \n" +
//" and (a.canceled = 'N' or a.canceled = '' or a.canceled is null) \n" +
" ORDER BY a.showorder, a.subcompanyname ";
//System.out.println(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("name");
String _type = rs1.getString("type");
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
//System.out.println("_id="+_id+";_name="+_name+";_type="+_type+";canceled="+canceled);
if(canceled == 1){
String sql2 = "select count(*) cnt from FnaBudgetInfo a where a.status <> 0 and a.organizationtype = 1 and a.budgetorganizationid = "+_id;
rs2.executeSql(sql2);
if(!(rs2.next() && rs2.getInt("cnt") > 0)){
//System.out.println("continue1");
continue;
}
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if(!allowSubCmpIdEdit && !allowSubCmpIdTreeView_list_1.contains(_id)
&& !allowDepIdEdit && !allowSubCmpIdTreeView_list_2.contains(_id)){
//System.out.println("continue2");
continue;
}
if(idx>0){
result.append(",");
}
String isParent = "false";
String sql2 = "select count(*) cnt from HrmSubCompany a where a.supsubcomid = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
if("false".equals(isParent)){
sql2 = "select count(*) cnt from HrmDepartment a where a.subcompanyid1 = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name));
if("s".equalsIgnoreCase(_type)){
result.append(",isParent:"+isParent);
result.append(",icon:"+JSONObject.quote("/images/treeimages/Home_wev8.gif"));
}
result.append("}");
idx++;
}
}else if("s".equalsIgnoreCase(idType) && Util.getIntValue(id) > 0){//展开分部后,显示该目录下的下级组织架构
int idx = 0;
String sql1 = "select * from (\n" +
" select a.id, a.subcompanyname as name, a.showorder, 's' as type, a.canceled \n" +
" from HrmSubCompany a \n" +
" where a.supsubcomid = "+Util.getIntValue(id)+" \n" +
//" and (a.canceled = 'N' or a.canceled = '' or a.canceled is null) \n" +
" UNION \n" +
" SELECT a.id, a.departmentname as name, a.showorder, 'd' as type, a.canceled \n" +
" from HrmDepartment a \n" +
" where a.subcompanyid1 = "+Util.getIntValue(id)+" \n" +
" and (a.supdepid = 0 or a.supdepid = '' or a.supdepid is null) \n" +
//" and (a.canceled = 'N' or a.canceled = '' or a.canceled is null) \n" +
" ) t \n" +
" ORDER BY case when (type='s') then 0 else 1 end, t.showorder, t.name ";
//System.out.println(sql1);
//rs1.writeLog(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("name");
String _type = rs1.getString("type");
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
if(canceled == 1){
String _organizationtype = "1";
if("d".equals(_type)){
_organizationtype = "2";
}
String sql2 = "select count(*) cnt from FnaBudgetInfo a where a.status <> 0 and a.organizationtype = "+_organizationtype+" and a.budgetorganizationid = "+_id;
rs2.executeSql(sql2);
if(!(rs2.next() && rs2.getInt("cnt") > 0)){
continue;
}
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if("s".equals(_type)){
if(!allowSubCmpIdEdit && !allowSubCmpIdTreeView_list_1.contains(_id)
&& !allowDepIdEdit && !allowSubCmpIdTreeView_list_2.contains(_id)){
//System.out.println("continue2");
continue;
}
}else if("d".equals(_type)){
if(!allowDepIdEdit && !allowDepIdTreeView_list_1.contains(_id)){
//System.out.println("continue2");
continue;
}
}
if(idx>0){
result.append(",");
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name));
if("s".equalsIgnoreCase(_type)){
String isParent = "false";
String sql2 = "select count(*) cnt from HrmSubCompany a where a.supsubcomid = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
if("false".equals(isParent)){
sql2 = "select count(*) cnt from HrmDepartment a where a.subcompanyid1 = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
}
result.append(",isParent:"+isParent);
result.append(",icon:"+JSONObject.quote("/images/treeimages/Home_wev8.gif"));
}else{
String isParent = "false";
String sql2 = "select count(*) cnt from HrmDepartment a where a.supdepid = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
result.append(",isParent:"+isParent);
result.append(",icon:"+JSONObject.quote(""));
}
result.append("}");
idx++;
}
}else if("d".equalsIgnoreCase(idType) && Util.getIntValue(id) > 0){//展开部门后,显示该目录下的下级组织架构
int idx = 0;
String sql1 = "SELECT a.id, a.departmentname as name, a.showorder, 'd' as type, a.canceled \n" +
" from HrmDepartment a \n" +
" where a.supdepid = "+Util.getIntValue(id)+" \n" +
//" and (a.canceled = 'N' or a.canceled = '' or a.canceled is null) \n" +
" ORDER BY a.showorder, a.departmentname ";
//System.out.println(sql1);
rs1.executeSql(sql1);
while(rs1.next()){
String _id = rs1.getString("id");
String _name = rs1.getString("name");
String _type = rs1.getString("type");
int canceled = Util.getIntValue(rs1.getString("canceled"), 0);
if(canceled == 1){
String sql2 = "select count(*) cnt from FnaBudgetInfo a where a.status <> 0 and a.organizationtype = 2 and a.budgetorganizationid = "+_id;
rs2.executeSql(sql2);
if(!(rs2.next() && rs2.getInt("cnt") > 0)){
continue;
}
_name += "("+SystemEnv.getHtmlLabelName(22151,user.getLanguage())+")";//封存
}
if(!allowDepIdEdit && !allowDepIdTreeView_list_1.contains(_id)){
//System.out.println("continue2");
continue;
}
if(idx>0){
result.append(",");
}
String isParent = "false";
String sql2 = "select count(*) cnt from HrmDepartment a where a.supdepid = "+_id;
rs2.executeSql(sql2);
if(rs2.next() && rs2.getInt("cnt") > 0){
isParent = "true";
}
result.append("{"+
"id:"+JSONObject.quote(_type+"_"+_id)+","+
"id2:"+JSONObject.quote(_type+"_"+_id)+","+
"name:"+JSONObject.quote(_name)+","+
"isParent:"+isParent+","+
"icon:"+JSONObject.quote("")+
"}");
idx++;
}
}
}
}
}
//System.out.println("result="+result.toString());
%><%="["+result.toString()+"]" %>