Commit c4cb0a30 by Liu

fix:工单参数

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