当前位置: 首页 > news >正文

vxe-gantt 甘特图实现产品进度列表,自定义任务条样式和提示信息

vxe-gantt 甘特图实现产品进度列表,自定义任务条样式和提示信息

查看官网:https://gantt.vxeui.com/
gitbub:https://github.com/x-extends/vxe-gantt
gitee:https://gitee.com/x-extends/vxe-gantt

效果

image

代码

通过 task-view-config.viewStyle.cellStyle 设置任务视图单元格样式,使用 taskBar、taskBarTooltip 插槽来自定义模板

<template><div><vxe-gantt v-bind="ganttOptions"><template #task-bar="{ row }"><div class="custom-task-bar" :style="{ backgroundColor: row.bgColor }"><div class="custom-task-bar-img"><vxe-image :src="row.imgUrl" width="60" height="60"></vxe-image></div><div><div>{{ row.title }}</div><div>开始日期:{{ row.start }}</div><div>结束日期:{{ row.end }}</div><div>进度:{{ row.progress }}%</div></div></div></template><template #task-bar-tooltip="{ row }"><div><div>任务名称:{{ row.title }}</div><div>开始时间:{{ row.start }}</div><div>结束时间:{{ row.end }}</div><div>进度:{{ row.progress }}%</div></div></template></vxe-gantt></div>
</template><script setup>
import { reactive } from 'vue'const ganttOptions = reactive({border: true,height: 600,cellConfig: {height: 100},taskViewConfig: {tableStyle: {width: 380},showNowLine: true,scales: [{ type: 'month' },{type: 'day',headerCellStyle ({ dateObj }) {// 周日高亮if (dateObj.e === 0) {return {backgroundColor: '#f9f0f0'}}return {}}},{type: 'date',headerCellStyle ({ dateObj }) {// 周日高亮if (dateObj.e === 0) {return {backgroundColor: '#f9f0f0'}}return {}}}],viewStyle: {cellStyle ({ dateObj }) {// 周日高亮if (dateObj.e === 0) {return {backgroundColor: '#f9f0f0'}}return {}}}},taskBarConfig: {showTooltip: true,barStyle: {round: true}},columns: [{ field: 'title', title: '任务名称' },{ field: 'start', title: '开始时间', width: 100 },{ field: 'end', title: '结束时间', width: 100 }],data: [{ id: 10001, title: '任务1', start: '2024-03-03', end: '2024-03-10', progress: 20, bgColor: '#c1c452', imgUrl: 'https://vxeui.com/resource/productImg/product9.png' },{ id: 10002, title: '任务2', start: '2024-03-05', end: '2024-03-12', progress: 15, bgColor: '#fd9393', imgUrl: 'https://vxeui.com/resource/productImg/product8.png' },{ id: 10003, title: '任务3', start: '2024-03-10', end: '2024-03-21', progress: 25, bgColor: '#92c1f1', imgUrl: 'https://vxeui.com/resource/productImg/product1.png' },{ id: 10004, title: '任务4', start: '2024-03-15', end: '2024-03-24', progress: 70, bgColor: '#fad06c', imgUrl: 'https://vxeui.com/resource/productImg/product3.png' },{ id: 10005, title: '任务5', start: '2024-03-20', end: '2024-04-05', progress: 50, bgColor: '#e78dd2', imgUrl: 'https://vxeui.com/resource/productImg/product11.png' },{ id: 10006, title: '任务6', start: '2024-03-22', end: '2024-03-29', progress: 38, bgColor: '#8be1e6', imgUrl: 'https://vxeui.com/resource/productImg/product7.png' },{ id: 10007, title: '任务7', start: '2024-03-28', end: '2024-04-04', progress: 24, bgColor: '#78e6d1', imgUrl: 'https://vxeui.com/resource/productImg/product5.png' },{ id: 10008, title: '任务8', start: '2024-04-05', end: '2024-04-18', progress: 65, bgColor: '#edb695', imgUrl: 'https://vxeui.com/resource/productImg/product4.png' }]
})
</script><style lang="scss" scoped>
.custom-task-bar {display: flex;flex-direction: row;padding: 8px 16px;width: 100%;font-size: 12px;
}
.custom-task-bar-img {display: flex;flex-direction: row;align-items: center;justify-content: center;width: 70px;height: 70px;
}
</style>

https://gitee.com/x-extends/vxe-gantt

http://www.zskr.cn/news/75004.html

相关文章:

  • Linux内核学习记录
  • ret2libc+一点点保护
  • 详细介绍:【数据库】国产数据库替代实战:金仓KES如何以“智能运维 + 低资源占用”年省百万运维成本?
  • 2025年广东地区湘菜供应链江西小炒社区厨房称重自选食材配送服务商TOP5评测!全品类供应+定制化服务权威榜单发布,赋能餐饮高效运营
  • 『NAS』在群晖部署一款好看的白板工具-Excalidraw
  • Ubuntu下,MySQL密码遗失时修改密码
  • 2025最新贵州伴手礼厂家/采购渠道/供应商/平台/卖场/超市TOP5推荐!地道风物+文化赋能权威榜单发布,甄选贵礼传递黔地心意
  • 001.makdown快速入门
  • Oracel VirtualBox安装Windows11时无法找到ISO文件或不满足系统要求
  • 构建个人知识库新选择:深度解析访答本地私有知识库
  • AIShareTxt入门:快速准确高效的为金融决策智能体提供股票实用的技术指标上下文
  • I know only one topic but I wear glasses in 20s
  • 云原生基石的试金石:基于 openEuler 部署 Docker 与 Nginx 的全景实录 - 指南
  • qemu如何和宿主机共享文件 - show
  • 2025贵州贵阳荣和酒坊采购渠道推荐!百年传承酱香白酒购买平台TOP5榜单发布,品味历史沉淀的醇香佳酿
  • UE5循环播放蒙太奇
  • 完整教程:神经网络—— 学习与感知器
  • 智能座舱
  • 团体设计天梯赛L1题解
  • 完整教程:乡镇外卖跑腿小程序开发实战:基于PHP的乡镇同城O2O
  • 关于博客后续
  • 2025.12.6博客
  • 英语_阅读_a robot for science fair_待读
  • 2025年什么牌子的轮胎比较好:权威测评优质轮胎排行
  • faster r cnn中的动量
  • 需求的分层
  • 12.5 程序员修炼之道:从小工到专家 第7章 在项目开始之前 - GENGAR
  • 理想L9更换轮胎推荐:2025年超500万用户力荐的组合
  • 小红书玩疯了!Ai像素级拆解提示词+Nano Banan Pro免费使用教程(附Api接入实战)
  • 2025.12.6日20:13-harsh无情的;粗糙的