【调度系统】广东民航医疗快线调度系统源代码
wlzboy
2025-09-06 2decf5219e3476e30095fd9dbf6e49c55e105563
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
<%@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>&nbsp;</td>";
                                            dialog_tbody=dialog_tbody+"<td>&nbsp;</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 "&nbsp;油量&nbsp;" Else  Response.Write GasVolume End If %></span>&nbsp;X&nbsp;
                      <input class="form-control" style="width: 25%;display: inline;" name="GasPrice" id="GasPrice" type="number" value="<%=GasPrice%>" oninput="JS_GasPrice('GasPrice')">&nbsp;=&nbsp;
                      <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">实付金额&nbsp;[<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>