accuracy.html 8.15 KB
<style>
    #accuracy_data_page .table_wrap {
        height: calc(100% - 70px);
        margin-top: 25px;
    }

    #accuracy_data_page div.data_list {
        overflow: auto;
        height: calc(100% - 66px);
        display: block;
        position: relative;
        font-size: 14px;
    }

    #accuracy_data_page table th:nth-of-type(1), #accuracy_data_page table td:nth-of-type(1) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(2), #accuracy_data_page table td:nth-of-type(2) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(3), #accuracy_data_page table td:nth-of-type(3) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(4), #accuracy_data_page table td:nth-of-type(4) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(5), #accuracy_data_page table td:nth-of-type(5) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(6), #accuracy_data_page table td:nth-of-type(6) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(7), #accuracy_data_page table td:nth-of-type(7) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(8), #accuracy_data_page table td:nth-of-type(8) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(9), #accuracy_data_page table td:nth-of-type(9) {
        width: 10%;
    }

    #accuracy_data_page table th:nth-of-type(10), #accuracy_data_page table td:nth-of-type(10) {
        width: 10%;
    }

    table i.material-icons {
        font-size: 16px !important;
        vertical-align: middle !important;
        color: #FFC107;
        margin-left: 2px;
        cursor: default;
    }
</style>
<div class="container-fluid page" id="accuracy_data_page">
    <div class="card">

        <div class="card-body" style="height: 100%">
            <div class="top_form_card" style="width: 100%;">
                <form>
                    <div class="row">
                        <div class="col-md-2">
                            <div class="form-group">
                                <label class="bmd-label-floating">日期</label>
                                <input type="text" name="rq" required class="form-control flatpickr_date"
                                       value="2018-07-02">
                            </div>
                        </div>
                        <div class="col-md-2">
                            <div class="form-group">
                                <label class="bmd-label-floating">线路</label>
                                <div class="ct_auto_wrap line_autocompleter">
                                    <input type="text" name="lineName" required class="form-control" autocomplete="off">
                                </div>
                            </div>
                        </div>
                        <div class="col-md-2" style="padding-right: 0">
                            <div class="form-group">
                                <label class="bmd-label-floating">时间</label>
                                <input type="time" name="st" required class="form-control flatpickr_time" value="00:00">
                            </div>
                        </div>
                        <div class="col-md-2" style="padding-left: 0">
                            <div class="form-group">
                                <label class="bmd-label-floating"></label>
                                <input type="time" name="et" required class="form-control flatpickr_time" value="23:00">
                            </div>
                        </div>
                        <div class="col-md-2">
                            <div class="form-group">
                                <label class="bmd-label-floating">车辆</label>
                                <input type="text" name="nbbm" class="form-control " autocomplete="off">
                            </div>
                        </div>
                        <div class="col-md-1">
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary btn-raised" style="margin-top: 22px;">
                                    <i class="material-icons">search</i> 搜索
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>

            <div class="table_wrap">
                <div class="table-responsive">
                    <table class="table table-hover" style="margin-bottom: 0;">
                        <thead class="">
                        <th>发布时间</th>
                        <th>站点</th>
                        <th>自编号</th>
                        <th>车牌号</th>
                        <th>站数</th>
                        <th>距离(米)</th>
                        <th>预计(秒)</th>
                        <th>实际(秒)</th>
                        <th>dd2</th>
                        <th>状态</th>
                        </thead>
                    </table>

                    <div class="data_list">
                        <table class="table table-hover">
                            <tbody></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script id="accuracy_list-temp" type="text/html">
    {{each list as obj i}}
    <tr>
        <td>{{obj.timeStr}}</td>
        <td>{{obj.station}}</td>
        <td>{{obj.nbbm}}</td>
        <td>{{obj.plate}}</td>
        <td>{{obj.stopDis}}</td>
        <td>{{obj.distance}}</td>
        <td>{{obj.seconds}}</td>
        <td>{{obj.realSeconds}}</td>
        <td>{{obj.d2}}</td>
        <td>
            {{if obj.status == 1}}
                <span class="badge badge-success"></span>
            {{else if obj.status == -1}}
                <span class="badge badge-danger">不准确</span>
            {{/if}}
        </td>
    </tr>
    {{/each}}
</script>

<script>
    (function () {
        var wrap = '#accuracy_data_page';

        flatpickr(wrap + ' .flatpickr_date', flatpickrDateConfig);
        $('[data-toggle="tooltip"]').tooltip();
        //滚动条
        $('div.data_list', wrap).perfectScrollbar({suppressScrollX: true});
        //线路自动补全
        $.get('/basic/lines', function (rs) {
            var data = [], item;
            for (var i = 0, len = rs.length; i < len; i++) {
                item = rs[i];
                data.push({
                    code: item.lineCode,
                    text: item.name,
                    others: [item.fullChars, item.camelChars]
                });
            }
            gb_ct_autocompleter.build($('.line_autocompleter', wrap), data);
        });


        var f = $('form', wrap);
        f.on('submit', function () {
            try {
                query();
            } catch (e) {
                console.log(e);
            }
            return false;
        });

        function query() {
            var data = f.serializeJSON();
            data.lineCode = $('[name=lineName]', f).data('val');
            if (!data.rq) {
                gb_utils.showNotification('参数异常', '必须选择日期', 'danger');
                return;
            }

            $.get('/accuracy_data/search', data, function (rs) {
                var diff;
                for (var i = 0, len = rs.length; i < len; i++) {
                    rs[i].timeStr = moment(rs[i].t1).format('HH:mm');

                    diff = Math.abs(rs[i]['realSeconds'] - rs[i]['seconds']);
                    //是否准点
                    if (diff > 60 * 3)
                        rs[i].status = -1;
                    else {

                        if (diff / rs[i]['stopDis'] <  40)
                            rs[i].status = 1;
                        else
                            rs[i].status = -1;
                    }
                }

                var htmlStr = template('accuracy_list-temp', {list: rs});

                $('div.data_list>table tbody', wrap).html(htmlStr);
                $('div.data_list', wrap).perfectScrollbar('update');
            });
        }
    })();
</script>