Explorar o código

Merge branch 'master' of http://222.243.138.146:2000/ygtx/gxt_app

wuhb hai 5 meses
pai
achega
7db072d616
Modificáronse 3 ficheiros con 32 adicións e 16 borrados
  1. 6 1
      api/order/list.uts
  2. 24 13
      pages/order/index.uvue
  3. 2 2
      types/order.uts

+ 6 - 1
api/order/list.uts

@@ -8,13 +8,18 @@ import { request } from '../../utils/request'
  * @param page 页码
  * @param rows 每页数量
  * @param workOrderProjectNo 工单编号(可选)
+ * @param status 工单状态(可选)
  */
-export const getOrderList = (page: number, rows: number, workOrderProjectNo: string | null): Promise<any> => {
+export const getOrderList = (page: number, rows: number, workOrderProjectNo: string | null, status: string | null = null): Promise<any> => {
     let url = `/mobile/order/list?pageNum=${page}&pageSize=${rows}`
     if (workOrderProjectNo != null && workOrderProjectNo.length > 0) {
         url += `&repairOrder.workOrderProjectNo=${workOrderProjectNo}`
 		url += `&workOrder.workOrderProjectNo=${workOrderProjectNo}`
     }
+    // 添加状态筛选参数
+    if (status != null && status.length > 0) {
+        url += `&workOrderStatus=${encodeURIComponent(status)}`
+    }
     return request({
         url: url,
         method: 'GET'

+ 24 - 13
pages/order/index.uvue

@@ -11,8 +11,11 @@
 
 		<view class="status-bar">
 			<view class="status-box">
-				<text class="status-txt" :class="{'stauts-sel':ix == 0}">全部</text>
-				<text class="status-txt" :class="{'stauts-sel':ix == 1}">待接单</text>
+				<text class="status-txt" :class="{'stauts-sel': currentStatus === ''}" @click="switchStatus('')">全部</text>
+				<text class="status-txt" :class="{'stauts-sel': currentStatus === 'assigned'}" @click="switchStatus('assigned')">待接单</text>
+				<text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_finish'}" @click="switchStatus('to_finish')">待结单</text>
+				<text class="status-txt" :class="{'stauts-sel': currentStatus === 'to_approve'}" @click="switchStatus('to_approve')">待审批</text>
+				<text class="status-txt" :class="{'stauts-sel': currentStatus === 'completed'}" @click="switchStatus('completed')">已完成</text>
 			</view>
 		</view>
         <!-- 列表内容 -->
@@ -78,7 +81,7 @@
     const loading = ref<boolean>(false)
     const refreshing = ref<boolean>(false)
     const total = ref<number>(0)
-	const ix = ref<number>(1)
+	const currentStatus = ref<string>('') // 添加状态管理
 
     // 辅助函数:从 any 类型提取属性
     const getOrderType = (item: any | null): string => {
@@ -117,6 +120,13 @@
         return orderInfoItem.assignTime
     }
 
+    // 切换状态
+    const switchStatus = (status: string): void => {
+        currentStatus.value = status
+        page.value = 1
+        loadData(true)
+    }
+
     // 加载列表数据
     const loadData = async (isRefresh: boolean | null): Promise<void> => {
         if (loading.value) {
@@ -135,9 +145,9 @@
                 page.value = 1
             }
 
-            // 调用 API
+            // 调用 API,传递状态参数
             const searchKeyword = keyword.value.length > 0 ? keyword.value : null
-            const result = await getOrderList(page.value, pageSize, searchKeyword)
+            const result = await getOrderList(page.value, pageSize, searchKeyword, currentStatus.value || null)
 
             // 提取响应数据
             const resultObj = result as UTSJSONObject
@@ -153,8 +163,8 @@
                     const orderItem: orderInfo = {
 						orderType: item['orderType'] as Number,
                         id: item['id'] as Number,
-                        teamLeaderName: item['teamLeaderName'] as string | '',
-                        acceptUserName: item['acceptUserName'] as string | '',
+                        teamLeaderName: item['teamLeaderName'] as string | null,
+                        acceptUserName: item['acceptUserName'] as string | null,
                         acceptTime: item['acceptTime'] as string | null,
                         assignTime: item['assignTime'] as string | null,
                         assignUserName: item['assignUserName'] as string | null,
@@ -173,6 +183,7 @@
                     newData.push(orderItem)
                 }
 
+                // 不再在前端过滤,直接使用API返回的数据
                 if (shouldRefresh) {
                     dataList.value = newData
                 } else {
@@ -239,9 +250,9 @@
     // 点击列表项
     const handleItemClick = (item: any | null, index: number): void => {
         if (item == null) return
-        const contractorItem = item as ContractorInfo
+        const orderItem = item as orderInfo
         uni.navigateTo({
-            url: `/pages/workbench/detail/index?id=${contractorItem.id}`
+            url: `/pages/workbench/detail/index?id=${orderItem.id}`
         })
     }
 
@@ -300,17 +311,17 @@
 		flex: 1;
 		
 		.status-txt{
-			padding: 8px;
-			width: 70px;
+			padding: 8px 12px;
 			text-align: center;
 			margin-right: 12rpx;
 			border-radius: 36rpx;
 			background-color: #fff;
 			font-size: 28rpx;
+			cursor: pointer;
 		}
 		
 		.stauts-sel{
-			background-color: blue;
+			background-color: #007AFF;
 			color: #fff;
 		}
 	}
@@ -390,4 +401,4 @@
             }
         }
     }
-</style>
+</style>

+ 2 - 2
types/order.uts

@@ -3,8 +3,8 @@
 export type orderInfo = {
 	orderType: Number
     id: Number
-    teamLeaderName: string | ''
-    acceptUserName: string | ''
+    teamLeaderName: string | null
+    acceptUserName: string | null
     acceptTime: string | null
     assignTime: string | null
     assignUserName: string | null