yangyin
2024-10-15 291c57d6f6abe29398aee6ae6be9d91d6311e50d
src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue
@@ -24,7 +24,7 @@
      <template #main>
         <div class="w100 h100" v-show="tableHasChildren">
            <el-tabs v-model="activeTabName" class="h-full" @tab-change="handleClick">
               <el-tab-pane label="数据集管理" name="dataset" class="h-full">
               <el-tab-pane label="指标管理" name="dataset" class="h-full">
                  <div class="h-full">
                     <el-table
                        v-loading="tableLoading"
@@ -89,46 +89,6 @@
                     </div>
                  </div>
               </el-tab-pane>
               <el-tab-pane label="维度管理" name="tagObject" class="h-full">
                  <div class="h-full">
                     <el-table
                        v-loading="tableLoading"
                        ref="draggableTableRef"
                        class="h100"
                        border
                        :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                        :data="tagObjectDData"
                        highlight-current-row
                     >
                        <el-table-column label="名称" prop="title" width="200" fixed="left" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="描述" prop="creator" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="状态" prop="create_time" width="125" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="创建人" prop="published" width="100" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="更新时间" prop="note" show-overflow-tooltip width="150"> </el-table-column>
                        <el-table-column label="操作" width="80" fixed="right" show-overflow-tooltip> </el-table-column>
                     </el-table>
                  </div>
               </el-tab-pane>
               <el-tab-pane label="术语管理" name="terminology" class="h-full">
                  <div class="h-full">
                     <el-table
                        v-loading="tableLoading"
                        ref="draggableTableRef"
                        class="h100"
                        border
                        :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                        :data="terminologyData"
                        highlight-current-row
                     >
                        <el-table-column label="名称" prop="title" width="200" fixed="left" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="近义词" prop="creator" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="创建人" prop="create_time" width="125" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="更新时间" prop="published" width="100" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="描述" prop="note" show-overflow-tooltip width="150"> </el-table-column>
                        <el-table-column label="操作" width="80" fixed="right" show-overflow-tooltip> </el-table-column>
                     </el-table>
                  </div>
               </el-tab-pane>
               <el-tab-pane label="权限管理" name="permission" class="h-full">
                  <div class="h-full">
                     <div class="flex items-center justify-between set-permission box-border">
@@ -154,12 +114,38 @@
                     </el-form>
                  </div>
               </el-tab-pane>
               <el-tab-pane label="推荐问题" name="terminology" class="h-full">
                  <div class="h-full">
                     <el-table
                        v-loading="tableLoading"
                        ref="draggableTableRef"
                        class="h100"
                        border
                        :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                        :data="terminologyData"
                        highlight-current-row
                     >
                        <el-table-column label="名称" prop="title" width="200" fixed="left" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="近义词" prop="creator" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="创建人" prop="create_time" width="125" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="更新时间" prop="published" width="100" show-overflow-tooltip> </el-table-column>
                        <el-table-column label="描述" prop="note" show-overflow-tooltip width="150"> </el-table-column>
                        <el-table-column label="操作" width="80" fixed="right" show-overflow-tooltip> </el-table-column>
                     </el-table>
                  </div>
               </el-tab-pane>
            </el-tabs>
         </div>
         <div class="w100 h100" v-show="!tableHasChildren">
         <div class="w100 h100 relative" v-show="!tableHasChildren">
            <div class="absolute top-0 right-0 w-[112px] h-[24[x]] bg-white z-50 leading-3 pt-2">
               <el-radio-group v-model="canvasRadio" size="small">
                  <el-radio-button label="列表" value="canvas_list" />
                  <el-radio-button label="画布" value="canvas_tu" />
               </el-radio-group>
            </div>
            <el-tabs v-model="activeModelName" class="h-full" @tab-change="handleClick">
               <el-tab-pane label="模型管理" name="modelName" class="h-full">
                  <div class="h-full">
                  <div class="h-full" v-show="canvasRadio === 'canvas_list'">
                     <el-table
                        v-loading="tableLoading"
                        ref="draggableTableRef"
