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

重庆专业网站推广费用广州快速排名

重庆专业网站推广费用,广州快速排名,郑州工作,b2c网站开发注意事项:1、横坐标根据日期转换成时间刻度在( gantt.config.scales);2、获取时间刻度的最大值(findMaxRepairTime);3、甘特图多级列表需注意二级三级每个父子id需要唯一(convertData) 安装依赖 npm install dhtmlx-gantt --save 在当前页引入和配置 dhtmlx-gantt im…

注意事项:1、横坐标根据日期转换成时间刻度在( gantt.config.scales);2、获取时间刻度的最大值(findMaxRepairTime);3、甘特图多级列表需注意二级三级每个父子id需要唯一(convertData

  1. 安装依赖

    npm install dhtmlx-gantt --save

  2. 在当前页引入和配置 dhtmlx-gantt

    import gantt from "dhtmlx-gantt"; // 引入模块
    // import 'dhtmlx-gantt/codebase/dhtmlxgantt.css'
    import "dhtmlx-gantt/codebase/skins/dhtmlxgantt_terrace.css"; //皮肤
    import "dhtmlx-gantt/codebase/locale/locale_cn"; // 本地化
    // import "dhtmlx-gantt/codebase/ext/dhtmlxgantt_tooltip.js"; //任务条悬浮提示
    

     

  3. 创建甘特图容器

    <div ref="gantt" class="left-container" />initMount() {let convertedData = this.convertData(this.aircraftData);this.tasks.data = convertedData;let maxNum = this.findMaxRepairTime(this.aircraftData);gantt.config.start_date = new Date(2025, 0, 16, 0, 0, 0);gantt.config.end_date = new Date(2025,0,16,Math.floor(maxNum / 60),maxNum % 60,0);gantt.config.autosize = true;gantt.config.readonly = true;gantt.config.show_grid = true;gantt.config.columns = [{ name: "text", label: "名称", tree: true, width: "260" },];gantt.config.show_task_cells = true;// 设置时间刻度gantt.config.scales = [{unit: "minute",step: 10,format: function (date) {// 提取小时和分钟var hours = date.getHours();var minutes = date.getMinutes();// 将小时转换为分钟,并加上额外的分钟数var totalMinutes = hours * 60 + minutes + 10;return totalMinutes;},},];// 设置任务条上展示的内容,参数task会返回当前任务的数据gantt.templates.task_text = function (start, end, task) {return '<div class="gantt-task-content">' + task.text + "-" + task.time + "分钟" + '</div>';};// gantt.config.xml_date = '%Y-%m-%d %H:%i:%s';this.initData();// 初始化甘特图gantt.init(this.$refs.gantt);gantt.clearAll();//销毁// gantt.destructor()gantt.parse(this.tasks);},//初始化甘特图initData: function () {this.tasks.data.map(function (current, ind, arry) {var newObj = {};if (current.type) {if (current.type == 1) {newObj = Object.assign({}, current, { color: "#67c23a" });}//   } else if (current.type == 2) {//     newObj = Object.assign({}, current, { color: "#fec0dc" });//   } else if (current.type == 3) {//     newObj = Object.assign({}, current, { color: "#62ddd4" });//   } else if (current.type == 4) {//     newObj = Object.assign({}, current, { color: "#d1a6ff" });//   }} else {newObj = Object.assign({}, current, { color: "#f9d484" });}return newObj;});},

  4. 处理后端返回的数据

    //处理数组convertData(aircraftData) {let result = [];let nextUniqueId = 0; // 用于生成唯一的IDaircraftData.forEach((aircraft) => {let aircraftInfo = {id: aircraft.taskId,text: aircraft.planeNum,start_date: new Date(2025, 0, 16, 0, 0),end_date: new Date(2025,0,16,Math.floor(aircraft.repairTime / 60),aircraft.repairTime % 60,0),duration: aircraft.repairTime,open: true,time: aircraft.repairTime,};result.push(aircraftInfo);aircraft.lruList.forEach((sparePart) => {let sparePartId = `sparepart-${nextUniqueId++}`; // 生成唯一的IDlet sparePartInfo = {text: sparePart.lruName,start_date: new Date(2025, 0, 16, 0, 0),end_date: new Date(2025,0,16,Math.floor(sparePart.repairTime / 60),sparePart.repairTime % 60,0),id: sparePartId, // sparePart.lruId,  //随机数这个id与下面的sparePart.lruWorkList的parent一致duration: sparePart.repairTime,parent: sparePart.taskId,type: 1,open: true,time: sparePart.repairTime,};result.push(sparePartInfo);sparePart.lruWorkList.forEach((procedure) => {let procedureId = `procedure-${nextUniqueId++}`; // 生成唯一的IDlet procedureInfo = {text: procedure.taskName,start_date: new Date(2025, 0, 16, 0, 0),end_date: new Date(2025,0,16,Math.floor(procedure.workTime / 60),procedure.workTime % 60,0),id: procedureId, //procedure.lruWorkId, //这个 id要唯一duration: procedure.workTime,parent: sparePartId, // procedure.lruIdThree, //aircraft.lruList这个id和parent一致type: procedure.isCompleted,time: procedure.workTime,};result.push(procedureInfo);});});});return result;},//取最大的修理时间findMaxRepairTime(data) {let maxRepairTime = 0;data.forEach((aircraft) => {if (aircraft.repairTime > maxRepairTime) {maxRepairTime = aircraft.repairTime;}});return maxRepairTime;},
    

  5. 子组件监听调用

    watch: {newData: {handler(newVal) {if (newVal !== undefined && newVal !== null)
http://www.ds6.com.cn/news/95022.html

相关文章:

  • 怎样做网站推销产品营销页面设计
  • 本地怎样做网站北京网站建设公司报价
  • wordpress 点赞功能深圳市seo上词贵不贵
  • 备案用的网站建设方案书站长之家关键词挖掘
  • 咨询管理公司网站优化的意义
  • 新疆乌鲁木齐建设工程信息网上海优化公司选哪个
  • 如何用框架做网站天天广告联盟
  • 关于国际贸易的网站正在直播足球比赛
  • 网站建设合作合同模板seo建站技巧
  • 王爷不要网站优化排名服务
  • 如何用二级域名做网站布奏佛山旺道seo优化
  • 教人做饮料的网站网络推广外包要多少钱
  • 重庆市城乡建设委员会教育网站竞价恶意点击立案标准
  • 动态网站和静态网站yahoo引擎入口
  • 一个空间做2个网站吗kol营销
  • wordpress优酷插件做网站seo怎么赚钱
  • 营销网站售后调查系统网站建设策划方案
  • 毕业生 网站开发培训网站搭建
  • 老网站文章突然无收录网推和地推的区别
  • 网站关键词描述字数搜索引擎优化的核心是
  • 32岁学做网站广告关键词查询
  • 专业的wap网站开发html制作网页代码
  • 做热图的网站百度问答库
  • 西安网站seo外包如何找做网站的公司
  • 南开网站建设公司北京seo优化公司
  • 企业品牌战略安徽seo报价
  • 做字幕网站做网站
  • 个人手机网站建设百度指数怎么做
  • 北京智能网站建设系统加盟通过百度指数不能判断出
  • 专业做鞋子的网站吗查询网138网站域名