ryanemax 1 dzień temu
rodzic
commit
62d731ef32

+ 16 - 6
src/modules/project/pages/project-detail/stages/stage-order.component.ts

@@ -54,13 +54,23 @@ export class StageOrderComponent implements OnInit {
     title: '',
     projectType: '', // 家装 | 工装
     renderType: '', // 静态单张 | 360全景
-    demoday: new Date(),
-    deadline: new Date(),
+    demoday: this.formatDate(),
+    deadline: this.formatDate(),
     description: '',
     priceLevel: '一级', // 一级(老客户) | 二级(中端组) | 三级(高端组)
     spaceType: 'single' // single | multi
   };
 
+  formatDate (date = new Date()) {
+    const year = date.getFullYear();
+    // 月份从 0 开始,需 +1,并用 padStart 补零确保两位数
+    const month = String(date.getMonth() + 1).padStart(2, '0');
+    // 日期补零确保两位数
+    const day = String(date.getDate()).padStart(2, '0');
+    return `${year}-${month}-${day}`;
+  };
+
+  
   // 空间管理
   projectSpaces: Project[] = [];
   isMultiSpaceProject: boolean = false;
@@ -298,8 +308,8 @@ export class StageOrderComponent implements OnInit {
         this.projectInfo.title = this.project.get('title') || '';
         this.projectInfo.projectType = this.project.get('projectType') || '';
         this.projectInfo.renderType = this.project.get('renderType') || '';
-        this.projectInfo.deadline = this.project.get('deadline') || '';
-        this.projectInfo.demoday = this.project.get('demoday') || '';
+        this.projectInfo.deadline = this.formatDate(this.project.get('deadline') || new Date());
+        this.projectInfo.demoday = this.formatDate(this.project.get('demoday') || new Date());
         this.projectInfo.description = this.project.get('description') || '';
 
         const data = this.project.get('data') || {};
@@ -740,8 +750,8 @@ export class StageOrderComponent implements OnInit {
       this.project.set('title', this.projectInfo.title);
       this.project.set('projectType', this.projectInfo.projectType);
       this.project.set('renderType', this.projectInfo.renderType);
-      this.project.set('deadline', this.projectInfo.deadline);
-      this.project.set('demoday', this.projectInfo.demoday);
+      this.project.set('deadline', new Date(this.projectInfo.deadline));
+      this.project.set('demoday', new Date(this.projectInfo.demoday));
       this.project.set('description', this.projectInfo.description);
       this.project.set('spaceType', this.projectInfo.spaceType);