w1301625107 / Vue-Gantt-chart

使用Vue做数据控制的Gantt图表
https://w1301625107.github.io/Vue-Gantt-chart/demo/index.html
MIT License
635 stars 138 forks source link

任务之间能连线么? #75

Open zzh4818 opened 3 years ago

zzh4818 commented 3 years ago

任务间会有某个参数关联,关联参数如果相同,我们想通过线段连接起来,组件能实现任务间的连线么? 类似于 https://dhtmlx.com/vue/demos/gantt/#/many/default

w1301625107 commented 3 years ago

不能,这个需要自己实现

jiusak commented 2 years ago

好像可以用leaderline(新人四处抄来的)

import LeaderLine from 'leader-line-vue'; import AnimEvent from "anim-event"; const that = this; this.timer = setTimeout( function () { that.drawLeaderLine(that.myList); // this.done = 1; }, 1000) drawLeaderLine(list) {

  list.forEach(element => {
    let start = document.getElementById(element.id)
    console.log(element.id)
    if (element.children && element.children.length) {
      element.children.forEach(child => {
        let line = LeaderLine.setLine(start, document.getElementById(child.id))
        line.color = 'rgba(30, 130, 250, 0.5)'
        line.path = 'grid'
        line.size = 3
        // line.setOptions({
        //     dash: {animation: true},
        // })
        line.setOptions({ startSocket: 'left', endSocket: 'left', startSocketGravity: [1, 20], });
        window.addEventListener('wheel', AnimEvent.add(function () {
          console.log("scroll")
          line.position()

        }), false);
        this.lines.push(line)
      })
      this.drawLeaderLine(element.children)
    }
  })
},