Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdream-ai-fe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
侯明涛
sdream-ai-fe
Commits
0ace2d9a
Commit
0ace2d9a
authored
Jan 04, 2026
by
Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:工单参数逻辑
parent
2514136e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
8 deletions
+46
-8
src/pages/Chat/components/ChatItem/ChatAnswerOperate.tsx
+6
-2
src/pages/Chat/components/ChatItem/ChatAnswerRecommend.tsx
+11
-1
src/pages/ChatTactics/TacticsChat.tsx
+0
-0
src/pages/ChatTactics/TacticsHome.tsx
+29
-5
No files found.
src/pages/Chat/components/ChatItem/ChatAnswerOperate.tsx
View file @
0ace2d9a
...
@@ -23,6 +23,7 @@ export const ChatAnswerOperate: React.FC<ChatAnswerOperateProps> = ({ answer })
...
@@ -23,6 +23,7 @@ export const ChatAnswerOperate: React.FC<ChatAnswerOperateProps> = ({ answer })
// 读取路由参数 from
// 读取路由参数 from
const
from
=
searchParams
.
get
(
'from'
)
const
from
=
searchParams
.
get
(
'from'
)
const
fromValues
=
searchParams
.
getAll
(
'from'
)
// 兜底读取缓存的 tacticsMeta(会话从 tactics 打开的元信息)
// 兜底读取缓存的 tacticsMeta(会话从 tactics 打开的元信息)
const
tacticsMetaFromStorage
=
useMemo
(()
=>
{
const
tacticsMetaFromStorage
=
useMemo
(()
=>
{
...
@@ -50,8 +51,11 @@ export const ChatAnswerOperate: React.FC<ChatAnswerOperateProps> = ({ answer })
...
@@ -50,8 +51,11 @@ export const ChatAnswerOperate: React.FC<ChatAnswerOperateProps> = ({ answer })
}
}
},
[])
},
[])
// 规则:当 sessionStorage 中存在 userMeta 或 tacticsMeta 时,或路由参数 from=tactics 时,统一隐藏收藏按钮
// 检查路由参数中是否有 from=order
const
shouldHideCollect
=
!!
userMetaFromStorage
||
!!
tacticsMetaFromStorage
||
from
===
'tactics'
const
hasOrderFromRoute
=
fromValues
.
includes
(
'order'
)
// 规则:当 sessionStorage 中存在 userMeta 或 tacticsMeta 时,或路由参数 from=tactics 或 from=order 时,统一隐藏收藏按钮
const
shouldHideCollect
=
!!
userMetaFromStorage
||
!!
tacticsMetaFromStorage
||
from
===
'tactics'
||
hasOrderFromRoute
const
[
isCollect
,
setIsCollect
]
=
useState
(
answer
.
collectionFlag
)
const
[
isCollect
,
setIsCollect
]
=
useState
(
answer
.
collectionFlag
)
const
[
isLike
,
setIsLike
]
=
useState
(
answer
.
feedbackStatus
===
'01'
)
const
[
isLike
,
setIsLike
]
=
useState
(
answer
.
feedbackStatus
===
'01'
)
...
...
src/pages/Chat/components/ChatItem/ChatAnswerRecommend.tsx
View file @
0ace2d9a
...
@@ -23,13 +23,23 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
...
@@ -23,13 +23,23 @@ export const ChatAnswerRecommend: React.FC<ChatAnswerRecommendProps> = ({ answer
// 仅在 from=tactics 场景下,按照要求补充 busiType / recordType 参数
// 仅在 from=tactics 场景下,按照要求补充 busiType / recordType 参数
const
from
=
searchParams
.
get
(
'from'
)
const
from
=
searchParams
.
get
(
'from'
)
const
place
=
searchParams
.
get
(
'place'
)
const
place
=
searchParams
.
get
(
'place'
)
const
fromValues
=
searchParams
.
getAll
(
'from'
)
const
shouldAttachBusiParams
=
from
===
'tactics'
const
shouldAttachBusiParams
=
from
===
'tactics'
const
busiType
=
shouldAttachBusiParams
?
'02'
:
undefined
const
busiType
=
shouldAttachBusiParams
?
'02'
:
undefined
let
recordType
:
string
|
undefined
let
recordType
:
string
|
undefined
if
(
shouldAttachBusiParams
)
{
if
(
shouldAttachBusiParams
)
{
// from=tactics 且 from=order → recordType=A11
// from=tactics 且 place=user → recordType=A03
// from=tactics 且 place=user → recordType=A03
// from=tactics 且 place!=user/无 → recordType=A01
// from=tactics 且 place!=user/无 → recordType=A01
recordType
=
place
===
'user'
?
'A03'
:
'A01'
if
(
fromValues
.
includes
(
'order'
))
{
recordType
=
'A11'
}
else
if
(
place
===
'user'
)
{
recordType
=
'A03'
}
else
{
recordType
=
'A01'
}
}
}
try
{
try
{
const
res
=
await
fetchQueryRecommendQuestion
(
const
res
=
await
fetchQueryRecommendQuestion
(
...
...
src/pages/ChatTactics/TacticsChat.tsx
View file @
0ace2d9a
This diff is collapsed.
Click to expand it.
src/pages/ChatTactics/TacticsHome.tsx
View file @
0ace2d9a
...
@@ -59,23 +59,40 @@ export const TacticsHome: React.FC = () => {
...
@@ -59,23 +59,40 @@ export const TacticsHome: React.FC = () => {
}
}
},
[
searchParams
])
},
[
searchParams
])
// 读取 from=order 时的 orderMeta 参数(直接从 query 读取,不再使用 sessionStorage)
const
orderMeta
=
useMemo
(()
=>
{
const
fromValues
=
searchParams
.
getAll
(
'from'
)
if
(
!
fromValues
.
includes
(
'order'
))
{
return
undefined
}
return
{
workOrderIds
:
searchParams
.
get
(
'workOrderIds'
)
||
undefined
,
}
},
[
searchParams
])
// 仅用于创建会话的额外参数(对应 create_conversation)
// 仅用于创建会话的额外参数(对应 create_conversation)
const
getConversationExtra
=
useCallback
(()
=>
{
const
getConversationExtra
=
useCallback
(()
=>
{
if
(
orderMeta
)
{
return
{
busiType
:
'02'
,
// from=order 场景下,不传 busiId
}
as
Partial
<
any
>
}
if
(
userMeta
?.
place
===
'user'
)
{
if
(
userMeta
?.
place
===
'user'
)
{
return
{
return
{
busiType
:
'02'
,
busiType
:
'02'
,
// place=user 场景下,业务方要求 busiId 取 numberType
// place=user 场景下,业务方要求 busiId 取 numberType
busiId
:
userMeta
.
numberType
,
busiId
:
userMeta
.
numberType
,
}
}
as
Partial
<
any
>
}
}
if
(
tacticsMeta
)
{
if
(
tacticsMeta
)
{
return
{
return
{
busiType
:
'02'
,
busiType
:
'02'
,
busiId
:
tacticsMeta
.
taskId
,
busiId
:
tacticsMeta
.
taskId
,
}
}
as
Partial
<
any
>
}
}
return
{}
return
{}
as
Partial
<
any
>
},
[
tacticsMeta
,
userMeta
])
},
[
orderMeta
,
tacticsMeta
,
userMeta
])
const
initTacticsConversation
=
()
=>
{
const
initTacticsConversation
=
()
=>
{
const
fromCollect
=
location
.
state
?.
fromCollect
const
fromCollect
=
location
.
state
?.
fromCollect
...
@@ -94,7 +111,14 @@ export const TacticsHome: React.FC = () => {
...
@@ -94,7 +111,14 @@ export const TacticsHome: React.FC = () => {
const
from
=
searchParams
.
get
(
'from'
)
const
from
=
searchParams
.
get
(
'from'
)
const
place
=
searchParams
.
get
(
'place'
)
const
place
=
searchParams
.
get
(
'place'
)
if
(
conversationId
&&
from
===
'tactics'
)
{
if
(
conversationId
&&
from
===
'tactics'
)
{
const
storageKey
=
place
===
'user'
?
'tactics_user_conversation_id'
:
'tactics_conversation_id'
const
fromValues
=
searchParams
.
getAll
(
'from'
)
let
storageKey
=
'tactics_conversation_id'
if
(
fromValues
.
includes
(
'order'
))
{
storageKey
=
'tactics_order_conversation_id'
}
else
if
(
place
===
'user'
)
{
storageKey
=
'tactics_user_conversation_id'
}
window
.
localStorage
.
setItem
(
storageKey
,
conversationId
)
window
.
localStorage
.
setItem
(
storageKey
,
conversationId
)
}
}
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment