Просмотр исходного кода

工单时间优化、待处理工单修改

HD_wangm 4 месяцев назад
Родитель
Сommit
57b1bbb02a

+ 17 - 0
api/order/list.uts

@@ -58,3 +58,20 @@ export const overdueList = (page: number, rows: number, keyword: string | null):
         method: 'GET'
     })
 }
+
+/*
+ * 获取待处理工单列表
+ * @param page 页码
+ * @param rows 每页数量
+ */
+export const pendingList = (page: number, rows: number, keyword: string | null): Promise<any> => {
+    let url = `/mobile/order/pendingList?pageNum=${page}&pageSize=${rows}`
+	if (keyword != null && keyword.length > 0) {
+	    // 支持工单编码和风机编号查询
+	    url += `&keyword=${encodeURIComponent(keyword)}`
+	}
+    return request({
+        url: url,
+        method: 'GET'
+    })
+}

+ 5 - 6
pages/index/index.uvue

@@ -90,7 +90,7 @@
 			</view>
 			<template v-if="overdueListData.length > 0">
 				<common-list
-					:dataList="overdueListData.slice(0, 2)"
+					:dataList="overdueListData.slice(0, 4)"
 					:loading="overdueLoading"
 					:hasMore="false"
 					:refresherEnabled="false"
@@ -135,7 +135,7 @@
     import { ref, onMounted } from 'vue'
     import { getUserInfo } from '../../utils/storage'
     import FlowChart from '../../components/index/flow-chart/flow-chart.uvue'
-    import { getOrderList, almostOverdueList, overdueList } from '../../api/order/list'
+    import { getOrderList, almostOverdueList, overdueList, pendingList } from '../../api/order/list'
     import { listMobileOrderScores } from '../../api/score/index'
 	import type { SysDictData } from '../../types/dict'
 	import { getDictDataByType } from '../../api/dict/index'
@@ -228,7 +228,7 @@
 	// 获取待接单数量
 	const loadAssignedCount = async (): Promise<void> => {
 	    try {
-	        const result = await getOrderList(1, 1, null, 'pending')
+	        const result = await pendingList(1, 1, null)
 	        const resultObj = result as UTSJSONObject
 
 	        if (resultObj['code'] == 200) {
@@ -236,7 +236,7 @@
 	            assignedCount.value = total
 	        }
 	    } catch (e: any) {
-	        console.error('获取待单数量失败:', e.message)
+	        console.error('获取待处理工单数量失败:', e.message)
 	    }
 	}
 
@@ -298,8 +298,7 @@
 	const loadOverdueList = async (): Promise<void> => {
 		try {
 			overdueLoading.value = true
-			// const result = await getOrderList(1, 2, '','assigned,to_finish,to_approve,suspended')
-			const result = await overdueList(1, 2, '') // 获取前2条
+			const result = await overdueList(1, 4, '') // 获取前2条
 			const resultObj = result as UTSJSONObject
 
 			if (resultObj['code'] == 200) {

+ 3 - 1
pages/order/almostOverdue.uvue

@@ -158,7 +158,9 @@ import { getDictDataByType } from '../../api/dict/index'
                         model: item['model'] as string | null,
                         createTime: item['createTime'] as string | null,
 						suspendReason: item['suspendReason'] as string | null,
-						rejectionReason: item['rejectionReason'] as string | null
+						rejectionReason: item['rejectionReason'] as string | null,
+						updateTime: item['updateTime'] as string | null,  // 新增字段
+						workEndTime: item['workEndTime'] as string | null  // 新增字段
                     }
                     newData.push(orderItem)
                 }

+ 14 - 10
pages/order/detail/acceptIndex.uvue

@@ -180,7 +180,7 @@
 	// 添加字典加载状态
 	const dictLoaded = ref<boolean>(false)
 	let keyword = ref<string>("")
-	
+
 	// 详情数据
 	const detailData = ref<acceptOrderInfo2>({
 		orderType: 0,
@@ -210,7 +210,9 @@
 		misNo: null,
 		content: null,
 		faultCode: null,
-		faultBarcode: null
+		faultBarcode: null,
+		updateTime: null,  // 新增字段
+		workEndTime: null  // 新增字段
 	})
 
 	// 选择器选项类型
@@ -462,7 +464,9 @@
 					misNo: data['misNo'] as string | null,
 					content: data['content'] as string | null,
 					faultCode: data['faultCode'] as string | null,
-					faultBarcode: data['faultBarcode'] as string | null
+					faultBarcode: data['faultBarcode'] as string | null,
+                    updateTime: data['updateTime'] as string | null,  // 新增字段
+                    workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
 
@@ -488,14 +492,14 @@
             loading.value = false
         }
     }
