id
wujingjing
2025-04-18 c376e8bc29095620d0cdb556965b08dcbf8bab0e
src/views/project/yw/dataManage/workFlowMgr/WorkFlowIndex.vue
@@ -52,7 +52,11 @@
               :data="displayTableData"
               highlight-current-row
            >
               <el-table-column prop="title" label="工作流名称" fixed="left" show-overflow-tooltip align="left" />
               <el-table-column type="index" label="序号" width="55" fixed="left" align="center"></el-table-column>
               <el-table-column prop="id" width="310" label="ID" fixed="left" show-overflow-tooltip align="left" />
               <el-table-column prop="title" width="200" 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">
@@ -61,10 +65,15 @@
                     }}</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">
@@ -77,6 +86,31 @@
                           <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>
@@ -127,7 +161,12 @@
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';
@@ -136,7 +175,6 @@
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);
@@ -196,9 +234,7 @@
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) => {
@@ -352,8 +388,40 @@
      },
   });
};
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();
});