项目

一般

简介

B2.html

报警数据查询页面 - 韦 士飞, 2019-07-24 10:35

 
1
<!DOCTYPE html>
2
<html>
3
<head lang="en">
4
    <meta charset="GB2312">
5
    <title></title>
6
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
7
    <link rel="stylesheet" type="text/css" href="css/jquery-ui.css" />
8
    <script src="js/jquery-3.3.1.min.js"></script>
9
    <link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.min.css" />
10
    <script type="text/javascript" src="js/jquery.datetimepicker.full.min.js"></script>
11
    <script type="text/javascript" src="js/jquery.table2excel.js"></script>
12
    <script type="text/javascript" src="js/omara.js"></script>
13

    
14
</head>
15
<body class="you_bd" style="width:95%">
16
<div >
17
    <div style="margin: 10px;margin-top: 15px; width:100%">
18
        <span>&nbsp;&nbsp;&nbsp;??ѯģʽ??
19
                        <select id="IsQryMode" style="width:80px;" onchange="onChangeQryMode(this)">
20
                        <option value="0">4Сʱ</option>
21
                        <option value="1">24Сʱ</option>
22
                        <option value="2">һ??</option>
23
                        <option value="3">һ????</option>
24
                        <option value="4">һ??</option>
25
                        <option value="5">?Զ???</option>
26
                        </select>
27
                </span>
28
                <span class="datesel" id="datesel" style="display:none"><span>&nbsp;&nbsp;&nbsp;<input type="text" id="date_3" value="" /></span>
29
        <span>&nbsp;--&nbsp;&nbsp;<input type="text" id="date_4" value="" /></span></span> 
30
        <!--<span>ѡ???ѯ????:</span> <span>??ʼ <input type="text" id="date_3" value="" /></span>
31
        <span>???? <input type="text" id="date_4" value="" /></span>-->
32
        <span>&nbsp;&nbsp;&nbsp;????豸??
33
                        <select id="IsSID" style="width:180px;">
34
                        </select></span>
35
        <span><input type="button" id="btn_qry" class="dateBtn2" value="??ѯ"></span>
36
        <span>&nbsp;&nbsp;<input type="button" id="btn_save" value="???浽excel" onclick="javascript:saveToExcel('almList')"></span>
37
    </div>
38
    <span class="lond" id="lond" style="text-align: center;margin-left: 200px;display:none" ><img  src="img/loding.gif" ><span>???ڲ?ѯ???ݿ?....</span></span>
39
    <div id="container3" style="width:100%;min-height: 500px;overflow: auto"></div>
40
    <div style="position: fixed;left: 30px;top: 50px;" class="hide">
41
        <img src="img/ico_guanbi.png" class="btn_img_guanbi" style="position: absolute;right: 5px;top: 5px;cursor:pointer">
42
        <img id="AlmImg" src="img/loginBG.jpg" width="640" height="480" style="box-shadow: 8px 5px 5px #888888;">
43
    </div>
44
</div>
45
<a href='javascript:history.back()' class='back' style='color: #fff'>????</a>
46
<script>
47
<% db_Open("/NandFlash/dbCfg.db3"); %>
48
var jname = <% db_QryAdv("select SID,Name from tbSM",0); %>
49
//var jtypes=<% db_QryAdv("select sm.Type,smt.Name, smt.Note from tbSM sm left join tbSMType smt on smt.Type=sm.Type where sm.State=0 and sm.DataMode=1",1); %>;
50
var jsids=<% db_QryAdv("select * from tbSM where State=0 and DataMode=1 order by SID",1); %>;
51
var jdis=<% db_QryAdv("select s.*,k.Name as KName,t.Note as TNote,t.Name as TName,t.Port from tbSM s left join tbSMKind k on k.Kind=s.Kind left join tbSMType t on (t.Type=s.Type and t.Tag1=s.Tag1) where Port=1 and State=0 and DataMode=1",1); %>;
52
<% db_Close(); %>
53

54
var mSMName = new Map();
55
$.each(jname.recs,function(i,n){
56
        mSMName.set(n.SID, n.Name); 
57
});
58

