Browse Source

工作联系人获取上传文件教材逻辑

cehn 5 months ago
parent
commit
16b8f642d7

+ 1 - 1
projects/textbook/src/modules/nav-province-contact/collect-file/collect-file.component.html

@@ -137,7 +137,7 @@
       @if (currentTextbook?.get('type')=='全册') {
       <nz-collapse [nzBordered]="false">
         @for (panel of currentTextbook?.get('childrens'); track panel) { @if
-          (panel?.get('editionUnit') == this.eduProcess?.get('name')) {
+          (panel?.get('editionUnit') == tbookSer.profile.user?.department?.name) {
         <nz-collapse-panel
           #p
           [nzHeader]="title"

+ 34 - 12
projects/textbook/src/modules/nav-province-contact/collect-file/collect-file.component.ts

@@ -40,7 +40,7 @@ import { NzCollapseModule } from 'ng-zorro-antd/collapse';
 })
 export class CollectFileComponent implements OnInit {
   textbookList: Array<Parse.Object> = [];
-  eduProcess?: Parse.Object; //流程
+  // eduProcess?: Parse.Object; //流程
   count: number = 0;
 
   limit: number = 10;
@@ -91,8 +91,8 @@ export class CollectFileComponent implements OnInit {
   ) {}
 
   async ngOnInit() {
-    await this.getEduProcess();
-    if(!this.eduProcess?.id) return
+    // await this.getEduProcess();
+    if(!this.tbookSer.profile.user?.department?.name) return
     this.getTextbook();
   }
   async getEduProcess() {
@@ -102,7 +102,7 @@ export class CollectFileComponent implements OnInit {
     query.containedIn('status', ['400']);
     let r = await query.first();
     console.log(r);
-    this.eduProcess = r;
+    // this.eduProcess = r;
   }
 
   async getTextbook(val?: string): Promise<any[] | void> {
@@ -136,12 +136,32 @@ export class CollectFileComponent implements OnInit {
           childrens: {
             $inQuery: {
               where: {
-                editionUnit: this.eduProcess?.get('name'),
+                editionUnit: this.tbookSer.profile.user?.department?.name,
                 // editionUnit: '高等教育出版社',
               },
               className: 'EduTextbookVolume',
             },
           },
+          eduProcess:{
+            $inQuery: {
+              where: {
+                status: '400',
+                collectStartData:{
+                  $lt:{
+                    "__type": "Date",
+                    "iso": new Date()
+                  },
+                },
+                collectEndData:{
+                  $gt:{
+                    "__type": "Date",
+                    "iso": new Date()
+                  },
+                }
+              },
+              className: 'EduProcess',
+            },
+          }
         },
       };
       let query = Parse.Query.fromJSON('EduTextbook', queryParams);
@@ -153,6 +173,8 @@ export class CollectFileComponent implements OnInit {
       query.include(
         'childrens',
         'eduProcess.profileSubmitted.user',
+        'eduProcess.collectStartData',
+        'eduProcess.collectEndData',
         'department'
       );
       this.count = await query.count();
@@ -169,7 +191,7 @@ export class CollectFileComponent implements OnInit {
         //是否保存
         let isSave = item?.get('childrens').some((child: Parse.Object) => {
           return (
-            this.eduProcess?.get('name') == child?.get('editionUnit') &&
+            this.tbookSer.profile.user?.department?.name == child?.get('editionUnit') &&
             child?.get('collectStatus') == '100'
           );
         });
@@ -184,8 +206,8 @@ export class CollectFileComponent implements OnInit {
         //是否提交
         let isSbmit = item?.get('childrens').every((child: Parse.Object) => {
           return (
-            this.eduProcess?.get('name') != child?.get('editionUnit') ||
-            (this.eduProcess?.get('name') == child?.get('editionUnit') &&
+            this.tbookSer.profile.user?.department?.name != child?.get('editionUnit') ||
+            (this.tbookSer.profile.user?.department?.name == child?.get('editionUnit') &&
               child?.get('collectStatus') == '200')
           );
         });
@@ -238,10 +260,10 @@ export class CollectFileComponent implements OnInit {
   //打开上传弹窗
   onEditModal(data: Parse.Object) {
     if (
-      !this.eduProcess?.get('collectStartData') ||
-      !this.eduProcess?.get('collectEndData') ||
-      this.eduProcess?.get('collectStartData') > new Date() ||
-      this.eduProcess?.get('collectEndData') < new Date()
+      !data.get('eduProcess')?.get('collectStartData') ||
+      !data.get('eduProcess')?.get('collectEndData') ||
+      data.get('eduProcess')?.get('collectStartData') > new Date() ||
+      data.get('eduProcess')?.get('collectEndData') < new Date()
     ) {
       this.msg.warning('非收集文件工作期内');
       return;