enterCommunityList.vue
4.77 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
<template>
<div class="enter-community-container">
<el-card v-if="showPage === 'myCommunity'">
<div slot="header" class=" flex justify-between">
<span>{{ $t('enterCommunity.myCommunity') }}</span>
<el-button type="primary" size="small" @click="showHcUse">
<i class="el-icon-plus"></i>
{{ $t('enterCommunity.commercialProcess') }}
</el-button>
</div>
<el-table :data="communityList" border v-loading="loading">
<el-table-column prop="provName" :label="$t('enterCommunity.province')" align="center" />
<el-table-column prop="cityName" :label="$t('enterCommunity.city')" align="center" />
<el-table-column prop="areaName" :label="$t('enterCommunity.district')" align="center" width="150" />
<el-table-column prop="name" :label="$t('enterCommunity.communityName')" align="center" width="200" />
<el-table-column prop="communityId" :label="$t('enterCommunity.communityCode')" align="center" />
<el-table-column prop="tel" :label="$t('enterCommunity.servicePhone')" align="center" />
<el-table-column prop="communityArea" :label="$t('enterCommunity.area')" align="center" />
<el-table-column prop="startTime" :label="$t('enterCommunity.startTime')" align="center" />
<el-table-column prop="endTime" :label="$t('enterCommunity.endTime')" align="center" />
<el-table-column :label="$t('enterCommunity.status')" align="center">
<template slot-scope="{ row }">
{{ statusMap[row.auditStatusCd] || row.auditStatusCd }}
</template>
</el-table-column>
<el-table-column :label="$t('enterCommunity.operation')" align="center" width="120">
<template slot-scope="{ row }">
<el-button v-if="row.auditStatusCd === '1100'" type="text" size="small" @click="openEditDialog(row)">
{{ $t('enterCommunity.modify') }}
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination class="pagination" :current-page="pagination.current" :page-sizes="[10, 20, 30, 50]"
:page-size="pagination.size" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange" @current-change="handlePageChange" />
</el-card>
<el-card v-else>
<div slot="header" class=" flex justify-between">
<div>{{ $t('enterCommunity.commercialProcess') }}</div>
<el-button type="primary" size="small" @click="goBack">
<i class="el-icon-close"></i>
{{ $t('enterCommunity.back') }}
</el-button>
</div>
<div class="commercial-content">
<img src="/img/hc_use.png" alt="Commercial Process">
</div>
</el-card>
<edit-community-area ref="editDialog" @success="fetchCommunityList" />
</div>
</template>
<script>
import { listMyCommunity } from '@/api/community/enterCommunityApi'
import EditCommunityArea from '@/components/community/editCommunityArea.vue'
export default {
name: 'EnterCommunityList',
components: { EditCommunityArea },
data() {
return {
showPage: 'myCommunity',
loading: false,
communityList: [],
pagination: {
current: 1,
size: 10,
total: 0
},
statusMap: {
'1000': this.$t('enterCommunity.statusOptions.1000'),
'1100': this.$t('enterCommunity.statusOptions.1100'),
'1200': this.$t('enterCommunity.statusOptions.1200')
}
}
},
mounted() {
this.fetchCommunityList()
},
methods: {
async fetchCommunityList() {
this.loading = true
try {
const params = {
page: this.pagination.current,
row: this.pagination.size,
communityId: this.getCommunityId()
}
const data = await listMyCommunity(params)
this.communityList = data
this.pagination.total = data.length
} catch (error) {
this.$message.error(error.message || this.$t('enterCommunity.fetchError'))
} finally {
this.loading = false
}
},
openEditDialog(community) {
this.$refs.editDialog.open(community)
},
showHcUse() {
this.showPage = 'hcUse'
},
goBack() {
this.showPage = 'myCommunity'
},
handlePageChange(page) {
this.pagination.current = page
this.fetchCommunityList()
},
handleSizeChange(size) {
this.pagination.size = size
this.fetchCommunityList()
}
}
}
</script>
<style scoped>
.enter-community-container {
padding: 20px;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
.float-right {
float: right;
}
.commercial-content {
text-align: center;
padding: 20px 0;
}
.commercial-content img {
max-width: 100%;
}
.pagination {
margin-top: 20px;
text-align: right;
}
</style>