addOilAdd.jsp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  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. <link href="/shares/js/yw/master1/liger/skins/ynet/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  9. <link href="${pageContext.request.contextPath }/main.css" rel="stylesheet" type="text/css" />
  10. <link href="/shares/css/yw/master1/reset.css" rel="stylesheet" type="text/css" />
  11. <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
  12. <script type="text/javascript" src="/shares/js/file.js"></script>
  13. <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  14. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  15. <script type="text/javascript" src="/shares/js/constant.js"></script>
  16. <script type="text/javascript" src="/shares/js/common.js"></script>
  17. <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
  18. <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
  19. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
  20. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
  21. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
  22. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  23. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  24. <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
  25. <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
  26. <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
  27. <link rel="stylesheet" type="text/css" href="/shares/css/yw/master1/${sessionScope.loginFrom}/jquery.jscrollpane.codrops1.css" />
  28. <script type="text/javascript" src="/shares/js/yw/master1/jquery.mousewheel.js"></script>
  29. <!-- the jScrollPane script -->
  30. <script type="text/javascript" src="/shares/js/yw/master1/jquery.jscrollpane.min.js"></script>
  31. <script type="text/javascript" src="/shares/js/yw/master1/scroll-startstop.events.jquery.js"></script>
  32. <script type="text/javascript" src="/shares/js/yw/master1/scroll.js"></script>
  33. <script type="text/javascript">
  34. //焦点
  35. $(document).ready(function() {
  36. $("input[type='text']:first").focus();
  37. //$("#gas_station").ligerComboBox();
  38. //$("#oilType").ligerComboBox();
  39. });
  40. function checkForm(){
  41. var rs = $.validate({
  42. name : "plate_number",
  43. model : [ {
  44. type : "require",
  45. msg : "车牌号不能为空!"
  46. }]
  47. });
  48. rs = $.validate({
  49. name : "gas_station",
  50. model : [ {
  51. type : "require",
  52. msg : "油库不能为空!"
  53. } ]
  54. }) && rs;
  55. rs = $.validate({
  56. name : "gas_volume",
  57. model : [ {
  58. type : "require",
  59. msg : "加油量不能为空!"
  60. } ]
  61. }) && rs;
  62. rs = $.validate({
  63. name : "gas_time",
  64. model : [ {
  65. type : "require",
  66. msg : "加油时间不能为空!"
  67. } ]
  68. }) && rs;
  69. /* rs = $.validate({
  70. name : "handle_per_name",
  71. model : [ {
  72. type : "require",
  73. msg : "经手人不能为空!"
  74. } ]
  75. }) && rs; */
  76. if (rs) {
  77. var a = $("#gas_time").val();
  78. $("#gas_times").val(a);
  79. var gas_station = $("#gas_station").val();
  80. if(gas_station != ""){
  81. var oilMass = "";
  82. $.ajax({
  83. url:'carOilDepotAction.do?task=numeration',
  84. async: false,
  85. type: 'post',
  86. data: {"oilIn.oil_depot_id":$("#gas_station").val(),"oilIn.oil_num_id":$("#oil_type_id").val()},
  87. cache: false,
  88. error: function(obj){},
  89. success: function(obj){
  90. if(obj!=""){
  91. oilMass = obj;
  92. }
  93. }
  94. });
  95. if(oilMass != ""){
  96. var oilMass1 = $("#gas_volume").val();
  97. if(parseInt(oilMass1) > parseInt(oilMass)){
  98. $.ligerDialog.alert('油库油量('+oilMass+')不足!', '提示', 'warn');
  99. return false;
  100. }
  101. }
  102. }
  103. return true;
  104. }else{
  105. return false;
  106. }
  107. }
  108. $(function() {
  109. loadTypeTree("assignedUserBtn", {
  110. type : "usersingle",
  111. backId : "handle_per",
  112. backName : "handle_per_name",
  113. tab : "1,2,3"
  114. });
  115. });
  116. $(function() {
  117. $("#gas_time").ligerDateEditor({showTime: true,labelAlign : 'left',width : 171,height : 21});
  118. });
  119. function numeration () {
  120. var gas_station = $("#gas_station").val();
  121. if(gas_station != ""){
  122. var oilMass = "";
  123. $.ajax({
  124. url:'carOilDepotAction.do?task=numeration',
  125. async: false,
  126. type: 'post',
  127. data: {"oilIn.oil_depot_id":$("#gas_station").val(),"oilIn.oil_num_id":$("#oil_type_id").val()},
  128. cache: false,
  129. error: function(obj){},
  130. success: function(obj){
  131. if(obj!=""){
  132. oilMass = obj;
  133. }
  134. }
  135. });
  136. if(oilMass != ""){
  137. var oilMass1 = $("#gas_volume").val();
  138. if(parseInt(oilMass1) > parseInt(oilMass)){
  139. $.ligerDialog.alert('油库油量('+oilMass+')不足!', '提示', 'warn');
  140. return false;
  141. }
  142. }
  143. }
  144. }
  145. function refresh(obj){
  146. if(obj == "1"){
  147. parent.location.reload();
  148. }
  149. }
  150. function check(event) {
  151. var e = window.event || event;
  152. var target = e.srcElement || e.target;
  153. var k = e.keyCode;
  154. if(isFunKey(k)) {
  155. return true;
  156. }
  157. var c = getChar(k);
  158. if(target.value.length == '' && (c == '-' || c == '+')) {
  159. return true;
  160. }
  161. if(isNaN(target.value + getChar(k))) {
  162. return false;
  163. }
  164. return true;
  165. }
  166. function isFunKey(code) {
  167. // 8 --> Backspace
  168. // 35 --> End
  169. // 36 --> Home
  170. // 37 --> Left Arrow
  171. // 39 --> Right Arrow
  172. // 46 --> Delete
  173. // 112~123 --> F1~F12
  174. var funKeys = [8, 35, 36, 37, 39, 46];
  175. for(var i = 112; i <= 123; i++) {
  176. funKeys.push(i);
  177. }
  178. for(var i = 0; i < funKeys.length; i++) {
  179. if(funKeys[i] == code) {
  180. return true;
  181. }
  182. }
  183. return false;
  184. }
  185. function getChar(k) {
  186. if(k >= 48 && k <= 57) {
  187. return String.fromCharCode(k);
  188. }
  189. if(k >= 96 && k <= 105) {
  190. return String.fromCharCode(k - 48);
  191. }
  192. if(k == 110 || k == 190 || k== 188 ) {
  193. return ".";
  194. }
  195. if(k == 109 || k == 189) {
  196. return "-";
  197. }
  198. if(k == 107 || k == 187) {
  199. return "+";
  200. }
  201. return "#";
  202. }
  203. function submitItemName() {
  204. $("#oil_type").val("");
  205. var plate_numbers = "";
  206. var plate_number= document.getElementById("plate_number");
  207. //var plate_number2= document.getElementById("plate_number").value;
  208. if (plate_number.value != "" && typeof (plate_number.value) != "undefined") {
  209. plate_numbers = encodeURI(encodeURI(plate_number.value));
  210. }
  211. if (plate_number != "" && typeof (plate_number) != "undefined") {
  212. sendAsyncAjax({"plate_numbers" : "111"}, "carOilDepotAction.do?task=toFind&plate_number="+plate_numbers+"", "json", process2);
  213. }
  214. }
  215. function process2(data){
  216. //if(data.win_state == '2'){
  217. // $.ligerDialog.alert('该项目已经中标!', '提示', 'warn');
  218. // return;
  219. //}
  220. $("#oil_type").val(data.dictionary_name);
  221. $("#oil_type_id").val(data.oil_plants_number);
  222. $("#car_id").val(data.universalid);
  223. }
  224. /*
  225. * jquery.js
  226. *
  227. * function:类似GOOGLE搜索框提示功能
  228. */
  229. (function($) {
  230. $.fn.autopoint = function (options) {
  231. defaults = {
  232. url:options.url,
  233. keyLeft : 37,//向左方向键
  234. keyUp : 38,//向上方向键
  235. keyRight : 39,//向右方向键
  236. keyDown : 40,//向下方向键
  237. keyEnter : 13,//回车键
  238. listHoverCSS : 'jhover',//提示框列表鼠标悬浮的样式
  239. tpl : '<div onchange="submitItemName();" class="list"><div class="word">{word}</div><div class="view">约{view}条记录</div></div>',
  240. topoffset:options.topoffset||5
  241. };
  242. var options = $.extend(defaults, options);
  243. var dropDiv = $('<div></div>').addClass('dropDiv').appendTo('body');
  244. var isOver = false;
  245. dropDiv.hover(
  246. function(){
  247. isOver = true;
  248. },
  249. function(){
  250. isOver = false;
  251. });
  252. return this.each(function(){
  253. var pa = $(this);
  254. $(this).bind('keydown',
  255. function(event){
  256. if (dropDiv.css('display') != 'none') {
  257. //当提示层显示时才对键盘事件处理
  258. var currentList = dropDiv.find('.' + options.listHoverCSS);
  259. if (event.keyCode == options.keyDown) {
  260. //如果按的是向下方向键
  261. if (currentList.length == 0) {
  262. //如果提示列表没有一个被选中,则将列表第一个选中
  263. $(this).val(getPointWord(dropDiv.find('.list:first').mouseover()));
  264. //$("#plate_number_id").val(getPointView(dropDiv.find('.list:first').mouseover()));
  265. //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
  266. submitItemName();
  267. }else if (currentList.next().length == 0) {
  268. //如果是最后一个被选中,则取消选中,即可认为是输入框被选中
  269. unHoverAll();
  270. }else {
  271. unHoverAll();
  272. //将原先选中列的下一列选中
  273. if (currentList.next().length != 0)
  274. $(this).val(getPointWord(currentList.next().mouseover()));
  275. //$("#plate_number_id").val(getPointView(currentList.next().mouseover()));
  276. //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
  277. submitItemName();
  278. }
  279. return false;
  280. }else if (event.keyCode == options.keyUp) {//如果按的是向上方向键
  281. if (currentList.length == 0) {
  282. $(this).val(getPointWord(dropDiv.find('.list:last').mouseover()));
  283. //$("#plate_number_id").val(getPointView(dropDiv.find('.list:last').mouseover()));
  284. //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
  285. submitItemName();
  286. }else if (currentList.prev().length == 0) {
  287. unHoverAll();
  288. }else {
  289. unHoverAll();
  290. if (currentList.prev().length != 0)
  291. $(this).val(getPointWord(currentList.prev().mouseover()));
  292. //$(this).val(getPointView(currentList.prev().mouseover()));
  293. //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
  294. submitItemName();
  295. }
  296. return false;
  297. }else if(event.keyCode == options.keyEnter) dropDiv.empty().hide();
  298. }
  299. //当按下键之前记录输入框值,以方便查看键弹起时值有没有变
  300. $(this).attr('alt', $(this).val());
  301. //$("#plate_number_id").attr('alt', $("#plate_number_id").val());
  302. submitItemName();
  303. }).bind('keyup', function(event){
  304. //如果弹起的键是向上或向下方向键则返回
  305. if(event.keyCode == options.keyDown||event.keyCode == options.keyUp) return;
  306. if($(this).val() == ''){
  307. dropDiv.empty().hide();
  308. return;
  309. }
  310. //若输入框值没有改变或变为空则返回
  311. if ($(this).val() == $(this).attr('alt'))
  312. return;
  313. getData(pa, $(this).val());
  314. }).bind('blur', function(){
  315. if(isOver&&dropDiv.find('.' + options.listHoverCSS)!=0) return;
  316. //文本输入框失去焦点则清空并隐藏提示层
  317. dropDiv.empty().hide();
  318. });
  319. /**处理ajax返回成功的方法**/
  320. handleResponse = function(parent, json) {
  321. var isEmpty = true;
  322. for(var o in json){
  323. if(o == 'data') isEmpty = false;
  324. }
  325. if(isEmpty) {
  326. showError("返回数据格式错误,请检查请求URL是否正确!");
  327. return;
  328. }
  329. if(json['data'].length == 0) {
  330. //返回数据为空
  331. return;
  332. }
  333. refreshDropDiv(parent, json);
  334. dropDiv.show();
  335. }
  336. /**处理ajax失败的方法**/
  337. handleError = function(error) {
  338. //showError("由于url错误或超时请求失败!");
  339. }
  340. showError = function(error){
  341. alert(error);
  342. }
  343. /**通过ajax返回json格式数据生成用来创建dom的字符串**/
  344. render = function(parent, json) {
  345. var res = json['data'] || json;
  346. var appendStr = '';
  347. //用json对象中内容替换模版字符串中匹配/\{([a-z]+)\}/ig的内容,如{word},{view}
  348. for ( var i = 0; i < res.length; i+=1) {
  349. appendStr += options.tpl.replace(/\{([a-z]+)\}/ig, function(m, n) {
  350. return res[i][n];
  351. });
  352. }
  353. jebind(parent, appendStr);
  354. }
  355. /**将新建dom对象插入到提示框中,并重新绑定mouseover事件监听**/
  356. jebind = function(parent, a) {
  357. dropDiv.append(a);
  358. dropDiv.find('.list').each(function() {
  359. $(this).unbind('mouseover').mouseover(function() {
  360. unHoverAll();
  361. $(this).addClass(options.listHoverCSS);
  362. }).unbind('click').click(function(){
  363. parent.val(getPointWord($(this)));
  364. dropDiv.empty().hide();
  365. parent.focus();
  366. submitItemName();
  367. });
  368. });
  369. }
  370. /**将提示框中所有列的hover样式去掉**/
  371. unHoverAll = function() {
  372. dropDiv.find('.list').each(function() {
  373. $(this).removeClass(options.listHoverCSS);
  374. });
  375. }
  376. /**在提示框中取得当前选中的提示关键字**/
  377. getPointWord = function(p) {
  378. return p.find('div:first').text()
  379. }
  380. //getPointView = function(p) {
  381. // return p.find('div:second').text()
  382. //}
  383. /**刷新提示框,并设定样式**/
  384. refreshDropDiv = function(parent, json) {
  385. var left = parent.offset().left;
  386. var height = parent.height();
  387. var top = parent.offset().top + options.topoffset + height;
  388. var width = options.width || parent.width() + 'px';
  389. dropDiv.empty();
  390. dropDiv.css( {
  391. 'border' : '1px solid #000000',
  392. 'left' : left,
  393. 'top' : top,
  394. 'width' : width
  395. });
  396. render(parent, json);
  397. //防止ajax返回之前输入框失去焦点导致提示框不消失
  398. parent.focus();
  399. }
  400. /**通过ajax向服务器请求数据**/
  401. getData = function(parent, word) {
  402. $.ajax( {
  403. type : 'GET',
  404. data : "word="+ word,
  405. url : options.url,
  406. dataType : 'json',
  407. timeout : 1000,
  408. success : function(json){handleResponse(parent, json);},
  409. error : handleError
  410. });
  411. $("#oil_type").val("");
  412. }
  413. });
  414. }
  415. })(jQuery);
  416. $(function(){
  417.   $("#plate_number").autopoint({url:'carOilDepotAction.do?task=checkUp'});
  418. });
  419. </script>
  420. <style type="text/css">
  421. .dropDiv {
  422. position: absolute;
  423. z-index: 9999;
  424. display: block;
  425. cursor: hand;
  426. background-color: #FFFFFF;
  427. }
  428. .dropDiv .jhover {
  429. background-color: #D3D3D3;
  430. }
  431. .dropDiv .list {
  432. float:left;
  433. width:100%;
  434. height: 25px;
  435. }
  436. .dropDiv .word {
  437. float:left;
  438. }
  439. .dropDiv .view {
  440. float:right;
  441. color: gray;
  442. text-align: right;
  443. font-size: 10pt;
  444. display: none;
  445. }
  446. body {
  447. background: #fff;
  448. }
  449. .forum-container .l-table-edit-td2 span {
  450. font-size: 16px;
  451. color: #000;
  452. font-family: "微软雅黑";
  453. font-weight: 100;
  454. line-height: 28px;
  455. color: #737373;
  456. }
  457. .forum-container .l-table-edit-td2 select {
  458. background: #fff;
  459. border: 1px solid #afafaf;
  460. border-right: 1px solid #d3d3d3;
  461. border-bottom: 1px solid #d3d3d3;
  462. width: 165px;
  463. height: 24px;
  464. line-height: 24px;
  465. padding: 0 0px;
  466. color: #737373;
  467. }
  468. </style>
  469. </head>
  470. <body style="background: none; overflow: hidden;" ontouchmove="event.preventDefault();">
  471. <!-- <h1>Google搜索</h1>
  472. <div style="margin-top: 20px; margin-left: 30px">
  473. 请输入搜索关键字:<input type="text" size="50" />
  474.    <input type="text" size="50" />
  475. </div>
  476. </body>
  477. <body>
  478. -->
  479. <%@ include file="/include/message.jsp"%>
  480. <form action="MTOilDepot.do" method="post" onsubmit="return checkForm()">
  481. <div class="s_title b10 f6">
  482. <img src="/shares/images/master1/gg_ico.png" width="27" height="26" /> 新增加油
  483. <div class="article_title">
  484. <input class="art_back" style="width: 50px;" title="返回" name="" onclick="history.back();" type="button" />
  485. <input class="art_sub" title="保存" name="" type="submit" value=""/>
  486. </div>
  487. </div>
  488. <div id="jp-container" class="jp-container liuyan">
  489. <div class="forum-container">
  490. <center>
  491. <table class="l-table-edit line">
  492. <tr>
  493. <th colspan="4">加油信息</th>
  494. </tr>
  495. <tr>
  496. <td class="l-table-edit-text" width="15%">车牌号<FONT COLOR="red">*</FONT>:</td>
  497. <td class="l-table-edit-td" width="85%" colspan="3">
  498. <input type="text" name="gas.plate_number" id="plate_number" autocomplete="off" style="width: 300px;">
  499. <input type="hidden" name="gas.car_id" id="car_id" style="width: 300px;">
  500. </td>
  501. </tr>
  502. <tr>
  503. <td class="l-table-edit-text" width="15%">油库<FONT COLOR="red">*</FONT>:</td>
  504. <td class="l-table-edit-td2" width="85%" colspan="3">
  505. <select name="gas.gas_station" id="gas_station" style="width: 173px;">
  506. <option value="">--选择--</option>
  507. <c:forEach items="${depots }" var="depots">
  508. <option value="${depots.universalid }">
  509. ${depots.oil_depot_name}
  510. </option>
  511. </c:forEach>
  512. </select></td>
  513. </tr>
  514. <tr>
  515. <td class="l-table-edit-text">油号:</td>
  516. <td class="l-table-edit-td" colspan="3">
  517. <input type="text" id="oil_type" name="oil_type" value="" disabled="disabled">
  518. <input type="hidden" id="oil_type_id" name="gas.oil_type" value="">
  519. </td>
  520. </tr>
  521. <tr>
  522. <td class="l-table-edit-text">加油量<FONT COLOR="red">*</FONT>:</td>
  523. <td class="l-table-edit-td" colspan="3">
  524. <select id="oilType" name="oilType" style="width: 173px;">
  525. <option value="1">升</option>
  526. <option value="2">公斤</option>
  527. </select>
  528. <input type="text" onblur="numeration();" id="gas_volume" name="gas.gas_volume" value="" style="ime-mode: disabled;" onpaste="return false" onkeydown="return check(event)" onkeyup="if(isNaN(this.value)||this.value<0||this.value>100000000000) this.value='0'">
  529. </td>
  530. </tr>
  531. <tr>
  532. <td class="l-table-edit-text">加油时间:<FONT COLOR="red">*</FONT></td>
  533. <td class="l-table-edit-td" colspan="3">
  534. <input type="text" id="gas_time" name="gas_time" value="">
  535. <input type="hidden" id="gas_time" name="gas_time" value="">
  536. <input type="hidden" id="gas_times" name="gas_times" value="">
  537. </td>
  538. </tr>
  539. <tr>
  540. <td class="l-table-edit-text">经手人:</td>
  541. <td class="l-table-edit-td">
  542. <input type="hidden" name="gas.handle_per" id="handle_per" value="" />
  543. <input type="text" id="handle_per_name" name="handle_per_name" value="" readonly="readonly" />
  544. <input type="button" value="请选择" id="assignedUserBtn" class="l-button" />
  545. </td>
  546. </tr>
  547. <tr>
  548. <td class="l-table-edit-text">备注:</td>
  549. <td class="l-table-edit-td" colspan="3">
  550. <div style="float: left;">
  551. <textarea id="remark" name="gas.remark" rows="3" cols="61"></textarea>
  552. </div></td>
  553. </tr>
  554. </table>
  555. <input type="hidden" id="universalid" name="universalid" value="">
  556. <input type="hidden" id="task" name="task" value="doAddOilAdd">
  557. <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
  558. </center>
  559. </div>
  560. </div>
  561. </form>
  562. </body>
  563. </html>