Browse Source

修改甘特图的bug

695593266@qq.com 1 month ago
parent
commit
90e2fe7789

+ 19 - 4
src/views/productionPlan/components/newFactoryProductionScheduling.vue

@@ -21,7 +21,7 @@
         <el-date-picker
           v-model="dateRange"
           type="daterange"
-          size="mini"
+          size="small"
           value-format="yyyy-MM-dd"
           range-separator="至"
           start-placeholder="计划开始时间"
@@ -884,9 +884,7 @@
 
       async handleDateChange(val) {
         this.dateRange = val;
-        if (this.activeTab === 'factory') {
-          await this.refreshSchedulingView();
-        }
+        await this.refreshSchedulingView();
       },
 
       async refreshSchedulingView() {
@@ -917,6 +915,23 @@
           }
         } else {
           data = await teamSchedulingGanttChart(params);
+
+          const extractedPlanIds = new Set();
+          (data || []).forEach((item) => {
+            (item.resourcePeriods || []).forEach((period) => {
+              if (period.planId) extractedPlanIds.add(period.planId);
+            });
+            (item.resourceList || []).forEach((resource) => {
+              if (resource.planId) extractedPlanIds.add(resource.planId);
+            });
+          });
+
+          if (extractedPlanIds.size > 0) {
+            const plans = await this.loadPlansByIds(
+              Array.from(extractedPlanIds)
+            );
+            this.planDataList = this.buildPlanTableRows(plans);
+          }
         }
         this.calendarSourceData = data || [];
         this.tableData = this.initGanttFlatRows(data || []);