From 9b5a94232d5eb17fb3b0621ad691d0cdd73db5bb Mon Sep 17 00:00:00 2001
From: yangyin <1850366751@qq.com>
Date: 星期三, 16 十月 2024 11:14:48 +0800
Subject: [PATCH] 分组列表默认全部展开

---
 src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue |   69 +++++++++++++---------------------
 1 files changed, 27 insertions(+), 42 deletions(-)

diff --git a/src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue b/src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue
index e79a76e..983ef48 100644
--- a/src/views/project/yw/systemManage/metricAgentMgr/MetricAgentMgr.vue
+++ b/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 ====================== 琛ㄦ牸鏁版嵁锛宼able init ======================
+//#region ====================== 鎸囨爣绠$悊琛ㄦ牸鏁版嵁锛宼able 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();
 });

--
Gitblit v1.9.3