Przeglądaj źródła

fix: 修改优化

liaojiaxing 2 tygodni temu
rodzic
commit
2e55fd5753

+ 18 - 3
src/pages/excel/MindmapModal.vue

@@ -114,7 +114,7 @@ import {
 import type { MindMapInstance } from "@/components/mindmap/Mindmap.vue";
 import type { FormInstance } from "element-plus";
 import { ElMessage } from "element-plus";
-import { bfsWalk } from "simple-mind-map/src/utils";
+import { bfsWalk, walk } from "simple-mind-map/src/utils";
 // import { useEditBomStore } from "@/store/editbom";
 
 import Mindmap from "@/components/mindmap/Mindmap.vue";
@@ -165,7 +165,11 @@ watch(
 // 定位到根节点
 const zoomToRoot = () => {
   const mindmap = mindmapRef.value?.getInstance();
+  mindmap?.renderer?.clearActiveNode();
   mindmap?.renderer?.setRootNodeCenter();
+  const data = mindmap?.getData(false);
+  const root = mindmap?.renderer.findNodeByUid(data?.data?.uid);
+  root?.active();
 };
 
 // 切换布局
@@ -239,10 +243,15 @@ const handleSearch = () => {
   });
 
   if (result.length) {
+    // 展开高亮选择目标
     result.forEach((node) => {
-      const n = mindmap?.renderer.findNodeByUid(node.data?.uid);
-      n?.active();
+      mindmap?.renderer?.expandToNodeUid(node.data?.uid);
     });
+    
+    setTimeout(() => {
+      const list = result.map((node) => mindmap?.renderer.findNodeByUid(node.data?.uid));
+      mindmap?.renderer?.activeMultiNode(list);
+    }, 300);
   } else {
     ElMessage.warning("未找到节点");
   }
@@ -298,6 +307,12 @@ const handleSave = () => {
 watch(
   () => props?.defaultData,
   (val) => {
+    // 设置初始化加载层级
+    walk(val, null,  (node: any, _p: any, _isRoot: any, layerIndex: number) => {
+    if (formData.level && (layerIndex >= formData.level)) {
+      node.data.expand = false;
+    }
+  });
     data.value = val;
   }
 );

+ 9 - 3
src/pages/excel/index.vue

@@ -10,12 +10,12 @@
         >
         <!-- <el-button link @click="openMindmap"><img class="w-1em mr-4px" :src="mindmapImg"/>思维导图模式</el-button> -->
       </div>
-      <div>
-        <!-- <el-button link @click="openMindmap" class="mr-8px"><img class="w-1em mr-4px" :src="saveImg"/>项目比对</el-button> -->
+      <!-- <div>
+        <el-button link @click="openMindmap" class="mr-8px"><img class="w-1em mr-4px" :src="saveImg"/>项目比对</el-button> 
         <el-select placeholder="历史版本" style="width: 120px" size="small">
           <el-option label="2025.7.16 12:12" value="1"></el-option>
         </el-select>
-      </div>
+      </div>-->
     </div>
     <Sheet
       ref="sheetRef"
@@ -59,6 +59,12 @@ const onSheetCreated = (univer: Univer, univerApi: FUniver) => {
 // 正常保存
 const handleSave = () => {
   const workbook = sheetRef.value?.getUniverSnapshot();
+  // @ts-ignore
+  workbook?.resources?.forEach((item: any) => {
+    if(item.name === "SHEET_AuthzIoMockService_PLUGIN") {
+      item.data = '{}';
+    }
+  });
   console.log(workbook, window.parent);
   try {
     window.parent?.BpmTools?.program(

+ 16 - 16
src/pages/mindmap/index.vue

@@ -18,22 +18,22 @@ const mindmapData = ref<any>();
 
 onMounted(() => {
   // 测试接口
-  // fetch(`https://sl-yf-bommgr-admin-dev.shalu.com/api/module/Invoke`, {
-  //   method: "POST",
-  //   headers: {
-  //     'Authorization': "bpm_client_1410638690438352896",
-  //     "content-type": "application/json;charset=UTF-8",
-  //   },
-  //   body: JSON.stringify({
-  //     interfaceCode: "Common.getBOMAiImageData",
-  //     bom_id: "b9be149a-ea42-4f0c-985e-77bd9adbc8f3",
-  //   }),
-  // })
-  //   .then((res) => res.json())
-  //   .then((res) => {
-  //     console.log("res", res);
-  //     mindmapData.value = res.result.data;
-  //   });
+  fetch(`https://sl-yf-bommgr-admin-dev.shalu.com/api/module/Invoke`, {
+    method: "POST",
+    headers: {
+      'Authorization': "bpm_client_1414420693713424384",
+      "content-type": "application/json;charset=UTF-8",
+    },
+    body: JSON.stringify({
+      interfaceCode: "Common.getBOMAiImageData",
+      bom_id: "b9be149a-ea42-4f0c-985e-77bd9adbc8f3",
+    }),
+  })
+    .then((res) => res.json())
+    .then((res) => {
+      console.log("res", res);
+      mindmapData.value = res.result.data;
+    });
 
   if (!route.query?.id) return;
   window.parent?.BpmTools?.program(

Plik diff jest za duży
+ 1 - 1
stats.html