59
listSM();
60
function listSM()
61
{
62
        var bshow = 0;
63
        var stbl = "";
64
        stbl+=" <option value=\"all\">ȫ??</option>";
65
        $.each(jsids.recs,function(i,n){
66
                if (n.Kind==2560 || n.Kind==2816 || n.Kind==3072)
67
                        stbl+="";//" <option value=\""+((n.Type<<16)+(n.Tag1<<8)+n.SID)+"\">"+n.Name+"</option>";
68
                else
69
                {
70
                        if (n.SID==1)
71
                        {
72
                                stbl+="";
73
                        }
74
                        else if (n.SID==2)
75
                        {
76
                                stbl+="";
77
                        }
78
                        else
79
                        {
80
                                stbl+=" <option value=\""+(n.SID)+"\">"+n.Name+"</option>";
81
                        }
82
                }
83
        });
84
    $("#IsSID").html(stbl);
85
}
86
var szShowData = "";
87
var iDataCount = 0;
88
function saveToExcel(tableid){
89
        if (iDataCount > 60000)
90
        {
91
        alert("??ѯ?????????????޷???????Excel??\n??ǰ????????"+iDataCount+"????¼\n???ֻ?ܵ???60000????¼");
92
        return false
93
        }
94
        $("#"+tableid).table2excel({
95
                exclude: ".noExl",
96
                name: "Excel Document Name",
97
                filename: "AlarmData" + new Date().toISOString().replace(/[\-\:\.]/g, "")+".xls",
98
                fileext: ".xls",
99
                exclude_img: true,
100
                exclude_links: true,
101
                exclude_inputs: true
102
        });
103
}
104
$(".almbtn").on("click",function(){
105
  var src=$(this).attr("op");
106
  $("#AlmImg").attr("src",src);
107
  $(".Almimg").fadeToggle();
108
});
109
$(".btn_img_guanbi").click(function(){
110
    $(".Almimg").fadeOut()
111
});
112

113
$("#date_3").datetimepicker({
114
  format:"Y-m-d H:i:00",      //??ʽ??????
115
});
116
$("#date_4").datetimepicker({
117
  format:"Y-m-d H:i:00",      //??ʽ??????
118
});
119
$.datetimepicker.setLocale('ch');
120

121
function onChangeQryMode(obj){
122
    var usel=document.getElementById('IsQryMode');
123
    var uselidx=usel.selectedIndex; //??ţ?ȡ??ǰѡ??ѡ??????
124
    var imode = usel.options[uselidx].value;
125
        if (imode==0)//<option value="0">4Сʱ</option>
126
        {
127
                $("#datesel").hide();
128
        }
129
        else if (imode==1)//<option value="1">24Сʱ</option>
130
        {
131
                $("#datesel").hide();
132
        }
133
        else if (imode==2)//<option value="2">һ??</option>
134
        {
135
                $("#datesel").hide();
136
        }
137
        else if (imode==3)//<option value="3">һ????</option>
138
        {
139
                $("#datesel").hide();
140
        }
141
        else if (imode==4)//<option value="4">һ??</option>
142
        {
143
                $("#datesel").hide();
144
        }
145
        else if (imode==5)//<option value="5">?Զ???</option>
146
        {
147
                $("#datesel").show();
148
        }
149
        return;
150
}
151

