editCost.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  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. <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
  9. <script type="text/javascript" src="/shares/js/file.js"></script>
  10. <link href="${pageContext.request.contextPath}/main.css" rel="stylesheet" type="text/css" />
  11. <link href="${pageContext.request.contextPath }/liger/lib/ligerUI/skins/${sessionScope.css}/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  12. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  13. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  14. <script type="text/javascript" src="/shares/js/constant.js"></script>
  15. <script type="text/javascript" src="/shares/js/common.js"></script>
  16. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  17. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  19. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  23. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  24. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  25. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  26. <script type="text/javascript">
  27. //焦点
  28. $(document).ready(function() {
  29. $("input[type='text']:first").focus();
  30. $("#contributions_way").ligerComboBox();
  31. $("#cost_name").ligerComboBox();
  32. });
  33. function checkForm(){
  34. var rs = $.validate({
  35. name : "plate_number",
  36. model : [ {
  37. type : "require",
  38. msg : "车牌号不能为空!"
  39. }, {
  40. type : "len",
  41. min : 1,
  42. max : 50,
  43. msg : "车牌号长度不能超过50个字!"
  44. } ]
  45. });
  46. rs = $.validate({
  47. name : "cost_name",
  48. model : [ {
  49. type : "require",
  50. msg : "费用名称不能为空!"
  51. } ]
  52. }) && rs;
  53. rs = $.validate({
  54. name : "contributions_date",
  55. model : [ {
  56. type : "require",
  57. msg : "交费日期不能为空!"
  58. } ]
  59. }) && rs;
  60. if($("#contributions_money").val() != ''){
  61. rs = $.validate({
  62. name : "contributions_money",
  63. model : [{
  64. type : "isNumber",
  65. msg : "请输入数字!"
  66. },{
  67. type : "regex",
  68. regex: new RegExp("^[0-9].*$"),
  69. msg : "金额不能小于0!"
  70. },{type : "len",min : 0,max : 10,msg : "交费金额不能超过10个字符!"}]
  71. }) && rs;
  72. }
  73. /* rs = $.validate({
  74. name : "charge_unit",
  75. model : [ {
  76. type : "require",
  77. msg : "收费单位不能为空!"
  78. }]
  79. }) && rs; */
  80. if($("#contributions_way").val() != '1'){
  81. if($("#period_month").val() != ''){
  82. rs = $.validate({
  83. name : "period_month",
  84. model : [ {
  85. type : "require",
  86. msg : "周期{月}不能为空!"
  87. }, {
  88. type : "isNumber",
  89. msg : "请输入数字!"
  90. },{
  91. type : "regex",
  92. regex: new RegExp("^[0-9]*[1-9][0-9]*$"),
  93. msg : "请输入正整数!"
  94. }]
  95. }) && rs;
  96. }
  97. }
  98. if (rs) {
  99. //上传附件
  100. var e = document.getElementsByName("documentId");
  101. var evalue = "";
  102. for(var i=0;i<e.length;i++){
  103. if(""!=e[i].value){
  104. evalue=evalue + e[i].value +",";
  105. }
  106. }
  107. $("#upload_id").val(evalue);
  108. return true;
  109. }else{
  110. return false;
  111. }
  112. }
  113. $(function() {
  114. loadTypeTree("selectbutton1", {
  115. type : "singleuser",
  116. backId : "dev_buy_person",
  117. backName : "dev_buy_person_name",
  118. tab : 1
  119. });
  120. loadTypeTree("selectbutton2", {
  121. type : "detpusersingle",
  122. backId : "dev_useman",
  123. backName : "dev_useman_name",
  124. tab : 1
  125. });
  126. $("#contributions_date").ligerDateEditor({
  127. labelAlign : 'left'
  128. //initValue : '${requestScope.device.dev_buy_date }'
  129. });
  130. });
  131. /**
  132. * 选择车牌号函数
  133. */
  134. function chooseCustomer(o) {
  135. o = $.extend({
  136. plate_number_id : "plate_number_id",
  137. plate_number : "plate_number",
  138. out_car_mileage : "out_car_mileage",
  139. motorcade : "motorcade",
  140. checkbox : true
  141. }, o);
  142. $.ligerDialog.open({
  143. url : 'carMotorcadeCarAction.do?task=carList2&state=3&lookup=lookup&checkbox='+o.checkbox,
  144. height : 350,
  145. width : 800,
  146. title : "车辆信息",
  147. buttons : [
  148. {
  149. text : '确定',
  150. onclick : function(item, dialog) {
  151. var rows = dialog.frame.f_select();
  152. if(rows.length == 0){
  153. $.ligerDialog.alert('请选择一个车辆信息!', '提示', 'warn');
  154. return;
  155. }
  156. if(rows.length > 1){
  157. $.ligerDialog.alert('只能选择一个车辆信息!', '提示', 'warn');
  158. return;
  159. }
  160. var universalids = "", plate_numbers = "" ,initial_ranges = "" ,motorcades = "";
  161. if (rows) {
  162. for ( var i = 0; i < rows.length; i++) {
  163. universalids += ("," + rows[i].universalid);
  164. plate_numbers += ("," + rows[i].plate_number);
  165. initial_ranges += ("," + rows[i].initial_range);
  166. motorcades += ("," + rows[i].motorcade_name);
  167. }
  168. universalid = universalids.substring(1, universalids.length);
  169. plate_number = plate_numbers.substring(1, plate_numbers.length);
  170. initial_range = initial_ranges.substring(1, initial_ranges.length);
  171. motorcade = motorcades.substring(1, motorcades.length);
  172. }
  173. if ($("#" + o.plate_number_id).length > 0){
  174. $("#" + o.plate_number_id).val(universalid);
  175. }
  176. if ($("#" + o.plate_number).length > 0){
  177. $("#" + o.plate_number).val(plate_number);
  178. }
  179. if ($("#" + o.out_car_mileage).length > 0){
  180. $("#" + o.out_car_mileage).val(initial_range);
  181. }
  182. if ($("#" + o.motorcade).length > 0){
  183. $("#" + o.motorcade).val(motorcade);
  184. }
  185. //加一个获取联系列表的方法,实现客户和联系人的联动效果
  186. //if('' != o.inputid && 'undefined' != o.inputid){
  187. //getContacterList(ids, o);
  188. //}
  189. dialog.close();
  190. $(".l-dialog-win").remove();
  191. }
  192. }, {
  193. text : '取消',
  194. onclick : function(item, dialog) {
  195. dialog.close();
  196. $(".l-dialog-win").remove();
  197. }
  198. } ],
  199. name : "listDialog"
  200. });
  201. }
  202. //选择往来单位
  203. function chooseUnit(o){
  204. o = $.extend({
  205. charge_unit_id : "charge_unit_id",
  206. charge_unit : "charge_unit",
  207. checkbox : true
  208. }, o);
  209. $.ligerDialog.open({
  210. url : 'carDealingsUnitAction.do?task=toList1&lookup=lookup&checkbox='+o.checkbox,
  211. height : 350,
  212. width : 800,
  213. title : "往来单位",
  214. buttons : [
  215. {
  216. text : '确定',
  217. onclick : function(item, dialog) {
  218. var rows = dialog.frame.f_select();
  219. if(rows.length == 0){
  220. $.ligerDialog.alert('请选择一个单位信息!', '提示', 'warn');
  221. return;
  222. }
  223. if(rows.length > 1){
  224. $.ligerDialog.alert('只能选择一个单位信息!', '提示', 'warn');
  225. return;
  226. }
  227. var universalids = "", unit_names = "";
  228. if (rows) {
  229. for ( var i = 0; i < rows.length; i++) {
  230. universalids += ("," + rows[i].universalid);
  231. unit_names += ("," + rows[i].unit_name);
  232. }
  233. universalid = universalids.substring(1, universalids.length);
  234. unit_name = unit_names.substring(1, unit_names.length);
  235. }
  236. if ($("#" + o.charge_unit_id).length > 0){
  237. $("#" + o.charge_unit_id).val(universalid);
  238. }
  239. if ($("#" + o.charge_unit).length > 0){
  240. $("#" + o.charge_unit).val(unit_name);
  241. }
  242. dialog.close();
  243. $(".l-dialog-win").remove();
  244. }
  245. }, {
  246. text : '取消',
  247. onclick : function(item, dialog) {
  248. dialog.close();
  249. $(".l-dialog-win").remove();
  250. }
  251. } ],
  252. name : "listDialog"
  253. });
  254. }
  255. //付款方式选择
  256. function select() {
  257. if(($("#contributions_way").val()) == '2'){
  258. document.getElementById("period_month2").style.display = "inline";
  259. }
  260. if(($("#contributions_way").val()) == '1'){
  261. document.getElementById("period_month2").style.display = "none";
  262. }
  263. }
  264. $(function(){
  265. if(($("#contributions_way").val()) == '1'){
  266. document.getElementById("period_month2").style.display = "none";
  267. }
  268. });
  269. function refresh(obj){
  270. if(obj == "1"){
  271. parent.location.reload();
  272. }
  273. }
  274. </script>
  275. <style type="text/css">
  276. .file-style{
  277. width: 550px;
  278. }
  279. .file-style input[type='file'] {
  280. width:385px ;
  281. height:24px;
  282. line-height:22px;
  283. vertical-align: bottom;
  284. background-color: #fff;
  285. border: 1px solid #cccccc;
  286. margin-top: 2px;
  287. margin-bottom: 2px;
  288. }
  289. </style>
  290. </head>
  291. <body>
  292. <%@ include file="/include/message.jsp"%>
  293. <form action="carCostAction.do" method="post" onsubmit="return checkForm()">
  294. <div id="title" class="form-button">
  295. <input type="submit" class="l-button" value="确认" />
  296. <input type="button" value="关闭" class="l-button" onclick="closeWindow();" />
  297. </div>
  298. <div class="container-layout">
  299. <div class="forum-container">
  300. <center>
  301. <table class="l-table-edit line">
  302. <tr>
  303. <th colspan="4">
  304. 费用信息
  305. </th>
  306. </tr>
  307. <tr>
  308. <td class="l-table-edit-text">车牌号<FONT COLOR="red">*</FONT>:</td>
  309. <td class="l-table-edit-td" colspan="3">
  310. <input type="text" id="plate_number" name="plate_number" value="${cost.plate_number }" readonly="readonly">
  311. <input type="hidden" id="plate_number_id" name="plate_number_id" value="${cost.car_id }">
  312. <input type="button" class="l-button" value="选择"
  313. onclick="chooseCustomer({plate_number_id:'plate_number_id',plate_number:'plate_number',out_car_mileage:'out_car_mileage',motorcade:'motorcade'});" />
  314. </td>
  315. </tr>
  316. <tr>
  317. <td class="l-table-edit-text">费用名称<FONT COLOR="red">*</FONT>:</td>
  318. <td class="l-table-edit-td" colspan="3">
  319. <select id="cost_name" name="cost_name">
  320. <option value="${cost.cost_name }">${cost.dictionary_name }</option>
  321. <c:forEach items="${dictionaries }" var="dictionaries">
  322. <c:if test="${cost.cost_name != dictionaries.universalid }">
  323. <option value="${dictionaries.universalid }">${dictionaries.dictionary_name }</option>
  324. </c:if>
  325. </c:forEach>
  326. </select>
  327. </td>
  328. </tr>
  329. <tr>
  330. <td class="l-table-edit-text">交费日期<FONT COLOR="red">*</FONT>:</td>
  331. <td class="l-table-edit-td" colspan="3">
  332. <input type="text" id="contributions_date" name="contributions_date" value="${cost.contributions_date }" readonly="readonly">
  333. <input type="hidden" id="contributions_date" name="contributions_date" value="">
  334. </td>
  335. </tr>
  336. <tr>
  337. <td class="l-table-edit-text">交费金额:</td>
  338. <td class="l-table-edit-td" colspan="3">
  339. <c:if test="${cost.contributions_money != 0 }">
  340. <input type="text" id="contributions_money" name="contributions_money" value="${cost.contributions_money }">
  341. </c:if>
  342. <c:if test="${cost.contributions_money == 0}">
  343. <input type="text" id="contributions_money" name="contributions_money" value="">
  344. </c:if>
  345. </td>
  346. </tr>
  347. <tr>
  348. <td class="l-table-edit-text">收费单位:</td>
  349. <td class="l-table-edit-td" colspan="3">
  350. <input type="text" id="charge_unit" name="charge_unit" value="${cost.unit_name }">
  351. <input type="button" class="l-button" value="选择" id="select4"
  352. onclick="chooseUnit({universalid:'universalid',charge_unit:'charge_unit'});" />
  353. <input type="hidden" id="charge_unit_id" name="charge_unit_id" value="${cost.charge_unit }}">
  354. </td>
  355. </tr>
  356. <tr>
  357. <td class="l-table-edit-text">交费方式:</td>
  358. <td class="l-table-edit-td" colspan="3">
  359. <select id=contributions_way name="contributions_way" onchange="select()">
  360. <c:if test="${cost.contributions_way == 1 }">
  361. <option value="1">一次性</option>
  362. <option value="2">周期付</option>
  363. </c:if>
  364. <c:if test="${cost.contributions_way == 2 }">
  365. <option value="2">周期付</option>
  366. <option value="1">一次性</option>
  367. </c:if>
  368. </select>
  369. </td>
  370. </tr>
  371. <tr id="period_month2">
  372. <td class="l-table-edit-text">周期[月]:</td>
  373. <td class="l-table-edit-td" colspan="3">
  374. <c:if test="${cost.period_month != 0 }">
  375. <input type="text" id="period_month" name="period_month" value="${cost.period_month }">
  376. </c:if>
  377. <c:if test="${cost.period_month == 0}">
  378. <input type="text" id="period_month" name="period_month" value="">
  379. </c:if>
  380. </td>
  381. </tr>
  382. <tr style="height: 35px;">
  383. <td class="l-table-edit-text">上传附件:</td>
  384. <td class="l-table-edit-td" colspan="3">
  385. <input type="hidden" name="upload_id" id="upload_id">
  386. <jsp:include page="/include/file.jsp">
  387. <jsp:param name="fieldName" value="documentId"/>
  388. <jsp:param name="folder" value="car"/>
  389. <jsp:param name="documentId" value="${cost.upload_id }"/>
  390. <jsp:param name="size" value="5" />
  391. <jsp:param name="isDelFile" value="2" />
  392. <jsp:param name="definedCss" value="file-style" />
  393. <jsp:param name="isCrypt" value="1" />
  394. </jsp:include>
  395. </td>
  396. </tr>
  397. <tr>
  398. <td class="l-table-edit-text">备注:</td>
  399. <td class="l-table-edit-td" colspan="3">
  400. <div style="float: left;">
  401. <textarea id="remark" name="remark" rows="3" cols="61">${cost.remark }</textarea>
  402. </div>
  403. </td>
  404. </tr>
  405. </table>
  406. <input type="hidden" id="universalids" name="universalids" value="${cost.universalid}">
  407. <input type="hidden" id="uploadId" name="uploadId" value="${cost.upload_id}">
  408. <input type="hidden" id="task" name="task" value="doEditCost">
  409. <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
  410. </center>
  411. </div>
  412. </div>
  413. </form>
  414. </body>
  415. </html>