-	
+
 	// 搜索
 	const handleSearch = (): void => {
-		teamLeaderList.value = teamAllLeaderList.value.filter(leader => 
+		teamLeaderList.value = teamAllLeaderList.value.filter(leader =>
 			leader.nickName.includes(keyword.value)
 		)
 	}
-	
+
 	// 清空搜索
 	const clearSearch = (): void => {
 		keyword.value = ""
@@ -804,7 +808,7 @@
 		padding: 20rpx 30rpx;
 		background-color: #d7eafe;
 	}
-	
+
 	.search-box {
 		flex-direction: row;
 		align-items: center;
@@ -812,19 +816,19 @@
 		padding: 0 24rpx;
 		background-color: #f5f5f5;
 		border-radius: 36rpx;
-	
+
 		.search-icon {
 			width: 32rpx;
 			height: 32rpx;
 			margin-right: 12rpx;
 		}
-	
+
 		.search-input {
 			flex: 1;
 			font-size: 28rpx;
 			color: #333333;
 		}
-	
+
 		.clear-icon {
 			margin-left: 12rpx;
 			font-size: 28rpx;

+ 7 - 3
pages/order/detail/approveIndex.uvue

@@ -72,7 +72,7 @@
 					</view> -->
                 </view>
             </view>
-		
+
 			<view class="info-section">
 			    <view class="section-title">
 			        <text class="section-title-text">审批意见</text>
@@ -173,7 +173,9 @@
 		misNo: null,
 		content: null,
 		faultCode: null,
-		faultBarcode: null
+		faultBarcode: null,
+		updateTime: null,  // 新增字段
+		workEndTime: null  // 新增字段
 	})
 
 	// 选择器选项类型
@@ -436,7 +438,9 @@
 					misNo: data['misNo'] as string | null,
 					content: data['content'] as string | null,
 					faultCode: data['faultCode'] as string | null,
-					faultBarcode: data['faultBarcode'] as string | null
+					faultBarcode: data['faultBarcode'] as string | null,
+                    updateTime: data['updateTime'] as string | null,  // 新增字段
+                    workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
 

+ 6 - 2
pages/order/detail/index.uvue

@@ -142,7 +142,9 @@
 		createTime: null,
 		workOrderFlowList: null,
 		suspendReason: null,
-		rejectionReason: null
+		rejectionReason: null,
+        updateTime: null,  // 新增字段
+        workEndTime: null  // 新增字段
     })
 
     const loading = ref<boolean>(false)
@@ -266,7 +268,9 @@
                     createTime: data['createTime'] as string | null,
                     workOrderFlowList: workOrderFlowList,
 					suspendReason: data['suspendReason'] as string | null,
-					rejectionReason: data['rejectionReason'] as string | null
+					rejectionReason: data['rejectionReason'] as string | null,
+                    updateTime: data['updateTime'] as string | null,  // 新增字段
+                    workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
             } else {

+ 6 - 2
pages/order/detail/resumeIndex.uvue

@@ -129,7 +129,9 @@
 		createTime: null,
 		workOrderFlowList: null,
 		suspendReason: null,
-		rejectionReason: null
+		rejectionReason: null,
+		updateTime: null,  // 新增字段
+		workEndTime: null  // 新增字段
 	})
 
 	// 选择器选项类型
@@ -354,7 +356,9 @@
                     createTime: data['createTime'] as string | null,
                     workOrderFlowList: workOrderFlowList,
 					suspendReason: data['suspendReason'] as string | null,
-					rejectionReason: data['rejectionReason'] as string | null
+					rejectionReason: data['rejectionReason'] as string | null,
+                    updateTime: data['updateTime'] as string | null,  // 新增字段
+                    workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
 

+ 6 - 2
pages/order/detail/suspendIndex.uvue

@@ -179,7 +179,9 @@
 		createTime: null,
 		workOrderFlowList: null,
 		suspendReason: null,
-		rejectionReason: null
+		rejectionReason: null,
+		updateTime: null,  // 新增字段
+		workEndTime: null  // 新增字段
 	})
 
 	// 选择器选项类型
@@ -421,7 +423,9 @@
                     createTime: data['createTime'] as string | null,
                     workOrderFlowList: workOrderFlowList,
 					suspendReason: data['suspendReason'] as string | null,
