Commit c4cb0a30 by Liu

fix:工单参数

parent ca0d7aea
......@@ -139,7 +139,8 @@ export const TacticsChat: React.FC = () => {
}
return {
busiType: '02',
busiId: userName, // 如果 userName
busiId: userName,
workOrderIds: orderMeta.workOrderIds,
} as Partial<any>
}
if (userMeta?.place === 'user') {
......
......@@ -60,10 +60,11 @@ export const TacticsHome: React.FC = () => {
}
}, [searchParams])
// 读取 from=order 时的 orderMeta 参数(直接从 query 读取,不再使用 sessionStorage)
// 读取 from=tactics&place=order 时的 orderMeta 参数(直接从 query 读取,不再使用 sessionStorage)
const orderMeta = useMemo(() => {
const fromValues = searchParams.getAll('from')
if (!fromValues.includes('order')) {
const from = searchParams.get('from')
const place = searchParams.get('place')
if (from !== 'tactics' || place !== 'order') {
return undefined
}
return {
......@@ -91,6 +92,7 @@ export const TacticsHome: React.FC = () => {
return {
busiType: '02',
busiId: userName,
workOrderIds: orderMeta.workOrderIds,
} as Partial<any>
}
if (userMeta?.place === 'user') {
......
......@@ -4,7 +4,6 @@ import { motion } from 'framer-motion'
import { useSearchParams } from 'react-router-dom'
import AvatarBot from '@/assets/avatarBot.png'
import AIIcon from '@/assets/ai-icon.png'
import { safeSessionStorageGetItem } from '@/lib/utils'
interface TacticsWelcomeProps {
cleared?: boolean
......@@ -14,15 +13,14 @@ export const TacticsWelcome: React.FC<TacticsWelcomeProps> = ({ cleared }) => {
const viteOutputObj = import.meta.env.VITE_OUTPUT_OBJ || 'open'
const [searchParams] = useSearchParams()
const from = searchParams.get('from')
// 直接从 sessionStorage 读取 place
const placeFromCache = safeSessionStorageGetItem('__TACTICS_PLACE__')
const isOrderPlace = from === 'tactics' && placeFromCache === 'order'
const place = searchParams.get('place')
const isOrderPlace = from === 'tactics' && place === 'order'
// 打印路由参数
console.log('TacticsWelcome 路由参数:', {
searchParams: Object.fromEntries(searchParams.entries()),
from,
placeFromCache,
place,
isOrderPlace,
cleared,
url: window.location.href,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment