selectItemAjaxData.jsp
4.03 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
<%@ page import="weaver.general.Util" %>
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page" />
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="java.util.*" %>
<%@ page import="org.json.JSONArray" %>
<%@ page import="org.json.JSONObject" %>
<jsp:useBean id="SelectItemManager" class="weaver.workflow.selectItem.SelectItemManager" scope="page" />
<%
User user = HrmUserVarify.getUser (request , response) ;
int id = Util.getIntValue(request.getParameter("id"));
String selectAll = Util.null2String(request.getParameter("selectAll"));
String src = Util.null2String(request.getParameter("src"));
if(src.equals("pubchoiceback")){
String sql="SELECT id,name,defaultvalue,pathcategory,maincategory,cancel,isaccordtosubcom from mode_selectitempagedetail WHERE mainid="+id+" and pid=0 AND statelev=1";
if(!selectAll.equals("true")){
sql +=" and (cancel IS NULL OR cancel='0' OR cancel='') ";
}
sql +=" ORDER BY disorder";
//System.out.println(sql);
rs.executeSql(sql);
JSONArray jsonArray=new JSONArray();
JSONObject jsonObject=new JSONObject();
while(rs.next()){
int _id = Util.getIntValue(rs.getString("id"),0);
String _name = Util.null2String(rs.getString("name"));
String _defaultvalue = Util.null2String(rs.getString("defaultvalue"));
String _pathcategory = Util.null2String(rs.getString("pathcategory"));
String _maincategory = Util.null2String(rs.getString("maincategory"));
String _cancel = Util.null2String(rs.getString("cancel"));
String _isaccordtosubcom = Util.null2String(rs.getString("isaccordtosubcom"));
jsonObject=new JSONObject();
jsonObject.put("id", _id);
jsonObject.put("name", _name);
jsonObject.put("defaultvalue", _defaultvalue);
jsonObject.put("pathcategory", _pathcategory);
jsonObject.put("maincategory", _maincategory);
jsonObject.put("isaccordtosubcom", _isaccordtosubcom);
jsonObject.put("cancel", _cancel);
jsonArray.put(jsonObject);
}
out.println(jsonArray.toString());
//System.out.println(jsonArray.toString());
}else if(src.equals("notcancel")){//解封
int detailid = Util.getIntValue(request.getParameter("detailid"));
ArrayList<String> arrayList = new ArrayList<String>();
arrayList = SelectItemManager.getAllSubSelectItemId(arrayList, ""+detailid, -1);
String allSubIds = "";//所有子项id
for(int j=0;j<arrayList.size();j++){
allSubIds += ","+arrayList.get(j);
}
String allids = detailid + allSubIds;
String sql = "update mode_selectitempagedetail set cancel=0 where id in ("+allids+")";
rs.executeSql(sql);
JSONObject jsonObject = new JSONObject();
jsonObject.put("detailid",detailid);
SelectItemManager.syncPubSelectOp(id,user.getLanguage());
response.getWriter().write(jsonObject.toString());
return;
}else if(src.equals("selectItemback")){
JSONArray jsonArray=new JSONArray();
JSONObject jsonObject=new JSONObject();
//Map<String,String> selectItemOptionMap = SelectItemManager.getSelectItemOption(id+"");
Map<String,String> selectItemOptionMap = new LinkedHashMap<String,String>();
String isbill = Util.null2String(request.getParameter("isbill"));
if(isbill.equals("0")){
selectItemOptionMap = SelectItemManager.getSelectItemOptionWithOld(id+"");
}else{
selectItemOptionMap = SelectItemManager.getSelectItemOption(id+"");
}
for(Map.Entry<String, String> entry: selectItemOptionMap.entrySet()){
jsonObject=new JSONObject();
jsonObject.put("id", entry.getKey());
jsonObject.put("name", entry.getValue());
jsonArray.put(jsonObject);
}
out.println(jsonArray.toString());
}else if(src.equals("hasPubChoice")){
int formid = Util.getIntValue(request.getParameter("formid"));
int isdetail = Util.getIntValue(request.getParameter("isdetail"));
String detailtable = Util.null2String(request.getParameter("detailtable"));
boolean flag = SelectItemManager.hasPubChoice(formid,isdetail,detailtable);
if(flag){
out.println("true");
}else{
out.println("false");
}
}
%>