vue如何使用 jsplumb 生成流程圖
更新時間:2025年02月28日 11:03:13 作者:陳大大小
文章介紹了如何在Vue項目中使用jsPlumb庫來生成流程圖,文章提供了兩個簡單的示例代碼,展示了如何定義流程圖的數(shù)據(jù)字段和如何配置連線樣式,最后,文章鼓勵讀者繼續(xù)探索更多關于vue和jsPlumb的使用技巧,感興趣的朋友一起看看吧
1、安裝jsPlumb:
npm install jsplumb
2、 在使用的 .vue 文件中引入
import { jsPlumb } from "jsplumb";圖一:

圖二:

圖一簡單示例:
流程圖的數(shù)據(jù)字段:
id: "item-12", // id(必傳)
label: "節(jié)點一", // 節(jié)點名稱(必傳)
nodeName: "start", // 節(jié)點標識:start:開始節(jié)點;end:結束節(jié)點;
connectId:
[
{
source: "item-12", // 連接線起點(必傳)
target: "item-7", // 連接線終點(必傳)
stub: 40, // 連接線距離主流程線的位置高度(同一個節(jié)點有第二條連接線的時候
必傳,值越大距離主流程距離越遠)
direction: "Bottom", // 連接線距離主流程線的位置方向(同一個節(jié)點有第二條連接
線的時候必傳)
}
],
tipContent:
[
{
handleUser: "業(yè)務部", // 節(jié)點內(nèi)容信息
handleTime: "2024-10-23 15:20:08" // 節(jié)點內(nèi)容信息
}
](代碼直接復制即可食用)
templete 代碼
<template>
<div class="bfd-pages">
<!-- 流程圖 -->
<div class="title-box">
<div class="title">
<span>流程圖</span>
</div>
</div>
<div class="table-page-search-wrapper">
<div class="line-wrap">
<div
v-for="(item, index) in flowChartDataList"
:key="index"
:id="item.id"
:class="
getColor(item.id) == '1'
? 'state-item-during'
: getColor(item.id) == '2'
? 'state-item-finish'
: 'state-item'
"
>
<img
v-if="item.nodeName == 'start'"
class="imgs"
src="@/assets/images/start.png"
alt=""
/>
<img
v-else-if="item.nodeName == 'summary'"
class="imgs"
src="@/assets/images/cent.png"
alt=""
/>
<img
v-else-if="item.nodeName == 'end'"
class="imgs"
src="@/assets/images/end.png"
alt=""
/>
<div v-else>
<div v-if="item.tipContent">
<a-tooltip>
<template #title>
<div v-for="(detailInfoItem, i) in item.tipContent" :key="i">
<div>{{ detailInfoItem.handleUser }}</div>
<div>{{ detailInfoItem.handleTime }}</div>
</div>
</template>
{{ item.label }}
</a-tooltip>
</div>
<div v-else>
{{ item.label }}
</div>
</div>
</div>
</div>
</div>
</div>
</template>script 代碼
<script>
import { jsPlumb } from "jsplumb";
export default {
name: "LiuChengTu",
props: {
// 流程編碼
flowCode: {
type: String,
default: "",
},
// id
businessId: {
type: String,
default: "",
},
flowVersion: {
type: String,
default: "",
},
},
data() {
return {
url: {
info: "/api/system/common/statusSet/approval/getFlowConfigForShow",
},
// 流程圖數(shù)據(jù)
flowChartData: [
{
"id": "0",
"label": "",
"nodeName": "start",
"connectId": [
{
"source": "0",
"target": "10",
"stub": 5
}
]
},
{
"id": "10",
"label": "節(jié)點一",
"nodeName": "",
"connectId": [
{
"source": "10",
"target": "20",
"stub": 5
}
]
},
{
"id": "20",
"label": "節(jié)點二",
"nodeName": "",
"connectId": [
{
"source": "20",
"target": "30",
"stub": 5
},
{
"source": "20",
"target": "60",
"stub": 80,
"direction": "Top"
},
{
"source": "20",
"target": "70",
"stub": 80,
"direction": "Top"
}
]
},
{
"id": "30",
"label": "節(jié)點三",
"nodeName": "",
"connectId": [
{
"source": "30",
"target": "40",
"stub": 5
},
{
"source": "30",
"target": "50",
"stub": 40,
"direction": "Top"
}
]
},
{
"id": "40",
"label": "節(jié)點四",
"nodeName": "",
"connectId": [
{
"source": "40",
"target": "50",
"stub": 5
}
]
},
{
"id": "50",
"label": "節(jié)點五",
"nodeName": "",
"connectId": [
{
"source": "50",
"target": "60",
"stub": 5
},
{
"source": "50",
"target": "70",
"stub": 40,
"direction": "Bottom"
}
]
},
{
"id": "60",
"label": "節(jié)點六",
"nodeName": "",
"connectId": [
{
"source": "60",
"target": "70",
"stub": 5
}
]
},
{
"id": "70",
"label": "節(jié)點七",
"nodeName": "",
"connectId": [
{
"source": "70",
"target": "999",
"stub": 5
}
]
},
{
"id": "999",
"label": "",
"nodeName": "end",
"connectId": []
}
],
defatltDirection: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
topDirection: ["Top", "Top"],
bottomDirection: ["Bottom", "Bottom"],
flowChartDataList: [], // 流程圖數(shù)據(jù)
duringNode: "20", // 在節(jié)點期間
finishedNode: "10", // 已完成節(jié)點
plumbInsInfo: null, // 暫存流程圖圖像數(shù)據(jù)
};
},
mounted() {
this.initJsPlumb();
},
methods: {
getColor(val) {
let duringStatus = null;
let finishStatus = null;
if (this.duringNode !== null) {
let dataInfo = this.duringNode.split(',');
duringStatus = dataInfo.includes(val);
}
if (this.finishedNode !== null) {
let dataInfo = this.finishedNode.split(',');
finishStatus = dataInfo.includes(val);
}
if (duringStatus == true) {
// 當前節(jié)點
return "2";
} else if (finishStatus == true) {
// 已完成節(jié)點
return "1";
} else {
return "0";
}
},
initJsPlumb() {
if(this.plumbInsInfo !== null) {
// 首先刪除所有的連線
this.plumbInsInfo.deleteEveryConnection();
}
let plumbIns = jsPlumb.getInstance();
let jsPlumbConnectList = [];
// 處理數(shù)據(jù)
this.flowChartData.forEach((item, index) => {
if (item.connectId.length > 1) {
item.connectId.forEach((eleInfo, ind) => {
if (ind == 0) {
let plumbInsInfo = {
source: eleInfo.source,
target: eleInfo.target,
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{
cornerRadius: 5,
alwaysRespectStubs: true,
stub: eleInfo.stub,
},
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: {
stroke:
eleInfo.nodeDescribe == "pass"
? "#008000"
: eleInfo.nodeDescribe == "reject"
? "#ff0000"
: "#909399",
strokeWidth: 2,
}, // connector
};
jsPlumbConnectList.push(plumbInsInfo);
} else {
let plumbInsInfo = {
source: eleInfo.source,
target: eleInfo.target,
anchor:
eleInfo.direction == "Top"
? this.topDirection
: eleInfo.direction == "Bottom"
? this.bottomDirection
: this.defatltDirection,
connector: [
"Flowchart",
{
cornerRadius: 5,
alwaysRespectStubs: true,
stub: eleInfo.stub,
},
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: {
stroke:
eleInfo.nodeDescribe == "pass"
? "#008000"
: eleInfo.nodeDescribe == "reject"
? "#ff0000"
: "#909399",
strokeWidth: 2,
}, // connector
};
jsPlumbConnectList.push(plumbInsInfo);
}
});
} else {
if (item.nodeName !== "end") {
let plumbInsInfo = {
source: item.connectId[0].source,
target: item.connectId[0].target,
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{
cornerRadius: 5,
alwaysRespectStubs: true,
stub: item.connectId[0].stub,
},
],
endpoint: "Blank",
overlays: [
["Arrow", { width: 8, length: 8, location: 1 }],
[
"Label",
{
label: item.connectId[0].lableName
? item.connectId[0].lableName
: "",
location: 0.5,
cssClass: "jsplumb-flowchart-label",
visible: true,
},
],
], // overlay
paintStyle: {
stroke:
item.connectId[0].nodeDescribe == "pass"
? "#008000"
: item.connectId[0].nodeDescribe == "reject"
? "#ff0000"
: "#909399",
strokeWidth: 2,
}, // 連接線樣式
};
jsPlumbConnectList.push(plumbInsInfo);
}
}
});
this.flowChartDataList = this.flowChartData;
console.log("------", jsPlumbConnectList);
setTimeout(() => {
plumbIns.ready(function () {
jsPlumbConnectList.forEach((ele) => {
plumbIns.connect(ele);
});
});
this.plumbInsInfo = plumbIns;
}, 500);
},
},
};
</script>style 代碼
<style lang="less" scoped>
.title-box {
display: flex;
justify-content: space-between;
border-bottom: 1px solid #2464b0;
margin-bottom: 20px;
.title {
height: 40px;
font-size: 16px;
color: #2464b0;
font-weight: 650;
// border-bottom: 1px solid #2464b0;
display: flex;
-webkit-box-align: center;
align-items: center;
// margin-bottom: 20px;
}
.title:before {
display: inline-block;
height: 30px;
margin-right: 10px;
border-right: 7px solid #2464b0;
content: "";
}
}
.table-page-search-wrapper {
padding: 150px 0 10px 0;
.line-wrap {
display: flex;
margin-bottom: 100px;
justify-content: center;
align-items: center;
.state-item {
width: 120px;
height: 100px;
color: #606266;
background: #f6f6f6;
border: 2px solid rgba(0, 0, 0, 0.05);
text-align: center;
// line-height: 30px;
font-family: sans-serif;
border-radius: 4px;
margin-right: 60px;
font-size: 12px;
padding: 5px 10px;
display: flex;
justify-content: center;
align-items: center;
font-weight: normal;
.imgs {
width: 50px;
height: 50px;
}
}
.state-item-during {
width: 120px;
height: 100px;
color: green;
background: #f6f6f6;
border: 2px solid green;
text-align: center;
// line-height: 30px;
font-family: Arial, sans-serif;
border-radius: 8px;
margin-right: 60px;
font-size: 12px;
padding: 5px 10px;
display: flex;
justify-content: center;
align-items: center;
font-weight: normal;
.imgs {
width: 50px;
height: 50px;
}
}
.state-item-finish {
width: 120px;
height: 100px;
color: red;
background: #f6f6f6;
border: 2px solid red;
text-align: center;
// line-height: 30px;
font-family: sans-serif;
border-radius: 4px;
margin-right: 60px;
font-size: 12px;
padding: 5px 10px;
display: flex;
justify-content: center;
align-items: center;
font-weight: normal;
.imgs {
width: 50px;
height: 50px;
}
}
}
}
</style>圖二簡單示例:
注意:注意看 id 為"item-3"和"item-9"那條數(shù)據(jù)的連線配置
其中有幾個小圖片,可以用自己的本地圖片代替(圖標大小的)
<template>
<div id="wrapper">
<div class="line-wrap" v-if="flowChartData1.length == 2">
<div :id="flowChartData1[1].id" class="state-item">
{{ flowChartData1[1].lable }}
</div>
</div>
<div class="line-wrap">
<div v-for="(item, index) in flowChartData" :key="index" :id="item.id" :class="item.nodeName == 'start' || item.nodeName == 'end' || item.nodeName == 'summary' ? 'state-item-img' : 'state-item'">
<img v-if="item.nodeName == 'start'" class="imgs" src="../assets/img/start.png" alt="" />
<img v-else-if="item.nodeName == 'summary'" class="imgs" src="../assets/img/cent.png" alt="" />
<img v-else-if="item.nodeName == 'end'" class="imgs" src="../assets/img/end.png" alt="" />
<div v-else>
{{ item.lable }}
</div>
</div>
</div>
<div class="line-wrap" v-if="flowChartData1.length > 0 && flowChartData1.length < 3">
<div :id="flowChartData1[0].id" class="state-item">
{{ flowChartData1[0].lable }}
</div>
</div>
</div>
</template>
<script>
import { jsPlumb } from "jsplumb";
export default {
name: "LiuChengTu",
data() {
return {
// 一行數(shù)據(jù)的
// flowChartData: [
// { id: "item-0", lable: "", nodeName: "start", connectId: [{source: "item-0", target: "item-1"}] }, // 開始
// { id: "item-1", lable: "改革處-經(jīng)辦人-發(fā)起", nodeName: "", connectId: [{source: "item-1", target: "item-2"}] },
// { id: "item-2", lable: "承辦部門-改革聯(lián)系人填報/分發(fā)", nodeName: "", connectId: [{source: "item-2", target: "item-3"}] },
// { id: "item-3", lable: "", nodeName: "summary", connectId: [{source: "item-3", target: "item-4"}] }, // 匯總/分發(fā)
// { id: "item-4", lable: "承辦部門-部門主任-審批", nodeName: "", connectId: [{source: "item-4", target: "item-5"}] },
// { id: "item-5", lable: "改革處-經(jīng)辦人-合規(guī)性審查", nodeName: "", connectId: [{source: "item-5", target: "item-6"}] },
// { id: "item-6", lable: "改革處-處領導-合規(guī)性審查", nodeName: "", connectId: [{source: "item-6", target: "item-7"}] },
// { id: "item-7", lable: "", nodeName: "summary", connectId: [{source: "item-7", target: "item-8"}] }, // 匯總/分發(fā)
// { id: "item-8", lable: "", nodeName: "end", connectId: [] }, // 結束
// ],
// 兩行數(shù)據(jù)的
// flowChartData: [
// { id: "item-0", lable: "", nodeName: "start", connectId: [{source: "item-0", target: "item-1"}] }, // 開始
// { id: "item-1", lable: "改革處-經(jīng)辦人-發(fā)起", nodeName: "", connectId: [{source: "item-1", target: "item-2"}] },
// { id: "item-2", lable: "承辦部門-改革聯(lián)系人填報/分發(fā)", nodeName: "", connectId: [{source: "item-2", target: "item-3"}] },
// { id: "item-3", lable: "", nodeName: "summary", connectId: [{source: "item-3", target: "item-4"}, {source: "item-3", target: "item-9"}] }, // 匯總/分發(fā)
// { id: "item-4", lable: "承辦部門-部門主任-審批", nodeName: "", connectId: [{source: "item-4", target: "item-5"}] },
// { id: "item-5", lable: "改革處-經(jīng)辦人-合規(guī)性審查", nodeName: "", connectId: [{source: "item-5", target: "item-6"}] },
// { id: "item-6", lable: "改革處-處領導-合規(guī)性審查", nodeName: "", connectId: [{source: "item-6", target: "item-7"}] },
// { id: "item-7", lable: "", nodeName: "summary", connectId: [{source: "item-7", target: "item-8"}] }, // 匯總/分發(fā)
// { id: "item-8", lable: "", nodeName: "end", connectId: [] }, // 結束
// { id: "item-9", lable: "改革處-經(jīng)辦人-接收待閱", nodeName: "handleOut", connectId: [{source: "item-9", target: "item-7"}] }, // 第二行數(shù)據(jù)
// ],
// 三行數(shù)據(jù)的
flowChartData: [
{ id: "item-0", lable: "", nodeName: "start", connectId: [{source: "item-0", target: "item-1"}] }, // 開始
{ id: "item-1", lable: "改革處-經(jīng)辦人-發(fā)起", nodeName: "", connectId: [{source: "item-1", target: "item-2"}] },
{ id: "item-2", lable: "承辦部門-改革聯(lián)系人填報/分發(fā)", nodeName: "", connectId: [{source: "item-2", target: "item-3"}] },
{ id: "item-3", lable: "", nodeName: "summary", connectId: [{source: "item-3", target: "item-4"}, {source: "item-3", target: "item-9"}, {source: "item-3", target: "item-10"}] }, // 匯總/分發(fā)
{ id: "item-4", lable: "承辦部門-部門主任-審批", nodeName: "", connectId: [{source: "item-4", target: "item-5"}] },
{ id: "item-5", lable: "改革處-經(jīng)辦人-合規(guī)性審查", nodeName: "", connectId: [{source: "item-5", target: "item-6"}] },
{ id: "item-6", lable: "改革處-處領導-合規(guī)性審查", nodeName: "", connectId: [{source: "item-6", target: "item-7"}] },
{ id: "item-7", lable: "", nodeName: "summary", connectId: [{source: "item-7", target: "item-8"}] }, // 匯總/分發(fā)
{ id: "item-8", lable: "", nodeName: "end", connectId: [] }, // 結束
{ id: "item-9", lable: "改革處-經(jīng)辦人-接收待閱", nodeName: "handleOut", connectId: [{source: "item-9", target: "item-7"}] }, // 第二行數(shù)據(jù)
{ id: "item-10", lable: "改革處-經(jīng)辦人-接收待閱123", nodeName: "handleOut", connectId: [{source: "item-10", target: "item-7"}] }, // 第二行數(shù)據(jù)
],
flowChartData1: []
};
},
mounted() {
this.initJsPlumb();
},
methods: {
initJsPlumb() {
let jsPlumbConnectList = [];
let listData = [];
let fenfaData = [];
// 處理數(shù)據(jù)
this.flowChartData.forEach(ele=>{
if(ele.connectId.length == 1) {
if(ele.nodeName == "handleOut") {
fenfaData.push(ele);
}else {
listData.push(ele);
let plumbInsInfo = {
source: ele.connectId[0].source,
target: ele.connectId[0].target,
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}
}else if(ele.connectId.length == 1){
if(ele.nodeName == "handleOut") {
fenfaData.push(ele);
}else {
listData.push(ele);
ele.connectId.forEach((itemInfo,index)=>{
if(index == 0) {
let plumbInsInfo = {
source: itemInfo.source,
target: itemInfo.target,
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}else {
let plumbInsInfo = {
source: itemInfo.source,
target: itemInfo.target,
anchor: ["Bottom", "Left"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}
})
}
}else {
if(ele.nodeName == "handleOut") {
fenfaData.push(ele);
}else {
listData.push(ele);
ele.connectId.forEach((itemInfo,index)=>{
if(index == 0) {
let plumbInsInfo = {
source: itemInfo.source,
target: itemInfo.target,
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}else if(index == 1) {
let plumbInsInfo = {
source: itemInfo.source,
target: itemInfo.target,
anchor: ["Bottom", "Left"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}else {
let plumbInsInfo = {
source: itemInfo.source,
target: itemInfo.target,
anchor: ["Top", "Left"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}
})
}
}
})
this.flowChartData = listData;
this.flowChartData1 = fenfaData;
if(this.flowChartData1.length > 0) {
this.flowChartData1.forEach((ele, index)=>{
if(index==0) {
let plumbInsInfo = {
source: ele.connectId[0].source,
target: ele.connectId[0].target,
anchor: ["Right", "Bottom"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}else {
let plumbInsInfo = {
source: ele.connectId[0].source,
target: ele.connectId[0].target,
anchor: ["Right", "Top"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
}
jsPlumbConnectList.push(plumbInsInfo)
}
})
}
setTimeout(() => {
let plumbIns = jsPlumb.getInstance();
plumbIns.ready(function () {
jsPlumbConnectList.forEach(ele=>{
plumbIns.connect(ele);
})
})
}, 500);
return;
// let plumbIns = jsPlumb.getInstance();
plumbIns.ready(function () {
plumbIns.connect({
// 對應上述基本概念
source: "item-0",
target: "item-1",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-1",
target: "item-2",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-2",
target: "item-3",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-3",
target: "item-4",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-4",
target: "item-5",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-5",
target: "item-6",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-6",
target: "item-7",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-7",
target: "item-8",
anchor: [
"Left",
"Right",
"Top",
"Bottom",
[0.3, 0, 0, -1],
[0.7, 0, 0, -1],
[0.3, 1, 0, 1],
[0.7, 1, 0, 1],
],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-3",
target: "item-9",
anchor: ["Bottom", "Left"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
plumbIns.connect({
// 對應上述基本概念
source: "item-9",
target: "item-7",
anchor: ["Right", "Bottom"],
connector: [
"Flowchart",
{ cornerRadius: 5, alwaysRespectStubs: true, stub: 5 },
],
endpoint: "Blank",
overlays: [["Arrow", { width: 8, length: 8, location: 1 }]], // overlay
// 添加樣式
paintStyle: { stroke: "#909399", strokeWidth: 2 }, // connector
// endpointStyle: { fill: '#909399', outlineStroke: '#606266', outlineWidth: 1 } // endpoint
});
});
},
},
};
</script>
<style lang="scss" scoped>
#wrapper {
background: radial-gradient(
ellipse at top left,
rgba(255, 255, 255, 1) 40%,
rgba(229, 229, 229, 0.9) 100%
);
padding: 60px 80px;
}
.state-item-img {
width: 50px;
height: 50px;
color: #606266;
border: 2px solid rgba(0, 0, 0, 0);
text-align: center;
line-height: 30px;
font-family: sans-serif;
border-radius: 4px;
margin-right: 56px;
font-size: 14px;
.imgs {
width: 50px;
height: 50px;
}
}
.state-item {
width: 120px;
height: 100px;
color: #606266;
background: #f6f6f6;
border: 2px solid rgba(0, 0, 0, 0.05);
text-align: center;
line-height: 30px;
font-family: sans-serif;
border-radius: 4px;
margin-right: 60px;
font-size: 14px;
padding: 5px 10px;
display: flex;
align-items: center;
}
.line-wrap {
display: flex;
margin-bottom: 100px;
justify-content: center;
align-items: center;
}
</style>到此這篇關于vue使用 jsplumb 生成流程圖的文章就介紹到這了,更多相關vue jsplumb 生成流程圖內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
Vue使用echarts散點圖在區(qū)域內(nèi)標點
這篇文章主要為大家詳細介紹了Vue使用echarts散點圖在區(qū)域內(nèi)標點,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2022-03-03
vue3+echarts+折線投影(陰影)效果的實現(xiàn)
這篇文章主要介紹了vue3+echarts+折線投影(陰影)效果的實現(xiàn)方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-10-10

