list.jsp 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <%@ page contentType="text/html; charset=UTF-8" language="java"%>
  2. <%@ page language="java" import="model.setup.constant.Collection" %>
  3. <%@ page language="java"
  4. import="com.sysmodel.datamodel.xmlmodel.ModelFactory,
  5. com.sysmodel.datamodel.xmlmodel.able.MdpConstant,
  6. com.sysmodel.datamodel.xmlmodel.able.Property,
  7. com.sysmodel.datamodel.xmlmodel.able.Template,
  8. com.sysmodel.datamodel.xmlmodel.DataContent,
  9. java.math.BigDecimal,
  10. java.util.*"%>
  11. <html>
  12. <%
  13. String nodeID = request.getParameter("nodeID")==null?"":(String)request.getParameter("nodeID") ;
  14. String codeName =request.getParameter("codeName") == null ? "" : request.getParameter("codeName");
  15. Collection cs = new Collection(nodeID,codeName,request.getContextPath());
  16. MdpConstant constant = ModelFactory.getSysmodel().getMdpConstantByName(codeName);
  17. %>
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  20. <title>常量信息维护</title>
  21. <link rel="stylesheet" href="../../../styles/css.css" type="text/css">
  22. <link rel="stylesheet" type="text/css" href="../../../../scripts/easyui/themes/default/easyui.css">
  23. <link rel="stylesheet" type="text/css" href="../../../../scripts/easyui/themes/icon.css">
  24. <link rel="stylesheet" type="text/css" href="../../../../scripts/easyui/themes/color.css">
  25. <link rel="stylesheet" type="text/css" href="../../../../scripts/easyui/demo/demo.css">
  26. <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
  27. <script type="text/javascript" src="../../../../scripts/easyui/jquery.easyui.min.js"></script>
  28. <script type="text/javascript" src="../../../../scripts/easyui/locale/easyui-lang-zh_CN.js"></script>
  29. <script>
  30. function submitAction(codeName,nodeID,cmd){
  31. if(cmd == "delete"){
  32. if(confirm("确定要删除吗?")){
  33. } else{
  34. return;
  35. }
  36. }
  37. form1.action = "listExec.jsp?codeName="+codeName+"&nodeID="+nodeID+"&cmd="+cmd ;
  38. form1.submit();
  39. }
  40. function checkEmpty(aControlName,aTipMsg){
  41. var aObj = document.forms[0].elements[aControlName];
  42. if(aObj.value==""){
  43. alert(aTipMsg + "不能为空!");
  44. aObj.focus();
  45. return false;
  46. }
  47. return true;
  48. }
  49. function isNumeric(aControlName,aTipMsg,aRegexValue){
  50. var aObj = document.forms[0].elements[aControlName];
  51. if(aObj.value=="") return true;
  52. var regex = new RegExp(aRegexValue);
  53. if(!regex.test(aObj.value)){
  54. alert(aTipMsg + "不是数值!");
  55. aObj.focus();
  56. return false;
  57. }
  58. return true;
  59. }
  60. function checkRange(aControlName,aTipMsg,maxValue,minValue){
  61. var aObj = document.forms[0].elements[aControlName];
  62. if(aObj.value=="") return true;
  63. var aCompareValue = parseFloat(aObj.value);
  64. if (maxValue != "" && aCompareValue > maxValue) {
  65. alert(aTipMsg + "不能大于 " + maxValue + " !");
  66. aObj.focus();
  67. return false;
  68. }
  69. if (minValue != "" && aCompareValue < minValue) {
  70. alert(aTipMsg + "不能小于 " + minValue + " !");
  71. aObj.focus();
  72. return false;
  73. }
  74. return true;
  75. }
  76. function checkMaxLength(aControlName,aTipMsg,maxLength){
  77. var aObj = document.forms[0].elements[aControlName];
  78. if(aObj.value.length>maxLength){
  79. alert(aTipMsg + "数据长度不能大于 " + maxLength + " 位!");
  80. return false;
  81. }
  82. return true;
  83. }
  84. function validateAllCode(aControlName,aTipMsg,dataType,theMaxLength,theScaleSize){
  85. var aObj = document.forms[0].elements[aControlName];
  86. if(dataType == "number"){
  87. if(isNumeric(aControlName,aTipMsg,"^(-|\\+)?\\d+(\\.\\d+)?$")) {
  88. return true;
  89. } else {
  90. document.forms[0].elements[aControlName].focus;
  91. return false ;
  92. }
  93. }else if(dataType =="string"){
  94. if(checkMaxLength(aControlName,aTipMsg,theMaxLength)) {
  95. return true;
  96. } else{
  97. document.forms[0].elements[aControlName].focus;
  98. return false;
  99. }
  100. }
  101. return true;
  102. }
  103. function checkinput(){
  104. return true;
  105. }
  106. function saveConButton(codeName,nodeID,cmd){
  107. $('#consMap_save').form('submit',{
  108. url: 'listExec.jsp?codeName='+codeName+'&nodeID='+nodeID+'&cmd='+cmd,
  109. onSubmit: function(){
  110. return $(this).form('validate');
  111. },
  112. success: function(result){
  113. var result = eval('('+result+')');
  114. if (!result.success){
  115. $.messager.show({
  116. title: 'Error',
  117. msg: result.success
  118. });
  119. } else {
  120. $('#consMapList').datagrid('reload'); // reload the user data
  121. }
  122. }
  123. });
  124. }
  125. function destroyMapButton(codeName,nodeID,cmd){
  126. $.messager.confirm('常量删除','确定要删除常量吗?',
  127. function(r){
  128. if (r){
  129. $.post('listExec.jsp',{codeName:codeName,nodeID:nodeID,cmd:cmd},function(result){
  130. if (result.success){
  131. $('#consMapList').datagrid('reload'); // reload the user data
  132. } else {
  133. $.messager.show({ // show error message
  134. title: 'Error',
  135. msg: result.errorMsg
  136. });
  137. }
  138. },'json');
  139. }
  140. });
  141. };
  142. </script>
  143. </head>
  144. <body>
  145. <div class="easyui-panel" title="<%=constant.getDescription()%>维护">
  146. <form name="form1" method="post" action="" id ="consMap_save">
  147. <div style="padding:0px 0px 0px 0px">
  148. <%=cs.createDetailHTML()%>
  149. <div style="text-align:center;padding:5px">
  150. <%if(!nodeID.equals("")){%>
  151. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveConButton('<%=codeName%>','<%=nodeID%>','modify')">修改</a>
  152. <%}%>
  153. <%if(nodeID.equals("")){%>
  154. <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveConButton('<%=codeName%>','<%=nodeID%>','add')">保存</a>
  155. <%}%>
  156. <!-- <input type="button" class="button" value="重置" onClick="document.form1.reset();"> -->
  157. </div>
  158. </div>
  159. <div class="report">
  160. <%
  161. List array_elements = constant.getListDataContent();
  162. DataContent dataContent = null;
  163. Template template = constant.getTemplate();
  164. List listProperty = template.getListproperty();
  165. int icols = listProperty.size();
  166. %>
  167. <div id="grid-example" style="height:500px;">
  168. <table id="consMapList" title="常量列表" class="easyui-datagrid"
  169. data-options="singleSelect:false,url:'json_data.jsp?nodeID=<%=nodeID %>&codeName=<%=codeName %>'"
  170. pagination="true"
  171. rownumbers="true"
  172. fit = "true"
  173. fitColumns="true">
  174. <thead>
  175. <tr>
  176. <%
  177. for (int j = 0; j < icols; j++) {
  178. Property property = (Property)listProperty.get(j);
  179. %>
  180. <th field="<%=property.getName() %>" width="50"><%=property.getDescription() %></th>
  181. <%} %>
  182. <th field="edit" width="50">修改</th>
  183. <th field="delete" width="50">删除</th>
  184. </tr>
  185. </thead>
  186. </table>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </form>
  192. </div>
  193. </body>
  194. </html>