RoutePlan.vue
3.59 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
<template>
<div class="route-plan-container">
<el-table :data="routePlanInfo.plans" border style="width: 100%">
<el-table-column prop="inspectionPlanName" :label="$t('inspectionRoute.planName')" align="center" />
<el-table-column prop="inspectionRouteName" :label="$t('inspectionRoute.planRoute')" align="center" />
<el-table-column prop="inspectionPlanPeriodName" :label="$t('inspectionRoute.planCycle')" align="center" />
<el-table-column prop="signTypeName" :label="$t('inspectionRoute.signType')" align="center" />
<el-table-column :label="$t('inspectionRoute.dateRange')" align="center">
<template slot-scope="scope">
{{ scope.row.startDate }}~{{ scope.row.endDate }}
</template>
</el-table-column>
<el-table-column :label="$t('inspectionRoute.timeRange')" align="center">
<template slot-scope="scope">
{{ scope.row.startTime }}~{{ scope.row.endTime }}
</template>
</el-table-column>
<el-table-column prop="beforeTime" :label="$t('inspectionRoute.taskAdvance')" align="center" />
<el-table-column prop="createUserName" :label="$t('inspectionRoute.creator')" align="center" />
<el-table-column prop="createTime" :label="$t('inspectionRoute.createTime')" align="center" />
<el-table-column :label="$t('inspectionRoute.inspector')" align="center">
<template slot-scope="scope">
<div v-for="(staff, i) in scope.row.staffs" :key="i">
{{ staff.staffName }}
</div>
</template>
</el-table-column>
<el-table-column prop="stateName" :label="$t('inspectionRoute.status')" align="center" />
</el-table>
<el-pagination :current-page.sync="page.current" :page-size="page.size" :total="page.total"
layout="total, prev, pager, next" @current-change="handlePageChange" />
</div>
</template>
<script>
import { getCommunityId } from '@/api/community/communityApi'
import { queryRouteInspectionPlan } from '@/api/inspection/inspectionRouteApi'
export default {
name: 'RoutePlan',
data() {
return {
routePlanInfo: {
plans: [],
inspectionRouteId: '',
inspectionPlanId: ''
},
page: {
current: 1,
size: 10,
total: 0
},
communityId: ''
}
},
created() {
this.communityId = getCommunityId()
},
beforeDestroy() {
},
methods: {
loadData(params) {
this.routePlanInfo.inspectionRouteId = params.inspectionRouteId
this.routePlanInfo.inspectionPlanId = params.inspectionPlanId || ''
this._loadRoutePlanData(1, 10)
},
handleSwitch(params) {
this.routePlanInfo.inspectionRouteId = params.inspectionRouteId
this.routePlanInfo.inspectionPlanId = params.inspectionPlanId || ''
this._loadRoutePlanData(1, 10)
},
async _loadRoutePlanData(page = 1, size = 10) {
try {
const params = {
communityId: this.communityId,
inspectionRouteId: this.routePlanInfo.inspectionRouteId,
inspectionPlanId: this.routePlanInfo.inspectionPlanId,
page,
row: size
}
const { data, total } = await queryRouteInspectionPlan(params)
this.routePlanInfo.plans = data
this.page.total = total
} catch (error) {
console.error('获取巡检计划失败:', error)
}
},
handlePageChange(currentPage) {
this._loadRoutePlanData(currentPage, this.page.size)
}
}
}
</script>
<style lang="scss" scoped>
.route-plan-container {
padding: 20px;
height: 100%;
.el-pagination {
margin-top: 20px;
text-align: right;
}
}
</style>