瀏覽代碼

默认值

CzRger 6 月之前
父節點
當前提交
5e0920453c
共有 5 個文件被更改,包括 44 次插入32 次删除
  1. 1 1
      package.json
  2. 4 4
      src/router/index.ts
  3. 3 3
      src/stores/theme.ts
  4. 18 6
      src/views/web/archive/relation-chart.vue
  5. 18 18
      yarn.lock

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
     "serve": "vite --host 0.0.0.0"
   },
   "dependencies": {
-    "@antv/g6": "^5.0.19",
+    "@antv/g6": "^5.0.21",
     "@types/node": "^20.14.12",
     "axios": "^1.7.2",
     "default-passive-events": "^2.0.0",

+ 4 - 4
src/router/index.ts

@@ -65,10 +65,10 @@ export const initMainRouter = async () => {
                 router.addRoute(manageRouter)
             }
             themeConfig = {
-                mainColor: '#f82828',
-                logo: 'https://element-plus.org/images/element-plus-logo.svg',
-                title: '海南社管智慧搜索平台',
-                subTitle: 'HAI NAN SHE GUAN ZHI HUI SOU SUO PING TAI',
+                // mainColor: '#f82828',
+                // logo: 'https://element-plus.org/images/element-plus-logo.svg',
+                // title: '海南社管智慧搜索平台',
+                // subTitle: 'HAI NAN SHE GUAN ZHI HUI SOU SUO PING TAI',
                 // titleLogo: 'https://element-plus.org/images/element-plus-logo.svg',
                 // webBgImg: 'https://element-plus.org/images/element-plus-logo.svg',
                 // loginImg: 'https://element-plus.org/images/element-plus-logo.svg',

+ 3 - 3
src/stores/theme.ts

@@ -6,10 +6,10 @@ import loginImg from '@/assets/images/global/login-img.png'
 export const useThemeStore = defineStore('theme', {
   state: () => ({
     init: false,
-    title: '智慧搜索平台',
-    subTitle: '',
+    title: '海南社管智慧搜索平台',
+    subTitle: 'HAI NAN SHE GUAN ZHI HUI SOU SUO PING TAI',
     logo: '',
-    titleLogo: '',
+    titleLogo: titleLogo,
     webBgImg: webBgImg,
     loginImg: loginImg,
     loadingBg: 'rgba(0, 0, 0, 0.4)'

+ 18 - 6
src/views/web/archive/relation-chart.vue

@@ -1,11 +1,11 @@
 <template>
-  <div class="relation-chart">
+  <div class="relation-chart" ref="ref_main">
     <div class="chart" id="container"/>
   </div>
 </template>
 
 <script setup lang="ts">
-import {getCurrentInstance, onMounted, reactive, watch} from "vue";
+import {getCurrentInstance, onMounted, reactive, ref, watch} from "vue";
 import {Graph} from "@antv/g6";
 
 const emit = defineEmits(['chartPage'])
@@ -13,7 +13,10 @@ const {proxy} = getCurrentInstance()
 const props = defineProps({
   data: {}
 })
-const state: any = reactive({})
+const state: any = reactive({
+  resizeObserver: <any>null,
+})
+const ref_main = ref()
 const setNodes = (data) => {
   data.nodes.forEach(v => {
     v.style = {
@@ -122,14 +125,23 @@ const initChart = () => {
     graph.on('node:click', (e) => {
       emit('chartPage', e.target.id)
     })
+    state.resizeObserver = new ResizeObserver((entries) => {
+      for (const entry of entries) {
+        graph && graph?.resize()
+      }
+    })
+    state.resizeObserver.observe(ref_main.value);
   }
 }
 watch(() => props.data, () => {
   initChart()
 })
-// onMounted(() => {
-//   initChart()
-// })
+onMounted(() => {
+  return () => {
+    state.resizeObserver?.unobserve(ref_main?.value)
+    state.resizeObserver?.disconnect()
+  }
+})
 </script>
 
 <style lang="scss" scoped>

+ 18 - 18
yarn.lock

@@ -2,7 +2,7 @@
 # yarn lockfile v1
 
 
-"@antv/component@^2.0.3":
+"@antv/component@^2.0.4":
   version "2.0.4"
   resolved "https://registry.npmmirror.com/@antv/component/-/component-2.0.4.tgz#3e8267158882378020d892afca554afc45383d91"
   integrity sha512-1bqDP98gCZhgAK34SGjQk2LI0BoY+VPA3iO74hM+bjSug33V99baoB29ahO+E/upf/o0aiOhkYN/lM3zWKeCxg==
@@ -27,7 +27,7 @@
     gl-matrix "^3.4.3"
     tslib "^2.5.3"
 
-"@antv/g-canvas@^2.0.10":
+"@antv/g-canvas@^2.0.12":
   version "2.0.12"
   resolved "https://registry.npmmirror.com/@antv/g-canvas/-/g-canvas-2.0.12.tgz#ba061b9275850a93dde713917af5ee1135a914fd"
   integrity sha512-VgdINi7KUqQePS7+iVqoKtvBg3+zbD+8Vmw2s+e6HdhM3fWBlbrIXIyZ+En+mVHYhLw6buPpW8wAsfNCija0bA==
@@ -115,7 +115,7 @@
     "@antv/g-lite" "2.0.9"
     tslib "^2.5.3"
 
-"@antv/g-plugin-dragndrop@^2.0.8":
+"@antv/g-plugin-dragndrop@^2.0.9":
   version "2.0.9"
   resolved "https://registry.npmmirror.com/@antv/g-plugin-dragndrop/-/g-plugin-dragndrop-2.0.9.tgz#b9f99b6d112644101d2759a93ed3817190804ba5"
   integrity sha512-Hhmk0PAqIOsNzAUv015/129o/R34S/7s41xEkx8/d9ZdziJSLL01c3wHhwG9sGnTRnW8CHHChAh0tT+ygpmS6g==
@@ -153,24 +153,24 @@
     "@antv/util" "^3.3.5"
     tslib "^2.5.3"
 
-"@antv/g6@^5.0.19":
-  version "5.0.19"
-  resolved "https://registry.npmmirror.com/@antv/g6/-/g6-5.0.19.tgz#50e588b14b305eb51c8ed01015729d98dbdc2f0e"
-  integrity sha512-5MPVXPEMjLLzCgnaWzjpFtePwlK4kAicnnUh2KbvOz+plGLv+GQLR2fgxbVrNCCruw+YAgyBl77WDp/pzSeYRA==
+"@antv/g6@^5.0.21":
+  version "5.0.21"
+  resolved "https://registry.npmmirror.com/@antv/g6/-/g6-5.0.21.tgz#77cf22362f813ace5744cdac488112a39ad803f1"
+  integrity sha512-fYeCi2a7pBeN8KwvINgeNjYtl9G6BqDLHyhdlI0buMnTwamHP/mQyfjxna7mXjUdHzhUHExZ91UvOBgz+AvDRg==
   dependencies:
-    "@antv/component" "^2.0.3"
+    "@antv/component" "^2.0.4"
     "@antv/event-emitter" "^0.1.3"
-    "@antv/g" "^6.0.12"
-    "@antv/g-canvas" "^2.0.10"
-    "@antv/g-plugin-dragndrop" "^2.0.8"
+    "@antv/g" "^6.0.13"
+    "@antv/g-canvas" "^2.0.12"
+    "@antv/g-plugin-dragndrop" "^2.0.9"
     "@antv/graphlib" "^2.0.3"
-    "@antv/hierarchy" "^0.6.12"
-    "@antv/layout" "^1.2.14-beta.6"
-    "@antv/util" "^3.3.7"
+    "@antv/hierarchy" "^0.6.13"
+    "@antv/layout" "1.2.14-beta.6"
+    "@antv/util" "^3.3.8"
     bubblesets-js "^2.3.3"
     hull.js "^1.0.6"
 
-"@antv/g@^6.0.12", "@antv/g@^6.0.5":
+"@antv/g@^6.0.13", "@antv/g@^6.0.5":
   version "6.0.13"
   resolved "https://registry.npmmirror.com/@antv/g/-/g-6.0.13.tgz#5776b54ec1b0cd488a2d4a4f4b4a7bbc4deada53"
   integrity sha512-wW5mZOs5sqsXJ0RHfwrLkskrLdJu+nfQE7p8RfwTHy48KVyO33Lm6hyu1r8Wx/9yeSxlZQE6gHmjjM9U/1V8lA==
@@ -187,12 +187,12 @@
   dependencies:
     "@antv/event-emitter" "^0.1.3"
 
-"@antv/hierarchy@^0.6.12":
+"@antv/hierarchy@^0.6.13":
   version "0.6.13"
   resolved "https://registry.npmmirror.com/@antv/hierarchy/-/hierarchy-0.6.13.tgz#7565f5f0061cb1563d21162fb74aaa25c48cbbcc"
   integrity sha512-gBC0bYXyBVrprWyR0hqINNYfeovxdIcKBAR7x6DfNyN1Gc3hGaSo0wif6Lrv/aWVHz17FeQlVsf8rgEx343FHg==
 
-"@antv/layout@^1.2.14-beta.6":
+"@antv/layout@1.2.14-beta.6":
   version "1.2.14-beta.6"
   resolved "https://registry.npmmirror.com/@antv/layout/-/layout-1.2.14-beta.6.tgz#95f2b0a7a864eb339d541d1fc746e8471fbfd7a3"
   integrity sha512-evrDECF20yebz46Vqcd9tEXCrELN/61cSCe/xD3XFBrRaOUVVDatKgr9JNHkMVHJcL1sXTa9xfGaWh4WUj6/yg==
@@ -219,7 +219,7 @@
     color-string "^1.5.5"
     fecha "^4.2.1"
 
-"@antv/util@^3.3.2", "@antv/util@^3.3.5", "@antv/util@^3.3.7":
+"@antv/util@^3.3.2", "@antv/util@^3.3.5", "@antv/util@^3.3.7", "@antv/util@^3.3.8":
   version "3.3.8"
   resolved "https://registry.npmmirror.com/@antv/util/-/util-3.3.8.tgz#f16bd3cfb033f960ed3f1c12ab2ea6b1f8c695d0"
   integrity sha512-RO2vmp84adfZn5HVXuNtHr35PRWthw4oCUv0hn9DmEWwOJSeU6NtDCEg9KvU8sH2bJaS3fe/cppNSVy2L8tOaw==