vue+jsplumb实现可视化流程节点编排导出json示例代码

代码语言:html

所属分类:其他

代码描述:vue+jsplumb实现可视化流程节点编排导出json示例代码,可以设置每个节点的输入参数,可以输入,也可以从上一个节点的输出作为输入,还可放大缩小画布,试运行工作流、导出json工作流数据到本地。完整前后端代码:https://blog.bfw.wiki/user12308/17442015236866530072.html

代码标签: vue jsplumb 可视化 流程 节点 编排 导出 json 示例

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

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>工作流编辑器</title>
      <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/mock.1.0.1.js"></script>
   <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: po.........完整代码请登录后点击上方下载按钮下载查看

网友评论0