sysGoodsApplicationEditOther.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <%--
  2. time:2017-06-05 16:33:55
  3. desc:edit the 物品申请
  4. --%>
  5. <%@page language="java" pageEncoding="UTF-8"%>
  6. <%@include file="/commons/include/html_doctype.html"%>
  7. <html>
  8. <head>
  9. <title>编辑 物品申请</title>
  10. <%@include file="/commons/include/form.jsp" %>
  11. <script type="text/javascript" src="${ctx}/js/hotent/CustomValid.js"></script>
  12. <script type="text/javascript" src="${ctx}/js/hotent/formdata.js"></script>
  13. <script type="text/javascript" src="${ctx}/js/hotent/subform.js"></script>
  14. <script type="text/javascript">
  15. var productids;
  16. $(function() {
  17. $("a.save").click(function() {
  18. var productcode = $("input[name='productcode']").val();
  19. if(!productcode) {
  20. $.ligerDialog.warn("请添加至少一件物品","消息提示");
  21. return;
  22. }
  23. $("#sysGoodsApplicationForm").attr("action","save.ht");
  24. $("#saveData").val(1);
  25. submitForm();
  26. });
  27. });
  28. //提交表单
  29. function submitForm(){
  30. var options={};
  31. if(showResponse){
  32. options.success=showResponse;
  33. }
  34. var frm=$('#sysGoodsApplicationForm').form();
  35. frm.ajaxForm(options);
  36. if(frm.valid()){
  37. frm.sortList();
  38. frm.submit();
  39. }
  40. }
  41. function showResponse(responseText) {
  42. var obj = new com.hotent.form.ResultMessage(responseText);
  43. if(!obj.isSuccess()){
  44. $.ligerDialog.err("提示信息"," 物品申请保存失败!",obj.getMessage());
  45. return;
  46. }
  47. $.ligerDialog.confirm(obj.getMessage()+",是否继续操作","提示信息", function(rtn) {
  48. if(rtn){
  49. window.location.href = window.location.href;
  50. }else{
  51. window.location.href = "${ctx}/platform/system/sysGoodsApplication/list.ht?flag=${sysGoodsApplication.flag}";
  52. }
  53. });
  54. }
  55. /*选择物品*/
  56. function selectGoods(flag){goodsDialog(flag,{callback:function (data){
  57. var temddata = data[0].value.split("#");
  58. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productid"]').val(temddata[0]);
  59. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productcode"]').val(temddata[1]);
  60. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productname"]').val(temddata[2]);
  61. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="brand"]').val(temddata[3]);
  62. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="specification"]').val(temddata[4]);
  63. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="price"]').val(temddata[5]);
  64. }});
  65. }
  66. /*物品对话框*/
  67. function goodsDialog(flag,conf){
  68. $("input[name='productid']").each(function(){
  69. var pro = $(this),
  70. tr = pro.parents("tr"),
  71. productid = $("input[name='productid']",tr).val();
  72. if(productid && productids.indexOf(productid) == -1) {
  73. productids = productid + "," + productids;
  74. }
  75. });
  76. if(!productids) productids = "";
  77. if(!conf) conf={};
  78. var url=__ctx + "/platform/system/sysGoodsApplication/selector.ht?flag=" + flag + "&productids=" + productids;
  79. var dialog = null;
  80. dialog = DialogUtil.open({
  81. passConf : {dialog:dialog},
  82. url:url,
  83. title : "物品列表",
  84. width : 600,
  85. height : 400,
  86. modal : true,
  87. resizable : true,
  88. buttons:[{
  89. text:'确定',
  90. onclick:function(){
  91. var arrysysgoods = dialog.jiframe.contents().find("input[name='sysgoodsdata'][checked]");
  92. if(conf.callback){
  93. conf.callback(arrysysgoods);
  94. dialog.close();
  95. }else{
  96. dialog.close();
  97. }
  98. }
  99. },{
  100. text:'取消',
  101. onclick: function (item,dialog) { dialog.close(); }
  102. }]
  103. });
  104. }
  105. function calculate(obj) {
  106. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val((($("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="price"]').val()*100).toFixed(2)*obj.val())/100);
  107. }
  108. function validateP(obj){
  109. var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
  110. if(!reg.test(obj.val())){
  111. $.ligerDialog.error("请输入正确数字类型","提示信息");
  112. obj.val("");
  113. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
  114. return;
  115. }
  116. }
  117. function validateQ(obj){
  118. var quantity = obj.val();
  119. var reg = /^[0-9]*$/;
  120. if(!reg.test(quantity)){
  121. $.ligerDialog.error("请输入正确数字类型","提示信息");
  122. obj.val("");
  123. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
  124. return;
  125. }
  126. var productid = $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="productid"]').val();
  127. var url = __ctx + "/platform/system/sysGoodsApplication/validate.ht";
  128. if(quantity.length > 0) {
  129. var rtn = {
  130. status : 0,
  131. msg : ""
  132. };
  133. $.ajax({
  134. url:url,
  135. data:{
  136. productid : productid,
  137. quantity : quantity
  138. },
  139. async:false
  140. }).done(function(data){
  141. if(data.status){
  142. rtn.status = -1;
  143. rtn.msg = data.msg;
  144. }
  145. }).fail(function(){
  146. rtn.status = -1;
  147. rtn.msg='后台出错!';
  148. });
  149. if(rtn.status){
  150. if(rtn.msg){
  151. $.ligerDialog.warn(rtn.msg,"消息提示");
  152. }
  153. obj.val("");
  154. $("#sysGoodsApplicationRelaForm tr,th,td").find('input[name="totalprice"]').val("");
  155. return;
  156. }
  157. }
  158. }
  159. </script>
  160. </head>
  161. <body>
  162. <div class="panel">
  163. <div class="panel-top">
  164. <div class="tbar-title">
  165. <c:choose>
  166. <c:when test="${sysGoodsApplication.id !=null}">
  167. <span class="tbar-label"><span></span>编辑物品申请</span>
  168. </c:when>
  169. <c:otherwise>
  170. <span class="tbar-label"><span></span>添加物品申请</span>
  171. </c:otherwise>
  172. </c:choose>
  173. </div>
  174. <div class="panel-toolbar">
  175. <div class="toolBar">
  176. <div class="group"><a class="link save" id="dataFormSave" href="#"><span></span>申请</a></div>
  177. <div class="l-bar-separator"></div>
  178. <div class="group"><a class="link back" href="list.ht?flag=${sysGoodsApplication.flag}"><span></span>返回</a></div>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="panel-body">
  183. <form id="sysGoodsApplicationForm" method="post" action="save.ht">
  184. <table class="table-detail" cellpadding="0" cellspacing="0" border="0" type="main">
  185. <tr>
  186. <th width="20%">申请科室: </th>
  187. <td><input type="text" id="department" name="department" value="${sysGoodsApplication.department}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
  188. </tr>
  189. <tr>
  190. <th width="20%">人员: </th>
  191. <td><input type="text" id="personnel" name="personnel" value="${sysGoodsApplication.personnel}" class="inputText" validate="{required:false,maxlength:32}" readonly /></td>
  192. </tr>
  193. <tr>
  194. <th width="20%">申请时间: </th>
  195. <td><input type="text" id="applicationdate" name="applicationdate" value="<fmt:formatDate value='${sysGoodsApplication.applicationdate}' pattern='yyyy-MM-dd HH:mm:ss'/>" class="inputText" style="width:150px" validate="{date:true}" readonly /></td>
  196. </tr>
  197. <tr>
  198. <th width="20%">申请原因: </th>
  199. <td><textarea rows="6" style="width:500px" id="reason" name="reason" validate={required:false}></textarea></td>
  200. </tr>
  201. </table>
  202. <table class="table-grid table-list" cellpadding="1" cellspacing="1" id="sysGoodsApplicationRela" formtype="form" type="subtable">
  203. <tr>
  204. <td colspan="8">
  205. <div class="group" align="left">
  206. <a id="btnAdd" class="link add">添加</a>
  207. </div>
  208. <div align="center">
  209. 申请物品
  210. </div>
  211. </td>
  212. </tr>
  213. <tr>
  214. <th>物品编号</th>
  215. <th>物品名称</th>
  216. <th>品牌</th>
  217. <th>规格</th>
  218. <th>数量</th>
  219. </tr>
  220. <c:forEach items="${sysGoodsApplicationRelaList}" var="sysGoodsApplicationRelaItem" varStatus="status">
  221. <tr type="subdata">
  222. <td style="text-align: center" name="productcode">${sysGoodsApplicationRelaItem.productcode}</td>
  223. <td style="text-align: center" name="productname">${sysGoodsApplicationRelaItem.productname}</td>
  224. <td style="text-align: center" name="brand">${sysGoodsApplicationRelaItem.brand}</td>
  225. <td style="text-align: center" name="specification">${sysGoodsApplicationRelaItem.specification}</td>
  226. <td style="text-align: center" name="quantity">${sysGoodsApplicationRelaItem.quantity}</td>
  227. <input type="hidden" name="productid" value="${sysGoodsApplicationRelaItem.productid}"/>
  228. <input type="hidden" name="productcode" value="${sysGoodsApplicationRelaItem.productcode}"/>
  229. <input type="hidden" name="productname" value="${sysGoodsApplicationRelaItem.productname}"/>
  230. <input type="hidden" name="brand" value="${sysGoodsApplicationRelaItem.brand}"/>
  231. <input type="hidden" name="specification" value="${sysGoodsApplicationRelaItem.specification}"/>
  232. <input type="hidden" id="price" name="price" value="${sysGoodsApplicationRelaItem.price}"/>
  233. <input type="hidden" name="quantity" value="${sysGoodsApplicationRelaItem.quantity}"/>
  234. <input type="hidden" id="totalprice" name="totalprice" value="${sysGoodsApplicationRelaItem.totalprice}"/>
  235. </tr>
  236. </c:forEach>
  237. <tr type="append">
  238. <td style="text-align: center" name="productcode"></td>
  239. <td style="text-align: center" name="productname"></td>
  240. <td style="text-align: center" name="brand"></td>
  241. <td style="text-align: center" name="specification"></td>
  242. <td style="text-align: center" name="quantity"></td>
  243. <input type="hidden" name="productid" value=""/>
  244. <input type="hidden" name="productcode" value=""/>
  245. <input type="hidden" name="productname" value=""/>
  246. <input type="hidden" name="brand" value=""/>
  247. <input type="hidden" name="specification" value=""/>
  248. <input type="hidden" id="price" name="price" value=""/>
  249. <input type="hidden" name="quantity" value=""/>
  250. <input type="hidden" id="totalprice" name="totalprice" value=""/>
  251. </tr>
  252. </table>
  253. <input type="hidden" name="id" value="${sysGoodsApplication.id}" />
  254. <input type="hidden" name="flag" value="${sysGoodsApplication.flag}" />
  255. <input type="hidden" name="saveData" id="saveData" />
  256. <input type="hidden" name="executeType" value="start" />
  257. </form>
  258. </div>
  259. <form id="sysGoodsApplicationRelaForm" style="display:none" title="申请物品">
  260. <table class="table-detail" id="sysGoodsApplicationRelaTable" cellpadding="0" cellspacing="0" border="0">
  261. <tr>
  262. <th width="20%">物品编号: <span class="required red">*</span></th>
  263. <td>
  264. <input type="text" name="productcode" value="" class="inputText" validate="{required:true,number:true }" readonly/>
  265. <a class="button" onclick="selectGoods('${sysGoodsApplication.flag}');"><span>选择</span></a>
  266. </td>
  267. </tr>
  268. <tr>
  269. <th width="20%">物品名称: <span class="required red">*</span></th>
  270. <td><input type="text" name="productname" value="" class="inputText" validate="{required:true,maxlength:128}"/></td>
  271. </tr>
  272. <tr>
  273. <th width="20%">品牌: <span class="required red">*</span></th>
  274. <td><input type="text" name="brand" value="" class="inputText" validate="{required:true,maxlength:32}"/></td>
  275. </tr>
  276. <tr>
  277. <th width="20%">规格: <span class="required red">*</span></th>
  278. <td><input type="text" name="specification" value="" class="inputText" validate="{required:true}" readonly/></td>
  279. </tr>
  280. <tr style="display:none">
  281. <th width="20%">价格: <span class="required red">*</span></th>
  282. <td><input type="text" name="price" value="" class="inputText" validate="{required:true,number:true,maxIntLen:18 }"/></td>
  283. </tr>
  284. <tr>
  285. <th width="20%">数量: <span class="required red">*</span></th>
  286. <td><input type="text" name="quantity" value="" class="inputText" onBlur="validateQ($(this))" onchange="calculate($(this))" validate="{required:true,number:true }"/></td>
  287. </tr>
  288. <tr style="display:none">
  289. <th width="20%">总价: <span class="required red">*</span></th>
  290. <td><input type="text" name="totalprice" value="" class="inputText" validate="{required:true,number:true,maxIntLen:18 }" readonly /></td>
  291. </tr>
  292. </table>
  293. <input type="hidden" name="productid" value=""/>
  294. </form>
  295. </div>
  296. </body>
  297. </html>