vue+jsplumb实现类似coze的流程可视化拖拽编排节点代码

代码语言:html

所属分类:其他

代码描述:vue+jsplumb实现类似coze的流程可视化拖拽编排节点代码,可以试运行,结合后端python引擎代码实现自动运行。完整的前后端代码:https://blog.bfw.wiki/user12308//17442015236866530072.html

代码标签: vue jsplumb 类似 coze 流程 可视化 拖拽 编排 节点 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>工作流编辑器</title>
<!-- 完整的前后端代码:https://blog.bfw.wiki/user12308//17442015236866530072.html -->
   <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jsplumb.min.js"></script>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 20px;
            background: #f0f2f5;
        }
         /* Add delete button style */
        .node-delete {
            position: absolute;
            top: 5px;
            right: 5px;
            width: 20px;
            height: 20px;
            background: #f44336;
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: none;
            font-size: 12px;
            line-height: 20px;
            text-align: center;
        }
        .node:hover .node-delete {
            display: block;
        }
         .validation-error {
            color: #f44336;
            padding: 10px;
            margin: 10px;
            background: #ffebee;
            border-radius: 4px;
            border: 1px solid #ef9a9a;
        }
       
        .node {
            position: absolute;
            width: 240px;
            min-height: 120px;
            border: 2px solid #2196F3;
            border-radius: 8px;
            padding: 15px;
            background: white;
            cursor: move;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }
        /* Add these styles to your existing CSS */
.param-controls {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
}

.add-param-btn {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
}

.remove-param-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 5px;
    font-size: 12px;
}

.param-name-input {
    width: calc(100% - 60px);
    padding: 6px;
    margin: 2px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
}
        .start-node {
            border-color: #4CAF50;
            background: #f1f8e9;
        }
        .end-node {
            border-color: #f44336;
            background: #ffebee;
        }
        .node-title {
            font-weight: bold;
            margin-bottom: 10px;
            padding-bottom: 8px;
            border-bottom: 1px solid #eee;
            color: #333;
        }
        .node-params {
            font-size: 13px;
            margin: 8px 0;
        }
        .param-group {
            margin-bottom: 8px;
        }
        .param-label {
            font-weight: 500;
            margin: 5px 0 3px;
            color: #666;
        }
        .param-input {
            width: 100%;
            padding: 6px;
            margin: 2px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
            box-sizing: border-box;
        }
        .param-select {
            width: 100%;
            padding: 6px;
            margin: 2px 0;
            border: 1px solid #ddd;
            border-radius: 4px;
            background: white;
        }
        .output-params {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px dashed #ddd;
        }
        .output-title {
            font-weight: bold;
            color: #666;
            margin-bottom: 8px;
        }
        .output-item {
            font-size: 12px;
            color: #777;
            margin: 4px 0;
            padding: 4px;
            background: #f5f5f5;
            border-radius: 4px;
        }
        .controls {
            margin: 20px;
            padding: 15px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .controls button {
            margin: 0 8px;
            padding: 8px 16px;
            background: #2196F3;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background 0.3s;
        }
        .controls button:hover {
            background: #1976D2;
        }
        .json-output {
            margin: 20px;
            padding: 20px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .json-output pre {
            background: #f5f5f5;
            padding: 15px;
            border-radius: 4px;
            overflow-x: auto;
            font-size: 13px;
            line-height: 1.5;
        }
        /* Add to existing CSS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.close-button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.input-group {
    margin-bottom: 15px;
}

.input-label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-weight: 500;
}

.run-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.run-button {
    background: #1976D2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 15px;
    margin-top: 10px;
}

.run-button:hover {
    background: #1565C0;
}

.node.success {
    border-color: #4CAF50;
}

.node-results {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    font-size: 12px;
}

.result-item {
    background: #f5f5f5;
    padding: 5px 8px;
    margin: 3px 0;
    border-radius: 4px;
    color: #666;
}
.workflow-container {
    position: relative;
    height: 600px;
    border: 1px solid #ccc;
    margin: 20px;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transform-origin: 0 0;
    transition: transform 0.3s ease;
}

.zoom-controls {
    display: inline-flex;
    align-items: center;
    
    padding: 5px;
    border-radius: 4px;
    
    margin-left: 20px;
}

.zoom-controls button {
    padding: 6px 10px;
   
    height: 30px;
    
    margin: 0 5px;
    bord.........完整代码请登录后点击上方下载按钮下载查看

网友评论0