| | |
| | | :data="displayTableData" |
| | | highlight-current-row |
| | | > |
| | | <el-table-column type="index" label="序号" width="55" fixed="left" align="center"></el-table-column> |
| | | <el-table-column prop="title" label="工作流名称" fixed="left" show-overflow-tooltip align="left" /> |
| | | |
| | | <el-table-column prop="prompt" width="280" label="工作流提示" show-overflow-tooltip align="center"> </el-table-column> |
| | | <el-table-column prop="published" width="120" label="发布状态" show-overflow-tooltip align="center"> |
| | | <template #default="scope"> |
| | |
| | | }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="调用方式" prop="inner_call" width="100" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | {{ scope.row.inner_call === 'Y' ? '内部' : '外部' }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="create_user" width="100" label="创建者" show-overflow-tooltip align="center" /> |
| | | <el-table-column prop="create_time" width="180" label="创建时间" show-overflow-tooltip align="center" /> |
| | | <el-table-column prop="note" width="180" label="说明" show-overflow-tooltip align="center" /> |
| | | <el-table-column label="操作" width="120" fixed="right" show-overflow-tooltip align="center"> |
| | | <el-table-column label="操作" width="180" fixed="right" show-overflow-tooltip align="center"> |
| | | <template #default="scope"> |
| | | <div class="space-x-2.5"> |
| | | <el-tooltip effect="dark" content="编辑" placement="top"> |
| | |
| | | <i |
| | | class="ywifont ywicon-jiegousheji !text-[15px] text-blue-400 cursor-pointer" |
| | | @click="gotoFlowDesign(scope.row)" |
| | | ></i> |
| | | </el-tooltip> |
| | | <el-tooltip effect="dark" content="工作流查看" placement="top"> |
| | | <i |
| | | class="ywifont ywicon-yulan !text-[16px] text-blue-400 cursor-pointer" |
| | | @click="gotoFlowView(scope.row)" |
| | | ></i> |
| | | </el-tooltip> |
| | | <el-tooltip |
| | | effect="dark" |
| | | :content="scope.row.published === SupervisorPublished.Y ? '取消发布' : '发布'" |
| | | placement="top" |
| | | > |
| | | <i |
| | | class="ywifont !text-[20px] cursor-pointer" |
| | | :class="[ |
| | | scope.row.published === SupervisorPublished.Y ? 'ywicon-quxiaofabu text-red-400' : 'ywicon-fabu text-blue-400', |
| | | ]" |
| | | @click=" |
| | | publishStatusChange( |
| | | scope.row.published === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y, |
| | | scope.row.id, |
| | | scope.$index |
| | | ) |
| | | " |
| | | ></i> |
| | | </el-tooltip> |
| | | |
| | |
| | | import { computed, nextTick, onMounted, ref } from 'vue'; |
| | | import OptDlg from './optDlg/OptDlg.vue'; |
| | | import * as agentGroupApi from '/@/api/ai/agentGroup'; |
| | | import { check_workflow_agent_validate, delete_workflow_agent, get_workflow_agent_list } from '/@/api/workflow/index'; |
| | | import { |
| | | check_workflow_agent_validate, |
| | | delete_workflow_agent, |
| | | get_workflow_agent_list, |
| | | publish_workflow_agent, |
| | | } from '/@/api/workflow/index'; |
| | | import Chat from '/@/components/chat/Chat.vue'; |
| | | import AHMContainer from '/@/components/layout/AHMContainer.vue'; |
| | | import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; |
| | |
| | | import { useCompRef } from '/@/utils/types'; |
| | | import { convertListToTree, debounce, travelTree } from '/@/utils/util'; |
| | | import { SupervisorPublished, supervisorPublishedMap } from '/@/views/project/yw/lowCode/sqlAmis/types'; |
| | | import { OptClassificationMap, classificationEnum } from '/@/views/types/metrics'; |
| | | //#region ====================== 左侧树数据,tree init ====================== |
| | | const leftTreeRef = useCompRef(LeftTreeByMgr); |
| | | const treeLoading = ref(false); |
| | |
| | | ElMessage.success('删除工作流成功'); |
| | | const index = tableData.value.findIndex((d) => d.id === row.id); |
| | | tableData.value.splice(index, 1); |
| | | work_update_data.value = work_update_data.value.filter((work) => work.id !== row.id); |
| | | removeDataAndRecalculateGroupNames(tree_update_data.value, work_update_data.value, row.id); |
| | | } else { |
| | | ElMessage.error('删除工作流失败' + (res?.json_msg ? `,${JSON.stringify(res.json_msg)}` : '')); |
| | |
| | | const updateSampleListsAndGroupNames = (tree_Data, work_Data) => { |
| | | let new_tree_Data = []; |
| | | tree_Data.forEach((node, index) => { |
| | | if (node.group_type == OptClassificationMap[classificationEnum.Knowledge]) { |
| | | new_tree_Data.push(node); |
| | | } |
| | | new_tree_Data.push(node); |
| | | }); |
| | | // 为每个节点关联工作流数据 |
| | | new_tree_Data.forEach((node) => { |
| | |
| | | ParentID: 'p_group_id', |
| | | Children: 'children', |
| | | }); |
| | | |
| | | // 合并子节点的工作流列表,并更新组名 |
| | | byParentData.forEach((item) => { |
| | | const updatedByParentData = byParentData.reduce((accumulator, item) => { |
| | | // 处理子节点,累加sampleList |
| | | if (item.children && item.children.length > 0) { |
| | | item.children.forEach((child_node) => { |
| | | item.sampleList = item.sampleList.concat(child_node.sampleList); |
| | | }); |
| | | } |
| | | // 移除旧的计数并添加新的计数 |
| | | item.group_name = item.group_name.replace(/ \([^)]*\)$/, '') + ` (${item.sampleList.length})`; |
| | | }); |
| | | // 将当前项添加到累加器中 |
| | | accumulator.push(item); |
| | | // 返回累加器 |
| | | return accumulator; |
| | | }, []); // 初始化累加器为空数组 |
| | | |
| | | return byParentData; |
| | | return updatedByParentData; |
| | | }; |
| | | // 插入一条数据时调用 |
| | | const addDataAndRecalculateGroupNames = (new_tree_Data, work_Data, newWorkData) => { |
| | |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | const gotoFlowView = (row) => { |
| | | router.push({ |
| | | name: 'FlowAppView', |
| | | query: { |
| | | id: row.id, |
| | | }, |
| | | }); |
| | | }; |
| | | //#endregion |
| | | |
| | | //#region ====================== 改变发布状态 ====================== |
| | | const publishStatusChange = async (published: SupervisorPublished, id, index) => { |
| | | const res = await publish_workflow_agent( |
| | | { |
| | | agent_id: id, |
| | | publish: published, |
| | | }, |
| | | { |
| | | loading: false, |
| | | } |
| | | ); |
| | | const origin = published === SupervisorPublished.Y ? SupervisorPublished.N : SupervisorPublished.Y; |
| | | const final = res.publish ?? origin; |
| | | if (final === origin) { |
| | | ElMessage.warning('操作失败' + (res.fail_msg ? `:${res.fail_msg}` : '')); |
| | | return; |
| | | } |
| | | |
| | | tableData.value[index].published = final; |
| | | |
| | | published === SupervisorPublished.Y ? ElMessage.success('发布成功') : ElMessage.info('已取消发布'); |
| | | }; |
| | | //#endregion |
| | | onMounted(async () => { |
| | | initData(); |
| | | }); |