From e3ac63c2b87ed1cc9409412fba7b8b38b4867a17 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期一, 19 一月 2026 13:11:15 +0800
Subject: [PATCH] 1.递交

---
 src/views/gantt/index.vue |  143 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 107 insertions(+), 36 deletions(-)

diff --git a/src/views/gantt/index.vue b/src/views/gantt/index.vue
index d40aeef..bbdab5a 100644
--- a/src/views/gantt/index.vue
+++ b/src/views/gantt/index.vue
@@ -56,7 +56,7 @@
       selectedIds: [],
       // 鍒嗛〉鐩稿叧鏁版嵁
       currentPage: 1,
-      pageSize: 10,
+      pageSize: 20,
       totalTasks: 0,
       allTasks: [], // 瀛樺偍鎵�鏈変换鍔℃暟鎹�
       paginatedTasks: [] // 褰撳墠椤电殑浠诲姟鏁版嵁
@@ -93,7 +93,8 @@
       // 涓嶅啀瀵归綈鏃堕棿杞村埢搴︼紙姣斿澶╂牸瀛愶級锛岃�屾槸鎸夆�滃皬鏃垛�濆榻�
       gantt.config.round_dnd_dates = false
       // 鏈�灏忔闀胯繕鏄� 1 灏忔椂锛屼絾浣犲凡缁忎粠鈥滃ぉ鏍煎瓙鈥濆彉鎴愨�滃皬鏃舵牸瀛愨�濅簡
-      gantt.config.time_step = 60 // 60 鍒嗛挓 = 1 灏忔椂
+      // gantt.config.time_step = 60 // 60 鍒嗛挓 = 1 灏忔椂
+      gantt.config.time_step = 1 //  1鍒嗛挓
 
       gantt.config.row_height = 32 // 琛岄珮
       gantt.config.bar_height = 20 // bar楂�
@@ -219,27 +220,27 @@
 
       // 鏄惁鏄伐浣滄椂闂�
       /* 鈫撯啌鈫� Working Time configuration 鈫撯啌鈫� */
-      // gantt.templates.scale_cell_class = function(date) {
-      //   if (!gantt.isWorkTime(date)) {
-      //     return 'weekend'
-      //   }
-      // }
-      //
-      // gantt.templates.timeline_cell_class = function(item, date) {
-      //   if (!gantt.isWorkTime({ date: date, task: item })) {
-      //     return 'weekend'
-      //   }
-      // }
+      gantt.templates.scale_cell_class = function(date) {
+        if (!gantt.isWorkTime(date)) {
+          return 'weekend'
+        }
+      }
 
-      // gantt.config.work_time = true
+      gantt.templates.timeline_cell_class = function(item, date) {
+        if (!gantt.isWorkTime({ date: date, task: item })) {
+          return 'weekend'
+        }
+      }
 
-      // gantt.addCalendar({
-      //   id: 'custom1',
-      //   worktime: {
-      //     hours: ['8:00-12:30', '13:00-17:30'], // global work hours for weekdays
-      //     days: [0, 1, 1, 1, 1, 1, 1]
-      //   }
-      // })
+      gantt.config.work_time = true
+
+      gantt.addCalendar({
+        id: 'customCalendar1',
+        worktime: {
+          hours: ['8:00-12:30', '13:00-17:30'], // global work hours for weekdays
+          days: [0, 1, 1, 1, 1, 1, 1]
+        }
+      })
 
       // gantt.addCalendar({
       //   id: 'custom2',
@@ -441,8 +442,23 @@
         // return '<span style="color: white; font-weight: bold; text-shadow: 1px 1px 1px #000;">' +
         //   task.description + ' - ' +
         //   '</span>'
-        return task.description
+        // return task.description
+        return task.progress * 100 + '%'
       }
