Skip to content

Commit d18e177

Browse files
feat: trigger
1 parent f3cb0b0 commit d18e177

20 files changed

Lines changed: 342 additions & 271 deletions

File tree

ui/AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ Keep these behaviors:
209209
## Frontend Implementation Notes
210210

211211
- Prefer existing project structure and naming.
212+
- Do not modify shared components under `src/components/` without an explicit user instruction to
213+
change those components. Follow the modification boundary in `src/components/COMPONENT_README.md`.
212214
- Do not write `aria-label` attributes in project source. Add concise Chinese HTML comments before
213215
buttons to describe their purpose, following `src/components/COMPONENT_README.md`.
214216
- Before changing existing behavior, trace the affected flow and dependent requirements, including

ui/src/components/COMPONENT_README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66

77
## 选型与目录
88

9+
### 公共组件修改边界
10+
11+
没有用户明确要求修改公共组件的指令,不允许修改 `src/components/` 下公共组件的内容,
12+
包括 `global/``business/` 及其他共享组件目录中的模板、逻辑、样式和接口。
13+
“参考某组件”“使用某组件”或修改业务页面,不视为授权修改该公共组件。
14+
实现前先使用已有 Props、事件和插槽,在所属 View 或功能目录中完成组合与适配。
15+
确实需要修改公共组件时,先说明具体组件、必要性及影响范围,取得明确指令后再修改。
16+
此约束纳入实现前检查和提交前 diff 检查;已有其他工作留下的公共组件改动不擅自覆盖或回退。
17+
918
依次检查全局 Mk 组件、业务组件、手动导入的共享 UI,最后使用 Element Plus;已有同类封装时
1019
直接复用,例如 `MkDialog``MkDrawer``MkDropdown``MkIcon``MkTable`。先用现有 Props、
1120
事件、插槽和样式适配,无法满足必要行为时再新增组件;无明确需求不引入新 UI 库。
@@ -71,7 +80,6 @@ Admin、Chat 入口调用 `configureMarkdownEditor()` 配置本地高亮、KaTeX
7180
### MkCollapse
7281

7382
`v-model:expanded` 可控制展开状态;未绑定时沿用 `defaultExpanded` 的内部状态。
74-
`destroyOnCollapse` 默认 `true`,设为 `false` 时折叠只隐藏内容,适用于需要保留参数表单及校验的场景。
7583

7684
标题折叠区,`title``label` 插槽提供标题,默认插槽提供内容。
7785
`defaultExpanded` 默认 `true`,仅设置初始状态;点击标题内部切换,当前不提供展开状态事件。

