Blame view

src/components/car/chooseParkingArea.vue 3.25 KB
b25b036d   wuxw   v1.9 优化日期
1
  <template>
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
2
3
    <el-dialog :title="$t('chooseParkingArea.title')" :visible.sync="visible" width="70%">
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
4
5
6
7
        <div slot="header">
          <el-row :gutter="20">
            <el-col :span="18"></el-col>
            <el-col :span="6">
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
8
9
10
                <el-input v-model="searchForm.num"
                  :placeholder="$t('chooseParkingArea.parkingLotNumPlaceholder')"></el-input>
                <el-button slot="append" type="primary" @click="queryParkingAreas">
e18d1bbb   wuxw   开发完成停车场 和停车位功能
11
12
                  {{ $t('chooseParkingArea.query') }}
                </el-button>
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
13
                <el-button type="primary" @click="resetParkingAreas">
e18d1bbb   wuxw   开发完成停车场 和停车位功能
14
15
                  {{ $t('chooseParkingArea.reset') }}
                </el-button>
e18d1bbb   wuxw   开发完成停车场 和停车位功能
16
17
18
            </el-col>
          </el-row>
        </div>
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
19
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
20
21
22
23
24
25
        <el-table :data="parkingAreas" border>
          <el-table-column prop="paId" :label="$t('chooseParkingArea.parkingLotId')" align="center"></el-table-column>
          <el-table-column prop="num" :label="$t('chooseParkingArea.parkingLotNum')" align="center"></el-table-column>
          <el-table-column prop="typeCd" :label="$t('chooseParkingArea.parkingLotType')" align="center"></el-table-column>
          <el-table-column :label="$t('chooseParkingArea.operation')" align="center" width="120">
            <template slot-scope="scope">
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
26
              <el-button type="primary" size="mini" @click="selectParkingArea(scope.row)">
e18d1bbb   wuxw   开发完成停车场 和停车位功能
27
28
29
30
31
                {{ $t('chooseParkingArea.select') }}
              </el-button>
            </template>
          </el-table-column>
        </el-table>
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
32
33
34
35
36
37
  
        <el-pagination @size-change="handleSizeChange" @current-change="handlePageChange"
          :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
          layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"
          style="margin-top:20px;text-align:right"></el-pagination>
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
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
    </el-dialog>
  </template>
  
  <script>
  import { listParkingAreas } from '@/api/car/listParkingSpaceApi'
  import { getCommunityId } from '@/api/community/communityApi'
  
  export default {
    name: 'ChooseParkingArea',
    data() {
      return {
        visible: false,
        searchForm: {
          num: ''
        },
        parkingAreas: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        }
      }
    },
    methods: {
      open() {
        this.visible = true
        this.loadParkingAreas()
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
66
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
67
68
69
70
71
72
73
74
      async loadParkingAreas() {
        try {
          const params = {
            page: this.pagination.current,
            row: this.pagination.size,
            communityId: getCommunityId(),
            num: this.searchForm.num
          }
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
75
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
76
          const res = await listParkingAreas(params)
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
77
78
          this.parkingAreas = res.parkingAreas
          this.pagination.total = res.total
e18d1bbb   wuxw   开发完成停车场 和停车位功能
79
80
81
82
        } catch (error) {
          this.$message.error(this.$t('common.loadError'))
        }
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
83
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
84
85
86
87
      selectParkingArea(row) {
        this.$emit('choose', row)
        this.visible = false
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
88
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
89
90
91
92
      queryParkingAreas() {
        this.pagination.current = 1
        this.loadParkingAreas()
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
93
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
94
95
96
97
      resetParkingAreas() {
        this.searchForm.num = ''
        this.queryParkingAreas()
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
98
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
99
100
101
102
      handlePageChange(page) {
        this.pagination.current = page
        this.loadParkingAreas()
      },
e9417fb0   wuxw   v1.9 停车位页面无法选择停车bug
103
  
e18d1bbb   wuxw   开发完成停车场 和停车位功能
104
105
106
107
108
109
110
      handleSizeChange(size) {
        this.pagination.size = size
        this.loadParkingAreas()
      }
    }
  }
  </script>