-					rejectionReason: data['rejectionReason'] as string | null
+					rejectionReason: data['rejectionReason'] as string | null,
+                    updateTime: data['updateTime'] as string | null,  // 新增字段
+                    workEndTime: data['workEndTime'] as string | null  // 新增字段
                 }
                 detailData.value = orderDtail
 

+ 33 - 9
pages/order/index.uvue

@@ -108,7 +108,7 @@ import {checkPermi} from '../../utils/storage'
 	const dictLoaded = ref<boolean>(false)
 	// 待处理工单加载
 	const dealLoad = ref<boolean>(false)
-	
+
 type StatusItem = {
 	key: string,
 	permis: string[],
@@ -164,7 +164,7 @@ const statusConfig: StatusItem[] = [
 	        dictLoaded.value = true
 	    }
 	}
-	
+
 	const getFirstVisibleStatus = (): string => {
 	  for (const item of statusConfig) {
 	    const hasPerm = item.permis.length === 0 || checkPermi(item.permis)
@@ -234,7 +234,9 @@ const statusConfig: StatusItem[] = [
                         model: item['model'] as string | null,
                         createTime: item['createTime'] as string | null,
 						suspendReason: item['suspendReason'] as string | null,
-						rejectionReason: item['rejectionReason'] as string | null
+						rejectionReason: item['rejectionReason'] as string | null,
+						updateTime: item['updateTime'] as string | null,  // 新增字段
+						workEndTime: item['workEndTime'] as string | null  // 新增字段
                     }
                     newData.push(orderItem)
                 }
@@ -341,11 +343,18 @@ const statusConfig: StatusItem[] = [
 		if (orderInfoItem.workOrderStatus == 'assigned') {
 			return '下发时间:' + orderInfoItem.assignTime
 		} else if(orderInfoItem.workOrderStatus == 'to_finish') {
+			if(orderInfoItem.workEndTime != null) {
+				return '结束时间:' + orderInfoItem.workEndTime
+			}
 			return '接单时间:' + orderInfoItem.acceptTime
-		// } else if(orderInfoItem.workOrderStatus == 'to_approve') {
-		// 	return '申请挂起时间:'
-		// } else if(orderInfoItem.workOrderStatus == 'suspended') {
-		// 	return '审批通过时间:'
+		} else if(orderInfoItem.workOrderStatus == 'to_approve') {
+			return '申请挂起时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'suspended') {
+			return '审批通过时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'return' || orderInfoItem.workOrderStatus == 'accept_return') {
+			return '退回时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'completed') {
+			return '结单时间:' + orderInfoItem.updateTime
 		}
 
 		// 默认显示创建时间
@@ -500,7 +509,7 @@ const statusConfig: StatusItem[] = [
 		// ✅ 自动选中第一个可显示的状态
 		currentStatus.value = getFirstVisibleStatus()
 	    loadData(true as boolean | null)
-		
+
 		// 监听首页切换状态事件
 		uni.$on('switchOrderStatus', (status: string) => {
 			switchStatus(status)
@@ -511,7 +520,7 @@ const statusConfig: StatusItem[] = [
 			page.value = 1
 			loadData(true)
 		})
-		
+
 	})
 
     // 组件卸载前清理事件监听
@@ -740,6 +749,21 @@ const statusConfig: StatusItem[] = [
 	color: #5cb87a;
 	border-color: #c2e7b0;
 }
+
+/* 退回 */
+.status-return {
+	background-color: #fff2f0;
+	color: #ff4d4f;
+	border-color: #ffccc7;
+}
+
+/* 退回 */
+.status-accept_return {
+	background-color: #fff2f0;
+	color: #ff4d4f;
+	border-color: #ffccc7;
+}
+
 .scroll-view_H {
 	width: 100%;
 	flex-direction: row;

+ 4 - 2
pages/order/overdue.uvue

@@ -158,7 +158,9 @@ import { getDictDataByType } from '../../api/dict/index'
                         model: item['model'] as string | null,
                         createTime: item['createTime'] as string | null,
 						suspendReason: item['suspendReason'] as string | null,
-						rejectionReason: item['rejectionReason'] as string | null
+						rejectionReason: item['rejectionReason'] as string | null,
+						updateTime: item['updateTime'] as string | null,  // 新增字段
+						workEndTime: item['workEndTime'] as string | null  // 新增字段
                     }
                     newData.push(orderItem)
                 }
@@ -226,7 +228,7 @@ import { getDictDataByType } from '../../api/dict/index'
 	const getCreateTime = (item: any | null): string|null => {
 	    if (item == null) return null
 	    const orderInfoItem = item as acceptOrderInfo
-	    return orderInfoItem.createTime
+	    return "下发时间:" + orderInfoItem.assignTime
 	}
 
 	const getWorkOrderStatus = (item: any | null): string | null => {

+ 33 - 9
pages/order/pendingOrder.uvue

@@ -29,7 +29,7 @@
                         </view>
 						<view class="info-row">
 							<view class="info-label">
-								<text class="text-gray">{{ getCreateTime(item) }}</text>
+								<text class="text-gray">{{ getDisplayTime(item) }}</text>
 							</view>
 						</view>
                     </view>
@@ -43,7 +43,7 @@
 import { ref, onBeforeUnmount, onMounted } from 'vue'
 import type { acceptOrderInfo } from '../../types/order'
 import type { SysDictData } from '../../types/dict'
-import { getOrderList } from '../../api/order/list'
+import { pendingList } from '../../api/order/list'
 import { getDictDataByType } from '../../api/dict/index'
 
     // 列表数据
@@ -122,7 +122,7 @@ import { getDictDataByType } from '../../api/dict/index'
             // 调用 API,传递关键字参数
             const searchKeyword = keyword.value.length > 0 ? keyword.value : null
 
-            const result = await getOrderList(page.value, pageSize, searchKeyword, "pending")
+            const result = await pendingList(page.value, pageSize, searchKeyword)
 
             // 提取响应数据
             const resultObj = result as UTSJSONObject
@@ -158,7 +158,9 @@ import { getDictDataByType } from '../../api/dict/index'
                         model: item['model'] as string | null,
                         createTime: item['createTime'] as string | null,
 						suspendReason: item['suspendReason'] as string | null,
-						rejectionReason: item['rejectionReason'] as string | null
+						rejectionReason: item['rejectionReason'] as string | null,
+						updateTime: item['updateTime'] as string | null,  // 新增字段
+						workEndTime: item['workEndTime'] as string | null  // 新增字段
                     }
                     newData.push(orderItem)
                 }
