js+css实现可视化拖拽流程图图表设计器代码
代码语言:html
所属分类:图表
代码描述:js+css实现可视化拖拽流程图图表设计器代码
代码标签: js css 可视化 拖拽 流程图 图表 设计器 代码
下面为部分代码预览,完整代码请点击下载或在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>
<style>
:root {
--primary: #2563eb;
--success: #10b981;
--warning: #f59e0b;
--danger: #ef4444;
--text-main: #1e293b;
--bg-canvas: #f8fafc;
--grid-color: #cbd5e1;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; display: flex; height: 100vh; overflow: hidden; background-color: #fff; }
/* 顶部工具栏 */
.header { position: absolute; top: 0; left: 0; right: 0; height: 50px; background: #fff; border-bottom: 1px solid #e2e8f0; display: flex; align-items: center; padding: 0 20px; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.header h1 { font-size: 16px; color: var(--text-main); font-weight: 600; margin-right: 30px; }
.btn { padding: 6px 16px; background: var(--primary); color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; font-weight: 500; transition: background 0.2s; margin-right: 10px; }
.btn:hover { background: #1d4ed8; }
.btn.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn.btn-outline:hover { background: #eff6ff; }
.tips { margin-left: auto; font-size: 12px; color: #64748b; }
.tips kbd { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; border: 1px solid #cbd5e1; }
/* 左侧组件库 */
.sidebar { position: absolute; top: 50px; left: 0; bottom: 0; width: 240px; background: #fff; border-right: 1px solid #e2e8f0; padding: 20px; z-index: 10; overflow-y: auto; }
.sidebar-title { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; margin-bottom: 15px; letter-spacing: 1px; }
.drag-item { display: flex; align-items: center; padding: 10px; margin-bottom: 12px; border: 1px solid #e2e8f0; border-radius: 6px; cursor: grab; background: #fff; transition: all 0.2s; user-select: none; }
.drag-item:hover { border-color: var(--primary); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); transform: translateY(-1px); }
.drag-item .icon { width: 30px; height: 30px; margin-right: 12px; border: 2px solid #475569; }
/* 右侧画布区 */
.main { position: absolute; top: 50px; left: 240px; right: 0; bottom: 0; background-color: var(--bg-canvas); overflow: auto; cursor: crosshair;
background-image: linear-gradient(var(--grid-color) 1px, transparent 1px), linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
background-size: 20px 20px; background-position: -1px -1px; }
/* 节点样式 */
.node { position: absolute; min-width: 120px; min-height: 50px; display: flex; align-items: center; justify-content: center; cursor: move; z-index: 2; user-select: none; }
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0