Blame view

src/views/community/adminRoomList.vue 8.07 KB
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
1
2
3
4
5
6
7
8
9
  <template>
    <div class="admin-room-container">
      <div class="flex justify-start">
        <div class="room-floor-unit-tree">
          <community-unit-tree ref="communityUnitTree" @selectCommunity="handleSelectCommunity"
            @selectFloor="handleSelectFloor" @selectUnit="handleSelectUnit" />
        </div>
        <div class="margin-top-xs margin-left-sm flex-grow">
          <el-card class="box-card">
8c078200   wuxw   物业相关功能基本测试完成
10
            <div slot="header" class="flex justify-between">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
              <span>{{ $t('adminRoom.search.title') }}</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="4">
                <el-input v-model.trim="searchForm.roomNum" :placeholder="$t('adminRoom.search.roomNum')" clearable />
              </el-col>
              <el-col :span="4">
                <el-input v-model.trim="searchForm.ownerNameLike" :placeholder="$t('adminRoom.search.ownerName')"
                  clearable />
              </el-col>
              <el-col :span="4">
                <el-input v-model.trim="searchForm.ownerTel" :placeholder="$t('adminRoom.search.ownerTel')" clearable />
              </el-col>
              <el-col :span="4">
                <el-select v-model="searchForm.state" :placeholder="$t('adminRoom.search.state')" clearable>
                  <el-option v-for="item in states" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
                </el-select>
              </el-col>
              <el-col :span="4">
                <el-select v-model="searchForm.roomSubType" :placeholder="$t('adminRoom.search.roomType')" clearable>
                  <el-option v-for="item in roomSubTypes" :key="item.statusCd" :label="item.name" :value="item.statusCd" />
                </el-select>
              </el-col>
              <el-col :span="4">
                <el-button type="primary" @click="handleSearch">{{ $t('common.search') }}</el-button>
              </el-col>
            </el-row>
          </el-card>
  
          <el-card class="box-card margin-top">
8c078200   wuxw   物业相关功能基本测试完成
41
            <div slot="header" class="flex justify-between">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
42
43
44
45
46
47
48
49
50
51
52
53
              <span>{{ $t('adminRoom.list.title') }}</span>
            </div>
            <div class="table-wrapper">
              <el-table :data="tableData" border style="width: 100%">
                <el-table-column prop="roomNum" :label="$t('adminRoom.table.room')" fixed="left" width="120" />
                <el-table-column prop="communityName" :label="$t('adminRoom.table.community')" />
                <el-table-column prop="layer" :label="$t('adminRoom.table.floor')">
                  <template slot-scope="scope">{{ scope.row.layer }}{{ $t('adminRoom.table.floorUnit') }}</template>
                </el-table-column>
                <el-table-column prop="ownerName" :label="$t('adminRoom.table.owner')">
                  <template slot-scope="scope">
                    <router-link v-if="scope.row.ownerName"
f6a81350   wuxw   运营 业主详情开发完成
54
                      :to="`/views/aCommunity/adminOwnerDetail?ownerId=${scope.row.ownerId}`">
