AInspectionPlanDetailStaff.vue
1.95 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
<template>
<div class="staff-container">
<el-table :data="staffs" border style="width: 100%" v-loading="loading">
<el-table-column prop="staffName" :label="$t('aInspectionPlanDetail.staffName')" align="center" />
<el-table-column prop="startTime" :label="$t('aInspectionPlanDetail.startTime')" align="center" />
<el-table-column prop="endTime" :label="$t('aInspectionPlanDetail.endTime')" align="center" />
</el-table>
<el-pagination :current-page.sync="page.current" :page-sizes="[10, 20, 30, 50]" :page-size="page.size"
:total="page.total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
</div>
</template>
<script>
import { listAdminInspectionPlanStaffs } from '@/api/inspection/aInspectionPlanDetailApi'
export default {
name: 'AInspectionPlanDetailStaff',
data() {
return {
loading: false,
staffs: [],
inspectionPlanId: '',
page: {
current: 1,
size: 10,
total: 0
}
}
},
methods: {
async loadData(params) {
this.inspectionPlanId = params.inspectionPlanId
await this.getStaffList()
},
async getStaffList() {
try {
this.loading = true
const params = {
inspectionPlanId: this.inspectionPlanId,
page: this.page.current,
row: this.page.size
}
const { inspectionPlanStaffs, total } = await listAdminInspectionPlanStaffs(params)
this.staffs = inspectionPlanStaffs
this.page.total = total
} catch (error) {
this.$message.error(this.$t('common.fetchError'))
} finally {
this.loading = false
}
},
handleSizeChange(val) {
this.page.size = val
this.getStaffList()
},
handleCurrentChange(val) {
this.page.current = val
this.getStaffList()
}
}
}
</script>
<style scoped>
.staff-container {
padding: 20px;
}
</style>