<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
|
<%Session.CodePage=65001%>
|
<%
|
'Response.Cookies("OA")("adminID")=""
|
'Response.end
|
CarGasID=request("CarGasID")
|
GasList=request("GasList")
|
state=request("state")
|
If state<>"" Then
|
stateSP=split(state,"|")
|
for i = 0 to UBOUND(stateSP)
|
If InStr(stateSP(i),"CarGasID=")=1 Then
|
CarGasID=Replace(stateSP(i),"CarGasID=","")
|
ElseIf InStr(stateSP(i),"GasList=")=1 Then
|
GasList=Replace(stateSP(i),"GasList=","")
|
End If
|
Next
|
End If
|
'if DispatchOrdID="" And ServiceOrdID="" then Response.Redirect "/"
|
%>
|
<!--#include virtual="/weixin/OAuth2.gds"-->
|
<!--#include virtual="/inc/function.gds"-->
|
<!--#include virtual="/weixin/sha1.gds"-->
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="keywords" content="">
|
<meta name="description" content="">
|
<meta name="author" content="">
|
<link rel="icon" href="assets/images/favicon.png" type="image/png">
|
<title>加油记录</title>
|
<link href="assets/css/icons.css" rel="stylesheet">
|
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
|
<link href="assets/css/style.css" rel="stylesheet">
|
<link href="assets/css/responsive.css" rel="stylesheet">
|
<link href="assets/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet">
|
<link href="assets/plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet">
|
|
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
|
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
<!--[if lt IE 9]>
|
<script src="js/html5shiv.min.js"></script>
|
<script src="js/respond.min.js"></script>
|
<![endif]-->
|
|
</head>
|
|
<body class="sticky-header">
|
|
|
<!--Start left side Menu-->
|
<div class="left-side sticky-left-side">
|
|
<!--logo-->
|
<div class="logo">
|
<a href="index.html"><img src="assets/images/logo.png" alt=""></a>
|
</div>
|
|
<div class="logo-icon text-center">
|
<a href="index.html"><img src="assets/images/logo-icon.png" alt=""></a>
|
</div>
|
<!--logo-->
|
|
<div class="left-side-inner">
|
<!--Sidebar nav-->
|
<!--#include virtual="/menu_left_new.gds"-->
|
<!--End sidebar nav-->
|
|
</div>
|
</div>
|
<!--End left side menu-->
|
|
<%
|
Set rs = Server.CreateObject("ADODB.Recordset")
|
OAID=session("adminID")
|
If CarGasID<>"" Then
|
sql="select * from CarGas,CarData where CarID=GasCarID and GasState>=0 and id="&CarGasID
|
rs.open sql,objConn,1,1
|
If not rs.Eof Then
|
CarGasID = rs("id")
|
CarID = rs("CarID")
|
CarLicense = rs("CarLicense") '车牌号码
|
GasMileage = rs("GasMileage") '
|
GasDate = rs("GasDate") '加油日期
|
GasVolume = rs("GasVolume") '加油量
|
GasPrice = rs("GasPrice") '单价
|
GasMacSumPrice = rs("GasMacSumPrice") '机显
|
GasSumPrice = rs("GasSumPrice") '总额
|
GasType = rs("GasType") '加油类型
|
OAID = rs("OAID")
|
OATime = rs("OATime")
|
GasStation = rs("GasStation")
|
GasPayment = rs("GasPayment")
|
GasRemarks = rs("GasRemarks")
|
is_JumpGun = rs("is_JumpGun")
|
End If
|
rs.close()
|
End If
|
If GasDate="" Then
|
GasTime=Time()
|
GasDate=Date()
|
Else
|
GasTime=Hour(GasDate)&":"&Minute(GasDate)
|
GasDate=Year(GasDate)&"/"&Month(GasDate)&"/"&Day(GasDate)
|
End If
|
%>
|
<!-- main content start-->
|
<div class="main-content" >
|
|
<!-- header section start-->
|
<div class="header-section">
|
|
<a class="toggle-btn"><i class="fa fa-bars"></i></a>
|
|
<form class="searchform">
|
<input type="text" class="form-control" name="keyword" placeholder="Search here..." />
|
</form>
|
|
<!--notification menu start -->
|
<div class="menu-right">
|
<ul class="notification-menu">
|
|
<li class="btn-default dropdown-toggle">
|
<%If CarGasID<>"" Then
|
Response.Write "加油记录:"&CarGasID
|
Else
|
Response.Write "记油耗"
|
End If
|
%>
|
</li>
|
|
</ul>
|
</div>
|
<!--notification menu end -->
|
|
</div>
|
<!-- header section end-->
|
|
|
|
<!--body wrapper start-->
|
<div class="wrapper" id="win_Orer">
|
<!-- Start -->
|
<div class="white-box">
|
<h2 class="header-title">加油记录</h2>
|
<form class="js-validation-bootstrap form-horizontal" action="#" name="SpecialOrderForm" method="post">
|
<input name="CarGasID" id="CarGasID" type="hidden" value="<%=CarGasID%>">
|
<input name="GasList" id="GasList" type="hidden" value="<%=GasList%>">
|
<input name="GasEndMileage" id="GasEndMileage" type="hidden" value="0">
|
<div class="form-group">
|
<label class="col-md-2 control-label">记录人员:<%=OAUser(OAID,"UserName")%></label>
|
</div>
|
|
<div class="form-group" id="CarDiv">
|
<label class="col-md-2 control-label">车牌<span class="text-danger">*</span></label>
|
<div class="col-md-6">
|
<input id="CarID" name="CarID" id="CarID" type="hidden" value="<%=CarID%>">
|
<input class="form-control" name="CarLicense" id="CarLicense" placeholder="点击选择.." type="text" onclick="JS_CarDialogOpen('CarDiv')" value="<%=CarLicense%>">
|
</div>
|
</div>
|
<script>
|
//打开查询对话框
|
function JS_CarDialogOpen(DivID,SearchTXT,page){
|
if (page==undefined && SearchTXT==undefined){JS_dialogSetUp(DivID,1,'JS_CarDialogOpen');}
|
$.ajax({
|
type: "POST",
|
dataType:'json',
|
url: "Search_Car_ajax.gds",
|
data: {
|
OrdClass:"<%=DispatchOrdClass%>",
|
CarSearchTXT:SearchTXT,
|
page:page
|
},
|
success:function(data){
|
//console.log(data);
|
if (data!=''){
|
if (data.result==1){
|
//表头
|
dialog_Header="";
|
for (i=0;i<data.Header.length;i++){
|
dialog_Header=dialog_Header+"<th>"+data.Header[i]+"</th>";
|
}
|
document.getElementById('dialog_Header').innerHTML=dialog_Header;
|
//内容
|
dialog_tbody="";
|
for (i=0;i<data.CarList.length;i++){
|
dialog_tbody=dialog_tbody+"<tr onclick=\"JS_CarSave('"+data.CarList[i].CarID+"','"+data.CarList[i].CarLicense+"',"+DivID+")\">";
|
dialog_tbody=dialog_tbody+"<td>"+data.CarList[i].CarLicense+"</td>";
|
dialog_tbody=dialog_tbody+"<td>"+data.CarList[i].CarModels+"</td>";
|
dialog_tbody=dialog_tbody+"</tr>";
|
}
|
for (i=i;i<10;i++){
|
dialog_tbody=dialog_tbody+"<tr>";
|
dialog_tbody=dialog_tbody+"<td> </td>";
|
dialog_tbody=dialog_tbody+"<td> </td>";
|
dialog_tbody=dialog_tbody+"</tr>";
|
}
|
document.getElementById('dialog_tbody').innerHTML=dialog_tbody;
|
//分页
|
JS_dialogPage(data.acc1,data.acc2,'JS_CarDialogOpen',DivID,data.SearchTXT);
|
|
}else{
|
alert(data.Error);
|
}
|
}
|
}
|
});
|
if (page==undefined && SearchTXT==undefined){JS_dialogOpen(DivID);}
|
}
|
//选择车辆
|
function JS_CarSave(CarID,CarLicense,DivID)
|
{
|
$.ajax({
|
type: "POST",
|
url: "admin_save.gds",//需要跳转到的界面 the page you want to post data
|
data: {
|
//要传给后台的数据 the data you should send to background
|
admin_save:"36_json",
|
DispatchOrdCarID:CarID,
|
isCarGas:"1"
|
},
|
dataType:'json',
|
beforeSend: function() {},//在发送之前你可以进行相关操作 what you want to do before send
|
success: function(data) {
|
console.log(data);
|
if (data!='')
|
{
|
if (data.result==1){
|
document.getElementById("GasEndMileage").value=data.GasEndMileage;
|
//if (data.GasPrice!=""){document.getElementById("GasPrice").value=data.GasPrice;}
|
if (data.GasType!=""){document.getElementById("GasType").value=data.GasType;}
|
}
|
}
|
}
|
})
|
document.getElementById("CarID").value=CarID;
|
document.getElementById("CarLicense").value=CarLicense;
|
JS_dialogClose(DivID);
|
}
|
</script>
|
|
<div class="form-group">
|
<label class="col-md-2 control-label">当前仪表盘里程<span class="text-danger">*</span></label>
|
<div class="col-md-6">
|
<input class="form-control" name="GasMileage" id="GasMileage" type="number" value="<%=GasMileage%>">
|
</div>
|
</div>
|
|
<div class="form-group" id="CarDiv">
|
<label class="col-md-2 control-label">加油时间<span class="text-danger">*</span></label>
|
<div class="col-md-6">
|
<input type="text" id="GasDate" name="GasDate" class="form-control" placeholder="yyyy/mm/dd" value="<%=GasDate%>" style="width: 58%;display: initial;">
|
<input id="GasTime" type="text" class="form-control" value="<%=GasTime%>" style="width: 30%;display: initial;">
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-2 control-label">油量(升) X 单价(元/升) = 机显金额(元)<span class="text-danger">*</span></label>
|
<div class="col-sm-6">
|
<input name="GasVolume" id="GasVolume" type="hidden" value="<%=GasVolume%>">
|
<span id="GasVolumeTXT"><%If GasVolume="" Then Response.Write " 油量 " Else Response.Write GasVolume End If %></span> X
|
<input class="form-control" style="width: 25%;display: inline;" name="GasPrice" id="GasPrice" type="number" value="<%=GasPrice%>" oninput="JS_GasPrice('GasPrice')"> =
|
<input class="form-control" style="width: 25%;display: inline;" name="SumPrice" id="SumPrice" type="number" value="<%=GasMacSumPrice%>" oninput="JS_GasPrice('SumPrice')">
|
</div>
|
</div>
|
|
<div class="form-group" style="display: none;">
|
<label class="col-md-2 control-label">实付金额 [<a onclick="JS_GasPrice('GasSumPrice')">使用机显金额</a>]</label>
|
<div class="col-md-6">
|
<input class="form-control" name="GasSumPrice" id="GasSumPrice" type="number" value="<%=GasSumPrice%>">
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-md-2 control-label">是否加满跳枪?<span class="text-danger">*</span></label>
|
<input name="is_JumpGun" id="is_JumpGun" type="hidden" value="<%=is_JumpGun%>">
|
<div class="col-md-6">
|
<button type="button" class="switch is_JumpGun btn <%if is_JumpGun="1" then Response.Write "btn-purple" Else Response.Write "btn-white" End If%>">已跳枪</button>
|
<button type="button" class="switch is_JumpGun btn <%if is_JumpGun="2" then Response.Write "btn-purple" Else Response.Write "btn-white" End If%>">没跳枪</button>
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-2 control-label">燃油标号</label>
|
<div class="col-sm-6">
|
<select class="form-control" name="GasType" id="GasType">
|
<option value="">请选择</option>
|
<%sql="select vID,vtext from dictionary where vtitle='GasType' and vType>=1 order by vOrder"
|
rs.open Sql,objConn,1,1
|
do while not rs.Eof%>
|
<option value="<%=rs("vtext")%>"<%if GasType=rs("vtext") then Response.Write " selected"%>><%=rs("vtext")%></option>
|
<%rs.movenext
|
Loop
|
rs.close()%>
|
</select>
|
</div>
|
</div>
|
|
<div class="form-group" id="CarDiv">
|
<label class="col-md-2 control-label">加油站</label>
|
<div class="col-md-6">
|
<input class="form-control" name="GasStation" id="GasStation" " type="text" value="<%=GasStation%>">
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-md-2 control-label">备注</label>
|
<div class="col-md-6">
|
<textarea class="form-control" rows="2" name="GasRemarks" id="GasRemarks"><%=GasRemarks%></textarea>
|
</div>
|
</div>
|
|
<div class="form-group">
|
<div class="col-md-10 col-md-offset-3">
|
<input name="admin_save" id="admin_save" type="hidden" value="">
|
|
<%If CarGasID=0 Then%>
|
<button class="btn btn-primary" id="OrderApp" onclick="JS_admin_save('57')" type="submit" style="width: 80%;">确认记录</button>
|
<%Else%>
|
<button class="btn btn-primary" id="OrderEdit" onclick="JS_admin_save('58')" type="submit" style="width: 60%;">修改</button>
|
<button class="btn btn-danger" id="OrderCancel" onclick="JS_admin_save('59')" type="submit" style="width: 20%;">删除</button>
|
<%End If%>
|
</div>
|
</div>
|
</form>
|
</div>
|
<!-- End 任务单-->
|
|
</div>
|
<!-- End Wrapper-->
|
|
<!--Start 查询窗口-->
|
<script>
|
//初始化对话框
|
function JS_dialogSetUp(DivID,dialogType,JSName)
|
{
|
//列表搜索
|
dialog_box="";
|
if(dialogType==1){
|
dialog_box="<div class=\"search-box-top\"><form onSubmit=\""+JSName+"('"+DivID+"',document.getElementById('dialog_Search').value);return false;\"><input id=\"DivID\" type=\"hidden\" value=\"\"><div class=\"input-group\"><input id=\"dialog_Search\" class=\"form-control input-search\" placeholder=\"Search...\" type=\"text\"><span class=\"input-group-btn\"><button class=\"btn btn-primary\" type=\"button\" onclick=\""+JSName+"('"+DivID+"',document.getElementById('dialog_Search').value)\"><i class=\"fa fa-search\"></i></button><button class=\"btn btn-primary\" type=\"button\" onclick=\"JS_dialogClose()\" style=\"margin-left: 6px;\"><i class=\"fa ion-close\"></i></button></span></div></form></div>";
|
dialog_box=dialog_box+"<div class=\"table-wrap\"><table class=\"table table table-hover m-0\"><thead><tr id=\"dialog_Header\"></tr></thead><tbody id=\"dialog_tbody\"></tbody></table></div>"
|
dialog_box=dialog_box+"<ul class=\"pagination m-t-10\" id=\"dialog_pagination\"></ul>"
|
}
|
document.getElementById('dialog_box').innerHTML=dialog_box;
|
}
|
//分页
|
function JS_dialogPage(acc1,acc2,JSName,DivID,SearchTXT)
|
{
|
dialog_pagination="";
|
if (acc2>1){
|
|
if (acc1>1){dialog_pagination=dialog_pagination+"<li><a onclick=\""+JSName+"('"+DivID+"','"+SearchTXT+"',"+(acc1-1)+")\" aria-label=\"Previous\"><span aria-hidden=\"true\">«</span></a></li>";}
|
for (i=1;i<=acc2;i++){
|
if (acc1==i){
|
dialog_pagination=dialog_pagination+"<li class=\"active\"><a>"+i+"</a></li>";
|
}else{
|
dialog_pagination=dialog_pagination+"<li><a onclick=\""+JSName+"('"+DivID+"','"+SearchTXT+"',"+i+")\">"+i+"</a></li>";
|
}
|
}
|
if (acc2>acc1){dialog_pagination=dialog_pagination+"<li><a onclick=\""+JSName+"('"+DivID+"','"+SearchTXT+"',"+(acc1+1)+")\" aria-label=\"Next\"><span aria-hidden=\"true\">»</span></a></li>";}
|
}
|
document.getElementById('dialog_pagination').innerHTML=dialog_pagination;
|
}
|
|
//打开对话框
|
function JS_dialogOpen(DivID)
|
{
|
var sTop=document.documentElement.scrollTop;
|
if (sTop==0) {sTop=document.body.scrollTop;}
|
var sLeft= document.documentElement.scrollLeft;
|
if (sLeft==0) {sLeft=document.body.scrollLeft;}
|
var dTop = document.getElementById(DivID).getBoundingClientRect().top;
|
var dLeft = document.getElementById(DivID).getBoundingClientRect().left;
|
var dBottom = document.getElementById(DivID).getBoundingClientRect().bottom;
|
//console.log(dTop);
|
if (dTop<200) {dTop=150;}else{dTop=(dTop-50);}
|
if (dBottom>400){dTop=dTop-(600-dBottom);}
|
//if (dLeft>=35) {dLeft=dLeft-35;}
|
win_Dialog.style.display="block";
|
win_Dialog.style.left=(dLeft)+"px";
|
win_Dialog.style.top=(sTop+dTop)+"px";
|
win_Dialog.style.display='block';
|
document.getElementById('DivID').value=DivID;
|
}
|
//关闭对话框
|
function JS_dialogClose(DivID){
|
document.getElementById('win_Orer').style.display='';
|
document.getElementById('win_Dialog').style.display='none';
|
document.body.scrollTop=document.getElementById(document.getElementById('DivID').value).getBoundingClientRect().top;
|
}
|
|
</script>
|
<div id="win_Dialog" class="dialogJshadow" style="display:none;z-index: 1000;">
|
<div class="row">
|
<div class="col-md-12">
|
<div id="dialog_box" class="white-box" style="border: 1px solid #e1e1e1;margin-right:0;margin-left:0"></div>
|
</div>
|
</div>
|
</div>
|
<!--End 查询窗口-->
|
|
|
|
</div>
|
<!--End main content -->
|
|
|
|
<!--Begin core plugin -->
|
|
<script src="assets/js/jquery.min.js"></script>
|
<script src="assets/js/bootstrap.min.js"></script>
|
<script src="assets/plugins/moment/moment.js"></script>
|
<script src="assets/js/jquery.slimscroll.js "></script>
|
<script src="assets/js/jquery.nicescroll.js"></script>
|
<script src="assets/js/functions.js"></script>
|
<script src="assets/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
|
<script src="assets/plugins/timepicker/bootstrap-timepicker.js"></script>
|
|
<script src="assets/plugins/jquery-validation/jquery.validate.min.js"></script>
|
<script src="assets/plugins/sweetalert/sweet-alert.js"></script>
|
<!-- End core plugin -->
|
|
<!-- BEGIN PAGE LEVEL SCRIPTS -->
|
|
<script>
|
//油价计算
|
function JS_GasPrice(KeyId)
|
{
|
var GasVolume=document.getElementById('GasVolume').value;
|
var GasPrice=document.getElementById('GasPrice').value;
|
var SumPrice=document.getElementById('SumPrice').value;
|
var GasSumPrice=document.getElementById('GasSumPrice').value;
|
if (KeyId=='GasPrice' && GasVolume!=''){KeyId='GasVolume'} else if (KeyId=='GasPrice' && SumPrice!=''){KeyId='SumPrice'}
|
if (KeyId=='GasSumPrice'){
|
document.getElementById('GasSumPrice').value=SumPrice;
|
}else if (GasPrice!=''){
|
var OldSumPrice=SumPrice;
|
if (KeyId=='GasVolume')
|
{
|
var SumPrice=toDecimal(GasVolume*GasPrice);
|
document.getElementById('SumPrice').value=SumPrice;
|
}
|
else if (KeyId=='SumPrice')
|
{
|
document.getElementById('GasVolume').value=toDecimal(SumPrice/GasPrice);
|
document.getElementById('GasVolumeTXT').innerHTML=toDecimal(SumPrice/GasPrice);
|
}
|
if ((GasSumPrice=='' || GasSumPrice==OldSumPrice) && SumPrice!='')
|
{
|
document.getElementById('GasSumPrice').value=SumPrice;
|
}
|
}
|
}
|
function toDecimal(x) {
|
var f = parseFloat(x);
|
if (isNaN(f)) {
|
return;
|
}
|
f = Math.round(x*100)/100;
|
return f;
|
}
|
//开关控制
|
$('.switch').click(function(){
|
var Switch=$(this).text();
|
var UBstate=0;
|
var event=$(this).attr('class').split(" ")[0];
|
var btnName=$(this).attr('class').split(" ")[1];
|
//console.log(btnName);
|
$("."+btnName).addClass("btn-white");
|
$("."+btnName).removeClass("btn-purple");
|
if (Switch=="已跳枪")
|
{
|
$(this).addClass("btn-purple");
|
$(this).removeClass("btn-white");
|
$('#'+btnName).val('1');
|
}else if (Switch=="没跳枪") {
|
$(this).addClass("btn-purple");
|
$(this).removeClass("btn-white");
|
$('#'+btnName).val('2');
|
}
|
});
|
jQuery('#datepicker').datepicker();
|
jQuery('#GasDate').datepicker({
|
format: "yyyy/mm/dd",
|
language: "zh-CN",
|
autoclose: true,
|
todayHighlight: true
|
});
|
jQuery('#GasTime').timepicker({
|
showMeridian : false
|
});
|
|
function JS_admin_save(admin_save){
|
$('#admin_save').val(admin_save);
|
}
|
jQuery.validator.addMethod("isMileage", function(value, element) {
|
var StreetMileage = $('#GasMileage').val();
|
var EndMileage = value;
|
//console.log(StreetMileage);
|
return this.optional(element) || StreetMileage<=EndMileage && StreetMileage*2>EndMileage;
|
}, "请正确填写回车公里数)");
|
|
var BaseFormValidation = function() {
|
var initValidationBootstrap = function(){
|
jQuery('.js-validation-bootstrap').validate({
|
submitHandler:function(form) {
|
//OrderApp()
|
var GasEndMileage=Number($('#GasEndMileage').val())
|
var GasMileage=Number($('#GasMileage').val())
|
if (GasEndMileage>GasMileage)
|
{
|
swal({
|
title: "加油里程差值不能为负数",
|
text: "上次加油里程:"+$('#GasEndMileage').val()+"公里\n当前仪表盘里程:"+$('#GasMileage').val()+"公里\n行驶里程:"+(GasMileage-GasEndMileage)+"公里",
|
type: "error",
|
showCancelButton: false,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "返回",
|
closeOnConfirm: true
|
});
|
}else if (GasEndMileage+700<GasMileage && GasEndMileage>0){
|
swal({
|
title: "两次加油里程差异过大",
|
text: "上次加油里程:"+$('#GasEndMileage').val()+"公里\n当前仪表盘里程:"+$('#GasMileage').val()+"公里\n行驶里程:"+(GasMileage-GasEndMileage)+"公里",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
cancelButtonText: "取消",
|
confirmButtonText: "继续提交",
|
closeOnConfirm: false
|
}, function(){
|
var admin_save=$('#admin_save').val();
|
if (admin_save=='59'){
|
OrderCancel();
|
}else{
|
OrderApp();
|
}
|
});
|
}else{
|
var admin_save=$('#admin_save').val();
|
if (admin_save=='59'){
|
OrderCancel();
|
}else{
|
OrderApp();
|
}
|
}
|
//console.log(admin_save);
|
},
|
errorClass: 'help-block animated fadeInDown',
|
errorElement: 'div',
|
errorPlacement: function(error, e) {
|
jQuery(e).parents('.form-group > div').append(error);
|
},
|
highlight: function(e) {
|
jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-error');
|
jQuery(e).closest('.help-block').remove();
|
},
|
success: function(e) {
|
jQuery(e).closest('.form-group').removeClass('has-error');
|
jQuery(e).closest('.help-block').remove();
|
},
|
rules: {
|
'CarLicense': {required: true},
|
'GasMileage': {required : true},
|
'GasVolume': {required : true},
|
'GasPrice': {required : true},
|
'GasSumPrice': {required : true},
|
'is_JumpGun':{required : true}
|
},
|
messages: {
|
'CarLicense': '请选择车辆',
|
'GasMileage': '请输入当前总里程',
|
'GasVolume': '请输入加油量',
|
'GasPrice': '请输入单价',
|
'GasSumPrice': '请输入实付金额',
|
'is_JumpGun1': '请选择加油情况'
|
}
|
});
|
};
|
|
return {
|
init: function () {
|
// Init Bootstrap Forms Validation
|
initValidationBootstrap();
|
}
|
};
|
}();
|
|
// Initialize when page loads
|
jQuery(function(){ BaseFormValidation.init(); });
|
|
//--按钮操作--BEGIN
|
//保存加油记录
|
var OrderApp = function(){
|
ServiceOrdType=$('#ServiceOrdType').find("option:selected").text();
|
$('#GasSumPrice').val($('#SumPrice').val()); //默认实际支付=机显金额
|
swal({
|
title: "确定保存记录?",
|
text: "车牌:"+$('#CarLicense').val()+"\n加油:"+$('#GasVolume').val()+"升\n机显:"+$('#SumPrice').val()+"元",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
cancelButtonText: "取消",
|
confirmButtonText: "确认",
|
closeOnConfirm: false
|
}, function(){
|
$.ajax({
|
type: "POST",
|
url: "admin_save.gds",//需要跳转到的界面 the page you want to post data
|
data: {
|
//要传给后台的数据 the data you should send to background
|
CarGasID:$('#CarGasID').val(),
|
admin_save_type:'json',
|
admin_save:$('#admin_save').val(),
|
GasList:$('#GasList').val(),
|
GasCarID:$('#CarID').val(),
|
GasDate:$('#GasDate').val()+' '+$('#GasTime').val()+':00',
|
GasMileage:$('#GasMileage').val(),
|
GasVolume:$('#GasVolume').val(),
|
GasPrice:$('#GasPrice').val(),
|
GasMacSumPrice:$('#SumPrice').val(),
|
GasSumPrice:$('#GasSumPrice').val(),
|
GasType:$('#GasType').val(),
|
GasStation:$('#GasStation').val(),
|
GasRemarks:$('#GasRemarks').val(),
|
is_JumpGun:$('#is_JumpGun').val()
|
},
|
dataType:'json',
|
beforeSend: function() {},//在发送之前你可以进行相关操作 what you want to do before send
|
success: function(data) {
|
console.log(data);
|
if (data!='')
|
{
|
if (data.result==1)
|
{
|
swal({
|
title : "记录完成",
|
text : "",
|
type : "success",
|
}, function() {
|
window.location.href="CarGasList_new.gds?GasList="+data.GasList
|
});
|
}else{
|
swal("保存失败", "代码:"+data.errcode, "error");
|
}
|
}else{swal("操作失败", "网络通信失败,请重试", "error");}
|
}
|
})
|
});
|
};
|
|
//删除记录
|
var OrderCancel = function(){
|
swal({
|
title: "确定删除记录?",
|
text: "",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
cancelButtonText: "取消",
|
confirmButtonText: "确认",
|
closeOnConfirm: false
|
}, function(){
|
$.ajax({
|
type: "POST",
|
url: "admin_save.gds",//需要跳转到的界面 the page you want to post data
|
data: {
|
//要传给后台的数据 the data you should send to background
|
admin_save_type:'json',
|
admin_save:$('#admin_save').val(),
|
CarGasID:$('#CarGasID').val(),
|
Car_Check:-1,
|
GasList:$('#GasList').val()
|
},
|
dataType:'json',
|
beforeSend: function() {},//在发送之前你可以进行相关操作 what you want to do before send
|
success: function(data) {
|
//console.log(data);
|
if (data!='')
|
{
|
if (data.result==1)
|
{
|
swal({
|
title : "删除完成",
|
text : "",
|
type : "success",
|
}, function() {
|
window.location.href="CarGasList_new.gds?GasList="+data.GasList
|
});
|
}else{
|
swal("保存失败", "代码:"+data.errcode, "error");
|
}
|
}else{swal("操作失败", "网络通信失败,请重试", "error");}
|
}
|
})
|
});
|
};
|
//--按钮操作--End
|
</script>
|
|
</body>
|
|
</html>
|