Ver código fonte

♻️ refactor(order-detail): 移除未使用的状态管理和编辑功能

- 删除未使用的 `OrderStatus` 类型定义
- 移除 `Textarea` 组件导入
- 移除 `orderStatus`、`note` 状态及相关 `setter`
- 移除 `statusOptions` 数组定义
- 清理 `useEffect` 中设置订单状态的代码
- 删除 `handleStatusChange`、`handleSaveNote`、`handleEditOrder` 事件处理函数
- 移除关联人才卡片中的“添加人才”按钮
- 移除状态管理卡片及其所有相关UI
- 移除备注输入区域和“保存备注”按钮
- 移除操作按钮区域中的“编辑订单”按钮
- 将“备注和操作日志卡片”标题简化为“操作日志卡片”
yourname 3 semanas atrás
pai
commit
13a42a7de8

+ 4 - 67
mini-ui-packages/yongren-order-management-ui/src/pages/OrderDetail/OrderDetail.tsx

@@ -1,11 +1,10 @@
 import React, { useState, useEffect } from 'react'
-import { View, Text, ScrollView, Input, Textarea } from '@tarojs/components'
+import { View, Text, ScrollView, Input } from '@tarojs/components'
 import Taro from '@tarojs/taro'
 import { useQuery } from '@tanstack/react-query'
 import { Navbar } from '@d8d/mini-shared-ui-components/components/navbar'
 import { enterpriseOrderClient } from '../../api'
 
-type OrderStatus = 'draft' | 'confirmed' | 'in_progress' | 'completed' | 'cancelled'
 
 interface OrderDetailData {
   id: any
@@ -32,20 +31,11 @@ const OrderDetail: React.FC = () => {
   const orderIdParam = router.params.id ? parseInt(router.params.id) : null
   const orderId = orderIdParam && !Number.isNaN(orderIdParam) ? orderIdParam : null
 
-  const [orderStatus, setOrderStatus] = useState<OrderStatus>('in_progress')
-  const [note, setNote] = useState('')
   const [persons, setPersons] = useState<any[]>([])
   const [videos, setVideos] = useState<any[]>([])
   const [checkinStats, setCheckinStats] = useState({ current: 0, total: 0, percentage: 0 })
   const [salaryVideoStats, setSalaryVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
   const [taxVideoStats, setTaxVideoStats] = useState({ current: 0, total: 0, percentage: 0 })
-  const statusOptions = [
-    { value: 'draft', label: '草稿', class: 'bg-gray-100 text-gray-800' },
-    { value: 'confirmed', label: '已确认', class: 'bg-blue-100 text-blue-800' },
-    { value: 'in_progress', label: '进行中', class: 'bg-green-100 text-green-800' },
-    { value: 'completed', label: '已完成', class: 'bg-purple-100 text-purple-800' },
-    { value: 'cancelled', label: '已取消', class: 'bg-red-100 text-red-800' },
-  ]
 
   // 获取订单详情查询函数
   const fetchOrderDetailQuery = async (id: number) => {
@@ -108,7 +98,6 @@ const OrderDetail: React.FC = () => {
   // 处理查询成功
   useEffect(() => {
     if (order) {
-      setOrderStatus(order.status || 'draft')
       // TODO: 获取关联人才、视频、统计数据
       // 暂时使用空数组
       setPersons([])
@@ -142,21 +131,8 @@ const OrderDetail: React.FC = () => {
   }
 
 
-  const handleStatusChange = (newStatus: OrderStatus) => {
-    setOrderStatus(newStatus)
-    console.log('更新订单状态:', newStatus)
-    // TODO: 调用API更新订单状态
-  }
 
-  const handleSaveNote = () => {
-    console.log('保存备注:', note)
-    // TODO: 调用API保存备注
-  }
 
-  const handleEditOrder = () => {
-    console.log('编辑订单')
-    // TODO: 跳转到编辑页面
-  }
 
   const handleDownloadReport = () => {
     console.log('下载报告')
@@ -295,11 +271,8 @@ const OrderDetail: React.FC = () => {
 
         {/* 关联人才卡片 */}
         <View className="card bg-white p-4 mb-4">
-          <View className="flex justify-between items-center mb-3">
+          <View className="flex items-center mb-3">
             <Text className="font-semibold text-gray-700">关联人才</Text>
-            <View className="flex items-center text-blue-500 text-xs" onClick={() => console.log('添加人才')}>
-              <Text>添加人才</Text>
-            </View>
           </View>
           <View className="space-y-3">
             {persons.map((person) => (
@@ -354,40 +327,10 @@ const OrderDetail: React.FC = () => {
           </View>
         </View>
 
-        {/* 状态管理卡片 */}
-        <View className="card bg-white p-4 mb-4">
-          <Text className="font-semibold text-gray-700 mb-3">状态管理</Text>
-          <View className="flex space-x-2 mb-3">
-            {statusOptions.map((option) => (
-              <View
-                key={option.value}
-                className={`flex items-center justify-center text-xs px-3 py-1 rounded-full ${option.value === orderStatus ? option.class : 'bg-gray-100 text-gray-800'}`}
-                onClick={() => handleStatusChange(option.value as OrderStatus)}
-              >
-                <Text>{option.label}</Text>
-              </View>
-            ))}
-          </View>
-          <Text className="text-xs text-gray-500 mb-3">当前状态: {statusOptions.find(opt => opt.value === orderStatus)?.label}</Text>
-        </View>
 
-        {/* 备注和操作日志卡片 */}
+        {/* 操作日志卡片 */}
         <View className="card bg-white p-4 mb-4">
-          <Text className="font-semibold text-gray-700 mb-3">添加备注</Text>
-          <Textarea
-            className="border border-gray-300 rounded-lg px-3 py-2 text-sm mb-3"
-            placeholder="请输入备注内容..."
-            value={note}
-            onInput={(e) => setNote(e.detail.value)}
-          />
-          <View
-            className="flex items-center justify-center bg-blue-500 text-white text-xs px-3 py-2 rounded-lg"
-            onClick={handleSaveNote}
-          >
-            <Text>保存备注</Text>
-          </View>
-
-          <Text className="font-semibold text-gray-700 mt-4 mb-3">操作日志</Text>
+          <Text className="font-semibold text-gray-700 mb-3">操作日志</Text>
           <View className="space-y-2 text-sm">
             <View className="flex justify-between">
               <Text className="text-gray-600">状态变更为进行中</Text>
@@ -407,12 +350,6 @@ const OrderDetail: React.FC = () => {
         {/* 操作按钮区域 */}
         <View className="card bg-white p-4 mb-4">
           <View className="flex flex-col space-y-2">
-            <View
-              className="flex items-center justify-center bg-blue-500 text-white text-sm px-4 py-2 rounded-lg"
-              onClick={handleEditOrder}
-            >
-              <Text>编辑订单</Text>
-            </View>
             <View
               className="flex items-center justify-center bg-green-500 text-white text-sm px-4 py-2 rounded-lg"
               onClick={handleDownloadReport}