editFormFormula.jsp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. <%@ page language="java" contentType="text/html;charset=GBK"
  2. pageEncoding="GBK"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <html>
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  7. <title>动作设置</title>
  8. <link href="main.css" rel="stylesheet" type="text/css"></link>
  9. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  10. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  11. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
  12. <script type="text/javascript" src="/shares/js/yw/bpm/form/formFormula.js"></script>
  13. <script type="text/javascript" src="/shares/js/constant.js"></script>
  14. <script type="text/javascript" src="/shares/js/common.js"></script>
  15. <script type="text/javascript" src="/shares/js/yw/bpm/oa.js"></script>
  16. <script type="text/javascript" src="/shares/js/yw/bpm/promptDefine.js"></script>
  17. <script type="text/javascript">
  18. //0:无结尾,1:表单元素结尾,2:数字结尾,3:特殊符号结尾,4:运算符号结尾
  19. var eletime = parseInt("${requestScope.eletime}");
  20. $(document).ready(function() {
  21. var type = "${requestScope.formFormula.type.value }";
  22. if(type != null){
  23. $("#type").val(type);
  24. }
  25. });
  26. String.prototype.endWith=function(str){
  27. if(str==null||str==""||this.length==0||str.length>this.length)
  28. return false;
  29. if(this.substring(this.length-str.length)==str)
  30. return true;
  31. else
  32. return false;
  33. return true;
  34. };
  35. function getValue(bid){
  36. var str = document.getElementById(bid).value;
  37. var formulaTextShow = document.getElementById("formulaTextShow").value;
  38. if(eletime == 0 || eletime == 2 || eletime == 1 ){
  39. formulaTextShow = formulaTextShow + str;
  40. document.getElementById("formulaTextShow").value = formulaTextShow;
  41. eletime = 4;
  42. }else if(eletime == 3){
  43. if(formulaTextShow.endWith(")")){
  44. formulaTextShow = formulaTextShow + str;
  45. document.getElementById("formulaTextShow").value = formulaTextShow;
  46. eletime = 4;
  47. }else{
  48. addError("请用运算符号连接!");
  49. }
  50. }else if(eletime == 4){
  51. addError("请用其它元素连接!");
  52. }
  53. }
  54. function getNumValue(bid){
  55. var str = document.getElementById(bid).value;
  56. var formulaTextShow = document.getElementById("formulaTextShow").value;
  57. if(eletime == 0 || eletime == 2 || eletime == 4 ){
  58. formulaTextShow = formulaTextShow + str;
  59. document.getElementById("formulaTextShow").value = formulaTextShow;
  60. eletime = 2;
  61. }else if(eletime == 3){
  62. if(formulaTextShow.endWith(")")){
  63. addError("请用其它元素连接!");
  64. }else{
  65. formulaTextShow = formulaTextShow + str;
  66. document.getElementById("formulaTextShow").value = formulaTextShow;
  67. eletime = 2;
  68. }
  69. }else if(eletime == 1){
  70. addError("请用运算符号连接!");
  71. }
  72. }
  73. function getTsValue(bid){
  74. var str = document.getElementById(bid).value;
  75. var formulaTextShow = document.getElementById("formulaTextShow").value;
  76. if(eletime == 0 || eletime == 4){
  77. if(str == ")" || str == "."){
  78. addError("请用运算符号连接!");
  79. }else{
  80. formulaTextShow = formulaTextShow + str;
  81. document.getElementById("formulaTextShow").value = formulaTextShow;
  82. eletime = 3;
  83. }
  84. }else if(eletime == 1){
  85. if(str == "(" || str == "."){
  86. addError("请用运算符号连接!");
  87. }else{
  88. formulaTextShow = formulaTextShow + str;
  89. document.getElementById("formulaTextShow").value = formulaTextShow;
  90. eletime = 3;
  91. }
  92. }else if(eletime == 2){
  93. if(str == "("){
  94. addError("请用运算符号连接!");
  95. }else{
  96. formulaTextShow = formulaTextShow + str;
  97. document.getElementById("formulaTextShow").value = formulaTextShow;
  98. eletime = 3;
  99. }
  100. }else if(eletime == 3){
  101. addError("请用运算符号连接!");
  102. }
  103. }
  104. function clearFormulaText(){
  105. document.getElementById("formulaTextShow").value = "";
  106. eletime = 0;
  107. }
  108. function getElementValue(bid){
  109. var str = document.getElementById(bid).value;
  110. var formulaTextShow = document.getElementById("formulaTextShow").value;
  111. if(eletime == 0 || eletime == 4 ){
  112. formulaTextShow = formulaTextShow + str;
  113. document.getElementById("formulaTextShow").value = formulaTextShow;
  114. eletime = 1;
  115. }else if(eletime == 3){
  116. if(formulaTextShow.endWith("(")){
  117. formulaTextShow = formulaTextShow + str;
  118. document.getElementById("formulaTextShow").value = formulaTextShow;
  119. eletime = 4;
  120. }else{
  121. addError("请用运算符号连接!");
  122. }
  123. }else{
  124. addError("请用运算符号连接!");
  125. }
  126. }
  127. </script>
  128. </head>
  129. <body >
  130. <%@ include file="/include/message.jsp"%>
  131. <form action="FormFormulaAction.do" method="post" id="theForm" name="theForm" onsubmit="return checkForm();">
  132. <div id="title" class="form-button" style="width : 100%;">
  133. <input type="button" onclick="save()" class="l-button" value="保存" />
  134. <input onclick="closeTabUseInOA();" type="button" value="关闭" class="l-button">
  135. </div>
  136. <div class="container-layout">
  137. <div class="forum-container">
  138. <center>
  139. <table class="l-table-edit line">
  140. <tr>
  141. <th colspan="2">动作设置</th>
  142. </tr>
  143. <tr>
  144. <td class="l-table-edit-text" width="15%" >动作名称<FONT COLOR="red">*</FONT>:
  145. </td>
  146. <td class="l-table-edit-td" >
  147. &nbsp;&nbsp;<input type="text" id="formulaName"
  148. name="formulaName" value="${requestScope.formFormula.formulaName}" />
  149. </td>
  150. </tr>
  151. <tr>
  152. <td class="l-table-edit-text" width="15%" >动作 <FONT COLOR="red">*</FONT>:
  153. </td>
  154. <td class="l-table-edit-td" >
  155. &nbsp;&nbsp;<textarea name="formulaTextShow" id="formulaTextShow" cols="80" rows="5" readonly="readonly" >${requestScope.formFormula.formulaText }</textarea>
  156. <input type="hidden" id="formulaText" name="formulaText" value="${requestScope.formFormula.formulaText }">
  157. <input type="button" class="l-button" value="验证动作" onclick="checkFormula();" />&nbsp;
  158. <input type="button" class="l-button" value="清空" onclick="clearFormulaText();" />&nbsp;
  159. </td>
  160. </tr>
  161. <tr>
  162. <td class="l-table-edit-text" width="15%" >备注:
  163. </td>
  164. <td class="l-table-edit-td" >
  165. &nbsp;&nbsp;<textarea name="remark" id="remark" cols="80" rows="5">${requestScope.formFormula.remark }</textarea>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td class="l-table-edit-text" width="15%" >动作类型 :
  170. </td>
  171. <td class="l-table-edit-td" >
  172. &nbsp;&nbsp;<select name="type" id="type">
  173. <c:forEach items="${requestScope.bddzs }" var="bddz">
  174. <option value="${bddz.value }">${bddz.dataName }</option>
  175. </c:forEach>
  176. </select>
  177. </td>
  178. </tr>
  179. <tr>
  180. <td class="l-table-edit-text">运算符号:
  181. </td>
  182. <td class="l-table-edit-td">
  183. &nbsp;&nbsp;<input type="button" name="jia" id="jia" class="l-button" value="+" onclick="getValue(this.getAttribute('id'));" />&nbsp;
  184. <input type="button" name="jian" id="jian" class="l-button" value="-" onclick="getValue(this.getAttribute('id'));" />&nbsp;
  185. <input type="button" name="chen" id="chen" class="l-button" value="*" onclick="getValue(this.getAttribute('id'));" />&nbsp;
  186. <input type="button" name="chu" id="chu" class="l-button" value="/" onclick="getValue(this.getAttribute('id'));" />&nbsp;
  187. <%-- <input type="button" name="baifen" id="baifen" class="l-button" value="%" onclick="getValue(this.getAttribute('id'));" />&nbsp;--%>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td class="l-table-edit-text">特殊运算符号:
  192. </td>
  193. <td class="l-table-edit-td">
  194. &nbsp;&nbsp;<input type="button" name="zkh" id="zkh" class="l-button" value="(" onclick="getTsValue(this.getAttribute('id'));" />&nbsp;
  195. <input type="button" name="ykh" id="ykh" class="l-button" value=")" onclick="getTsValue(this.getAttribute('id'));" />&nbsp;
  196. <input type="button" name="dian" id="dian" class="l-button" value="." onclick="getTsValue(this.getAttribute('id'));" />&nbsp;
  197. </td>
  198. </tr>
  199. <tr>
  200. <td class="l-table-edit-text">运算数字:
  201. </td>
  202. <td class="l-table-edit-td">
  203. &nbsp;&nbsp;<input type="button" name="0" id="0" class="l-button" value="0" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  204. <input type="button" name="1" id="1" class="l-button" value="1" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  205. <input type="button" name="2" id="2" class="l-button" value="2" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  206. <input type="button" name="3" id="3" class="l-button" value="3" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  207. <input type="button" name="4" id="4" class="l-button" value="4" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  208. <input type="button" name="5" id="5" class="l-button" value="5" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  209. <input type="button" name="6" id="6" class="l-button" value="6" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  210. <input type="button" name="7" id="7" class="l-button" value="7" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  211. <input type="button" name="8" id="8" class="l-button" value="8" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  212. <input type="button" name="9" id="9" class="l-button" value="9" onclick="getNumValue(this.getAttribute('id'));" />&nbsp;
  213. </td>
  214. </tr>
  215. <%--
  216. <tr>
  217. <td class="l-table-edit-text">已有动作选择:
  218. </td>
  219. <td class="l-table-edit-td">
  220. &nbsp;
  221. <select name="fuhao" id="fuhao" style="width:50px">
  222. <option value="+">+</option>
  223. <option value="-">-</option>
  224. <option value="*">*</option>
  225. <option value="/">/</option>
  226. <option value="%">%</option>
  227. <option value="(">(</option>
  228. <option value=")">)</option>
  229. </select>
  230. </td>
  231. </tr>
  232. --%>
  233. <tr>
  234. <td class="l-table-edit-text">表单元素(数值型):
  235. </td>
  236. <td class="l-table-edit-td">
  237. &nbsp;
  238. <c:forEach items="${requestScope.elementList }" var="element">
  239. <input type="button" name="${element.elementId}" id="${element.elementId}" class="l-button" style="width:200px" value="${element.elementCode}" onclick="getElementValue(this.getAttribute('id'));" />&nbsp;
  240. </c:forEach>
  241. </td>
  242. </tr>
  243. </table>
  244. <input type="hidden" id="formulaId" name="formulaId" value="${requestScope.formFormula.formulaId }">
  245. <input type="hidden" id="formId" name="formId" value="${requestScope.formFormula.formId }">
  246. <input type="hidden" id="task" name="task" value="edit">
  247. <input type="hidden" id="tabid" name="tabid" value="${param.tabid }">
  248. </center>
  249. </div>
  250. </div>
  251. </form>
  252. </body>
  253. </html>