1d73dc48
wuxw
继续晚上巡检功能
|
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
|
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('inspectionPlan.planName')" prop="inspectionPlanName" required>
<el-input v-model="formData.inspectionPlanName" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('inspectionPlan.planRoute')" prop="inspectionRouteId" required>
<el-select v-model="formData.inspectionRouteId" style="width:100%" @change="handleRouteChange">
<el-option v-for="route in routeOptions" :key="route.inspectionRouteId" :label="route.routeName"
:value="route.inspectionRouteId" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('inspectionPlan.planCycle')" prop="inspectionPlanPeriod" required>
<el-select v-model="formData.inspectionPlanPeriod" style="width:100%" @change="handlePeriodChange">
<el-option label="月/天" value="2020022" />
<el-option label="按周" value="2020023" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('inspectionPlan.taskAdvance')">
<el-input-number v-model="formData.beforeTime" :min="1" />
<span class="margin-left">{{ $t('editInspectionPlan.minutesGenerate') }}</span>
</el-form-item>
</el-col>
</el-row>
<!-- 月/天选择 -->
<template v-if="formData.inspectionPlanPeriod === '2020022'">
<el-row>
<el-form-item :label="$t('editInspectionPlan.month')">
<el-checkbox-group v-model="formData.months">
<el-checkbox v-for="month in 12" :key="month" :label="month">
{{ month }}{{ $t('editInspectionPlan.month') }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-row>
<el-row>
<el-form-item :label="$t('editInspectionPlan.day')">
<el-checkbox-group v-model="formData.days">
<el-checkbox v-for="day in 31" :key="day" :label="day">
{{ day }}{{ $t('editInspectionPlan.day') }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-row>
</template>
<!-- 按周选择 -->
<template v-if="formData.inspectionPlanPeriod === '2020023'">
<el-row>
<el-form-item :label="$t('editInspectionPlan.week')">
<el-checkbox-group v-model="formData.workdays">
<el-checkbox v-for="(day, index) in weekDays" :key="index" :label="index + 1">
{{ day }}
</el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-row>
</template>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('editInspectionPlan.startDate')" required>
<el-date-picker v-model="formData.startDate" type="date" value-format="yyyy-MM-dd" style="width:100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('editInspectionPlan.endDate')" required>
<el-date-picker v-model="formData.endDate" type="date" value-format="yyyy-MM-dd" style="width:100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('editInspectionPlan.startTime')" required>
<el-time-picker v-model="formData.startTime" value-format="HH:mm" style="width:100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('editInspectionPlan.endTime')" required>
<el-time-picker v-model="formData.endTime" value-format="HH:mm" style="width:100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item :label="$t('editInspectionPlan.signMethod')" required>
<el-select v-model="formData.signType" style="width:100%">
|
1d73dc48
wuxw
继续晚上巡检功能
|
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
export default {
name: 'EditInspectionPlan',
components: {
SelectStaffDiv
},
data() {
return {
visible: false,
formData: {
inspectionPlanId: '',
inspectionPlanName: '',
inspectionRouteId: '',
inspectionPlanPeriod: '',
startDate: '',
endDate: '',
beforeTime: 30,
startTime: '',
endTime: '',
signType: '',
canReexamine: '1000',
months: [],
days: [],
workdays: [],
staffs: []
},
routeOptions: [],
signTypeOptions: [],
weekDays: [
this.$t('inspectionPlan.monday'),
this.$t('inspectionPlan.tuesday'),
this.$t('inspectionPlan.wednesday'),
this.$t('inspectionPlan.thursday'),
this.$t('inspectionPlan.friday'),
this.$t('inspectionPlan.saturday'),
this.$t('inspectionPlan.sunday')
]
}
},
async created() {
await this.loadDictData()
this.loadRoutes()
},
methods: {
async loadDictData() {
try {
this.signTypeOptions = await getDict('inspection_plan', 'sign_type')
} catch (error) {
console.error('Failed to load sign types:', error)
}
},
async loadRoutes() {
try {
const { data } = await listInspectionRoutes({
page: 1,
row: 100
})
this.routeOptions = data
} catch (error) {
console.error('Failed to load routes:', error)
}
},
open(plan) {
this.formData = {
...this.formData,
...plan,
months: plan.inspectionMonth ? plan.inspectionMonth.split(',').map(Number) : [],
days: plan.inspectionDay ? plan.inspectionDay.split(',').map(Number) : [],
workdays: plan.inspectionWorkday ? plan.inspectionWorkday.split(',').map(Number) : []
}
this.loadStaffs(plan.inspectionPlanId)
this.visible = true
},
async loadStaffs(planId) {
try {
|
1d73dc48
wuxw
继续晚上巡检功能
|
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
} catch (error) {
console.error('Failed to load staffs:', error)
}
},
handleSelectStaffs(staffs) {
this.formData.staffs = staffs
},
handleRouteChange() {
// 处理路线变更逻辑
},
handlePeriodChange() {
// 处理周期变更逻辑
},
resetForm() {
this.$refs.form.resetFields()
},
async savePlan() {
try {
// 获取选中的员工
// 准备数据
const payload = {
...this.formData,
inspectionMonth: this.formData.months.join(','),
inspectionDay: this.formData.days.join(','),
inspectionWorkday: this.formData.workdays.join(',')
}
// 调用API
await updateInspectionPlan(payload)
this.$message.success(this.$t('inspectionPlan.updateSuccess'))
this.visible = false
this.$emit('success')
} catch (error) {
|