+
+      // JavaScript 閰嶇疆
+      // gantt.templates.grid_row_class = function(start, end, task) {
+      //   // 鍙 id = 3 鐨勪换鍔¤澶勭悊
+      //   // if (task.id !== 7) return
+      //
+      //   // if (task.start_date === '2025-04-07 06:23') {
+      //   if (task.id === 8) {
+      //     console.log(task, 11)
+      //     return 'row-completed'
+      //   }
+      //
+      //   return '' // 鍏朵粬鎯呭喌杩斿洖榛樿
+      // }
 
       gantt.init('gantt_here')
       // 娉ㄦ剰锛氳繖閲屼笉绔嬪嵆鍔犺浇鏁版嵁锛岃�屾槸绛夊緟loadTasks琚皟鐢�
@@ -485,6 +501,7 @@
           'id': 1,
           'text': '宸ュ崟:MO-2025-05-001',
           saleOrder: 'SO-2025-05001',
+          'calendar_id': 'customCalendar1',
           partName: '璺戞鏈�',
           partCode: 'Run01',
           description: '鎺掍骇鏁伴噺:500 鎶ュ伐鏁伴噺:100 杩涘害:20%',
@@ -501,6 +518,7 @@
           'id': 2,
           'text': '宸ュ簭:鍒囧壊',
           saleOrder: 'SO-2025-05001',
+          'calendar_id': 'customCalendar1',
           partName: '璺戞鏈�',
           partCode: 'Run01',
           description: '鎺掍骇鏁伴噺:500 鎶ュ伐鏁伴噺:100 杩涘害:20%',
@@ -516,6 +534,7 @@
           'id': 3,
           'text': '璁惧:閲戝伐杞﹂棿1鍙疯澶�',
           saleOrder: 'SO-2025-05001',
+          'calendar_id': 'customCalendar1',
           partName: '璺戞鏈�',
           partCode: 'Run01',
           description: '鎺掍骇鏁伴噺:500 鎶ュ伐鏁伴噺:100 杩涘害:20%',
@@ -531,6 +550,7 @@
           'id': 4,
           'text': '璁惧:閲戝伐杞﹂棿2鍙疯澶�',
           saleOrder: 'SO-2025-05001',
+          'calendar_id': 'customCalendar1',
           partName: '璺戞鏈�',
           partCode: 'Run01',
           description: '鎺掍骇鏁伴噺:500 鎶ュ伐鏁伴噺:100 杩涘害:20%',
@@ -541,10 +561,12 @@
           'progress': 0.2,
           'owner': [{ 'resource_id': '5', 'value': 2 }],
           checked: false
