拖旺项目:聊城公交辅助决策系统
zhaoxing
2022-04-28 76950affed3e62fbc4e322432f874a2a797c0ba7
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
<template>
  <div class="page-container page-safety colorfff">
    <div class="nav">
      <img
        class="nav-icon"
        :src="require('@/assets/safety/location.png')"
        alt=""
      />
      <div class="nav-content">
        <span @click="goBack">数据看板 </span>
        <i class="el-icon el-icon-arrow-right"></i>
        <span> 站点拥堵列表</span>
      </div>
    </div>
    <div class="content">
      <div class="filter-section">
        <el-form :inline="true" :model="filterForm" ref="filterForm" class="g-table-filter">
          <el-form-item label="出发站点">
            <el-input style="width: 154px" placeholder="请输入关键字并回车" v-model="filterForm.leaveStationName" @keypress.enter.native="searchList"></el-input>
          </el-form-item>
          <el-form-item label="到达站点">
            <el-input style="width: 154px" placeholder="请输入关键字并回车" v-model="filterForm.arriveStationName" @keypress.enter.native="searchList"></el-input>
          </el-form-item>
          <el-form-item label="拥堵等级">
            <el-select
              style="width: 154px"
              v-model="filterForm.id"
              popper-class="safety-report-filter"
              @change="searchList"
            >
              <el-option  label="全部" value=""></el-option>
              <el-option v-for="item in typeOptions" :key="item.id" :label="item.dictLabel" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="时间筛选">
            <el-date-picker
              v-model="filterForm.oneDate"
              type="date"
              placeholder=""
              style="width: 154px"
              :clearable="true"
              @change="searchList"
            >
            </el-date-picker>
          </el-form-item>
        </el-form>
      </div>
      <div class="g-table">
        <el-table
          stripe
          style="width: 100%"
          header-row-class-name="table-header"
          :height="'calc(100vh - 400px)'"
          :data="list"
          highlight-current-row
          v-loading="loading"
          ref="stationCongestionTable"
          @sort-change="handleSortChange"
        >
          <el-table-column align="center" prop="leaveStationName" label="出发站点" sortable="custom"></el-table-column>
          <el-table-column align="center" prop="arriveStationName" label="到达站点" sortable="custom"></el-table-column>
          <el-table-column align="center" prop="stationTravelTime" label="行驶时间(分钟)" sortable="custom"></el-table-column>
          <el-table-column align="center" prop="runningSpeed" label="行驶速度(km/h)" sortable="custom"></el-table-column>
          <el-table-column align="center" prop="jamRange" label="拥堵等级" sortable="custom"></el-table-column>
        </el-table>
        <div class="g-pagination">
          <el-pagination
            layout="prev, pager, next"
            :total="total"
            :page-size="filterForm.pageSize"
            background
            @current-change="pageChange"
          ></el-pagination>
        </div>
      </div>
    </div>
  </div>
</template>
 
<script>
import moment from 'moment'
export default {
  name: "safetyAccidentReport",
  data() {
    return {
      loading: false,
      filterForm: {
        oneDate: "",
        pageSize: 20,
        pageNum: 1,
        id: '',    // 拥堵等级
        lineName: '',
        leaveStationName: '',
        arriveStationName: '',
      },
      list: [],
      typeOptions: [],
      total: 0
    };
  },
  mounted() {
    if(this.$route.query.prop){
      let {prop, order} = this.$route.query;
      this.$refs.stationCongestionTable.sort(prop, order);
    }else {
      this.getList();
    }
  },
  activated(){
    if(this.$route.query.status) this.filterForm.status = this.$route.query.status
    if(this.$route.query.prop){
      let {prop, order} = this.$route.query;
      this.$refs.stationCongestionTable.sort(prop, order);
    }else {
      this.getList();
    }
    this.getJamRangeList();    // 获取拥堵等级
  },
  methods: {
    handleSortChange(opt){
      let {prop, order} = opt;
      this.filterForm.sortWord = prop;
      switch (order){
        case 'ascending':
          this.filterForm.sortFx = 'ASC';
          break;
        case 'descending':
          this.filterForm.sortFx = 'DESC';
          break;
        default:
          this.filterForm.sortFx = '';
      }
      this.getList();
    },
    searchList(){
      this.filterForm.pageNum = 1;
      this.list = [];
      this.getList();
    },
    getList() {
      this.loading = true;
      const params = {};
      if(this.filterForm.sortFx){
        params.sortFx = this.filterForm.sortFx;
        params.sortWord = this.filterForm.sortWord;
      }
      this.$axios
        .get(this.$Interface.road.getAllStationJamList, {
          params: {
            limit: this.filterForm.pageSize,
            page: this.filterForm.pageNum,
            lineName: this.filterForm.lineName,
            leaveStationName: this.filterForm.leaveStationName,
            arriveStationName: this.filterForm.arriveStationName,
            id: this.filterForm.id,
            oneDate: this.filterForm.oneDate ? moment(this.filterForm.oneDate).format('yyyy-MM-DD') : null,
            ...params
          },
        })
        .then((res) => {
          this.list = res.data.records;
          this.total = Number(res.data.total);
          this.loading = false;
        });
    },
    getJamRangeList(){
      this.$axios.get(this.$Interface.road.getJamRangeList).then(res => {
        this.typeOptions = res.data;
      })
    },
 
    pageChange(page){
      this.filterForm.pageNum = page;
      this.getList();
    },
    goBack(){
      this.$router.go(-1)
    }
  },
};
</script>
 
<style lang="less" scoped>
@import url("../../assets/css/common.css");
.page-container {
  padding: 20px 30px;
  padding-bottom: 0;
  .nav {
    display: flex;
    font-size: 14px;
    width: 100%;
    height: 20px;
    align-items: center;
    .nav-icon {
      width: 18px;
      margin-left: 11px;
      flex-shrink: 0;
      margin-right: 11px;
    }
    .nav-content {
      flex: 1;
    }
  }
  .content {
    margin-top: 16px;
    .filter-section {
      text-align: center;
    }
    .table-container {
      margin: 0 72px;
      .pagination-block {
        text-align: center;
        margin-top: 20px;
      }
    }
  }
}
</style>