Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Pangea-Agent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Gavin-Group
Pangea-Agent
Commits
0db615a6
Commit
0db615a6
authored
Dec 25, 2025
by
高如斌
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
访客场景字段临时特殊处理
parent
9073d710
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
1 deletion
+53
-1
ChatArea.vue
frontend/src/components/ChatArea.vue
+26
-1
FormRender.vue
frontend/src/components/FormRender.vue
+8
-0
form.ts
frontend/src/stores/form.ts
+19
-0
No files found.
frontend/src/components/ChatArea.vue
View file @
0db615a6
...
@@ -654,8 +654,33 @@ const processSSELine = async (
...
@@ -654,8 +654,33 @@ const processSSELine = async (
case "
form
":
case "
form
":
if (data && data.coms) {
if (data && data.coms) {
// 正常情况:
// formJson.value = data;
// formJson.value = data;
formJson.value = data;
// 演示场景特殊处理:
// 提取被过滤掉的字段
const hiddenFields = data.coms
.filter((com: any) => {
const title = com.props?.title;
return title === "
接访员工手机号
" || title === "
接访员工姓名
";
})
.map((com: any) => ({
title: com.props?.title || "",
name: com.props?.name || "",
}));
// 保存隐藏字段到 store
formStore.setHiddenFields(hiddenFields);
// 过滤掉不需要的字段
const filteredData = {
...data,
coms: data.coms.filter((com: any) => {
const title = com.props?.title;
return title !== "
接访员工手机号
" && title !== "
接访员工姓名
";
}),
};
formJson.value = filteredData;
}
}
break;
break;
}
}
...
...
frontend/src/components/FormRender.vue
View file @
0db615a6
...
@@ -26,6 +26,14 @@ const templateRef = ref();
...
@@ -26,6 +26,14 @@ const templateRef = ref();
const
submit
=
()
=>
{
const
submit
=
()
=>
{
templateRef
.
value
?.
ctx
.
validate
(
1
,
(
isValid
:
boolean
,
formData
:
any
)
=>
{
templateRef
.
value
?.
ctx
.
validate
(
1
,
(
isValid
:
boolean
,
formData
:
any
)
=>
{
if
(
isValid
)
{
if
(
isValid
)
{
// 临时处理:追加隐藏字段到表单数据
const
hiddenFields
=
formStore
.
hiddenFields
;
hiddenFields
.
forEach
((
field
)
=>
{
if
(
field
.
name
)
{
formData
[
field
.
name
]
=
"none"
;
}
});
console
.
log
(
"表单验证通过,提交数据:"
,
formData
);
console
.
log
(
"表单验证通过,提交数据:"
,
formData
);
// 调用 store 的 submitForm 方法,触发回调
// 调用 store 的 submitForm 方法,触发回调
formStore
.
submitForm
(
formData
);
formStore
.
submitForm
(
formData
);
...
...
frontend/src/stores/form.ts
View file @
0db615a6
...
@@ -69,6 +69,9 @@ export const useFormStore = defineStore("form", {
...
@@ -69,6 +69,9 @@ export const useFormStore = defineStore("form", {
// 表单提交回调函数
// 表单提交回调函数
onSubmitCallback
:
null
as
((
data
:
any
)
=>
void
)
|
null
,
onSubmitCallback
:
null
as
((
data
:
any
)
=>
void
)
|
null
,
// 过滤掉的隐藏字段
hiddenFields
:
[]
as
Array
<
{
title
:
string
;
name
:
string
}
>
,
}),
}),
actions
:
{
actions
:
{
...
@@ -87,6 +90,21 @@ export const useFormStore = defineStore("form", {
...
@@ -87,6 +90,21 @@ export const useFormStore = defineStore("form", {
this
.
formJson
=
getInitFormJson
();
this
.
formJson
=
getInitFormJson
();
},
},
/**
* 设置隐藏字段
* @param fields 隐藏字段数组
*/
setHiddenFields
(
fields
:
Array
<
{
title
:
string
;
name
:
string
}
>
)
{
this
.
hiddenFields
=
fields
;
},
/**
* 清空隐藏字段
*/
clearHiddenFields
()
{
this
.
hiddenFields
=
[];
},
/**
/**
* 设置表单提交回调函数
* 设置表单提交回调函数
* @param callback 回调函数
* @param callback 回调函数
...
@@ -149,6 +167,7 @@ export const useFormStore = defineStore("form", {
...
@@ -149,6 +167,7 @@ export const useFormStore = defineStore("form", {
closeForm
()
{
closeForm
()
{
this
.
showForm
=
false
;
this
.
showForm
=
false
;
this
.
clearFormJson
();
this
.
clearFormJson
();
this
.
clearHiddenFields
();
},
},
},
},
});
});
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