@@ -213,6 +199,7 @@
                        <Chat ref="chatRef" class="flex-auto px-2" :questionApi="questionAi"> </Chat>
                     </div>
                  </div>
                  <div class="h-full" v-show="canvasRadio === 'canvas_tu'"></div>
               </el-tab-pane>
            </el-tabs>
         </div>
@@ -233,6 +220,7 @@
import MetricPrompt from './optDlg/MetricPrompt.vue';
import * as agentGroupApi from '/@/api/ai/agentGroup';
import * as metricApi from '/@/api/metrics';
import { get_scene_group_sample } from '/@/api/scene/index';
import { updatePublishStatus } from '/@/api/supervisorAdmin';
import Chat from '/@/components/chat/Chat.vue';
import AMContainer from '/@/components/layout/AMContainer.vue';
@@ -241,19 +229,27 @@
import { useQueryTable } from '/@/hooks/useQueryTable';
import { useCompRef } from '/@/utils/types';
import { convertListToTree } from '/@/utils/util';
import { OptClassificationMap, classificationEnum } from '/@/views/types/metrics';
//#region ====================== 左侧树数据,tree init ======================
const leftTreeRef = useCompRef(LeftTreeByMgr);
const treeLoading = ref(false);
const listData = ref([]);
const currentListID = computed(() => currentNode.value?.group_id);
const currentNode = ref(null);
const listTreeData = computed(() => {
   const result = convertListToTree(listData.value, {
   const byParentData = convertListToTree(listData.value, {
      ID: 'group_id',
      ParentID: 'p_group_id',
      Children: 'children',
   });
   const result = [];
   byParentData.forEach((item) => {
      if (
         item.group_type != OptClassificationMap[classificationEnum.Office] &&
         item.group_type != OptClassificationMap[classificationEnum.Knowledge]
      ) {
         result.push(item);
      }
   });
   return result;
});
@@ -284,27 +280,24 @@
   }
};
//#endregion
//#region ====================== 表格数据,table init ======================
//#region ====================== 指标管理表格数据,table init ======================
const tableLoading = ref(false);
const tableData = ref([]);
const isDragStatus = ref(false);
const metricStatus = ref(false);
const allTableData = ref(null);
const getTableData = async () => {
   if (!allTableData.value) {
      const res = await metricApi.getMetricAgentListByPost();
      allTableData.value = (res.values || []).map((item) => {
         item.create_time = item.create_time?.slice(0, 10);
         return item;
      });
   }
   tableData.value = allTableData.value.filter((item) => item.agent_group === currentListID.value);
};
//#endregion
//#region ====================== 表格查询、排序,search form init ======================
const queryParams = ref({
   title: '',
});
@@ -318,14 +311,21 @@
const tableHasChildren = ref(false);
const handleClick = (tabName) => {
   activeTabName.value = tabName;
   switch (tabName) {
      case 'dataset':
         if (metricStatus.value) return;
         getTableData();
         metricStatus.value = true;
         break;
      case 'terminology':
         if (terminologyStatus.value) return;
         getTerminologyData();
         terminologyStatus.value = true;
         break;
      case 'modelName':
         break;
   }
};
//#endregion
//#region ====================== 数据对象管理 ======================
const tagObjectDData = ref([]);
//#endregion
//#region ====================== 术语管理 ======================
const terminologyData = ref([]);
//#endregion
//#region ====================== 权限管理 ======================
const permissionForm = ref({
@@ -337,8 +337,18 @@
const byOrganizationData = ref([]);
const byIndividualData = ref([]);
//#endregion
//#region ====================== 推荐问题 ======================
const terminologyData = ref([]);
const terminologyStatus = ref(false);
//获取场景list
const getTerminologyData = async () => {
   const res = await get_scene_group_sample();
   terminologyData.value = res.samples.filter((item) => item.group_id === currentListID.value);
};
//#endregion
//#region ====================== 模型管理(没有父节点) ======================
const activeModelName = ref('modelName');
const canvasRadio = ref('canvas_list');
const deleteModelData = (row) => {};
const getNodeTableData = () => {};
//#endregion
@@ -487,6 +497,7 @@
   metricNameIsShow.value = true;
};
//#endregion
onMounted(() => {
   getListTreeData();
});