Blame view

src/views/car/carInManageList.vue 9.6 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
a3057712   wuxw   完成在场车辆和车辆进出场记录
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
    <div class="animated fadeInRight car-in-manage-container">
      <el-row :gutter="20">
        <!-- 左侧停车场区域选择 -->
  
        <el-col :span="3" class="padding-r-0">
          <div class="border-radius">
            <div class="margin-xs-r treeview">
              <ul class="list-group text-center border-radius">
                <li v-for="(item, index) in carInManageInfo.parkingAreas" :key="index" class="list-group-item node-orgTree"
                  :class="{ 'vc-node-selected': carInManageInfo.conditions.paNum === item.num }" @click="swatchParkingArea(item)">
                  {{ item.num }}
                </li>
              </ul>
            </div>
          </div>
        </el-col>
  
        <!-- 右侧内容区域 -->
        <el-col :span="21">
          <!-- 查询条件卡片 -->
          <el-card class="search-card">
            <div slot="header" class="clearfix flex justify-between">
              <span>{{ $t('carInManage.searchCondition') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="6">
                <el-input :placeholder="$t('carInManage.inputPlateNumber')" v-model="carInManageInfo.conditions.carNum"
                  clearable @keyup.enter.native="queryCarInoutMethod" />
              </el-col>
  
              <el-col :span="6">
                <el-select v-model="carInManageInfo.conditions.state" :placeholder="$t('carInManage.selectVehicleStatus')"
                  style="width:100%">
                  <el-option value="" :label="$t('carInManage.selectVehicleStatus')" />
                  <el-option value="100300" :label="$t('carInManage.inStatus')" />
                  <el-option value="100400" :label="$t('carInManage.paymentComplete')" />
                  <el-option value="100500" :label="$t('carInManage.exitStatus')" />
                  <el-option value="100600" :label="$t('carInManage.timeoutRepayment')" />
                </el-select>
              </el-col>
  
              <el-col :span="6">
                <el-select v-model="carInManageInfo.conditions.carType" :placeholder="$t('carInManage.selectPlateType')"
                  style="width:100%">
                  <el-option value="" :label="$t('carInManage.selectPlateType')" />
                  <el-option value="T" :label="$t('carInManage.temporaryVehicle')" />
                  <el-option value="S" :label="$t('carInManage.forSaleVehicle')" />
                  <el-option value="H" :label="$t('carInManage.monthlyRental')" />
                  <el-option value="W" :label="$t('carInManage.whitelist')" />
                  <el-option value="B" :label="$t('carInManage.blacklist')" />
                  <el-option value="I" :label="$t('carInManage.internalVehicle')" />
                  <el-option value="NM" :label="$t('carInManage.freeVehicle')" />
                </el-select>
              </el-col>
  
              <el-col :span="6">
b25b036d   wuxw   v1.9 优化日期
58
                <el-date-picker v-model="carInManageInfo.conditions.startTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                :placeholder="$t('carInManage.enterStartTime')"  style="width:100%" />
a3057712   wuxw   完成在场车辆和车辆进出场记录
59
60
61
              </el-col>
  
              <el-col :span="6" class="margin-top-10">
b25b036d   wuxw   v1.9 优化日期
62
                <el-date-picker v-model="carInManageInfo.conditions.endTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"                :placeholder="$t('carInManage.enterEndTime')"  style="width:100%" />
a3057712   wuxw   完成在场车辆和车辆进出场记录
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
              </el-col>
  
              <el-col :span="6" class="margin-top-10">
                <el-button type="primary" @click="queryCarInoutMethod">
                  {{ $t('carInManage.search') }}
                </el-button>
                <el-button @click="resetCarInoutMethod">
                  {{ $t('carInManage.reset') }}
                </el-button>
              </el-col>
            </el-row>
          </el-card>
  
          <!-- 在场车辆卡片 -->
          <el-card class="list-card margin-top-20">
            <div slot="header" class="flex justify-between">
              <div>{{ $t('carInManage.parkedVehicles') }}</div>
            </div>
  
            <el-table :data="carInManageInfo.carIns" border style="width: 100%" v-loading="loading">
              <el-table-column prop="ciId" :label="$t('carInManage.inoutId')" align="center" />
              <el-table-column prop="stateName" :label="$t('carInManage.vehicleStatus')" align="center" />
              <el-table-column prop="carNum" :label="$t('carInManage.plateNumber')" align="center" />
              <el-table-column prop="paNum" :label="$t('carInManage.parkingLot')" align="center" />
              <el-table-column prop="feeName" :label="$t('carInManage.billingRule')" align="center" />
              <el-table-column prop="carTypeName" :label="$t('carInManage.plateType')" align="center" />
              <el-table-column prop="inTime" :label="$t('carInManage.entryTime')" align="center" />
              <el-table-column :label="$t('carInManage.parkingDuration')" align="center">
                <template slot-scope="scope">
                  {{ scope.row.hours }} {{ $t('carInManage.hour') }} {{ scope.row.min }} {{ $t('carInManage.minute') }}
                </template>
              </el-table-column>
              <el-table-column :label="$t('carInManage.parkingFee')" align="center">
                <template slot-scope="scope">
                  <span v-if="scope.row.carType !== '1001'">{{ scope.row.payCharge }}</span>
                  <span v-else>-</span>
                </template>
              </el-table-column>
            </el-table>
  
            <!-- 分页 -->
            <el-pagination class="margin-top-20" :current-page.sync="pagination.currentPage" :page-sizes="[10, 20, 30, 50]"
              :page-size="pagination.pageSize" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange" @current-change="handleCurrentChange" />
          </el-card>
        </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
  import { listParkingAreas, listCarIns } from '@/api/car/carInManageApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'CarInManageList',
    data() {
      return {
        loading: false,
        pagination: {
          currentPage: 1,
          pageSize: 10,
          total: 0
        },
        carInManageInfo: {
          parkingAreas: [],
          carIns: [],
          conditions: {
            state: '',
            carNum: '',
            carType: '',
            startTime: '',
            endTime: '',
            paNum: '',
            iotApiCode: 'listCarInParkingAreaBmoImpl',
            page: 1,
            row: 10,
            communityId: ''
          }
        }
      }
    },
    created() {
      this.communityId = getCommunityId()
      this.carInManageInfo.conditions.communityId = this.communityId
      this.loadParkingAreas()
    },
    methods: {
      // 加载停车场区域
      async loadParkingAreas() {
        try {
          const params = {
            page: 1,
            row: 100,
            communityId: this.communityId
          }
          const response = await listParkingAreas(params)
          this.carInManageInfo.parkingAreas = response.parkingAreas || []
  
          if (this.carInManageInfo.parkingAreas.length > 0) {
            this.carInManageInfo.conditions.paNum = this.carInManageInfo.parkingAreas[0].num
            this.loadCarIns()
          }
        } catch (error) {
          this.$message.error(this.$t('common.loadFailed'))
        }
      },
      swatchParkingArea(parkingArea) {
        this.carInManageInfo.conditions.paNum = parkingArea.num
        this.loadCarIns()
      },
  
      // 加载在场车辆
      async loadCarIns() {
        this.loading = true
        try {
          // 处理参数
          const params = {
            ...this.carInManageInfo.conditions,
            page: this.pagination.currentPage,
            row: this.pagination.pageSize
          }
          params.carNum = params.carNum ? params.carNum.trim() : ''
  
          // 调用API
          const response = await listCarIns(params)
          this.carInManageInfo.carIns = response.data || []
          this.pagination.total = response.total || 0
        } catch (error) {
          this.$message.error(this.$t('common.loadFailed'))
        } finally {
          this.loading = false
        }
      },
  
      // 切换停车场区域
      handleAreaChange(val) {
        this.carInManageInfo.conditions.paNum = val
        this.loadCarIns()
      },
  
      // 查询
      queryCarInoutMethod() {
        this.pagination.currentPage = 1
        this.loadCarIns()
      },
  
      // 重置
      resetCarInoutMethod() {
        this.carInManageInfo.conditions = {
          ...this.carInManageInfo.conditions,
          state: '',
          carNum: '',
          carType: '',
          startTime: '',
          endTime: ''
        }
        this.pagination.currentPage = 1
        this.loadCarIns()
      },
  
      // 分页大小改变
      handleSizeChange(size) {
        this.pagination.pageSize = size
        this.loadCarIns()
      },
  
      // 当前页改变
      handleCurrentChange(page) {
        this.pagination.currentPage = page
        this.loadCarIns()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .car-in-manage-container {
    padding: 20px;
  
    .list-group {
    padding-left: 0;
    margin-bottom: 0;
  }
  
  .list-group-item {
    position: relative;
    display: block;
    padding: 10px 15px;
    margin-bottom: -1px;
    background-color: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
  }
  
  .list-group-item:hover {
    background-color: #f5f5f5;
  }
  
  .vc-node-selected {
    background-color: #409EFF;
    color: white;
    border-color: #409EFF;
  }
  
    .parking-area-card {
      height: 100%;
  
      .area-radio-group {
        display: flex;
        flex-direction: column;
  
        .area-radio-button {
          margin-bottom: 10px;
          text-align: center;
        }
      }
    }
  
    .search-card,
    .list-card {
      border-radius: 5px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
    }
  
    .margin-top-10 {
      margin-top: 10px;
    }
  
    .margin-top-20 {
      margin-top: 20px;
    }
  }
  </style>