dhtmlxGantt 甘特图使用

data() {
   
    return {
   
      ganttData: {
   
        data: [
          {
   
            id: 1,
            text: "Team",
            type: "milestone",
            start_date: new Date("2022-01-25"),
          },
          {
   
            id: 2,
            text: "222",
            start_date: new Date("2022-04-25"),
            end_date: new Date("2022-07-01"),
            open: true,
            type: "object",
          },
          {
   
            id: 3,
            text: "3333",
            person: "Julia Garner",
            parent: 2,
            open: true,
          },
          {
   
            id: 4,
            text: "444",
            start_date: new Date("2022-04-28"),
            end_date: new Date("2022-07-01"),
            duration: 63,
            progress: 0.5,
            person: "Julia Garner",
            parent: 3,
          },
          {
   
            id: 5,
            text: "555",
            start_date: new Date("2022-07-02"),
            end_date: new Date("2022-08-2"),
            parent: 3,
          },
          {
   
            id: 6,
            text: "6666",
            start_date: new Date("2022-05-15"),
            end_date: new Date("2022-06-30"),
            duration: 2,
            progress: 0.5,
            parent: 2,
            open: true,
          },
          {
   
            id: 7,
            text: "7777",
            start_date: new Date("2022-04-27"),
            end_date: new Date("2022-05-18"),
            duration: 3,
            progress: 0.5,
            color: "#ED263D",
            parent: 6,
            unit: "月",
            production_cycle: 20,
            production_ability: 200,
          },
        ],
        links: [
          {
    id: 1, source: 1, target: 3, type: "0" },
          {
    id: 2, source: 3, target: 4, type: "1" },
          {
    id: 3, source: 4, target: 5, type: "1" }, // 0 开始到开始 1 结束到开始 2 结束到结束
        ],
      },
      currentTaskId: "",
    };
  },
  methods: {
   
  initGantt() {
   
      console.log('tasks', this.tasks)
      gantt.config.date_format = "%Y-%m-%d %H:%i:%s"; //  设置日期格式
      gantt.config.duration_unit = "day"; // minute, day, month
      gantt.i18n.setLocale("cn");
      gantt.plugins({
    
          marker: true 
      }); 
      var dateToStr = moment().format('YYYY-MM-DD');
      var markerId = gantt.addMarker({
   
          start_date: new Date(), //a Date object that sets the marker's date
          css: "today", //a CSS class applied to the marker
          text: "Now", //the marker title
          title: dateToStr // the marker's tooltip
      });
      gantt.getMarker(markerId);
      // 日期列显示
      gantt.config.min_column_width = 60;
      gantt.config.scale_height = 40 * 2;
      var 
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值