152
$(".dateBtn2").click(function(){
153
    index=1;
154
    var sDate;
155
    var eDate;
156
    var usel=document.getElementById('IsQryMode');
157
    var uselidx=usel.selectedIndex; //??ţ?ȡ??ǰѡ??ѡ??????
158
    var imode = usel.options[uselidx].value;
159
    var nRDate = new Date();
160
        var df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
161
        if (imode==0)//<option value="0">4Сʱ</option>
162
        {
163
                eDate=df.format(nRDate);
164
                nRDate.setHours(nRDate.getHours()-4);
165
                sDate=df.format(nRDate);
166
                //sDate=nRDate.getFullYear()+"-"+(nRDate.getMonth()+1)+"-"+nRDate.getDate()+" "+nRDate.getHours()+":"+nRDate.getMinutes()+":"+nRDate.getSeconds();
167
                //eDate=nRDate.getFullYear()+"-"+(nRDate.getMonth()+1)+"-"+nRDate.getDate()+" "+nRDate.getHours()+":"+nRDate.getMinutes()+":"+nRDate.getSeconds();
168
        }
169
        else if (imode==1)//<option value="1">24Сʱ</option>
170
        {
171
                eDate=df.format(nRDate);
172
                nRDate.setDate(nRDate.getDate()-1);
173
                sDate=df.format(nRDate);
174
        }
175
        else if (imode==2)//<option value="2">һ??</option>
176
        {
177
                eDate=df.format(nRDate);
178
                nRDate.setDate(nRDate.getDate()-7);
179
                sDate=df.format(nRDate);
180
        }
181
        else if (imode==3)//<option value="3">һ????</option>
182
        {
183
                eDate=df.format(nRDate);
184
                nRDate.setMonth(nRDate.getMonth()-1);
185
                sDate=df.format(nRDate);
186
        }
187
        else if (imode==4)//<option value="4">һ??</option>
188
        {
189
                eDate=df.format(nRDate);
190
                nRDate.setFullYear(nRDate.getFullYear()-1);
191
                sDate=df.format(nRDate);
192
        }
193
        else if (imode==5)//<option value="5">?Զ???</option>
194
        {
195
                sDate=$("#date_3").val();
196
                eDate=$("#date_4").val();
197
        }
198
    dataarr=[];
199
    dataarr2=[];
200
    datatime=[];
201
    //var sDate=$("#date_3").val();
202
    //var eDate=$("#date_4").val();
203
        //alert("ʱ?䣺"+sDate+","+eDate);
204
    //var sArr = sDate.split("-");
205
    //var eArr = eDate.split("-");
206
    //var sRDate = new Date(sArr[0], sArr[1], sArr[2]);
207
    //var eRDate = new Date(eArr[0], eArr[1], eArr[2]);
208
    var sRDate = new Date(sDate);
209
    var eRDate = new Date(eDate);
210
    var nRDate = new Date();
211
    var difftime = (nRDate-eRDate)/(60*60*1000);
212
        //alert("ʱ??"+difftime);
213
    var result = (eRDate-sRDate)/(24*60*60*1000);
214
    //if(result>7){
215
    //    alert("???ֻ?ܲ?ѯ7??????????????????ݣ?");
216
    //    return false
217
    //}
218
    if(sDate==""||eDate==""||sDate>eDate){
219
        alert("????????ȷ?IJ?ѯʱ?䣡");
220
        return false
221
    }
222
    var usel=document.getElementById('IsSID');
223
    var uselidx=usel.selectedIndex; //??ţ?ȡ??ǰѡ??ѡ??????
224
    var isid = usel.options[uselidx].value;
225
        
226
        szShowData = "";
227
        iDataCount = 0;
228
        {
229
                szShowData+="<div style='overflow: auto;height: 500px;'>";
230
                szShowData+="<table id='almList' width='100%' style='border: #B0B7BF 1px solid'>";
231
                szShowData+="<tr><td style='width: 200px;'>????ʱ??</td><td style='width: 100px;'>????ԭ??</td><td style='width: 100px;'>??????ʽ</td><td style='width: 100px;'>????????</td><td style='width: 100px;'>???</td><td style='width: 200px;'>????????</td><td style='width: 150px;'>?豸????</td><td style='width: 50px;'>AID</td><td style='width: 40px;'>??ͼ</td></tr>";
232
        }
233
        $(".lond").show();
234
        //if (difftime < 1)
235
        {
236
                $.ajax({
237
                        type: "POST",
238
                        url: "../omdev/smalarm-t.asp",
239
                        data: "starttime="+sDate+"&endtime="+eDate+"&isid="+isid,
240
                        dataType: "json",
241
                        //async: false,
242
                        success: function(msg){
243
                                showData(msg);
244
                        }
245
                });
246
        }
247
    $.ajax({
248
        type: "POST",
249
        url: "../omdev/smalarm.asp",
250
        data: "starttime="+sDate+"&endtime="+eDate+"&isid="+isid,
251
        dataType: "json",
252
                //async: false,
253
        beforeSend: function() {
254
            $(".dateBtn").attr('disabled', 'disabled');
255
            $(".lond").show();
256
        },
257
        complete: function() {
258
            $(".lond").hide();
259
            $(".dateBtn").removeAttr("disabled");
260
                        $("#container3").html(szShowData);
261
        },
262
        success: function(msg){
263
                        showData(msg);
264
        }
265
    });
266
});
267

