Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 31e02dd0
authored
Dec 02, 2025
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 智能体管理/质检/培训列表删除接口联调/新增弹框表单组件
1 parent
d5ea7570
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
578 additions
and
38 deletions
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/AgenticQuality.vue
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/AgenticTrain.vue
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/QualityDialog.vue
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/TrainDialog.vue
package.json
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/AgenticQuality.vue
View file @
31e02dd
This diff is collapsed.
Click to expand it.
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/AgenticTrain.vue
View file @
31e02dd
...
@@ -83,35 +83,43 @@
...
@@ -83,35 +83,43 @@
<!-- 模板表格 -->
<!-- 模板表格 -->
<el-table
<el-table
:data=
"t
emplates
Data"
:data=
"t
able
Data"
style=
"width: 100%"
style=
"width: 100%"
:header-cell-style=
"
{ background: '#f5f7fa', color: '#606266', fontWeight: '500' }"
:header-cell-style=
"
{ background: '#f5f7fa', color: '#606266', fontWeight: '500' }"
class="custom-table mb-4"
class="custom-table mb-4"
>
>
<el-table-column
prop=
"name"
label=
"面向部门"
/>
<el-table-column
prop=
"targetDeptName"
label=
"面向部门"
/>
<el-table-column
prop=
"desc"
label=
"配置知识"
/>
<el-table-column
prop=
"knowledge"
label=
"配置知识"
/>
<el-table-column
prop=
"desc"
label=
"学习目标"
/>
<el-table-column
prop=
"learningObjectivePrompt"
label=
"学习目标"
/>
<el-table-column
prop=
"desc"
label=
"主动联系"
/>
<el-table-column
prop=
"proactiveContactEnabled"
label=
"主动联系"
>
<el-table-column
prop=
"desc"
label=
"创建时间"
/>
<template
#
default=
"
{ row }">
<el-table-column
prop=
"desc"
label=
"创建时间"
/>
<div>
<span
class=
"text-[#00A870] text-[12px] bg-[#E8F8F2] rounded-[3px] p-[8px]"
v-if=
"row.proactiveContactEnabled"
>
是
</span>
<span
class=
"text-[#777C85] text-[12px] bg-[#F0F2F5] rounded-[3px] p-[8px]"
v-else
>
否
</span>
</div>
</
template
>
</el-table-column>
<el-table-column
prop=
"createdDate"
label=
"创建时间"
/>
<el-table-column
label=
"操作"
width=
"150"
>
<el-table-column
label=
"操作"
width=
"150"
>
<template
#
default
>
<
template
#
default
=
"{ row }"
>
<el-button
link
type=
"primary"
>
编辑
</el-button>
<el-button
link
type=
"primary"
@
click=
"openDialog('edit', row)"
>
编辑
</el-button>
<el-button
link
type=
"primary"
>
删除
</el-button>
<el-button
link
type=
"primary"
@
click=
"deleteItem(row.id, row)"
>
删除
</el-button>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
<!-- 分页
(为了还原视觉,这里保持与上面一致)
-->
<!-- 分页 -->
<div
class=
"flex justify-between items-center text-gray-500 text-sm"
>
<div
class=
"flex justify-between items-center text-gray-500 text-sm"
>
<span>
共
101
项数据
</span>
<span>
共
{{ pageParams.total }}
项数据
</span>
<el-pagination
<el-pagination
v-model:current-page=
"
templatePage.current
"
v-model:current-page=
"
pageParams.currentPage
"
v-model:page-size=
"
templatePage.s
ize"
v-model:page-size=
"
pageParams.pageS
ize"
:page-sizes=
"[10, 20, 30]"
:page-sizes=
"[10, 20, 30]"
layout=
"sizes, prev, pager, next, slot, jumper"
layout=
"sizes, prev, pager, next, slot, jumper"
:total=
"
101
"
:total=
"
pageParams.total
"
background
background
@
size-change=
"getTrainingPlanList"
@
current-change=
"getTrainingPlanList"
>
>
<
template
#
default
>
<
template
#
default
>
<span
class=
"ml-2"
>
页
</span>
<span
class=
"ml-2"
>
页
</span>
...
@@ -121,26 +129,23 @@
...
@@ -121,26 +129,23 @@
</section>
</section>
</div>
</div>
</div>
</div>
<TrainDialog
ref=
"trainDialogRef"
/>
</template>
</template>
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
reactive
,
computed
,
onMounted
}
from
'vue'
;
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
;
import
{
getImageUrl
}
from
'@/utils/assets'
;
import
{
getImageUrl
}
from
'@/utils/assets'
;
import
TrainDialog
from
'./TrainDIalog.vue'
;
import
{
trainingPlanList
,
deleteTrainingPlan
}
from
'@/api/agentic'
;
// 3. 模板管理数据
// 表格数据
const
templatesData
=
[
const
tableData
=
ref
<
any
[]
>
([]);
{
name
:
'标准客服对话模板'
,
desc
:
'日常客户咨询服务'
},
{
name
:
'销售转化模板'
,
desc
:
'产品销售场景'
}
];
const
templatePage
=
reactive
({
const
pageParams
=
reactive
({
current
:
1
,
currentPage
:
1
,
size
:
10
pageSize
:
10
,
total
:
0
});
});
// 1. 工作流程数据
// 1. 工作流程数据
const
workflowSteps
=
[
const
workflowSteps
=
[
...
@@ -195,7 +200,59 @@ const coreFunctions = [
...
@@ -195,7 +200,59 @@ const coreFunctions = [
desc
:
'记录员工的训练历史和进步情况,生成学习报告和能力评估'
desc
:
'记录员工的训练历史和进步情况,生成学习报告和能力评估'
}
}
];
];
const
getTrainingPlanList
=
async
()
=>
{
try
{
const
res
=
await
trainingPlanList
(
pageParams
);
let
{
records
,
current
,
size
,
total
}
=
res
;
tableData
.
value
=
records
||
[];
pageParams
.
total
=
total
||
0
;
pageParams
.
currentPage
=
current
||
1
;
pageParams
.
pageSize
=
size
||
10
;
}
catch
(
error
)
{
console
.
error
(
'获取培训计划列表失败:'
,
error
);
ElMessage
.
error
(
'获取培训计划列表失败,请稍后重试'
);
}
}
const
deleteItem
=
async
(
id
:
number
,
row
:
any
)
=>
{
const
planName
=
row
.
targetDeptName
||
'该培训计划'
;
try
{
await
ElMessageBox
.
confirm
(
`确定要删除培训计划【
${
planName
}
】吗?`
,
'删除提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
customClass
:
'delete-confirm-dialog'
,
distinguishCancelAndClose
:
true
,
}
);
// 用户确认后执行删除
await
deleteTrainingPlan
({
'id'
:
id
});
ElMessage
.
success
(
'删除培训计划成功'
);
getTrainingPlanList
();
// 刷新列表
}
catch
(
error
:
any
)
{
// 用户取消操作时不显示错误提示
if
(
error
!==
'cancel'
)
{
console
.
error
(
'删除培训计划失败:'
,
error
);
ElMessage
.
error
(
'删除培训计划失败,请稍后重试'
);
}
}
}
const
trainDialogRef
=
ref
<
InstanceType
<
typeof
TrainDialog
>>
();
const
openDialog
=
(
type
:
'create'
|
'edit'
,
row
:
any
)
=>
{
if
(
trainDialogRef
.
value
)
{
trainDialogRef
.
value
.
openDialog
(
type
,
row
);
}
else
{
console
.
error
(
'trainDialogRef 未正确初始化'
);
}
}
onMounted
(()
=>
{
getTrainingPlanList
();
})
// 处理核心功能数据,确保图片 URL 使用子应用自己的域名
// 处理核心功能数据,确保图片 URL 使用子应用自己的域名
const
processedCoreFunctions
=
computed
(()
=>
{
const
processedCoreFunctions
=
computed
(()
=>
{
return
coreFunctions
.
map
(
item
=>
({
return
coreFunctions
.
map
(
item
=>
({
...
@@ -244,4 +301,80 @@ const processedCoreFunctions = computed(() => {
...
@@ -244,4 +301,80 @@ const processedCoreFunctions = computed(() => {
box-shadow
:
0
0
0
1px
#dcdfe6
inset
;
box-shadow
:
0
0
0
1px
#dcdfe6
inset
;
}
}
/* 删除确认对话框自定义样式 */
:deep
(
.delete-confirm-dialog
)
{
border-radius
:
8px
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__header
)
{
padding
:
20px
20px
16px
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__title
)
{
font-size
:
16px
;
font-weight
:
600
;
color
:
#2F3133
;
display
:
flex
;
align-items
:
center
;
gap
:
8px
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__status
)
{
font-size
:
20px
;
color
:
#FF7A00
!important
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__status.el-icon
)
{
color
:
#FF7A00
!important
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__status
svg
)
{
color
:
#FF7A00
!important
;
fill
:
#FF7A00
!important
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__message
)
{
padding
:
0
;
margin
:
0
;
font-size
:
14px
;
color
:
#2F3133
;
line-height
:
1.5
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__content
)
{
padding
:
0
20px
20px
;
}
:deep
(
.delete-confirm-dialog
.el-message-box__btns
)
{
padding
:
16px
20px
20px
;
justify-content
:
flex-end
;
gap
:
12px
;
}
:deep
(
.delete-confirm-dialog
.el-button--default
)
{
background-color
:
#F5F5F5
;
border-color
:
#F5F5F5
;
color
:
#2F3133
;
padding
:
8px
16px
;
font-size
:
14px
;
}
:deep
(
.delete-confirm-dialog
.el-button--default
:hover
)
{
background-color
:
#E8E8E8
;
border-color
:
#E8E8E8
;
}
:deep
(
.delete-confirm-dialog
.el-button--primary
)
{
background-color
:
#2563eb
;
border-color
:
#2563eb
;
color
:
#ffffff
;
padding
:
8px
16px
;
font-size
:
14px
;
}
:deep
(
.delete-confirm-dialog
.el-button--primary
:hover
)
{
background-color
:
#1d4ed8
;
border-color
:
#1d4ed8
;
}
</
style
>
</
style
>
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/QualityDialog.vue
0 → 100644
View file @
31e02dd
<
template
>
<div
class=
"app-container"
>
<!-- 触发按钮示例 -->
<!--
<el-button
type=
"primary"
@
click=
"openDialog('create')"
>
新建规则
</el-button>
<el-button
type=
"success"
@
click=
"openDialog('edit')"
>
编辑规则 (带数据)
</el-button>
-->
<!-- 弹窗组件 -->
<el-dialog
v-model=
"dialogVisible"
:title=
"dialogTitle"
width=
"500px"
:close-on-click-modal=
"false"
@
close=
"resetForm"
>
<el-form
ref=
"ruleFormRef"
:model=
"formData"
:rules=
"rules"
label-position=
"top"
class=
"rule-form"
>
<!-- 1. 规则/模版名称 -->
<el-form-item
:label=
"screenTitle + '名称'"
prop=
"name"
>
<el-input
v-model=
"formData.name"
:placeholder=
"'请输入' + screenTitle + '名称,支持中英文数字'"
maxlength=
"20"
show-word-limit
clearable
/>
</el-form-item>
<!-- 2. 关联素材 (树形选择器) -->
<el-form-item
label=
"关联素材"
prop=
"materials"
>
<el-tree-select
v-model=
"formData.materials"
:data=
"treeData"
multiple
show-checkbox
node-key=
"id"
placeholder=
"请选择关联知识库的文件"
filterable
collapse-tags
collapse-tags-tooltip
:max-collapse-tags=
"1"
class=
"full-width"
/>
</el-form-item>
<!-- 3. 规则描述 -->
<el-form-item
:label=
"screenTitle + '描述'"
prop=
"description"
>
<el-input
v-model=
"formData.description"
type=
"textarea"
:placeholder=
"'请输入' + screenTitle + '详细描述,支持中英文数字'"
maxlength=
"500"
show-word-limit
:rows=
"4"
resize=
"none"
/>
</el-form-item>
</el-form>
<!-- 底部按钮 -->
<template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
@
click=
"dialogVisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
{{
mode
===
'create'
?
'创建'
+
screenTitle
:
'保存'
+
screenTitle
}}
</el-button>
</div>
</
template
>
</el-dialog>
</div>
</template>
<
script
setup
lang=
"ts"
>
import
{
ref
,
reactive
,
computed
}
from
'vue'
import
type
{
FormInstance
,
FormRules
}
from
'element-plus'
import
{
ElMessage
}
from
'element-plus'
// --- 状态定义 ---
const
dialogVisible
=
ref
(
false
)
const
mode
=
ref
<
'create'
|
'edit'
>
(
'create'
)
const
ruleFormRef
=
ref
<
FormInstance
>
()
const
screenType
=
ref
<
string
>
(
''
)
const
screenTitle
=
ref
<
string
>
(
''
)
// 动态标题
const
dialogTitle
=
computed
(()
=>
(
mode
.
value
===
'create'
?
'创建'
+
screenTitle
.
value
:
'编辑'
+
screenTitle
.
value
))
// --- 表单数据 ---
const
formData
=
reactive
({
name
:
''
,
materials
:
[]
as
string
[],
// 存储选中的ID
description
:
''
})
// --- 验证规则 ---
const
rules
=
reactive
<
FormRules
>
({
name
:
[
{
required
:
true
,
message
:
'请输入规则名称'
,
trigger
:
'blur'
}
],
description
:
[
{
required
:
true
,
message
:
'请输入规则详细描述'
,
trigger
:
'blur'
}
]
// 图片中"关联素材"没有红星,所以此处不加 required,如需加可自行添加
})
// --- 模拟树形数据 (对应截图右侧下拉框) ---
const
treeData
=
[
{
id
:
'1'
,
label
:
'客服话术标准库'
,
children
:
[
{
id
:
'1-1'
,
label
:
'标准问候语模板'
},
{
id
:
'1-2'
,
label
:
'客户问题应答指南'
}
]
},
{
id
:
'2'
,
label
:
'产品信息库'
,
children
:
[
{
id
:
'2-1'
,
label
:
'产品功能介绍'
},
{
id
:
'2-2'
,
label
:
'产品定价策略'
}
]
}
]
// --- 方法 ---
// 打开弹窗
const
openDialog
=
(
type
:
'create'
|
'edit'
,
screenTypeParam
:
string
,
row
:
any
)
=>
{
mode
.
value
=
type
dialogVisible
.
value
=
true
screenType
.
value
=
screenTypeParam
screenTitle
.
value
=
screenTypeParam
===
'role'
?
'规则'
:
'模版'
;
console
.
log
(
row
);
if
(
type
===
'edit'
)
{
// 模拟回填数据
formData
.
name
=
'产品信息准确性'
formData
.
materials
=
[
'2-1'
,
'1-1'
]
// 选中"产品功能介绍"和"标准问候语"
formData
.
description
=
'此处是模拟的回填描述内容...'
}
}
// 重置表单 (关闭时触发)
const
resetForm
=
()
=>
{
if
(
!
ruleFormRef
.
value
)
return
ruleFormRef
.
value
.
resetFields
()
formData
.
materials
=
[]
// resetFields有时无法清空非prop绑定的复杂对象,手动清空保险
}
// 提交表单
const
submitForm
=
async
()
=>
{
if
(
!
ruleFormRef
.
value
)
return
await
ruleFormRef
.
value
.
validate
((
valid
)
=>
{
if
(
valid
)
{
// 提交逻辑
console
.
log
(
'提交数据:'
,
formData
)
ElMessage
.
success
(
mode
.
value
===
'create'
?
'创建成功'
:
'保存成功'
)
dialogVisible
.
value
=
false
}
})
}
// 暴露方法给父组件使用
defineExpose
({
openDialog
})
</
script
>
<
style
scoped
>
.app-container
{
padding
:
20px
;
}
/* 让树形选择器宽度填满 */
.full-width
{
width
:
100%
;
}
/* 调整 Dialog 底部按钮间距 */
.dialog-footer
{
display
:
flex
;
justify-content
:
flex-end
;
}
</
style
>
apps/frontend/venus-agentic/venus-agentic-assisant/src/views/ManageAgentic/components/TrainDialog.vue
0 → 100644
View file @
31e02dd
<
template
>
<!-- 触发按钮示例 (实际使用时可删除) -->
<!--
<div
class=
"demo-buttons"
>
<el-button
type=
"primary"
@
click=
"openDialog('create')"
>
新建培训计划
</el-button>
<el-button
type=
"success"
@
click=
"openDialog('edit')"
>
编辑培训计划 (模拟回显)
</el-button>
</div>
-->
<!-- Dialog 弹窗组件 -->
<el-dialog
v-model=
"visible"
:title=
"dialogTitle"
width=
"600px"
:close-on-click-modal=
"false"
@
closed=
"handleClose"
>
<el-form
ref=
"formRef"
:model=
"formData"
:rules=
"rules"
label-width=
"100px"
label-position=
"top"
class=
"training-form"
>
<!-- 1. 面向部门 -->
<el-form-item
label=
"面向部门"
prop=
"department"
>
<el-select
v-model=
"formData.department"
placeholder=
"请选择部门"
style=
"width: 100%"
>
<el-option
label=
"销售一部"
value=
"dept_1"
/>
<el-option
label=
"销售二部"
value=
"dept_2"
/>
<el-option
label=
"研发部"
value=
"dept_3"
/>
</el-select>
</el-form-item>
<!-- 2. 学习内容 (核心:TreeSelect) -->
<el-form-item
label=
"学习内容"
prop=
"content"
>
<el-tree-select
v-model=
"formData.content"
:data=
"treeData"
:render-after-expand=
"false"
show-checkbox
multiple
filterable
collapse-tags
collapse-tags-tooltip
placeholder=
"请选择学习内容"
style=
"width: 100%"
node-key=
"id"
/>
</el-form-item>
<!-- 3. 通用知识 (非必填) -->
<el-form-item
label=
"通用知识"
prop=
"generalKnowledge"
>
<el-select
v-model=
"formData.generalKnowledge"
placeholder=
"请选择"
style=
"width: 100%"
>
<el-option
label=
"企业文化"
value=
"gen_1"
/>
<el-option
label=
"入职指南"
value=
"gen_2"
/>
</el-select>
</el-form-item>
<!-- 4. 学习目标提示词 -->
<el-form-item
label=
"学习目标提示词"
prop=
"objective"
>
<el-input
v-model=
"formData.objective"
type=
"textarea"
:rows=
"4"
maxlength=
"5000"
show-word-limit
placeholder=
"例:创建一个15天的学习计划,需要学员了解产品核心卖点、典型案例分析,以及进行场景化小练习。请结合实际销售场景,设计渐进式的学习路径。"
/>
</el-form-item>
<!-- 5. 智能体主动联系 -->
<el-form-item
label=
"学员无应答时,智能体是否主动联系"
prop=
"autoContact"
>
<el-radio-group
v-model=
"formData.autoContact"
>
<el-radio
:label=
"true"
>
是
</el-radio>
<el-radio
:label=
"false"
>
否
</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<!-- 底部按钮 -->
<template
#
footer
>
<div
class=
"dialog-footer"
>
<el-button
@
click=
"visible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
:loading=
"loading"
>
{{
mode
===
'create'
?
'创建计划'
:
'保存计划'
}}
</el-button>
</div>
</
template
>
</el-dialog>
</template>
<
script
setup
>
import
{
ref
,
reactive
,
computed
}
from
'vue'
import
{
ElMessage
}
from
'element-plus'
// --- 状态定义 ---
const
visible
=
ref
(
false
)
const
mode
=
ref
(
'create'
)
// 'create' | 'edit'
const
loading
=
ref
(
false
)
const
formRef
=
ref
(
null
)
// --- 表单数据 ---
const
formData
=
reactive
({
department
:
''
,
content
:
[],
// TreeSelect 绑定的通常是ID数组
generalKnowledge
:
''
,
objective
:
''
,
autoContact
:
true
})
// --- 模拟树形数据 (对应图片右侧下拉框) ---
const
treeData
=
[
{
id
:
'1'
,
label
:
'产品知识'
,
children
:
[
{
id
:
'1-1'
,
label
:
'核心功能介绍'
},
{
id
:
'1-2'
,
label
:
'技术规格参数'
},
{
id
:
'1-3'
,
label
:
'竞品对比分析'
},
],
},
{
id
:
'2'
,
label
:
'销售技巧'
,
children
:
[
{
id
:
'2-1'
,
label
:
'谈判技巧'
},
{
id
:
'2-2'
,
label
:
'异议处理'
},
{
id
:
'2-3'
,
label
:
'客户心理学'
},
],
},
]
// --- 校验规则 ---
const
rules
=
{
department
:
[{
required
:
true
,
message
:
'请选择面向部门'
,
trigger
:
'change'
}],
content
:
[{
required
:
true
,
message
:
'请选择学习内容'
,
trigger
:
'change'
}],
objective
:
[{
required
:
true
,
message
:
'请输入学习目标提示词'
,
trigger
:
'blur'
}],
autoContact
:
[{
required
:
true
,
message
:
'请选择是否主动联系'
,
trigger
:
'change'
}]
}
// --- 计算属性 ---
const
dialogTitle
=
computed
(()
=>
{
return
mode
.
value
===
'create'
?
'创建培训计划'
:
'编辑培训计划'
})
// --- 核心逻辑方法 ---
/**
* 打开弹窗
* @param {String} type - 'create' 或 'edit'
* @param {Object} rowData - 编辑时传入的行数据
*/
const
openDialog
=
(
type
,
rowData
=
null
)
=>
{
mode
.
value
=
type
visible
.
value
=
true
if
(
type
===
'edit'
)
{
// 模拟回显数据 (对应图片右侧状态)
// 实际项目中这里应该是 Object.assign(formData, rowData)
formData
.
department
=
'dept_1'
// 销售一部
// 假设选择了: 产品知识(包含核心功能) + 销售技巧中的部分
formData
.
content
=
[
'1-1'
,
'2-1'
,
'2-2'
]
formData
.
generalKnowledge
=
''
formData
.
objective
=
'需要重点加强对新产品X系列的理解,并结合Q3季度的销售策略进行演练。'
formData
.
autoContact
=
true
}
else
{
// 新建模式:重置数据已在 handleClose 中处理,这里只需确保默认值
formData
.
autoContact
=
true
}
}
/**
* 关闭弹窗时的回调
* 用于重置表单,防止下次打开时有残留验证信息
*/
const
handleClose
=
()
=>
{
if
(
formRef
.
value
)
{
formRef
.
value
.
resetFields
()
}
// 手动清空非prop字段或重置默认值
formData
.
content
=
[]
formData
.
objective
=
''
}
/**
* 提交表单
*/
const
submitForm
=
async
()
=>
{
if
(
!
formRef
.
value
)
return
await
formRef
.
value
.
validate
((
valid
)
=>
{
if
(
valid
)
{
loading
.
value
=
true
// 模拟API请求
setTimeout
(()
=>
{
loading
.
value
=
false
console
.
log
(
'提交的数据:'
,
formData
)
ElMessage
.
success
(
mode
.
value
===
'create'
?
'创建成功'
:
'保存成功'
)
visible
.
value
=
false
},
1000
)
}
else
{
console
.
log
(
'表单校验失败'
)
return
false
}
})
}
// 暴露方法给父组件使用
defineExpose
({
openDialog
})
</
script
>
<
style
scoped
>
.demo-buttons
{
padding
:
20px
;
}
/* 调整表单项的间距,使其更像设计图 */
.training-form
.el-form-item
{
margin-bottom
:
24px
;
}
/* 强制让Label字体加粗一点,更像标题 */
:deep
(
.el-form-item__label
)
{
font-weight
:
500
;
color
:
#303133
;
}
</
style
>
package.json
View file @
31e02dd
...
@@ -25,23 +25,14 @@
...
@@ -25,23 +25,14 @@
"build:filter"
:
"node scripts/build/buildToRoot.mjs"
,
"build:filter"
:
"node scripts/build/buildToRoot.mjs"
,
"build:docs"
:
"pnpm run build --filter=@venus/docs"
,
"build:docs"
:
"pnpm run build --filter=@venus/docs"
,
"changeset"
:
"pnpm exec changeset"
,
"changeset"
:
"pnpm exec changeset"
,
"check"
:
"pnpm run check:circular && pnpm run check:dep && pnpm run check:type && pnpm check:cspell"
,
"check:circular"
:
"vsh check-circular"
,
"check:cspell"
:
"cspell lint **/*.ts **/README.md .changeset/*.md --no-progress"
,
"check:dep"
:
"vsh check-dep"
,
"check:type"
:
"turbo run typecheck"
,
"clean"
:
"node ./scripts/clean.mjs"
,
"clean"
:
"node ./scripts/clean.mjs"
,
"commit"
:
"powershell -ExecutionPolicy Bypass -File ./scripts/commit.ps1"
,
"commit"
:
"powershell -ExecutionPolicy Bypass -File ./scripts/commit.ps1"
,
"format"
:
"vsh lint --format"
,
"lint"
:
"vsh lint"
,
"postinstall"
:
"pnpm -r run stub --if-present"
,
"postinstall"
:
"pnpm -r run stub --if-present"
,
"prepare"
:
"husky"
,
"prepare"
:
"husky"
,
"preinstall"
:
"npx only-allow pnpm"
,
"preinstall"
:
"npx only-allow pnpm"
,
"preview"
:
"turbo-run preview"
,
"preview"
:
"turbo-run preview"
,
"publint"
:
"vsh publint"
,
"publint"
:
"vsh publint"
,
"reinstall"
:
"pnpm clean --del-lock && pnpm install"
,
"reinstall"
:
"pnpm clean --del-lock && pnpm install"
,
"test:unit"
:
"vitest run --dom"
,
"test:e2e"
:
"turbo run test:e2e"
,
"update:deps"
:
"npx taze -r -w"
,
"update:deps"
:
"npx taze -r -w"
,
"version"
:
"pnpm exec changeset version && pnpm install --no-frozen-lockfile"
,
"version"
:
"pnpm exec changeset version && pnpm install --no-frozen-lockfile"
,
"catalog"
:
"pnpx codemod pnpm/catalog"
,
"catalog"
:
"pnpx codemod pnpm/catalog"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment