Browse Source

fix: 定义类型

Gaokun Wang 5 days ago
parent
commit
14fee20a53
3 changed files with 8 additions and 5 deletions
  1. 1 1
      src/store/types.ts
  2. 3 2
      src/utils/webSocket.ts
  3. 4 2
      src/views/test/flow.vue

+ 1 - 1
src/store/types.ts

@@ -51,5 +51,5 @@ export type IndexType = {
 
 export type CaseFlowData = {
   caseList: ListItem[]
-  flowData: Record<string, string>
+  flowData: any
 }

+ 3 - 2
src/utils/webSocket.ts

@@ -1,4 +1,5 @@
 import { useCaseFlowData } from '@/store/caseFlow'
+import { ListItem } from '@/types/list'
 
 // WebSocket 状态枚举
 enum WebSocketStatus {
@@ -12,8 +13,8 @@ enum WebSocketStatus {
 interface WebSocketMessage {
   serverName: WsID
   type: MessageType
-  data?: Record<string, string>
-  list?: Record<string, string>[]
+  data?: any
+  list?: ListItem[]
 }
 
 // 定义消息类型

+ 4 - 2
src/views/test/flow.vue

@@ -25,7 +25,6 @@ import { $, getContainerSize } from '@/utils'
 import FlowGraph from '../graph'
 import ContextMenu from '@imengyu/vue3-context-menu'
 import SubFlowDialog from './components/subFlow.vue'
-import CaseData from '../data/index'
 import { Graph, type Node } from '@antv/x6'
 
 import { useCaseFlowData } from '@/store/caseFlow'
@@ -34,6 +33,9 @@ const useStoreCaseFlowData = useCaseFlowData()
 const flowData = computed(() => {
   return useStoreCaseFlowData.getFlowData
 })
+const caseData = computed(() => {
+  return useStoreCaseFlowData.getCaseList
+})
 const router = useRouter()
 const route = useRoute()
 let isReady = ref(false)
@@ -66,7 +68,7 @@ const initGraph = () => {
   FlowGraph.initShape()
   const id = route.params.id as string
   const subNodes = ref<any[]>([])
-  CaseData.list.forEach(item => {
+  caseData.value.forEach((item: any) => {
     if (item.id !== id && graph.value) {
       const s1 = graph.value.createNode({
         shape: 'sub-flow-node',