268
function showData(data)
269
{
270
        var q='';
271
        if (data.qry == "err")
272
                return;
273
        iDataCount += data.reccnt;
274
        $.each(data.recs,function(i,n){
275
                var name='δ֪';var note='?澯';var mask='';var recv='';
276
                var kind=(n.Type>>8);
277
                if(kind==0x01) name="?е?";
278
                else if(kind==0x02) name="???";
279
                else if(kind==0x03) name="UPS";
280
                else if(kind==0x04) name="????";
281
                else if(kind==0x05) name="??ʪ??";
282
                else if(kind==0x06) name="©ˮ";
283
                else if(kind==0x07) name="?յ?";
284
                else if(kind==0x08) name="???ܿյ?";
285
                else if(kind==0x09) name="??????";
286
                else if(kind==0x0a) name="??????";
287
                else if(kind==0x0b) name="??ʾ??";
288
                else if(kind==0x0c) name="?????Ƶ";
289
                else if(kind==0x0d) name="IC?Ž?";
290
                else if(n.Type<16){
291
                        if(n.Type==6) name="©ˮ???";
292
                        else if(n.Type==9) name="?̸?";
293
                        else if(n.Type==10) name="????";
294
                        else if(n.Type==11) name="?Ŵ?";
295
                }
296
                if(n.Alm&4){note+=" ???"}
297
                if(n.Alm&8){note+=" ?ط?"}
298
                if(n.Alm&16){note+=" ????"}
299
                if(n.Alm&0xf00){note+=" δ????"}
300
                if(n.AlmMask&1){mask+=" ????"}
301
                if(n.AlmMask&2){mask+=" ????"}
302
                if(n.AlmMask&4){mask+=" ????"}
303
                if(n.AlmMask&8){mask+=" ????"}
304
                if(n.AlmMask&0x10){mask+=" ?绰"}
305
                if(n.AlmMask&0x20){mask+=" ?ʼ?"}
306
                if(n.AlmMask&0x40){mask+=" POST"}
307
                if(n.AlmMask&0x100){mask+=" ????1"}
308
                if(n.AlmMask&0x200){mask+=" ????2"}
309
                for (var x=0; x<16; x++)
310
                        if ((n.AlmRecv & (1 << x))>0) recv+=" #"+(x+1);
311
                if(n.AlmMask&0x40){mask+=" POST"}
312
                //if(i==0){
313
                //        q+="<div style='overflow: auto;height: 500px;'>";
314
                //        q+="<table id='almList' width='100%' style='border: #B0B7BF 1px solid'>";
315
                //        q+="<tr><td style='width: 200px;'>????ʱ??</td><td style='width: 100px;'>????ԭ??</td><td style='width: 100px;'>??????ʽ</td><td style='width: 100px;'>????????</td><td style='width: 100px;'>???</td><td style='width: 200px;'>????????</td><td style='width: 150px;'>?豸????</td><td style='width: 50px;'>AID</td><td style='width: 40px;'>??ͼ</td></tr>";
316
                //}
317
                if(n.AID<0) {
318
                  note="??";
319
                  name="ϵͳ";
320
                  n.AlmBrief="??ʱ??";
321
                }
322
                q+="<tr><td>"+n.LastUpd+"</td><td>"+note+"</td><td>"+mask+"</td><td>"+recv+"</td><td>"+name+"</td><td>"+n.AlmBrief+"</td><td>"+mSMName.get(n.SID)+"</td><td>"+n.AID+"</td><td>";
323
                if( n.AlmImg!=undefined && n.AlmImg.length>2 ){
324
                        var istart=n.AlmImg.indexOf('wwwpub');
325
                        if (istart>=0) n.AlmImg=n.AlmImg.substring(istart+7);
326
                        q+="<span><img src='img/ico_img.png' op='"+ n.AlmImg+"' class='almbtn'></span>";
327
                }
328
                q+="</td></tr>";
329
        });
330
        szShowData += q;
331
}
332

    
333
</script>
334
</body>
335
</html>