budgetCostPostMaterialScheme-add.jsp 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>人员物资分配方案</title>
  7. <style>
  8. .ui-button {
  9. display: inline-block;
  10. padding: 2px 2px;
  11. margin-bottom: 0;
  12. font-size: 8px;
  13. font-weight: normal;
  14. line-height: 1.42857143;
  15. text-align: center;
  16. white-space: nowrap;
  17. vertical-align: middle;
  18. -ms-touch-action: manipulation;
  19. touch-action: manipulation;
  20. cursor: pointer;
  21. -webkit-user-select: none;
  22. -moz-user-select: none;
  23. -ms-user-select: none;
  24. user-select: none;
  25. background-image: none;
  26. border: 1px solid transparent;
  27. border-radius: 4px;
  28. }
  29. </style>
  30. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  31. <script src="${webBasePath}/webpage/cn/com/lzt/useractiviti/detail_tools.js"></script>
  32. <script type="text/javascript">
  33. $(document).ready(function(){
  34. $('#tt').tabs({
  35. onSelect:function(title){
  36. changeTabHeight();
  37. }
  38. });
  39. $(".tabs-wrap").css('width','100%');
  40. $('input[name$="num"]').live("change",function(){
  41. changeAmount(this);
  42. });
  43. $('input[name$="price"]').live("change",function(){
  44. changeAmount(this);
  45. });
  46. $('input[name$="materialName"]').live("click",function(){
  47. var tools = new detailTools('budgetCostPostMaterialSchemeDetail_table');
  48. var row =tools.touchRow(this);
  49. var type=row.getValue('type');
  50. if (type=='1'){
  51. addClothing(row);
  52. }else if (type=='2') {
  53. addGoods(row);
  54. }
  55. });
  56. if($.Datatype) {
  57. $.Datatype.fix2 = function (val, obj, frm) {
  58. $(obj).val(parseFloat(val).toFixed(2));
  59. return true;
  60. }
  61. }
  62. });
  63. function addGoods(row){
  64. var url="budgetDataController.do?selectReferGoods4Budget" +
  65. "&classname=cn.com.lzt.goodsinfo.entity.TBGoodsInfoEntity" +
  66. "&codefield=goodsCode" +
  67. "&categoryfield=belongCategoryCode" +
  68. "&categoryNamefield=belongCategoryName" +
  69. "&namefield=goodsName" +
  70. "&purchaseUnit=purchaseUnit" +
  71. "&specification=specification" +
  72. "&goodsDesc=goodsDesc" +
  73. "&strEmpty=strEmpty" +
  74. "&supplierName=defaultProvider&checkbox=false";
  75. _select(url,'选择货品',function(selected){
  76. var one =selected[0];
  77. row.setValue('materialId',one.id);
  78. row.setValue('materialName',one.goodsName);
  79. },'800px','600px');
  80. }
  81. function addClothing(row){
  82. var url="budgetDataController.do?selectClothing&checkbox=false";
  83. _select(url,'选择工作服',function(selected){
  84. var one = selected[0];
  85. row.setValue('materialId',one.id);
  86. row.setValue('materialName',one.name);
  87. },'800px','600px');
  88. }
  89. function changeAmount(obj){
  90. var tools = new detailTools('budgetCostPostMaterialSchemeDetail_table');
  91. var row =tools.touchRow(obj);
  92. var num=row.getValue('num');
  93. var price =row.getValue('price');
  94. if(num && price) {
  95. var amount = parseFloat(num)*parseFloat(price);
  96. row.setValue('amount',amount.toFixed(2));
  97. changeTotalAmount();
  98. }
  99. }
  100. function changeTotalAmount(){
  101. var totalAmount = 0;
  102. $('input[name$="amount"]').each(function(){
  103. var amount = $(this).val();
  104. if(amount) {
  105. totalAmount += parseFloat(amount);
  106. }
  107. });
  108. totalAmount=totalAmount.toFixed(2);
  109. $('#totalAmount').val(totalAmount);
  110. }
  111. function changeTabHeight(){
  112. var height =window.top.document.body.offsetHeight;
  113. height = height -181.3 - 36 - 100 -4;//去掉底部输入框table高度、title高度、弹出框小于后台页面高度、文本格式高度
  114. $('#tt .panel-body').css('width','auto').css('height',height+'px');
  115. }
  116. function _openDialog(url,title,okCallback,width,height){
  117. if(!width){
  118. width='500px';
  119. }
  120. if(!height){
  121. height='350px';
  122. }
  123. if(width=="100%"){
  124. width = window.top.document.body.offsetWidth;
  125. }
  126. if(height=="100%") {
  127. height =window.top.document.body.offsetHeight-100;
  128. }
  129. var _selectDialog= $.dialog({content:'url:'+url
  130. , zIndex: getzIndex()
  131. , title:title , lock: true, width:width, height: height, opacity: 0.4, button: [
  132. {name: '确定', callback:function () {
  133. var iframe = _selectDialog.iframe.contentWindow;
  134. if(okCallback){
  135. var b = okCallback(iframe);
  136. return b;
  137. }
  138. }
  139. , focus: true},
  140. {name: '取消', callback: function (){}}
  141. ]}).zindex();
  142. return _selectDialog;
  143. }
  144. function _select(url,title,okCallback,width,height){
  145. var dialog=_openDialog(url,title,function(iframe){
  146. var selectedRows = iframe.getSelectRows();
  147. if(selectedRows.length==0){
  148. iframe.tip('请至少选择一项');
  149. return false;
  150. }
  151. if(okCallback){
  152. var b = okCallback(selectedRows);
  153. return b;
  154. }
  155. },width,height);
  156. return dialog;
  157. }
  158. </script>
  159. </head>
  160. <body style="overflow-x: hidden;">
  161. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1" action="budgetCostPostMaterialSchemeController.do?doAdd" tipSweep="true">
  162. <input id="id" name="id" type="hidden" value="${entity.id }"/>
  163. <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
  164. <t:tab href="budgetCostPostMaterialSchemeController.do?budgetCostPostMaterialSchemeDetailList&id=${entity.id}" icon="icon-search" title="人员物资配置方案" id="budgetCostPostMaterialSchemeDetail"></t:tab>
  165. </t:tabs>
  166. <table cellpadding="0" cellspacing="1" class="formtable">
  167. <tr>
  168. <td align="right">
  169. <label class="Validform_label">名称:</label>
  170. </td>
  171. <td class="value">
  172. <input id="name" name="name" type="text" style="width: 150px" class="inputxt" datatype="*" ignore="checked" value="${entity.name}" />
  173. <span class="Validform_checktip"></span>
  174. <label class="Validform_label" style="display: none;">名称</label>
  175. </td>
  176. <td align="right">
  177. <label class="Validform_label">总金额:</label>
  178. </td>
  179. <td class="value">
  180. <input id="totalAmount" name="totalAmount" type="text" style="width: 150px" class="inputxt" readonly="readonly" value="${entity.totalAmount }"/>
  181. <span class="Validform_checktip"></span>
  182. <label class="Validform_label" style="display: none;">总金额</label>
  183. </td>
  184. </tr>
  185. </table>
  186. </t:formvalid>
  187. <!-- 添加 附表明细 模版 -->
  188. <table style="display:none">
  189. <tbody id="add_budgetCostPostMaterialSchemeDetail_table_template">
  190. <tr>
  191. <td align="center">
  192. <div style="width: 25px;" name="xh"></div>
  193. <input name="budgetCostPostMaterialSchemeDetailList[#index#].schemeId" type="hidden" />
  194. </td>
  195. <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
  196. <td align="left">
  197. <input name="budgetCostPostMaterialSchemeDetailList[#index#].type" type="hidden" />
  198. <input name="budgetCostPostMaterialSchemeDetailList[#index#].materialId" type="hidden" />
  199. <input name="budgetCostPostMaterialSchemeDetailList[#index#].materialName" maxlength="255" type="text" class="inputxt" style="width:120px;"
  200. datatype="*" nullmsg="请选择物资" readonly="readonly"/>
  201. <label class="Validform_label" style="display: none;">物资名称</label>
  202. </td>
  203. <td align="left">
  204. <input name="budgetCostPostMaterialSchemeDetailList[#index#].num" maxlength="32" type="text" class="inputxt" style="width:120px;" datatype="d,fix2"/>
  205. <label class="Validform_label" style="display: none;">数量</label>
  206. </td>
  207. <td align="left">
  208. <input name="budgetCostPostMaterialSchemeDetailList[#index#].price" maxlength="32" type="text" class="inputxt" style="width:120px;" datatype="d,fix2" />
  209. <label class="Validform_label" style="display: none;">均价</label>
  210. </td>
  211. <td align="left">
  212. <input name="budgetCostPostMaterialSchemeDetailList[#index#].amount" maxlength="32" type="text" class="inputxt" style="width:120px;" readonly="readonly"/>
  213. <label class="Validform_label" style="display: none;">金额</label>
  214. </td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. </body>
  219. <script src = "webpage/cn/com/lzt/budget/costpostmaterialscheme/budgetCostPostMaterialScheme.js"></script>