ebc1053d
wuxw
加入运营员工详情功能
|
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
|
<div >
<el-row>
<el-col :span="24" class="text-right">
<el-button type="primary" size="small" @click="openAddStaffCommunityModal">
{{ $t('aStaffDetailCommunitys.relateCommunity') }}
</el-button>
</el-col>
</el-row>
<div class="margin-top">
<el-table :data="communitys" border style="width: 100%">
<el-table-column prop="staffName" :label="$t('aStaffDetailCommunitys.staffName')" align="center" />
<el-table-column prop="staffId" :label="$t('aStaffDetailCommunitys.staffId')" align="center" />
<el-table-column prop="communityId" :label="$t('aStaffDetailCommunitys.communityId')" align="center" />
<el-table-column prop="communityName" :label="$t('aStaffDetailCommunitys.communityName')" align="center" />
<el-table-column :label="$t('aStaffDetailCommunitys.operation')" align="center" width="120">
<template slot-scope="scope">
<el-button type="text" size="small" @click="openDeleteRoleCommunityModel(scope.row)">
{{ $t('aStaffDetailCommunitys.delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
<el-row class="margin-top">
<el-col :span="12"></el-col>
<el-col :span="12" class="text-right">
<el-pagination :current-page.sync="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="handleCurrentChange" />
</el-col>
</el-row>
</div>
<add-a-staff-community ref="addCommunity" @success="handleAddCommunitySuccess" />
<delete-a-staff-community ref="deleteCommunity" @success="handleDeleteCommunitySuccess" />
</div>
</template>
<script>
import { listStaffCommunities } from '@/api/staff/aStaffDetailApi'
import AddAStaffCommunity from '@/components/staff/addAStaffCommunity'
import DeleteAStaffCommunity from '@/components/staff/deleteAStaffCommunity'
export default {
name: 'AStaffDetailCommunitys',
props: {
staffId: {
type: String,
required: true
}
},
data() {
return {
communitys: [],
pagination: {
current: 1,
size: 10,
total: 0
}
}
},
watch: {
staffId: {
immediate: true,
handler(newVal) {
if (newVal) {
this.loadData()
}
}
}
},
components:{
AddAStaffCommunity,
DeleteAStaffCommunity,
},
methods: {
async loadData() {
try {
const response = await listStaffCommunities({
staffId: this.staffId,
page: this.pagination.current,
row: this.pagination.size
})
this.communitys = response.data || []
|
ebc1053d
wuxw
加入运营员工详情功能
|
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
} catch (error) {
this.$message.error(this.$t('aStaffDetailCommunitys.loadError'))
}
},
openAddStaffCommunityModal() {
this.$refs.addCommunity.open({
staffId: this.staffId
})
},
openDeleteRoleCommunityModel(community) {
this.$refs.deleteCommunity.open(community)
},
handleSizeChange(size) {
this.pagination.size = size
this.loadData()
},
handleCurrentChange(page) {
this.pagination.current = page
this.loadData()
},
handleAddCommunitySuccess() {
this.loadData()
|