x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
    <meta charset="utf-8" />
5
    <title>Система контроля за подвижными элементами</title>
6
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
7
    <script type="text/javascript" src="https://hst-api.wialon.com/wsdk/script/wialon.js"></script>
8
</head>
9
<body> 
10
    
11
    
12
<table>
13
  <tr>
14
    <td>Выберите ресурс:</td>
15
      <td>
16
        <select id="res"></select>
17
      </td>
18
  </tr>
19
<tr><td>Гос № ТС:</td>
20
    <td><input type = "text" id="unit"/></td></tr>
21
<tr><td>От: (дата, время)</td>
22
    <td><input type="datetime-local" id = "from"/></td></tr>
23
<td>До: (дата, время)</td>
24
    <td><input type="datetime-local" id = "to"/></td>
25
<tr><td colspan="2" style="text-align:center;"><input type="button" value="Выполнить отчет" id="exec_btn"/></td></tr>
26
</table>
27
<div id="log"></div>
28
29
</body>
30
</html>
HTML
5
 
1
td, th{ border: 1px solid #c6c6c6; }
2
.wrap{ max-height:150px; overflow-y: auto; }
3
.odd, th{ background:#EEE; border: 1px solid #c6c6c6; }
4
ul{ list-style: none; margin:0px; padding:0px; display:block;overflow-y: auto; max-height: 200px;width: 300px}
5
label{ cursor:pointer; }
CSS
201
 
1
// Print message to log
2
function msg(text) { $("#log").prepend(text + "<br/>"); }
3
4
function init()
5
{
6
    var res_flags = wialon.item.Item.dataFlag.base | wialon.item.Resource.dataFlag.reports;
7
    var flags = wialon.item.Item.dataFlag.base | wialon.item.Unit.dataFlag.lastMessage | wialon.item.Item.dataFlag.customFields; 
8
    
9
    var sess = wialon.core.Session.getInstance(); // get instance of current Session
10
    // flags to specify what kind of data should be returned
11
    sess.loadLibrary("resourceReports"); // load Reports Library
12
    sess.loadLibrary("itemCustomFields");
13
    sess.updateDataFlags( // load items to current session
14
    [
15
        { type: "type",
16
          data: "avl_unit",
17
          flags: flags,
JS
Result
Source code of example Close ✕
1
 
1
/*source*/