dedd9ade
wuxw
开发完成admin 系统小区公众号
|
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
|
<template>
<div class="community-wechat-container">
<el-row :gutter="20">
<el-col :span="4">
<select-admin-community :community-id="communityId" @changeCommunity="handleCommunityChange" />
</el-col>
<el-col :span="20">
<el-card>
<div slot="header" class="clearfix">
<span>{{ $t('communityWechat.title') }}</span>
<el-button v-if="communityId && tableData.length === 0" type="primary" size="small" class="float-right"
@click="openAddDialog">
<i class="el-icon-plus"></i>
{{ $t('communityWechat.add') }}
</el-button>
</div>
<el-table :data="tableData" border style="width: 100%" v-loading="loading">
<el-table-column :label="$t('communityWechat.name')" prop="name" align="center" />
<el-table-column :label="$t('communityWechat.communityName')" prop="communityName" align="center" />
<el-table-column label="APPID" prop="appId" align="center" />
<el-table-column :label="$t('communityWechat.appSecret')" align="center">
<template >
********
</template>
</el-table-column>
<el-table-column :label="$t('communityWechat.description')" prop="remarks" align="center" />
<el-table-column :label="$t('communityWechat.operation')" align="center" width="150">
<template slot-scope="scope">
<el-button type="text" size="small" @click="openEditDialog(scope.row)">
{{ $t('communityWechat.edit') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<add-community-wechat ref="addDialog" @success="loadData" />
<edit-community-wechat ref="editDialog" @success="loadData" />
</div>
</template>
<script>
import { listAdminSmallWeChats } from '@/api/community/communityWechatApi'
import SelectAdminCommunity from '@/components/community/selectAdminCommunity'
import AddCommunityWechat from '@/components/community/addCommunityWechat'
import EditCommunityWechat from '@/components/community/editCommunityWechat'
export default {
name: 'CommunityWechatList',
components: {
SelectAdminCommunity,
AddCommunityWechat,
EditCommunityWechat
},
data() {
return {
loading: false,
communityId: '',
tableData: [],
page: {
current: 1,
size: 100,
total: 0
}
}
},
watch: {
communityId() {
this.loadData()
}
},
methods: {
handleCommunityChange(community) {
this.communityId = community.communityId
},
async loadData() {
if (!this.communityId) {
this.tableData = []
return
}
try {
this.loading = true
const params = {
page: this.page.current,
row: this.page.size,
weChatType: '1100',
communityId: this.communityId
}
const res = await listAdminSmallWeChats(params)
if (res.code === 0) {
this.tableData = res.data || []
this.page.total = res.total || 0
} else {
this.$message.error(res.msg || this.$t('communityWechat.loadFailed'))
}
} catch (error) {
console.error('获取公众号列表失败:', error)
this.$message.error(this.$t('communityWechat.loadFailed'))
} finally {
this.loading = false
}
},
openAddDialog() {
this.$refs.addDialog.open({
communityId: this.communityId,
objId: this.communityId,
weChatType: '1100'
})
},
openEditDialog(row) {
this.$refs.editDialog.open(row)
}
}
}
</script>
<style scoped>
.community-wechat-container {
padding: 20px;
}
.float-right {
float: right;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
</style>
|