Browse Source

fix: 优化流程设计回显

Gaokun Wang 5 days ago
parent
commit
b4e33f4bc6

+ 0 - 2
src/utils/list.ts

@@ -7,8 +7,6 @@ export function frontendPaginate<T>(items: T[], pageNum: number, pageSize: numbe
 
 // 条件过滤
 export function filterItems(items: ListItem[], conditions: FilterConditions): ListItem[] {
-  console.log('items', items.length)
-
   return items.filter(item => {
     // 名称筛选 (模糊匹配)
     if (conditions.name && !item.name.toLowerCase().includes(conditions.name.toLowerCase())) {

+ 0 - 1
src/utils/webSocket.ts

@@ -81,7 +81,6 @@ export const initWebSocket = (url: string) => {
       wsStatus.value = WebSocketStatus.ERROR
     },
     onMessage(_ws, event) {
-      console.log('收到 WebSocket 消息:', event.data)
       lastMessage.value = JSON.parse(event.data)
       // 这里可以添加全局消息处理逻辑
     }

+ 0 - 1
src/views/components/ToolBar/index.vue

@@ -192,7 +192,6 @@ function handleClick(event: Event) {
       paste()
       break
     case 'toJSON':
-      console.log(graph.toJSON())
       window.localStorage.setItem('graphJson', JSON.stringify(graph.toJSON()))
       // graph.fromJSON({cells:[graph.toJSON().cells[0],graph.toJSON().cells[1]]})
       const xmlContent = builder.build(graph.toJSON())

+ 10 - 3
src/views/test/flow.vue

@@ -52,7 +52,11 @@ watch(
   () => route.params.id as string,
   (newId, oldId) => {
     if (newId !== oldId) {
-      FlowGraph.initGraphShape(flowData.value[newId]['cells'] || {})
+      if (flowData.value[newId]) {
+        FlowGraph.initGraphShape(flowData.value[newId]['cells'] || {})
+      } else {
+        FlowGraph.initGraphShape({})
+      }
     }
   }
 )
@@ -104,8 +108,11 @@ const initGraph = () => {
     }
     handleContextmenu(e, cell)
   })
-
-  FlowGraph.initGraphShape(flowData.value[id]['cells'] || {})
+  if (flowData.value[id]) {
+    FlowGraph.initGraphShape(flowData.value[id]['cells'] || {})
+  } else {
+    FlowGraph.initGraphShape({})
+  }
   isReady.value = true
   const resizeFn = () => {
     const { width, height } = getContainerSize($('.panel'))

+ 6 - 1
src/views/test/index.vue

@@ -44,7 +44,9 @@
 
         <el-table-column fixed="right" label="操作" min-width="120">
           <template #default="{ row }">
-            <el-button link type="primary" size="small" @click="detail(row)">流程查看</el-button>
+            <el-button link type="primary" size="small" v-if="flowData[row.id]" @click="detail(row)"
+              >流程查看</el-button
+            >
             <el-button link type="primary" size="small" @click="designFlow(row)">
               流程设计
             </el-button>
@@ -95,6 +97,9 @@ onMounted(() => {
 const caseList = computed(() => {
   return useStoreCaseFlowData.getCaseList
 })
+const flowData = computed(() => {
+  return useStoreCaseFlowData.getFlowData
+})
 
 // 分页参数
 const pagination = ref<PaginationParams>({