gojs跟进流程进度,动态显示线条及箭头颜色

先贴图,箭头和连线颜色可自己配置

  


//自定义线条颜色及箭头颜色,只有linkDataArray中有"category":"lineColor"样式即可,可动态设置"category":"lineColor"显示流程位置
        myDiagram.model.addLinkData({"category":"lineColor"});
           // 其实也可以像创建节点那样,var 一个节点 然后定义相关的东西
        myDiagram.linkTemplateMap.add("lineColor",
            objGo(go.Link,
                {
                  selectable: false,      // 用户不能选择链接
                  curve: go.Link.Bezier,
                  layerName: "Background"  // 不要在任何节点前面交叉
                },
                objGo(go.Shape,  // 此形状仅在突出显示时才显示
                  { isPanelMain: true, stroke: "red", strokeWidth: 2 },
                  new go.Binding("stroke", "isHighlighted", function(h) { return h ? "red" : null; }).ofObject()),
                objGo(go.Shape,
                  // mark each Shape to get the link geometry with isPanelMain: true
                  { isPanelMain: true, stroke: "red", strokeWidth: 1 },
                  new go.Binding("stroke", "color")),
                objGo(go.Shape, { toArrow: "Standard",stroke: "red"})
            )

        );



{ "class": "go.GraphLinksModel",
  "linkFromPortIdProperty": "fromPort",
  "linkToPortIdProperty": "toPort",
  "modelData": {"position":"-5 27.662790697674417"},
  "nodeDataArray": [
{"text":"Start", "figure":"Circle", "fill":"#00AD5F", "key":-1, "loc":"220.6627906976744 70", "size":"76 74.67441860465117"},
{"text":"条件一", "figure":"Diamond", "fill":"lightskyblue", "key":-4, "loc":"400 190"},
{"text":"第一步", "key":-2, "loc":"400 70"},
{"text":"End", "figure":"Circle", "fill":"#CE0620", "key":-5, "loc":"210 360"},
{"text":"条件二", "figure":"Diamond", "fill":"lightskyblue", "key":-6, "loc":"400 360"}
 ],
  "linkDataArray": [
{"from":-1, "to":-2,"category":"lineColor", "fromPort":"R", "toPort":"L", "points":[258.6627906976744,70,268.6627906976744,70,312.8313953488372,70,312.8313953488372,70,357,70,367,70]},
{"from":-2, "to":-4,"category":"lineColor","fromPort":"", "toPort":"T", "points":[400,87.45,400,97.45,400,121.775,400,121.775,400,146.1,400,156.1]},
{"from":-4, "to":-6, "fromPort":"", "toPort":"T", "points":[400,223.9,400,233.9,400,275,400,275,400,316.1,400,326.1]},
{"from":-6, "to":-5, "fromPort":"", "toPort":"R", "points":[335.00000000000006,360,325.00000000000006,360,288.98837209302326,360,288.98837209302326,360,252.97674418604652,360,242.97674418604652,360]}
 ]}


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要让element的步骤条动态显示箭头,可以通过以下步骤实现: 1. 在步骤条组件中设置arrow属性为always,这样箭头会一直显示。 2. 在每个步骤中设置status属性,用于动态控制箭头的显示状态。比如,当前步骤的status设置为process时,当前步骤和下一个步骤之间的箭头就会显示。 3. 如果需要在步骤条中添加自定义箭头,可以使用scoped slot来实现。具体方法是在步骤条组件中定义一个名为“arrow”的scoped slot,然后在template中使用slot-scope来获取箭头的状态并自定义箭头的样式。 下面是一个示例代码: ``` <template> <el-steps :active="active" arrow="always" align-center> <el-step title="Step 1" :status="getStepStatus(1)"> <template slot="arrow"> <i class="custom-arrow"></i> </template> </el-step> <el-step title="Step 2" :status="getStepStatus(2)"> <template slot="arrow"> <i class="custom-arrow"></i> </template> </el-step> <el-step title="Step 3" :status="getStepStatus(3)"> <template slot="arrow"> <i class="custom-arrow"></i> </template> </el-step> </el-steps> </template> <script> export default { data() { return { active: 1 }; }, methods: { getStepStatus(step) { return this.active > step ? "finish" : this.active === step ? "process" : "wait"; } } }; </script> <style scoped> .custom-arrow { border-top: 10px solid #999; border-right: 10px solid transparent; border-left: 10px solid transparent; width: 0; height: 0; } </style> ``` 在上面的示例中,我们定义了一个自定义箭头样式,并在每个步骤中使用scoped slot来添加自定义箭头。getStepStatus方法用于动态控制箭头的状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值