community.vue
6.31 KB
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
<div class="community-container">
<div class="page-header">
<el-button type="primary" @click="handleAdd">{{ $t('community.addCommunity') }}</el-button>
</div>
<!-- 搜索区域 -->
<el-card class="search-card">
<el-form :inline="true" :model="searchForm" class="search-form">
<el-form-item :label="$t('community.province')">
<el-select v-model="searchForm.province" placeholder="请选择省份">
<el-option label="北京市" value="北京市"></el-option>
<!-- 其他省份选项 -->
</el-select>
</el-form-item>
<el-form-item :label="$t('community.city')">
<el-select v-model="searchForm.city" placeholder="请选择城市">
<el-option label="北京市" value="北京市"></el-option>
<!-- 其他城市选项 -->
</el-select>
</el-form-item>
<el-form-item :label="$t('community.district')">
<el-select v-model="searchForm.district" placeholder="请选择区/县">
<el-option label="西城区" value="西城区"></el-option>
<!-- 其他区县选项 -->
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">{{ $t('common.search') }}</el-button>
<el-button @click="handleReset">{{ $t('common.reset') }}</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- 表格区域 -->
<el-card class="table-card">
<el-table
:data="tableData"
border
style="width: 100%"
v-loading="loading"
>
<el-table-column
prop="province"
:label="$t('community.province')"
width="120">
</el-table-column>
<el-table-column
prop="city"
:label="$t('community.city')"
width="120">
</el-table-column>
<el-table-column
prop="district"
:label="$t('community.district')"
width="120">
</el-table-column>
<el-table-column
prop="communityName"
:label="$t('community.communityName')"
width="180">
</el-table-column>
<el-table-column
prop="communityCode"
:label="$t('community.communityCode')"
width="180">
</el-table-column>
<el-table-column
prop="phone"
:label="$t('community.phone')"
width="120">
</el-table-column>
<el-table-column
prop="area"
:label="$t('community.area')"
width="100">
</el-table-column>
<el-table-column
prop="startTime"
:label="$t('community.startTime')"
width="160">
</el-table-column>
<el-table-column
prop="endTime"
:label="$t('community.endTime')"
width="160">
</el-table-column>
<el-table-column
prop="status"
:label="$t('community.status')"
width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.status === '入驻成功' ? 'success' : 'info'">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column
:label="$t('common.operation')"
fixed="right"
width="150">
<template slot-scope="scope">
<el-button type="text" @click="handleEdit(scope.row)">{{ $t('common.edit') }}</el-button>
<el-button type="text" @click="handleView(scope.row)">{{ $t('common.view') }}</el-button>
<el-button type="text" @click="handleDelete(scope.row)" class="delete-btn">{{ $t('common.delete') }}</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 30, 50]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total">
</el-pagination>
</div>
</el-card>
</div>
</template>
<script>
export default {
name: 'Community',
data() {
return {
searchForm: {
province: '',
city: '',
district: ''
},
tableData: [{
province: '北京市',
city: '北京市',
district: '西城区',
communityName: '阳光家园',
communityCode: '202504125114067',
phone: '13255555555',
area: '100.00',
startTime: '2025-04-12 11:53:35',
endTime: '2026-04-12 11:53:35',
status: '入驻成功'
}],
loading: false,
currentPage: 1,
pageSize: 10,
total: 0
}
},
methods: {
handleAdd() {
// 处理添加小区
},
handleSearch() {
// 处理搜索
this.loading = true
setTimeout(() => {
this.loading = false
}, 1000)
},
handleReset() {
this.searchForm = {
province: '',
city: '',
district: ''
}
},
handleEdit(row) {
console.log('编辑', row)
},
handleView(row) {
console.log('查看', row)
},
handleDelete(row) {
this.$confirm(this.$t('common.deleteConfirm'), this.$t('common.warning'), {
confirmButtonText: this.$t('common.confirm'),
cancelButtonText: this.$t('common.cancel'),
type: 'warning'
}).then(() => {
console.log('删除', row)
this.$message({
type: 'success',
message: this.$t('common.deleteSuccess')
})
}).catch(() => {})
},
handleSizeChange(val) {
this.pageSize = val
this.handleSearch()
},
handleCurrentChange(val) {
this.currentPage = val
this.handleSearch()
}
}
}
</script>
<style scoped>
.community-container {
padding: 20px;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.search-card {
margin-bottom: 20px;
}
.search-form {
display: flex;
flex-wrap: wrap;
}
.table-card {
margin-bottom: 20px;
}
.pagination-container {
margin-top: 20px;
text-align: right;
}
.delete-btn {
color: #F56C6C;
}
.delete-btn:hover {
color: #f78989;
}
</style>