@@ -222,13 +224,35 @@ import { getDictDataByType } from '../../api/dict/index'
         const orderInfoItem = item as acceptOrderInfo
         return orderInfoItem.pcsDeviceName
     }
-
-	const getCreateTime = (item: any | null): string|null => {
-	    if (item == null) return null
-	    const orderInfoItem = item as acceptOrderInfo
-	    return orderInfoItem.createTime
+	
+	// 根据状态显示不同的时间
+	const getDisplayTime = (item: any | null): string|null => {
+		if (item == null) return null
+		const orderInfoItem = item as acceptOrderInfo
+	
+		// 如果是"待接单"状态,显示派单时间
+		if (orderInfoItem.workOrderStatus == 'assigned') {
+			return '下发时间:' + orderInfoItem.assignTime
+		} else if(orderInfoItem.workOrderStatus == 'to_finish') {
+			if(orderInfoItem.workEndTime != null) {
+				return '结束时间:' + orderInfoItem.workEndTime
+			}
+			return '接单时间:' + orderInfoItem.acceptTime
+		} else if(orderInfoItem.workOrderStatus == 'to_approve') {
+			return '申请挂起时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'suspended') {
+			return '审批通过时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'return' || orderInfoItem.workOrderStatus == 'accept_return') {
+			return '退回时间:' + orderInfoItem.updateTime
+		} else if(orderInfoItem.workOrderStatus == 'completed') {
+			return '结单时间:' + orderInfoItem.updateTime
+		}
+	
+		// 默认显示创建时间
+		return '创建时间:' + orderInfoItem.createTime
 	}
 
+
 	const getWorkOrderStatus = (item: any | null): string | null => {
 	    if (item == null) return ''
 	    const orderInfoItem = item as acceptOrderInfo

+ 4 - 0
types/order.uts

@@ -68,6 +68,8 @@ export type acceptOrderInfo = {
     workOrderFlowList?: WorkOrderFlowList | null
 	suspendReason: string | null
 	rejectionReason: string | null
+	updateTime: string | null  // 新增字段
+	workEndTime: string | null  // 新增字段
 }
 
 // 工单信息
@@ -100,4 +102,6 @@ export type acceptOrderInfo2 = {
 	content: string | null
 	faultBarcode: string | null
 	faultCode: string | null
+	updateTime: string | null  // 新增字段
+	workEndTime: string | null  // 新增字段
 }