-        }, {
+        },
+        {
           'id': 5,
           'text': '宸ュ崟:MO-2025-05-002',
           saleOrder: 'SO-2025-05002',
+          'calendar_id': 'customCalendar1',
           partName: '璧版鏈�',
           partCode: 'W01',
           description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:500 杩涘害:50%',
@@ -561,6 +583,7 @@
           'id': 6,
           'text': '宸ュ簭:鍒囧壊',
           saleOrder: 'SO-2025-05002',
+          'calendar_id': 'customCalendar1',
           partName: '璧版鏈�',
           partCode: 'W01',
           description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:500 杩涘害:50%',
@@ -577,10 +600,11 @@
           'text': '璁惧:閲戝伐杞﹂棿3鍙疯澶�',
           saleOrder: 'SO-2025-05002',
           partName: '璧版鏈�',
+          'calendar_id': 'customCalendar1',
           partCode: 'W01',
           description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:500 杩涘害:50%',
           'type': 'task',
-          'start_date': '2025-04-07 00:00',
+          'start_date': '2025-04-07 06:23',
           'parent': '6',
           'duration': 3,
           'progress': 0.5,
@@ -593,12 +617,48 @@
           saleOrder: 'SO-2025-05002',
           partName: '璧版鏈�',
           partCode: 'W01',
+          'calendar_id': 'customCalendar1',
           description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:600 杩涘害:60%',
           'type': 'task',
+          render: 'split', // 鐢ㄤ簬鍦ㄤ竴涓伐浣滄椂闂存鍐呮樉绀轰笉涓嬶紝闇�瑕佽繘琛屽垎鍓叉樉绀�
           'start_date': '2025-04-12 00:00',
           'parent': '6',
           'duration': 4,
           'progress': 0.6,
+          'owner': [{ 'resource_id': '5', 'value': 2 }],
+          checked: false
+        },
+        {
+          'id': 10,
+          'text': '璁惧:閲戝伐杞﹂棿4鍙疯澶�',
+          saleOrder: 'SO-2025-05002',
+          partName: '璧版鏈�',
+          partCode: 'W01',
+          'calendar_id': 'customCalendar1',
+          description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:600 杩涘害:60%',
+          'type': 'task',
+          render: 'split',
+          'start_date': '2025-04-12 00:00',
+          'parent': '8',
+          'duration': 1,
+          'progress': 0.6,
+          'owner': [{ 'resource_id': '5', 'value': 2 }],
+          checked: false
+        },
+        {
+          'id': 11,
+          'text': '璁惧:閲戝伐杞﹂棿4鍙疯澶�',
+          saleOrder: 'SO-2025-05002',
+          partName: '璧版鏈�',
+          partCode: 'W01',
+          'calendar_id': 'customCalendar1',
+          description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:600 杩涘害:60%',
+          'type': 'task',
+          render: 'split',
+          'start_date': '2025-04-14 00:00',
+          'parent': '8',
+          'duration': 3,
+          'progress': 0.0,
           'owner': [{ 'resource_id': '5', 'value': 2 }],
           checked: false
         },
@@ -608,6 +668,7 @@
           saleOrder: 'SO-2025-05002',
           partName: '璧版鏈�',
           partCode: 'W01',
+          'calendar_id': 'customCalendar1',
           description: '鎺掍骇鏁伴噺:1000 鎶ュ伐鏁伴噺:400 杩涘害:40%',
           'type': 'task',
           'start_date': '2025-04-10 00:00',
@@ -761,13 +822,23 @@
   margin: unset;
 }
 
-/*.gantt_task_cell {*/
-/*  background: rgba(5, 185, 100, .1);*/
-/*}*/
+.gantt_task_cell {
+  background: rgba(5, 185, 100, .1);
+}
 
 /*!*闈炲伐浣滄棩*!*/
-/*.weekend {*/
-/*  background: rgba(255, 255, 255, 0.5);*/
+.weekend {
+  background: rgba(255, 255, 255, 0.1);
+  /*background: red;*/
+}
+
+/*.row-completed {*/
+/*  background-color: #bee4be !important; !* 娴呯豢鑹� *!*/
+/*}*/
+
+/*.gantt_grid_head_cell[data-column-id="duration"],*/
+/*.gantt_row .gantt_cell[data-column-name="duration"] {*/
+/*  background-color: #f5f5f5 !important;*/
 /*}*/
 
 /* 涓轰换鍔℃潯鍐呴儴鐨勮繘搴︽潯娣诲姞鍦嗚锛屼繚鎸佽瑙夌粺涓� */
@@ -807,21 +878,21 @@
 /* 闅愯棌婊戝潡 */
 #taskRange::-webkit-slider-thumb {
   opacity: 0;
-   -webkit-appearance: none !important;
-  width: 1px!important;
-  height: 1px!important;
+  -webkit-appearance: none !important;
+  width: 1px !important;
+  height: 1px !important;
 }
 
 #taskRange::-moz-range-thumb {
   opacity: 0;
-  width:  1px!important;
-  height:  1px!important;
+  width: 1px !important;
+  height: 1px !important;
 }
 
 #taskRange::-ms-thumb {
   opacity: 0;
-  width: 1px!important;
-  height: 1px!important;
+  width: 1px !important;
+  height: 1px !important;
 }
 
 </style>

--
Gitblit v1.9.3