ui/src/components/global/mk-collapse/index.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ defineOptions({ name: 'MkCollapse' })
77
const props = withDefaults(
88
defineProps<{
99
defaultExpanded?: boolean
10-
destroyOnCollapse?: boolean
1110
indicatorPosition?: 'after' | 'before'
1211
title?: string
1312
triggerClass?: HTMLAttributes['class']
1413
triggerStyle?: HTMLAttributes['style']
1514
}>(),
16-
{ defaultExpanded: true, destroyOnCollapse: true, indicatorPosition: 'before' },
15+
{ defaultExpanded: true, indicatorPosition: 'before' },
1716
)
1817
1918
defineSlots<{ default?: () => unknown; label?: () => unknown }>()
@@ -54,7 +53,7 @@ const expanded = computed({
5453
</div>
5554
</div>
5655
<el-collapse-transition>
57-
<div v-if="!destroyOnCollapse || expanded" v-show="expanded">
56+
<div v-show="expanded">
5857
<slot />
5958
</div>
6059
</el-collapse-transition>

ui/src/views/VIEW_README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,16 @@ Workspace 与 System 授权均使用该工作空间 ID,不读取路由工作
405405
任务选择复用 `SelectApplicationDialog``SelectToolDialog`,工具限定自定义和工作流类型。
406406
`trigger/trigger-form/request-parameters/RequestParameters.vue``MkFormList` 展示和删除事件请求参数,
407407
同目录 `RequestParameterDialog.vue` 负责新增、编辑及参数名必填与重名校验;确认后回写,取消保留原值。
408-
`trigger/trigger-form/task-execution/TaskParameters.vue` 展示任务输入及事件参数引用,
409-
`trigger/trigger-form/task-execution/task-parameters.ts` 从资源输入定义生成字段,只补全缺失值,不覆盖已有配置。
408+
`trigger/trigger-form/task-execution/parameters/``ApplicationParameter.vue``ToolParameter.vue`
409+
分别生成智能体和工具字段,共用 `ParameterForm.vue` 的输入、事件引用、初始化和校验;
410+
`types.ts` 仅维护跨组件使用的字段描述类型,不再单独拆分每个组件专用的参数工具文件。
411+
初始化只补全缺失值,不覆盖已有自定义配置;切回定时或移除全部事件参数时,引用参数恢复自定义默认值。
412+
智能体包含 Question、启用的文件类型、用户输入和接口参数;工具包含普通输入和工作流用户输入。
410413
抽屉采用类型卡片选择,选中卡片内显示配置,触发周期与 Cron 通过切换按钮切换;新建时需选择周期。
411-
`trigger/trigger-form/task-execution/TriggerTaskGroups.vue` 维护任务分组、展开收起、移除及参数表单,
414+
`trigger/trigger-form/task-execution/TaskExecution.vue` 维护任务分组、展开收起、移除及参数表单,
412415
组件内管理智能体与工具选择弹窗、资源详情加载和任务参数保留,通过 `v-model` 回写任务、
413416
`v-model:loading` 同步加载状态、`change` 通知清理校验,并提供 `validate``expandAll``reset`
414-
任务 UI 沿用 AI Chat 技能区的 `MkCollapse` 分组和紧凑资源卡片,参数区折叠后保留挂载以支持完整校验
417+
任务 UI 沿用 AI Chat 技能区的 `MkCollapse` 分组和紧凑资源卡片,保存前先展开全部任务,待参数表单挂载后统一校验
415418
抽屉负责触发器详情查询与保存,将详情资源快照通过 `initialResources` 传入任务组件;
416419
任务组件新增资源后展开任务,抽屉保存时调用分组组件校验全部参数。
417420
保存时校验所有任务,包括折叠的任务;接口失败保持抽屉打开。

ui/src/views/system/chat/users/UserFromDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ defineExpose({ open })
148148
<el-input v-model="userForm.password" readonly>
149149
<template #suffix>
150150
<el-button text @click="copyText(userForm.password)" class="-mr-1">
151-
<mk-icon name="icon_copy_outlined" class="text-N600"></mk-icon>
151+
<MkIcon name="icon_copy_outlined" class="text-N600" />
152152
</el-button>
153153
</template>
154154
</el-input>

ui/src/views/system/chat/users/UserListView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ onMounted(() => loadChatUsers())
215215
<!-- 编辑 -->
216216
<el-tooltip content="编辑" placement="top">
217217
<el-button type="primary" text @click.stop="handleOpenUserFormDrawer(row)">
218-
<mk-icon name="icon_edit_outlined"></mk-icon>
218+
<MkIcon name="icon_edit_outlined" />
219219
</el-button>
220220
</el-tooltip>
221221
<!-- 修改用户密码 -->

ui/src/views/system/identity/users/UserFromDrawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ defineExpose({ open })
211211
<el-input v-model="userForm.password" readonly>
212212
<template #suffix>
213213
<el-button text @click="copyText(userForm.password)" class="-mr-1">
214-
<mk-icon name="icon_copy_outlined" class="text-N600"></mk-icon>
214+
<MkIcon name="icon_copy_outlined" class="text-N600" />
215215
</el-button>
216216
</template>
217217
</el-input>

ui/src/views/system/identity/users/UserListView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,15 @@ onMounted(() => loadSystemUsers())
216216
<!-- 编辑 -->
217217
<el-tooltip content="编辑" placement="top">
218218
<el-button type="primary" text @click.stop="handleOpenUserFormDrawer(row)">
219-
<mk-icon name="icon_edit_outlined"></mk-icon>
219+
<MkIcon name="icon_edit_outlined" />
220220
</el-button>
221221
</el-tooltip>
222222
<!-- 修改用户密码 -->
223223
<UserPwdButton :user="row" @refresh="loadSystemUsers(false)" />
224224
<!-- 删除 -->
225225
<el-tooltip content="删除" placement="top">
226226
<el-button type="primary" text @click.stop="deleteUser(row)">
227-
<mk-icon name="icon_delete-trash_outlined"></mk-icon>
227+
<MkIcon name="icon_delete-trash_outlined" />
228228
</el-button>
229229
</el-tooltip>
230230
</div>

ui/src/views/tool/tool-form/component/init-field/InitFieldTable.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ function getTypeLabel(inputType: string) {
4040
<section>
4141
<div class="mb-4 flex-between">
4242
<h4 class="mk-title-decoration">启动参数</h4>
43-
<el-button link type="primary" @click="handleOpenInitField()">
43+
<el-button text type="primary" @click="handleOpenInitField()">
4444
<MkIcon name="icon_add_outlined" />
45-
<span>添加</span>
4645
</el-button>
4746
</div>
4847
<MkTable :data="initFields" size="small">

ui/src/views/tool/tool-form/component/input-field/InputFieldTable.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ function handleDeleteInputField(index: number) {
3535
<h4 class="mk-title-decoration">输入参数</h4>
3636
<span class="text-N600">使用工具时显示</span>
3737
</div>
38-
<el-button link type="primary" @click="handleOpenInputField()">
38+
<el-button text type="primary" @click="handleOpenInputField()">
3939
<MkIcon name="icon_add_outlined" />
40-
<span>添加</span>
4140
</el-button>
4241
</div>
4342
<MkTable :data="inputFields" size="small">

0 commit comments

Comments
 (0)