yangyin
2024-10-16 9b5a94232d5eb17fb3b0621ad691d0cdd73db5bb
src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue
@@ -11,6 +11,7 @@
               label: 'group_name',
               children: 'children',
            }"
            defaultExpandAll
            :treedata="listTreeData"
            title-name="分组列表"
            :show-more-operate="false"
@@ -114,29 +115,9 @@
                     </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 relative" v-show="!tableHasChildren">
         <div class="w100 h100 relative" v-show="!tableHasChildren && activeTabName === 'dataset'">
            <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" />
@@ -152,7 +133,7 @@
                        class="h100"
                        border
                        :row-class-name="isDragStatus ? 'cursor-move' : 'cursor-pointer'"
                        :data="displayTableData"
                        :data="modelTableData"
                        highlight-current-row
                     >
                        <el-table-column prop="title" label="模型名称" width="300" fixed="left" show-overflow-tooltip> </el-table-column>
@@ -228,19 +209,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;
});
@@ -271,27 +260,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: '',
});
@@ -305,13 +291,17 @@
const tableHasChildren = ref(false);
const handleClick = (tabName) => {
   activeTabName.value = tabName;
   switch (tabName) {
      case 'dataset':
         if (metricStatus.value) return;
         getTableData();
         metricStatus.value = true;
         break;
      case 'permission':
         break;
   }
};
//#endregion
//#region ====================== 指标管理 ======================
const tagObjectDData = ref([]);
//#endregion
//#region ====================== 权限管理 ======================
const permissionForm = ref({
   accessPermissions: '',
@@ -322,12 +312,10 @@
const byOrganizationData = ref([]);
const byIndividualData = ref([]);
//#endregion
//#region ====================== 推荐问题 ======================
const terminologyData = ref([]);
//#endregion
//#region ====================== 模型管理(没有父节点) ======================
const activeModelName = ref('modelName');
const canvasRadio = ref('canvas_list');
const modelTableData = ref([]);
const deleteModelData = (row) => {};
const getNodeTableData = () => {};
//#endregion
@@ -421,12 +409,8 @@
   chatTestMapRow.value = null;
   chatTestIsShow.value = false;
};
const draggableChatRef = ref<HTMLElement | null>(null);
const chatDragHandlerRef = ref<HTMLDivElement>(null);
const chatDragContainerRef = ref<HTMLDivElement>(null);
// `style` will be a helper computed for `left: ?px; top: ?px;`
const { x, y, style } = useDraggable(draggableChatRef, {
   handle: chatDragHandlerRef,
   initialValue: {
@@ -476,6 +460,7 @@
   metricNameIsShow.value = true;
};
//#endregion
onMounted(() => {
   getListTreeData();
});