|
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+<template>
|
|
|
2
|
+ <div class="work-order-management">
|
|
|
3
|
+ <el-card class="work-order-stats">
|
|
|
4
|
+ <template #header>
|
|
|
5
|
+ <span>工单统计</span>
|
|
|
6
|
+ </template>
|
|
|
7
|
+ <el-row :gutter="20">
|
|
|
8
|
+ <el-col :span="6">
|
|
|
9
|
+ <div class="stat-item">
|
|
|
10
|
+ <div class="stat-number">{{ statistics.totalOrders }}</div>
|
|
|
11
|
+ <div class="stat-label">总工单数</div>
|
|
|
12
|
+ </div>
|
|
|
13
|
+ </el-col>
|
|
|
14
|
+ <el-col :span="6">
|
|
|
15
|
+ <div class="stat-item">
|
|
|
16
|
+ <div class="stat-number">{{ statistics.pendingCount }}</div>
|
|
|
17
|
+ <div class="stat-label">待处理</div>
|
|
|
18
|
+ </div>
|
|
|
19
|
+ </el-col>
|
|
|
20
|
+ <el-col :span="6">
|
|
|
21
|
+ <div class="stat-item">
|
|
|
22
|
+ <div class="stat-number">{{ statistics.processingCount }}</div>
|
|
|
23
|
+ <div class="stat-label">处理中</div>
|
|
|
24
|
+ </div>
|
|
|
25
|
+ </el-col>
|
|
|
26
|
+ <el-col :span="6">
|
|
|
27
|
+ <div class="stat-item">
|
|
|
28
|
+ <div class="stat-number">{{ statistics.completedCount }}</div>
|
|
|
29
|
+ <div class="stat-label">已完成</div>
|
|
|
30
|
+ </div>
|
|
|
31
|
+ </el-col>
|
|
|
32
|
+ </el-row>
|
|
|
33
|
+ </el-card>
|
|
|
34
|
+
|
|
|
35
|
+ <el-card class="work-order-list">
|
|
|
36
|
+ <template #header>
|
|
|
37
|
+ <div class="card-header">
|
|
|
38
|
+ <span>工单列表</span>
|
|
|
39
|
+ <div class="header-actions">
|
|
|
40
|
+ <el-select v-model="statusFilter" placeholder="状态筛选" clearable style="width: 120px; margin-right: 10px;">
|
|
|
41
|
+ <el-option label="待处理" value="pending" />
|
|
|
42
|
+ <el-option label="已分配" value="assigned" />
|
|
|
43
|
+ <el-option label="处理中" value="processing" />
|
|
|
44
|
+ <el-option label="已完成" value="completed" />
|
|
|
45
|
+ <el-option label="已取消" value="cancelled" />
|
|
|
46
|
+ </el-select>
|
|
|
47
|
+ <el-input
|
|
|
48
|
+ v-model="searchQuery"
|
|
|
49
|
+ placeholder="搜索工单..."
|
|
|
50
|
+ style="width: 200px"
|
|
|
51
|
+ clearable
|
|
|
52
|
+ />
|
|
|
53
|
+ <el-button type="primary" @click="createNewWorkOrder">新建工单</el-button>
|
|
|
54
|
+ </div>
|
|
|
55
|
+ </div>
|
|
|
56
|
+ </template>
|
|
|
57
|
+
|
|
|
58
|
+ <el-table
|
|
|
59
|
+ :data="filteredWorkOrders"
|
|
|
60
|
+ stripe
|
|
|
61
|
+ style="width: 100%"
|
|
|
62
|
+ v-loading="loading"
|
|
|
63
|
+ >
|
|
|
64
|
+ <el-table-column prop="orderNo" label="工单编号" width="120" />
|
|
|
65
|
+ <el-table-column prop="title" label="工单标题" min-width="200" />
|
|
|
66
|
+ <el-table-column prop="orderType" label="工单类型" width="120" />
|
|
|
67
|
+ <el-table-column prop="priority" label="优先级" width="80">
|
|
|
68
|
+ <template #default="{ row }">
|
|
|
69
|
+ <el-tag :type="getPriorityType(row.priority)">
|
|
|
70
|
+ {{ getPriorityText(row.priority) }}
|
|
|
71
|
+ </el-tag>
|
|
|
72
|
+ </template>
|
|
|
73
|
+ </el-table-column>
|
|
|
74
|
+ <el-table-column prop="status" label="状态" width="100">
|
|
|
75
|
+ <template #default="{ row }">
|
|
|
76
|
+ <el-tag :type="getStatusType(row.status)">
|
|
|
77
|
+ {{ getStatusText(row.status) }}
|
|
|
78
|
+ </el-tag>
|
|
|
79
|
+ </template>
|
|
|
80
|
+ </el-table-column>
|
|
|
81
|
+ <el-table-column prop="assigneeName" label="处理人" width="100" />
|
|
|
82
|
+ <el-table-column prop="location" label="位置" width="150" />
|
|
|
83
|
+ <el-table-column prop="createdAt" label="创建时间" width="180">
|
|
|
84
|
+ <template #default="{ row }">
|
|
|
85
|
+ {{ formatDate(row.createdAt) }}
|
|
|
86
|
+ </template>
|
|
|
87
|
+ </el-table-column>
|
|
|
88
|
+ <el-table-column prop="completionTime" label="完成时间" width="180">
|
|
|
89
|
+ <template #default="{ row }">
|
|
|
90
|
+ {{ row.completionTime ? formatDate(row.completionTime) : '-' }}
|
|
|
91
|
+ </template>
|
|
|
92
|
+ </el-table-column>
|
|
|
93
|
+ <el-table-column label="操作" width="250" fixed="right">
|
|
|
94
|
+ <template #default="{ row }">
|
|
|
95
|
+ <el-button
|
|
|
96
|
+ size="small"
|
|
|
97
|
+ @click="viewWorkOrder(row)"
|
|
|
98
|
+ >
|
|
|
99
|
+ 查看
|
|
|
100
|
+ </el-button>
|
|
|
101
|
+ <el-button
|
|
|
102
|
+ size="small"
|
|
|
103
|
+ type="primary"
|
|
|
104
|
+ @click="assignWorkOrder(row)"
|
|
|
105
|
+ v-if="row.status === 'pending'"
|
|
|
106
|
+ >
|
|
|
107
|
+ 分派
|
|
|
108
|
+ </el-button>
|
|
|
109
|
+ <el-button
|
|
|
110
|
+ size="small"
|
|
|
111
|
+ type="success"
|
|
|
112
|
+ @click="startWorkOrder(row)"
|
|
|
113
|
+ v-if="row.status === 'assigned'"
|
|
|
114
|
+ >
|
|
|
115
|
+ 开始处理
|
|
|
116
|
+ </el-button>
|
|
|
117
|
+ <el-button
|
|
|
118
|
+ size="small"
|
|
|
119
|
+ type="info"
|
|
|
120
|
+ @click="completeWorkOrder(row)"
|
|
|
121
|
+ v-if="row.status === 'processing'"
|
|
|
122
|
+ >
|
|
|
123
|
+ 完成
|
|
|
124
|
+ </el-button>
|
|
|
125
|
+ <el-button
|
|
|
126
|
+ size="small"
|
|
|
127
|
+ type="danger"
|
|
|
128
|
+ @click="cancelWorkOrder(row)"
|
|
|
129
|
+ v-if="row.status !== 'completed' && row.status !== 'cancelled'"
|
|
|
130
|
+ >
|
|
|
131
|
+ 取消
|
|
|
132
|
+ </el-button>
|
|
|
133
|
+ </template>
|
|
|
134
|
+ </el-table-column>
|
|
|
135
|
+ </el-table>
|
|
|
136
|
+
|
|
|
137
|
+ <div class="pagination">
|
|
|
138
|
+ <el-pagination
|
|
|
139
|
+ v-model:current-page="currentPage"
|
|
|
140
|
+ v-model:page-size="pageSize"
|
|
|
141
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
142
|
+ :total="totalWorkOrders"
|
|
|
143
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
144
|
+ @size-change="handleSizeChange"
|
|
|
145
|
+ @current-change="handleCurrentChange"
|
|
|
146
|
+ />
|
|
|
147
|
+ </div>
|
|
|
148
|
+ </el-card>
|
|
|
149
|
+
|
|
|
150
|
+ <!-- 工单详情对话框 -->
|
|
|
151
|
+ <el-dialog
|
|
|
152
|
+ v-model="dialogVisible"
|
|
|
153
|
+ :title="dialogTitle"
|
|
|
154
|
+ width="80%"
|
|
|
155
|
+ :before-close="handleDialogClose"
|
|
|
156
|
+ >
|
|
|
157
|
+ <div v-if="currentWorkOrder">
|
|
|
158
|
+ <el-descriptions :column="2" border>
|
|
|
159
|
+ <el-descriptions-item label="工单编号">{{ currentWorkOrder.orderNo }}</el-descriptions-item>
|
|
|
160
|
+ <el-descriptions-item label="工单类型">{{ currentWorkOrder.orderType }}</el-descriptions-item>
|
|
|
161
|
+ <el-descriptions-item label="优先级">
|
|
|
162
|
+ <el-tag :type="getPriorityType(currentWorkOrder.priority)">
|
|
|
163
|
+ {{ getPriorityText(currentWorkOrder.priority) }}
|
|
|
164
|
+ </el-tag>
|
|
|
165
|
+ </el-descriptions-item>
|
|
|
166
|
+ <el-descriptions-item label="状态">
|
|
|
167
|
+ <el-tag :type="getStatusType(currentWorkOrder.status)">
|
|
|
168
|
+ {{ getStatusText(currentWorkOrder.status) }}
|
|
|
169
|
+ </el-tag>
|
|
|
170
|
+ </el-descriptions-item>
|
|
|
171
|
+ <el-descriptions-item label="处理人">{{ currentWorkOrder.assigneeName }}</el-descriptions-item>
|
|
|
172
|
+ <el-descriptions-item label="预计工时">{{ currentWorkOrder.estimatedDuration }}分钟</el-descriptions-item>
|
|
|
173
|
+ <el-descriptions-item label="问题标题">{{ currentWorkOrder.title }}</el-descriptions-item>
|
|
|
174
|
+ <el-descriptions-item label="位置">{{ currentWorkOrder.location }}</el-descriptions-item>
|
|
|
175
|
+ <el-descriptions-item label="问题描述" :span="2">{{ currentWorkOrder.description }}</el-descriptions-item>
|
|
|
176
|
+ <el-descriptions-item label="解决方案" :span="2">{{ currentWorkOrder.solutionDescription || '-' }}</el-descriptions-item>
|
|
|
177
|
+ <el-descriptions-item label="处理结果" :span="2">{{ currentWorkOrder.solutionResult || '-' }}</el-descriptions-item>
|
|
|
178
|
+ <el-descriptions-item label="客户反馈" :span="2">{{ currentWorkOrder.customerFeedback || '-' }}</el-descriptions-item>
|
|
|
179
|
+ </el-descriptions>
|
|
|
180
|
+
|
|
|
181
|
+ <!-- 处理记录 -->
|
|
|
182
|
+ <div style="margin-top: 20px;">
|
|
|
183
|
+ <h4>处理记录</h4>
|
|
|
184
|
+ <el-timeline>
|
|
|
185
|
+ <el-timeline-item
|
|
|
186
|
+ v-for="record in processRecords"
|
|
|
187
|
+ :key="record.id"
|
|
|
188
|
+ :timestamp="formatDate(record.createdAt)"
|
|
|
189
|
+ :type="getProcessStepType(record.processStep)"
|
|
|
190
|
+ >
|
|
|
191
|
+ <h5>{{ getProcessStepText(record.processStep) }}</h5>
|
|
|
192
|
+ <p>{{ record.comment }}</p>
|
|
|
193
|
+ <p v-if="record.processorName">处理人:{{ record.processorName }}</p>
|
|
|
194
|
+ <div v-if="record.photos && record.photos.length > 0">
|
|
|
195
|
+ <el-image
|
|
|
196
|
+ v-for="(photo, index) in record.photos"
|
|
|
197
|
+ :key="index"
|
|
|
198
|
+ :src="photo"
|
|
|
199
|
+ style="width: 100px; height: 100px; margin-right: 10px; margin-top: 10px;"
|
|
|
200
|
+ fit="cover"
|
|
|
201
|
+ :preview-src-list="record.photos"
|
|
|
202
|
+ />
|
|
|
203
|
+ </div>
|
|
|
204
|
+ </el-timeline-item>
|
|
|
205
|
+ </el-timeline>
|
|
|
206
|
+ </div>
|
|
|
207
|
+ </div>
|
|
|
208
|
+ </el-dialog>
|
|
|
209
|
+ </div>
|
|
|
210
|
+</template>
|
|
|
211
|
+
|
|
|
212
|
+<script setup>
|
|
|
213
|
+import { ref, computed, onMounted } from 'vue'
|
|
|
214
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
215
|
+import axios from 'axios'
|
|
|
216
|
+
|
|
|
217
|
+const workOrders = ref([])
|
|
|
218
|
+const statistics = ref({
|
|
|
219
|
+ totalOrders: 0,
|
|
|
220
|
+ pendingCount: 0,
|
|
|
221
|
+ assignedCount: 0,
|
|
|
222
|
+ processingCount: 0,
|
|
|
223
|
+ completedCount: 0,
|
|
|
224
|
+ cancelledCount: 0
|
|
|
225
|
+})
|
|
|
226
|
+
|
|
|
227
|
+const loading = ref(false)
|
|
|
228
|
+const dialogVisible = ref(false)
|
|
|
229
|
+const currentWorkOrder = ref(null)
|
|
|
230
|
+const processRecords = ref([])
|
|
|
231
|
+const statusFilter = ref('')
|
|
|
232
|
+const searchQuery = ref('')
|
|
|
233
|
+const currentPage = ref(1)
|
|
|
234
|
+const pageSize = ref(10)
|
|
|
235
|
+const totalWorkOrders = ref(0)
|
|
|
236
|
+
|
|
|
237
|
+// 计算属性
|
|
|
238
|
+const filteredWorkOrders = computed(() => {
|
|
|
239
|
+ let filtered = workOrders.value
|
|
|
240
|
+
|
|
|
241
|
+ // 状态筛选
|
|
|
242
|
+ if (statusFilter.value) {
|
|
|
243
|
+ filtered = filtered.filter(w => w.status === statusFilter.value)
|
|
|
244
|
+ }
|
|
|
245
|
+
|
|
|
246
|
+ // 搜索筛选
|
|
|
247
|
+ if (searchQuery.value) {
|
|
|
248
|
+ const query = searchQuery.value.toLowerCase()
|
|
|
249
|
+ filtered = filtered.filter(w =>
|
|
|
250
|
+ w.title.toLowerCase().includes(query) ||
|
|
|
251
|
+ w.orderNo.toLowerCase().includes(query) ||
|
|
|
252
|
+ w.location.toLowerCase().includes(query)
|
|
|
253
|
+ )
|
|
|
254
|
+ }
|
|
|
255
|
+
|
|
|
256
|
+ return filtered
|
|
|
257
|
+})
|
|
|
258
|
+
|
|
|
259
|
+const dialogTitle = computed(() => {
|
|
|
260
|
+ return currentWorkOrder.value ? `工单详情 - ${currentWorkOrder.value.orderNo}` : '工单详情'
|
|
|
261
|
+})
|
|
|
262
|
+
|
|
|
263
|
+// 获取工单列表
|
|
|
264
|
+const fetchWorkOrders = async () => {
|
|
|
265
|
+ loading.value = true
|
|
|
266
|
+ try {
|
|
|
267
|
+ const response = await axios.get('/api/work-orders/status/pending')
|
|
|
268
|
+ workOrders.value = response.data
|
|
|
269
|
+ totalWorkOrders.value = workOrders.value.length
|
|
|
270
|
+ await fetchStatistics()
|
|
|
271
|
+ } catch (error) {
|
|
|
272
|
+ console.error('获取工单列表失败:', error)
|
|
|
273
|
+ ElMessage.error('获取工单列表失败')
|
|
|
274
|
+ } finally {
|
|
|
275
|
+ loading.value = false
|
|
|
276
|
+ }
|
|
|
277
|
+}
|
|
|
278
|
+
|
|
|
279
|
+// 获取统计信息
|
|
|
280
|
+const fetchStatistics = async () => {
|
|
|
281
|
+ try {
|
|
|
282
|
+ const response = await axios.get('/api/work-orders/statistics')
|
|
|
283
|
+ statistics.value = response.data
|
|
|
284
|
+ } catch (error) {
|
|
|
285
|
+ console.error('获取统计信息失败:', error)
|
|
|
286
|
+ }
|
|
|
287
|
+}
|
|
|
288
|
+
|
|
|
289
|
+// 创建新工单
|
|
|
290
|
+const createNewWorkOrder = () => {
|
|
|
291
|
+ ElMessage.info('跳转到新建工单页面')
|
|
|
292
|
+}
|
|
|
293
|
+
|
|
|
294
|
+// 查看工单详情
|
|
|
295
|
+const viewWorkOrder = async (workOrder) => {
|
|
|
296
|
+ currentWorkOrder.value = workOrder
|
|
|
297
|
+ dialogVisible.value = true
|
|
|
298
|
+
|
|
|
299
|
+ // 获取处理记录
|
|
|
300
|
+ try {
|
|
|
301
|
+ const response = await axios.get(`/api/work-orders/process/${workOrder.id}`)
|
|
|
302
|
+ processRecords.value = response.data
|
|
|
303
|
+ } catch (error) {
|
|
|
304
|
+ console.error('获取处理记录失败:', error)
|
|
|
305
|
+ }
|
|
|
306
|
+}
|
|
|
307
|
+
|
|
|
308
|
+// 分派工单
|
|
|
309
|
+const assignWorkOrder = (workOrder) => {
|
|
|
310
|
+ ElMessageBox.prompt(
|
|
|
311
|
+ '请输入处理人ID',
|
|
|
312
|
+ '分派工单',
|
|
|
313
|
+ {
|
|
|
314
|
+ confirmButtonText: '确定',
|
|
|
315
|
+ cancelButtonText: '取消',
|
|
|
316
|
+ inputPattern: /^\d+$/,
|
|
|
317
|
+ inputErrorMessage: '请输入有效的用户ID'
|
|
|
318
|
+ }
|
|
|
319
|
+ ).then(async ({ value }) => {
|
|
|
320
|
+ try {
|
|
|
321
|
+ const assigneeName = '处理人' // 实际应用中应该根据ID获取用户名
|
|
|
322
|
+ const response = await axios.put(`/api/work-orders/${workOrder.id}/assign`, {
|
|
|
323
|
+ assigneeId: parseInt(value),
|
|
|
324
|
+ assigneeName: assigneeName
|
|
|
325
|
+ })
|
|
|
326
|
+
|
|
|
327
|
+ if (response.data) {
|
|
|
328
|
+ ElMessage.success('工单分派成功')
|
|
|
329
|
+ fetchWorkOrders()
|
|
|
330
|
+ }
|
|
|
331
|
+ } catch (error) {
|
|
|
332
|
+ console.error('分派工单失败:', error)
|
|
|
333
|
+ ElMessage.error('分派工单失败')
|
|
|
334
|
+ }
|
|
|
335
|
+ }).catch(() => {
|
|
|
336
|
+ // 用户取消
|
|
|
337
|
+ })
|
|
|
338
|
+}
|
|
|
339
|
+
|
|
|
340
|
+// 开始处理工单
|
|
|
341
|
+const startWorkOrder = async (workOrder) => {
|
|
|
342
|
+ try {
|
|
|
343
|
+ await ElMessageBox.confirm(
|
|
|
344
|
+ `确认为工单 "${workOrder.title}" 开始处理吗?`,
|
|
|
345
|
+ '开始处理',
|
|
|
346
|
+ { confirmButtonText: '确定', cancelButtonText: '取消' }
|
|
|
347
|
+ )
|
|
|
348
|
+
|
|
|
349
|
+ const response = await axios.put(`/api/work-orders/${workOrder.id}/start`)
|
|
|
350
|
+ if (response.data) {
|
|
|
351
|
+ ElMessage.success('开始处理成功')
|
|
|
352
|
+ fetchWorkOrders()
|
|
|
353
|
+ }
|
|
|
354
|
+ } catch (error) {
|
|
|
355
|
+ if (error !== 'cancel') {
|
|
|
356
|
+ console.error('开始处理失败:', error)
|
|
|
357
|
+ ElMessage.error('开始处理失败')
|
|
|
358
|
+ }
|
|
|
359
|
+ }
|
|
|
360
|
+}
|
|
|
361
|
+
|
|
|
362
|
+// 完成工单
|
|
|
363
|
+const completeWorkOrder = (workOrder) => {
|
|
|
364
|
+ ElMessageBox.prompt(
|
|
|
365
|
+ '请输入处理结果',
|
|
|
366
|
+ '完成工单',
|
|
|
367
|
+ {
|
|
|
368
|
+ confirmButtonText: '确定',
|
|
|
369
|
+ cancelButtonText: '取消',
|
|
|
370
|
+ inputType: 'textarea',
|
|
|
371
|
+ inputPlaceholder: '请详细描述处理结果'
|
|
|
372
|
+ }
|
|
|
373
|
+ ).then(async ({ value }) => {
|
|
|
374
|
+ try {
|
|
|
375
|
+ const response = await axios.put(`/api/work-orders/${workOrder.id}/complete`, {
|
|
|
376
|
+ solutionResult: value
|
|
|
377
|
+ })
|
|
|
378
|
+
|
|
|
379
|
+ if (response.data) {
|
|
|
380
|
+ ElMessage.success('工单完成成功')
|
|
|
381
|
+ fetchWorkOrders()
|
|
|
382
|
+ }
|
|
|
383
|
+ } catch (error) {
|
|
|
384
|
+ console.error('完成工单失败:', error)
|
|
|
385
|
+ ElMessage.error('完成工单失败')
|
|
|
386
|
+ }
|
|
|
387
|
+ }).catch(() => {
|
|
|
388
|
+ // 用户取消
|
|
|
389
|
+ })
|
|
|
390
|
+}
|
|
|
391
|
+
|
|
|
392
|
+// 取消工单
|
|
|
393
|
+const cancelWorkOrder = (workOrder) => {
|
|
|
394
|
+ ElMessageBox.confirm(
|
|
|
395
|
+ `确认为工单 "${workOrder.title}" 取消吗?`,
|
|
|
396
|
+ '取消工单',
|
|
|
397
|
+ { confirmButtonText: '确定', cancelButtonText: '取消' }
|
|
|
398
|
+ ).then(async () => {
|
|
|
399
|
+ try {
|
|
|
400
|
+ const response = await axios.put(`/api/work-orders/${workOrder.id}/status`, {
|
|
|
401
|
+ status: 'cancelled',
|
|
|
402
|
+ processStatus: 'terminated'
|
|
|
403
|
+ })
|
|
|
404
|
+
|
|
|
405
|
+ if (response.data) {
|
|
|
406
|
+ ElMessage.success('工单取消成功')
|
|
|
407
|
+ fetchWorkOrders()
|
|
|
408
|
+ }
|
|
|
409
|
+ } catch (error) {
|
|
|
410
|
+ console.error('取消工单失败:', error)
|
|
|
411
|
+ ElMessage.error('取消工单失败')
|
|
|
412
|
+ }
|
|
|
413
|
+ }).catch(() => {
|
|
|
414
|
+ // 用户取消
|
|
|
415
|
+ })
|
|
|
416
|
+}
|
|
|
417
|
+
|
|
|
418
|
+// 处理对话框关闭
|
|
|
419
|
+const handleDialogClose = () => {
|
|
|
420
|
+ currentWorkOrder.value = null
|
|
|
421
|
+ processRecords.value = []
|
|
|
422
|
+}
|
|
|
423
|
+
|
|
|
424
|
+// 辅助函数
|
|
|
425
|
+const getPriorityType = (priority) => {
|
|
|
426
|
+ switch (priority) {
|
|
|
427
|
+ case 'low': return 'info'
|
|
|
428
|
+ case 'normal': return ''
|
|
|
429
|
+ case 'high': return 'warning'
|
|
|
430
|
+ case 'critical': return 'danger'
|
|
|
431
|
+ default: return ''
|
|
|
432
|
+ }
|
|
|
433
|
+}
|
|
|
434
|
+
|
|
|
435
|
+const getPriorityText = (priority) => {
|
|
|
436
|
+ switch (priority) {
|
|
|
437
|
+ case 'low': return '低'
|
|
|
438
|
+ case 'normal': return '普通'
|
|
|
439
|
+ case 'high': return '高'
|
|
|
440
|
+ case 'critical': return '紧急'
|
|
|
441
|
+ default: return priority
|
|
|
442
|
+ }
|
|
|
443
|
+}
|
|
|
444
|
+
|
|
|
445
|
+const getStatusType = (status) => {
|
|
|
446
|
+ switch (status) {
|
|
|
447
|
+ case 'pending': return 'warning'
|
|
|
448
|
+ case 'assigned': return 'primary'
|
|
|
449
|
+ case 'processing': = 'primary'
|
|
|
450
|
+ case 'completed': return 'success'
|
|
|
451
|
+ case 'cancelled': return 'info'
|
|
|
452
|
+ default: return ''
|
|
|
453
|
+ }
|
|
|
454
|
+}
|
|
|
455
|
+
|
|
|
456
|
+const getStatusText = (status) => {
|
|
|
457
|
+ switch (status) {
|
|
|
458
|
+ case 'pending': return '待处理'
|
|
|
459
|
+ case 'assigned': return '已分配'
|
|
|
460
|
+ case 'processing': return '处理中'
|
|
|
461
|
+ case 'completed': return '已完成'
|
|
|
462
|
+ case 'cancelled': return '已取消'
|
|
|
463
|
+ default: return status
|
|
|
464
|
+ }
|
|
|
465
|
+}
|
|
|
466
|
+
|
|
|
467
|
+const getProcessStepType = (step) => {
|
|
|
468
|
+ switch (step) {
|
|
|
469
|
+ case 'created': return 'primary'
|
|
|
470
|
+ case 'accepted': return 'success'
|
|
|
471
|
+ case 'in_progress': return 'warning'
|
|
|
472
|
+ case 'completed': return 'success'
|
|
|
473
|
+ default: return 'primary'
|
|
|
474
|
+ }
|
|
|
475
|
+}
|
|
|
476
|
+
|
|
|
477
|
+const getProcessStepText = (step) => {
|
|
|
478
|
+ switch (step) {
|
|
|
479
|
+ case 'created': return '工单创建'
|
|
|
480
|
+ case 'accepted': return '工单接受'
|
|
|
481
|
+ case 'in_progress': return '处理中'
|
|
|
482
|
+ case 'completed': return '工单完成'
|
|
|
483
|
+ default: return step
|
|
|
484
|
+ }
|
|
|
485
|
+}
|
|
|
486
|
+
|
|
|
487
|
+const formatDate = (date) => {
|
|
|
488
|
+ if (!date) return ''
|
|
|
489
|
+ return new Date(date).toLocaleString()
|
|
|
490
|
+}
|
|
|
491
|
+
|
|
|
492
|
+const handleSizeChange = (val) => {
|
|
|
493
|
+ pageSize.value = val
|
|
|
494
|
+ fetchWorkOrders()
|
|
|
495
|
+}
|
|
|
496
|
+
|
|
|
497
|
+const handleCurrentChange = (val) => {
|
|
|
498
|
+ currentPage.value = val
|
|
|
499
|
+ fetchWorkOrders()
|
|
|
500
|
+}
|
|
|
501
|
+
|
|
|
502
|
+// 初始化
|
|
|
503
|
+onMounted(() => {
|
|
|
504
|
+ fetchWorkOrders()
|
|
|
505
|
+})
|
|
|
506
|
+</script>
|
|
|
507
|
+
|
|
|
508
|
+<style scoped>
|
|
|
509
|
+.work-order-management {
|
|
|
510
|
+ padding: 20px;
|
|
|
511
|
+}
|
|
|
512
|
+
|
|
|
513
|
+.work-order-stats {
|
|
|
514
|
+ margin-bottom: 20px;
|
|
|
515
|
+}
|
|
|
516
|
+
|
|
|
517
|
+.card-header {
|
|
|
518
|
+ display: flex;
|
|
|
519
|
+ justify-content: space-between;
|
|
|
520
|
+ align-items: center;
|
|
|
521
|
+}
|
|
|
522
|
+
|
|
|
523
|
+.header-actions {
|
|
|
524
|
+ display: flex;
|
|
|
525
|
+ align-items: center;
|
|
|
526
|
+ gap: 10px;
|
|
|
527
|
+}
|
|
|
528
|
+
|
|
|
529
|
+.stat-item {
|
|
|
530
|
+ text-align: center;
|
|
|
531
|
+ padding: 20px;
|
|
|
532
|
+ border-radius: 8px;
|
|
|
533
|
+ background: #f5f7fa;
|
|
|
534
|
+}
|
|
|
535
|
+
|
|
|
536
|
+.stat-number {
|
|
|
537
|
+ font-size: 24px;
|
|
|
538
|
+ font-weight: bold;
|
|
|
539
|
+ color: #409eff;
|
|
|
540
|
+ margin-bottom: 5px;
|
|
|
541
|
+}
|
|
|
542
|
+
|
|
|
543
|
+.stat-label {
|
|
|
544
|
+ color: #606266;
|
|
|
545
|
+ font-size: 14px;
|
|
|
546
|
+}
|
|
|
547
|
+
|
|
|
548
|
+.pagination {
|
|
|
549
|
+ margin-top: 20px;
|
|
|
550
|
+ text-align: right;
|
|
|
551
|
+}
|
|
|
552
|
+</style>
|