vue+elementui实现可视化拖拽工作流生成器及python运行工作流代码
代码语言:html
所属分类:其他
代码描述:vue+elementui实现可视化拖拽工作流生成器及python运行工作流代码,最终导出为json工作流配置文件,在python中可以执行输出结果。
代码标签: vue elementui 可视化 拖拽 工作流 生成器 python 运行 工作流 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>工作流可视化拖拽生成器</title> <!-- 引入 Vue.js --> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script> <!-- 引入 jsPlumb 用于连线 --> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jsplumb.min.js"></script> <!-- 引入 element-ui --> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/element-ui.2.15.1.css"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/element-ui.2.15.1.js"></script> <style> body { font-family: 'Arial', sans-serif; margin: 0; padding: 0; background-color: #f5f7fa; } .container { display: flex; height: 100vh; } .sidebar { width: 250px; background-color: #304156; color: #fff; padding: 20px; box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1); overflow-y: auto; } .sidebar h3 { margin-top: 0; border-bottom: 1px solid #4c5a70; padding-bottom: 10px; } .node-item { background-color: #1f2d3d; margin: 10px 0; padding: 10px; border-radius: 4px; cursor: move; transition: all 0.3s; } .node-item:hover { background-color: #283446; transform: translateY(-2px); } .workspace { flex: 1; padding: 20px; position: relative; overflow: auto; background-color: #f0f2f5; background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px); background-size: 20px 20px; } .node { position: absolute; width: 180px; background-color: #fff; border-radius: 4px; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); padding: 10px; z-index: 10; } .node-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 5px; border-bottom: 1px solid #ebeef5; } .node-title { font-weight: bold; color: #303133; } .node-content { margin-bottom: 10px; } .endpoint { width: 10px; height: 10px; background-color: #409EFF; border-radius: 50%; position: absolute; } .endpoint.input { top: 50%; left: -5px; transform: translateY(-50%); } .endpoint.output { top: 50%; right: -5px; transform: translateY(-50%); } .toolbar { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; gap: 10px; } .node-selected { border: 2px solid #409EFF; } .property-panel { width: 300px; background-color: #fff; box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1); padding: 20px; overflow-y: auto; } .property-panel h3 { margin-top: 0; border-bottom: 1px solid #ebeef5; padding-bottom: 10px; } .property-item { margin-bottom: 15px; } .endpoint.true { right: -5px; top: 30%; transform: translateY(-50%); } .endpoint.false { right: -5px; top: 70%; transform: translateY(-50%); } .endpoint-label { position: absolute; font-size: 10px; right: 15px; color: #606266; } </style> </head> <body> <div id="app"> <div class="container"> <!-- 左侧节点列表 --> <div class="sidebar"> <h3>节点列表</h3> <div v-for="(nodeType, index) in nodeTypes" :key="index" class="node-item" draggable="true" @dragstart="dragStart($event, nodeType)" > {{ nodeType.label }} </div> </div> <!-- 中间工作区 --> <div class="workspace" ref="workspace" @dragover="allowDrop" @drop="drop" @click="deselectAll" > <!-- 修改节点渲染部分 --> <div v-for="(node, index) in nodes" :key="node.id" class="node" :class="{'node-selected': selectedNode && selectedNode.id === node.id}" :id="'node-' + node.id" :style="{left: node.x + 'px', top: node.y + 'px'}" @mousedown="startDrag($event, node)" @click.stop="selectNode(node)" > <div class="node-header"> <div class="node-title">{{ node.type.label }}</div> <el-button type="danger" size="mini" icon="el-icon-delete" circle @click.stop="removeNode(node)" ></el-button> </div> <div class="node-content"> <div v-if="node.type.type === 'input'"> 输入节点 </div> <div v-else-if="node.type.type === 'process'"> 处理节点 </div> <div v-else-if="node.........完整代码请登录后点击上方下载按钮下载查看
网友评论0