a42b3256   wuxw   HC小区管理系统前段vue版正在开发中
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
                      {{ scope.row.ownerName }}({{ scope.row.link }})
                    </router-link>
                    <span v-else>-</span>
                  </template>
                </el-table-column>
                <el-table-column prop="roomSubTypeName" :label="$t('adminRoom.table.type')" />
                <el-table-column :label="$t('adminRoom.table.area')">
                  <template slot-scope="scope">{{ scope.row.builtUpArea }}/{{ scope.row.roomArea }}{{
                    $t('adminRoom.table.areaUnit') }}</template>
                </el-table-column>
                <el-table-column prop="roomRent" :label="$t('adminRoom.table.rent')" />
                <el-table-column prop="stateName" :label="$t('adminRoom.table.state')" />
                <el-table-column :label="$t('adminRoom.table.validDate')">
                  <template slot-scope="scope">
                    {{ scope.row.startTime }}<br>~{{ scope.row.endTime }}
                  </template>
                </el-table-column>
                <el-table-column prop="memberCount" :label="$t('adminRoom.table.member')" />
                <el-table-column prop="carCount" :label="$t('adminRoom.table.car')" />
                <el-table-column prop="roomCount" :label="$t('adminRoom.table.ownerRoom')" />
                <el-table-column prop="contractCount" :label="$t('adminRoom.table.contract')" />
                <el-table-column :label="$t('common.operation')" fixed="right" width="100">
                  <template slot-scope="scope">
                    <el-button size="mini" type="primary" @click="handleDetail(scope.row)">
                      {{ $t('common.detail') }}
                    </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <el-pagination :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]" :page-size="pagination.size"
              layout="total, sizes, prev, pager, next, jumper" :total="pagination.total" @size-change="handleSizeChange"
              @current-change="handleCurrentChange" />
          </el-card>
        </div>
      </div>
    </div>
  </template>
  
  <script>
  import { queryAdminRoom, getRoomStates, getRoomSubTypes } from '@/api/community/adminRoomApi'
  import CommunityUnitTree from '@/components/community/CommunityUnitTree'
  
  export default {
    name: 'AdminRoomList',
    components: {
      CommunityUnitTree
    },
    data() {
      return {
        searchForm: {
          communityId: '',
          floorId: '',
          unitId: '',
          ownerNameLike: '',
          ownerTel: '',
          roomNum: '',
          state: '',
          roomSubType: '',
          page: 1,
          row: 10
        },
        tableData: [],
        states: [],
        roomSubTypes: [],
        pagination: {
          current: 1,
          size: 10,
          total: 0
        },
        loading: false
      }
    },
    computed: {
      // tableWidth() {
      //   const bodyWidth = document.body.clientWidth
      //   const menuWidth = document.getElementById('menu-nav').offsetWidth || 0
      //   const treeWidth = document.querySelector('.room-floor-unit-tree').offsetWidth || 200
      //   return `${bodyWidth - menuWidth - treeWidth - 60}px`
      // }
    },
    created() {
      this.initData()
      this.getList()
    },
    methods: {
      async initData() {
        try {
          const [statesRes, typesRes] = await Promise.all([
            getRoomStates(),
            getRoomSubTypes()
          ])
          this.states = statesRes
          this.roomSubTypes = typesRes
          this.$refs.communityUnitTree.open()
        } catch (error) {
          this.$message.error(this.$t('common.fetchError'))
        }
      },
      async getList() {
        try {
          this.loading = true
          const params = {
            ...this.searchForm,
            page: this.pagination.current,
            row: this.pagination.size
          }
          const { data, total } = await queryAdminRoom(params)
          this.tableData = data
          this.pagination.total = total
        } catch (error) {
          this.$message.error(this.$t('adminRoom.fetchError'))
        } finally {
          this.loading = false
        }
      },
      handleSearch() {
        this.pagination.current = 1
        this.getList()
      },
      handleSelectCommunity({ communityId }) {
        this.searchForm.communityId = communityId
        this.searchForm.floorId = ''
        this.searchForm.unitId = ''
        this.getList()
      },
      handleSelectFloor({ floorId }) {
        this.searchForm.communityId = ''
        this.searchForm.floorId = floorId
        this.searchForm.unitId = ''
        this.getList()
      },
      handleSelectUnit({ unitId }) {
        this.searchForm.communityId = ''
        this.searchForm.floorId = ''
        this.searchForm.unitId = unitId
        this.getList()
      },
      handleDetail(row) {
        this.$router.push(`/pages/community/adminRoomDetail?roomId=${row.roomId}`)
      },
      handleSizeChange(val) {
        this.pagination.size = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.pagination.current = val
        this.getList()
      }
    }
  }
  </script>
  
  <style lang="scss" scoped>
  .admin-room-container {
    padding: 20px;
  
    .room-floor-unit-tree {
      width: 200px;
      padding-right: 0;
    }
  
    .flex-grow {
      flex-grow: 1;
    }
  
    .margin-top {
      margin-top: 20px;
    }
  
    .table-wrapper {
      overflow-x: auto;
    }
  
    .el-card {
      margin-bottom: 20px;
    }
  }
  </style>