incToolBarParam.jsp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@page import="com.hotent.platform.model.system.SysBaseParam,
  3. com.hotent.core.util.StringUtil,
  4. java.util.*,
  5. net.sf.json.JSONObject"
  6. %>
  7. <%
  8. List params = (List) request.getAttribute("paramList");
  9. for(Object obj: params) {
  10. SysBaseParam param=(SysBaseParam)obj;
  11. String sourceType = param.getSourceType();
  12. String paramValue=param.getParamValue();
  13. Long paramId=param.getParamId();
  14. String sourceKey=param.getSourceKey();
  15. %>
  16. <tr>
  17. <td class="paramWidth" align="center"><%=param.getParamName()%></td>
  18. <td>
  19. <%
  20. if (sourceType.equals("input")) {
  21. %>
  22. <input title='paramValue' <%if(param.getDataType().equals("Date")){ %>class="date" <%}else{%>class="inputText "<%}%>type="text" name="<%=paramId%>" value="<%=paramValue%>" style="width: 200px;">
  23. <%
  24. }
  25. else if (sourceType.equals("radio")) {
  26. Iterator<?> it = getIterator(sourceKey);
  27. while (it.hasNext()) {
  28. Map.Entry<String, String> mapEntry = (Map.Entry<String, String>) it.next();
  29. %>
  30. <input type="radio" class="inputText " <%if(mapEntry.getKey().equals(paramValue)){ %>checked="checked" <% }%> name="<%=paramId%>" value="<%=mapEntry.getKey()%>"><%=mapEntry.getValue()%>
  31. <%
  32. }
  33. }
  34. else if (sourceType.equals("select")) {
  35. Iterator<?> it = getIterator(sourceKey);
  36. %>
  37. <select name="<%=paramId %>">
  38. <%
  39. while (it.hasNext()) {
  40. Map.Entry<String, String> mapEntry = (Map.Entry<String, String>) it.next();
  41. %>
  42. <option class="inputText " <%if(mapEntry.getKey().equals(paramValue)){ %>selected="selected" <% }%> value="<%=mapEntry.getKey()%>"><%=mapEntry.getValue()%></option>
  43. <%
  44. }
  45. }
  46. else if (sourceType.equals("checkbox")) {
  47. List<String> valueList = StringUtil.stringToList(param.getParamValue());
  48. Iterator<?> it = getIterator(sourceKey);
  49. while (it.hasNext()) {
  50. Map.Entry<String, String> mapEntry = (Map.Entry<String, String>) it.next();
  51. %>
  52. <input type="checkbox" <% for(String str:valueList){if(mapEntry.getKey().equals(str.trim())){ %>checked="checked" <% }}%>class="test" name="<%=paramId%>" value="<%=mapEntry.getKey()%>"><%=mapEntry.getValue()%>
  53. <%
  54. }
  55. }
  56. else if (sourceType.equals("dict")) {
  57. %>
  58. <div id="dictionary">
  59. <input value="<%=paramValue%>" nodeKey="<%=sourceKey%>" id="dictTypeName" class="dicCombo" catKey="DIC" valueField="dictType" isNodeKey="true" name="<%=paramId%>" height="150" width="150"/>
  60. </div>
  61. <%} %>
  62. </td>
  63. <td class="paramWidth"><%=param.getDescription()%></td>
  64. <td class="paramWidth">
  65. <a onclick="javascript:delRow(this);" class="link del" >删除</a>
  66. </td>
  67. </tr>
  68. <%
  69. }
  70. %>
  71. <%!
  72. public Iterator getIterator(String source){
  73. JSONObject json = JSONObject.fromObject(source);
  74. Iterator<?> iter = json.keySet().iterator();
  75. Map map = new HashMap<String, String>();
  76. while (iter.hasNext()) {
  77. String key = (String) iter.next();
  78. String value = json.getString(key);
  79. map.put(key, value);
  80. }
  81. Set<?> set = map.entrySet();
  82. Iterator<?> it = set.iterator();
  83. return it;
  84. }
  85. %>