| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- <%@ page language="java" contentType="text/html;charset=GBK" pageEncoding="GBK"%>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html;charset=GBK">
- <title>新增加油登记</title>
- <link href="/shares/js/yw/master1/liger/skins/ynet/css/ligerui-all.css" rel="stylesheet" type="text/css" />
- <link href="${pageContext.request.contextPath }/main.css" rel="stylesheet" type="text/css" />
- <link href="/shares/css/yw/master1/reset.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="/shares/js/jquery-1.3.2.min.js"></script>
- <script type="text/javascript" src="/shares/js/file.js"></script>
- <script src="${pageContext.request.contextPath }/liger/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
- <script type="text/javascript" src="/shares/js/constant.js"></script>
- <script type="text/javascript" src="/shares/js/common.js"></script>
- <script src="/shares/xheditor/xheditor-1.1.14/xheditor-1.1.14-zh-cn.min.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/json2.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerTextBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/plugins/ligerSpinner.js" type="text/javascript"></script>
- <script src="${pageContext.request.contextPath }/liger/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
- <script type="text/javascript" src="${pageContext.request.contextPath}/liger/lib/ligerUI/js/ligerui.all.js"></script>
- <link rel="stylesheet" type="text/css" href="/shares/css/yw/master1/${sessionScope.loginFrom}/jquery.jscrollpane.codrops1.css" />
- <script type="text/javascript" src="/shares/js/yw/master1/jquery.mousewheel.js"></script>
- <!-- the jScrollPane script -->
- <script type="text/javascript" src="/shares/js/yw/master1/jquery.jscrollpane.min.js"></script>
- <script type="text/javascript" src="/shares/js/yw/master1/scroll-startstop.events.jquery.js"></script>
- <script type="text/javascript" src="/shares/js/yw/master1/scroll.js"></script>
- <script type="text/javascript">
- //焦点
- $(document).ready(function() {
- $("input[type='text']:first").focus();
- //$("#gas_station").ligerComboBox();
- //$("#oilType").ligerComboBox();
- });
-
- function checkForm(){
- var rs = $.validate({
- name : "plate_number",
- model : [ {
- type : "require",
- msg : "车牌号不能为空!"
- }]
- });
- rs = $.validate({
- name : "gas_station",
- model : [ {
- type : "require",
- msg : "油库不能为空!"
- } ]
- }) && rs;
- rs = $.validate({
- name : "gas_volume",
- model : [ {
- type : "require",
- msg : "加油量不能为空!"
- } ]
- }) && rs;
- rs = $.validate({
- name : "gas_time",
- model : [ {
- type : "require",
- msg : "加油时间不能为空!"
- } ]
- }) && rs;
- /* rs = $.validate({
- name : "handle_per_name",
- model : [ {
- type : "require",
- msg : "经手人不能为空!"
- } ]
- }) && rs; */
- if (rs) {
- var a = $("#gas_time").val();
- $("#gas_times").val(a);
- var gas_station = $("#gas_station").val();
- if(gas_station != ""){
- var oilMass = "";
- $.ajax({
- url:'carOilDepotAction.do?task=numeration',
- async: false,
- type: 'post',
- data: {"oilIn.oil_depot_id":$("#gas_station").val(),"oilIn.oil_num_id":$("#oil_type_id").val()},
- cache: false,
- error: function(obj){},
- success: function(obj){
- if(obj!=""){
- oilMass = obj;
- }
- }
- });
- if(oilMass != ""){
- var oilMass1 = $("#gas_volume").val();
- if(parseInt(oilMass1) > parseInt(oilMass)){
- $.ligerDialog.alert('油库油量('+oilMass+')不足!', '提示', 'warn');
- return false;
- }
- }
- }
- return true;
- }else{
- return false;
- }
- }
- $(function() {
- loadTypeTree("assignedUserBtn", {
- type : "usersingle",
- backId : "handle_per",
- backName : "handle_per_name",
- tab : "1,2,3"
- });
- });
- $(function() {
- $("#gas_time").ligerDateEditor({showTime: true,labelAlign : 'left',width : 171,height : 21});
- });
- function numeration () {
- var gas_station = $("#gas_station").val();
- if(gas_station != ""){
- var oilMass = "";
- $.ajax({
- url:'carOilDepotAction.do?task=numeration',
- async: false,
- type: 'post',
- data: {"oilIn.oil_depot_id":$("#gas_station").val(),"oilIn.oil_num_id":$("#oil_type_id").val()},
- cache: false,
- error: function(obj){},
- success: function(obj){
- if(obj!=""){
- oilMass = obj;
- }
- }
- });
- if(oilMass != ""){
- var oilMass1 = $("#gas_volume").val();
- if(parseInt(oilMass1) > parseInt(oilMass)){
- $.ligerDialog.alert('油库油量('+oilMass+')不足!', '提示', 'warn');
- return false;
- }
- }
- }
- }
- function refresh(obj){
- if(obj == "1"){
- parent.location.reload();
- }
- }
- function check(event) {
- var e = window.event || event;
- var target = e.srcElement || e.target;
- var k = e.keyCode;
- if(isFunKey(k)) {
- return true;
- }
- var c = getChar(k);
- if(target.value.length == '' && (c == '-' || c == '+')) {
- return true;
- }
- if(isNaN(target.value + getChar(k))) {
- return false;
- }
- return true;
- }
- function isFunKey(code) {
- // 8 --> Backspace
- // 35 --> End
- // 36 --> Home
- // 37 --> Left Arrow
- // 39 --> Right Arrow
- // 46 --> Delete
- // 112~123 --> F1~F12
- var funKeys = [8, 35, 36, 37, 39, 46];
- for(var i = 112; i <= 123; i++) {
- funKeys.push(i);
- }
- for(var i = 0; i < funKeys.length; i++) {
- if(funKeys[i] == code) {
- return true;
- }
- }
- return false;
- }
- function getChar(k) {
- if(k >= 48 && k <= 57) {
- return String.fromCharCode(k);
- }
- if(k >= 96 && k <= 105) {
- return String.fromCharCode(k - 48);
- }
- if(k == 110 || k == 190 || k== 188 ) {
- return ".";
- }
- if(k == 109 || k == 189) {
- return "-";
- }
- if(k == 107 || k == 187) {
- return "+";
- }
- return "#";
- }
- function submitItemName() {
- $("#oil_type").val("");
- var plate_numbers = "";
- var plate_number= document.getElementById("plate_number");
- //var plate_number2= document.getElementById("plate_number").value;
- if (plate_number.value != "" && typeof (plate_number.value) != "undefined") {
- plate_numbers = encodeURI(encodeURI(plate_number.value));
- }
- if (plate_number != "" && typeof (plate_number) != "undefined") {
- sendAsyncAjax({"plate_numbers" : "111"}, "carOilDepotAction.do?task=toFind&plate_number="+plate_numbers+"", "json", process2);
- }
- }
- function process2(data){
- //if(data.win_state == '2'){
- // $.ligerDialog.alert('该项目已经中标!', '提示', 'warn');
- // return;
- //}
- $("#oil_type").val(data.dictionary_name);
- $("#oil_type_id").val(data.oil_plants_number);
- $("#car_id").val(data.universalid);
- }
- /*
- * jquery.js
- *
- * function:类似GOOGLE搜索框提示功能
- */
- (function($) {
- $.fn.autopoint = function (options) {
- defaults = {
- url:options.url,
- keyLeft : 37,//向左方向键
- keyUp : 38,//向上方向键
- keyRight : 39,//向右方向键
- keyDown : 40,//向下方向键
- keyEnter : 13,//回车键
- listHoverCSS : 'jhover',//提示框列表鼠标悬浮的样式
- tpl : '<div onchange="submitItemName();" class="list"><div class="word">{word}</div><div class="view">约{view}条记录</div></div>',
- topoffset:options.topoffset||5
- };
- var options = $.extend(defaults, options);
- var dropDiv = $('<div></div>').addClass('dropDiv').appendTo('body');
- var isOver = false;
- dropDiv.hover(
- function(){
- isOver = true;
- },
- function(){
- isOver = false;
- });
- return this.each(function(){
- var pa = $(this);
- $(this).bind('keydown',
- function(event){
- if (dropDiv.css('display') != 'none') {
- //当提示层显示时才对键盘事件处理
- var currentList = dropDiv.find('.' + options.listHoverCSS);
- if (event.keyCode == options.keyDown) {
- //如果按的是向下方向键
- if (currentList.length == 0) {
- //如果提示列表没有一个被选中,则将列表第一个选中
- $(this).val(getPointWord(dropDiv.find('.list:first').mouseover()));
- //$("#plate_number_id").val(getPointView(dropDiv.find('.list:first').mouseover()));
- //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
- submitItemName();
- }else if (currentList.next().length == 0) {
- //如果是最后一个被选中,则取消选中,即可认为是输入框被选中
- unHoverAll();
- }else {
- unHoverAll();
- //将原先选中列的下一列选中
- if (currentList.next().length != 0)
- $(this).val(getPointWord(currentList.next().mouseover()));
- //$("#plate_number_id").val(getPointView(currentList.next().mouseover()));
- //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
- submitItemName();
- }
- return false;
- }else if (event.keyCode == options.keyUp) {//如果按的是向上方向键
- if (currentList.length == 0) {
- $(this).val(getPointWord(dropDiv.find('.list:last').mouseover()));
- //$("#plate_number_id").val(getPointView(dropDiv.find('.list:last').mouseover()));
- //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
- submitItemName();
- }else if (currentList.prev().length == 0) {
- unHoverAll();
- }else {
- unHoverAll();
- if (currentList.prev().length != 0)
- $(this).val(getPointWord(currentList.prev().mouseover()));
- //$(this).val(getPointView(currentList.prev().mouseover()));
- //$("#plate_number_id").val(getPointWord(dropDiv.find('.list:second').mouseover()));
- submitItemName();
- }
- return false;
- }else if(event.keyCode == options.keyEnter) dropDiv.empty().hide();
- }
- //当按下键之前记录输入框值,以方便查看键弹起时值有没有变
- $(this).attr('alt', $(this).val());
- //$("#plate_number_id").attr('alt', $("#plate_number_id").val());
- submitItemName();
- }).bind('keyup', function(event){
- //如果弹起的键是向上或向下方向键则返回
- if(event.keyCode == options.keyDown||event.keyCode == options.keyUp) return;
- if($(this).val() == ''){
- dropDiv.empty().hide();
- return;
- }
- //若输入框值没有改变或变为空则返回
- if ($(this).val() == $(this).attr('alt'))
- return;
- getData(pa, $(this).val());
- }).bind('blur', function(){
- if(isOver&&dropDiv.find('.' + options.listHoverCSS)!=0) return;
- //文本输入框失去焦点则清空并隐藏提示层
- dropDiv.empty().hide();
- });
- /**处理ajax返回成功的方法**/
- handleResponse = function(parent, json) {
- var isEmpty = true;
- for(var o in json){
- if(o == 'data') isEmpty = false;
- }
- if(isEmpty) {
- showError("返回数据格式错误,请检查请求URL是否正确!");
- return;
- }
- if(json['data'].length == 0) {
- //返回数据为空
- return;
- }
- refreshDropDiv(parent, json);
- dropDiv.show();
- }
- /**处理ajax失败的方法**/
- handleError = function(error) {
- //showError("由于url错误或超时请求失败!");
- }
- showError = function(error){
- alert(error);
- }
- /**通过ajax返回json格式数据生成用来创建dom的字符串**/
- render = function(parent, json) {
- var res = json['data'] || json;
- var appendStr = '';
- //用json对象中内容替换模版字符串中匹配/\{([a-z]+)\}/ig的内容,如{word},{view}
- for ( var i = 0; i < res.length; i+=1) {
- appendStr += options.tpl.replace(/\{([a-z]+)\}/ig, function(m, n) {
- return res[i][n];
- });
- }
- jebind(parent, appendStr);
- }
- /**将新建dom对象插入到提示框中,并重新绑定mouseover事件监听**/
- jebind = function(parent, a) {
- dropDiv.append(a);
- dropDiv.find('.list').each(function() {
- $(this).unbind('mouseover').mouseover(function() {
- unHoverAll();
- $(this).addClass(options.listHoverCSS);
- }).unbind('click').click(function(){
- parent.val(getPointWord($(this)));
- dropDiv.empty().hide();
- parent.focus();
- submitItemName();
- });
- });
- }
- /**将提示框中所有列的hover样式去掉**/
- unHoverAll = function() {
- dropDiv.find('.list').each(function() {
- $(this).removeClass(options.listHoverCSS);
- });
- }
- /**在提示框中取得当前选中的提示关键字**/
- getPointWord = function(p) {
- return p.find('div:first').text()
- }
- //getPointView = function(p) {
- // return p.find('div:second').text()
- //}
- /**刷新提示框,并设定样式**/
- refreshDropDiv = function(parent, json) {
- var left = parent.offset().left;
- var height = parent.height();
- var top = parent.offset().top + options.topoffset + height;
- var width = options.width || parent.width() + 'px';
- dropDiv.empty();
- dropDiv.css( {
- 'border' : '1px solid #000000',
- 'left' : left,
- 'top' : top,
- 'width' : width
- });
- render(parent, json);
- //防止ajax返回之前输入框失去焦点导致提示框不消失
- parent.focus();
- }
- /**通过ajax向服务器请求数据**/
- getData = function(parent, word) {
- $.ajax( {
- type : 'GET',
- data : "word="+ word,
- url : options.url,
- dataType : 'json',
- timeout : 1000,
- success : function(json){handleResponse(parent, json);},
- error : handleError
- });
- $("#oil_type").val("");
- }
- });
- }
- })(jQuery);
- $(function(){
- $("#plate_number").autopoint({url:'carOilDepotAction.do?task=checkUp'});
- });
- </script>
- <style type="text/css">
- .dropDiv {
- position: absolute;
- z-index: 9999;
- display: block;
- cursor: hand;
- background-color: #FFFFFF;
- }
- .dropDiv .jhover {
- background-color: #D3D3D3;
- }
- .dropDiv .list {
- float:left;
- width:100%;
- height: 25px;
- }
- .dropDiv .word {
- float:left;
- }
- .dropDiv .view {
- float:right;
- color: gray;
- text-align: right;
- font-size: 10pt;
- display: none;
- }
- body {
- background: #fff;
- }
- .forum-container .l-table-edit-td2 span {
- font-size: 16px;
- color: #000;
- font-family: "微软雅黑";
- font-weight: 100;
- line-height: 28px;
- color: #737373;
- }
- .forum-container .l-table-edit-td2 select {
- background: #fff;
- border: 1px solid #afafaf;
- border-right: 1px solid #d3d3d3;
- border-bottom: 1px solid #d3d3d3;
- width: 165px;
- height: 24px;
- line-height: 24px;
- padding: 0 0px;
- color: #737373;
- }
- </style>
- </head>
-
- <body style="background: none; overflow: hidden;" ontouchmove="event.preventDefault();">
- <!-- <h1>Google搜索</h1>
- <div style="margin-top: 20px; margin-left: 30px">
- 请输入搜索关键字:<input type="text" size="50" />
- <input type="text" size="50" />
- </div>
- </body>
- <body>
- -->
- <%@ include file="/include/message.jsp"%>
- <form action="MTOilDepot.do" method="post" onsubmit="return checkForm()">
- <div class="s_title b10 f6">
- <img src="/shares/images/master1/gg_ico.png" width="27" height="26" /> 新增加油
- <div class="article_title">
- <input class="art_back" style="width: 50px;" title="返回" name="" onclick="history.back();" type="button" />
- <input class="art_sub" title="保存" name="" type="submit" value=""/>
- </div>
- </div>
- <div id="jp-container" class="jp-container liuyan">
- <div class="forum-container">
- <center>
- <table class="l-table-edit line">
- <tr>
- <th colspan="4">加油信息</th>
- </tr>
- <tr>
- <td class="l-table-edit-text" width="15%">车牌号<FONT COLOR="red">*</FONT>:</td>
- <td class="l-table-edit-td" width="85%" colspan="3">
- <input type="text" name="gas.plate_number" id="plate_number" autocomplete="off" style="width: 300px;">
- <input type="hidden" name="gas.car_id" id="car_id" style="width: 300px;">
- </td>
- </tr>
- <tr>
- <td class="l-table-edit-text" width="15%">油库<FONT COLOR="red">*</FONT>:</td>
- <td class="l-table-edit-td2" width="85%" colspan="3">
- <select name="gas.gas_station" id="gas_station" style="width: 173px;">
- <option value="">--选择--</option>
- <c:forEach items="${depots }" var="depots">
- <option value="${depots.universalid }">
- ${depots.oil_depot_name}
- </option>
- </c:forEach>
- </select></td>
- </tr>
- <tr>
- <td class="l-table-edit-text">油号:</td>
- <td class="l-table-edit-td" colspan="3">
- <input type="text" id="oil_type" name="oil_type" value="" disabled="disabled">
- <input type="hidden" id="oil_type_id" name="gas.oil_type" value="">
- </td>
- </tr>
- <tr>
- <td class="l-table-edit-text">加油量<FONT COLOR="red">*</FONT>:</td>
- <td class="l-table-edit-td" colspan="3">
- <select id="oilType" name="oilType" style="width: 173px;">
- <option value="1">升</option>
- <option value="2">公斤</option>
- </select>
- <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'">
- </td>
- </tr>
- <tr>
- <td class="l-table-edit-text">加油时间:<FONT COLOR="red">*</FONT></td>
- <td class="l-table-edit-td" colspan="3">
- <input type="text" id="gas_time" name="gas_time" value="">
- <input type="hidden" id="gas_time" name="gas_time" value="">
- <input type="hidden" id="gas_times" name="gas_times" value="">
- </td>
- </tr>
- <tr>
- <td class="l-table-edit-text">经手人:</td>
- <td class="l-table-edit-td">
- <input type="hidden" name="gas.handle_per" id="handle_per" value="" />
- <input type="text" id="handle_per_name" name="handle_per_name" value="" readonly="readonly" />
- <input type="button" value="请选择" id="assignedUserBtn" class="l-button" />
- </td>
- </tr>
- <tr>
- <td class="l-table-edit-text">备注:</td>
- <td class="l-table-edit-td" colspan="3">
- <div style="float: left;">
- <textarea id="remark" name="gas.remark" rows="3" cols="61"></textarea>
- </div></td>
- </tr>
- </table>
- <input type="hidden" id="universalid" name="universalid" value="">
- <input type="hidden" id="task" name="task" value="doAddOilAdd">
- <input type="hidden" id="tabid" name="tabid" value="${requestScope.tabid}">
- </center>
- </div>
- </div>
- </form>
- </body>
- </html>
|