浏览代码

修复部分问题

warrior 1 月之前
父节点
当前提交
fbc3ce9a02

+ 4 - 3
projects/textbook/src/modules/nav-province-contact/page-process/process-list/process-list.component.html

@@ -1,4 +1,4 @@
-@if (!editLoading && eduProcessList.length > 0) {
+@if (bindEduPrc) {
 <nz-page-header>
   <nz-page-header-title
     >申报流程
@@ -282,11 +282,12 @@
       </div>
     </div>
   </div> -->
-} @else if (editLoading) {
+} 
+@if (loading) {
 <div class="loading">
   <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
 </div>
-} @else {
+} @if(!bindEduPrc && !loading) {
 <nz-empty
   style="margin: 100px auto"
   nzNotFoundContent="暂未绑定对应单位管理员,请联系工作人员"

+ 71 - 62
projects/textbook/src/modules/nav-province-contact/page-process/process-list/process-list.component.ts

@@ -55,7 +55,8 @@ interface depart {
     NzCheckboxModule,
     NzEmptyModule,
     NzModalModule,
-    NzRadioModule,NzTabsModule
+    NzRadioModule,
+    NzTabsModule,
   ],
   standalone: true,
 })
@@ -109,7 +110,10 @@ export class ProcessListComponent implements OnInit {
         del: false,
       };
     }
-    if(e?.get('collectStartData') && new Date() < new Date(e?.get('collectStartData'))){
+    if (
+      e?.get('collectStartData') &&
+      new Date() < new Date(e?.get('collectStartData'))
+    ) {
       return {
         title: '待收集',
         color: 'default',
@@ -117,11 +121,14 @@ export class ProcessListComponent implements OnInit {
         stop: false,
         end: false,
         del: false,
-        collect:true
+        collect: true,
       };
     }
-    if(e?.get('collectStartData') && new Date() > new Date(e?.get('collectStartData')) 
-    && new Date() < e?.get('collectEndData')){
+    if (
+      e?.get('collectStartData') &&
+      new Date() > new Date(e?.get('collectStartData')) &&
+      new Date() < e?.get('collectEndData')
+    ) {
       return {
         title: '收集中',
         color: 'orange',
@@ -129,7 +136,7 @@ export class ProcessListComponent implements OnInit {
         stop: false,
         end: false,
         del: false,
-        collect:true
+        collect: true,
       };
     }
     if (
@@ -212,9 +219,8 @@ export class ProcessListComponent implements OnInit {
     }
     return;
   };
-  editLoading:boolean = true
   active: number = 0;
-
+  bindEduPrc: boolean = false;
   constructor(
     public tbookSer: textbookServer,
     private route: Router,
@@ -235,7 +241,8 @@ export class ProcessListComponent implements OnInit {
   ngOnInit(): void {
     this.activeRoute.paramMap.subscribe(async (params) => {
       // this.nodes = await this.getDepart();
-      this.getEduProcess()
+      await this.getEduProcess();
+      if (this.eduProcessList.length > 0) this.bindEduPrc = true;
     });
   }
   async getDepart(
@@ -249,7 +256,7 @@ export class ProcessListComponent implements OnInit {
     query.select('code', 'name', 'branch', 'parent', 'type');
     query.descending('createdAt');
     query.limit(100);
-    query.equalTo('objectId', this.tbookSer.profile.user.department?.objectId)
+    query.equalTo('objectId', this.tbookSer.profile.user.department?.objectId);
     let res = await query.find();
     res.forEach((item) => {
       nodes.push({
@@ -264,8 +271,8 @@ export class ProcessListComponent implements OnInit {
   async onSearch(e: string) {
     this.nodes = await this.getDepart('', e);
   }
-  onSearchPro(e: string){
-    this.getEduProcess()
+  onSearchPro(e: string) {
+    this.getEduProcess();
   }
   changeDepart(e: any) {
     this.currentDepart = e;
@@ -275,30 +282,33 @@ export class ProcessListComponent implements OnInit {
   async getEduProcess() {
     this.eduProcessList = [];
     this.loading = true;
-    let query1= Parse.Query.fromJSON('EduProcess', {
+    let query1 = Parse.Query.fromJSON('EduProcess', {
       where: {
         $or: [
           {
-            name: { "$regex": `.*${this.searchValuePro}.*`},
+            name: { $regex: `.*${this.searchValuePro}.*` },
           },
-        ]
-      }
+        ],
+      },
     });
-    let query2= Parse.Query.fromJSON('EduProcess', {
+    let query2 = Parse.Query.fromJSON('EduProcess', {
       where: {
         $or: [
           {
-            code: { "$regex": `.*${this.searchValuePro}.*`},
+            code: { $regex: `.*${this.searchValuePro}.*` },
           },
-        ]
-      }
+        ],
+      },
     });
-    let query = Parse.Query.or(query1, query2)
+    let query = Parse.Query.or(query1, query2);
     query.include('profileSubmitted', 'profileSubmitted.user');
     query.notEqualTo('isDeleted', true);
-    query.equalTo('department',this.tbookSer.profile.user.department?.objectId)
+    query.equalTo(
+      'department',
+      this.tbookSer.profile.user.department?.objectId
+    );
     query.descending('createdAt');
-    query.equalTo('profileSubmitted',this.tbookSer?.profile?.objectId)
+    query.equalTo('profileSubmitted', this.tbookSer?.profile?.objectId);
     let r = await query.find();
     // let list: any[] = [];
     r.forEach((item) => {
@@ -308,7 +318,6 @@ export class ProcessListComponent implements OnInit {
       this.statusMap[item.id] = this.formatStatus(item);
     });
     this.eduProcessList = r;
-    this.editLoading = false
     this.loading = false;
   }
   //分页切换
@@ -373,45 +382,45 @@ export class ProcessListComponent implements OnInit {
     });
   }
 
-    //暂停流程
-    async onStatusChange(
-      data: Parse.Object,
-      type: string,
-      end?: boolean
-    ): Promise<void> {
-      console.log(data, type);
-      switch (type) {
-        case 'strat':
-          if (data?.get('status') == '100') {
-            data?.set('status', null);
-          }
-          if (data?.get('startDate') > new Date()) {
-            data?.set('startDate', new Date());
-          }
-          if (data?.get('deadline') < new Date()) {
-            data?.set(
-              'deadline',
-              new Date(new Date().getTime() + 60 * 1000 * 60 * 24 * 7)
-            );
-            console.warn('结束时间延长一周之后');
-          }
-          break;
-        case 'stop':
-          data?.set('status', '100');
-          break;
-        case 'end':
-          data?.set('status', '400');
-          data?.set('deadline', new Date());
-          break;
-        case 'del':
-          data?.set('isDeleted', true);
-          break;
-      }
-      await data.save();
-      if (end) {
-        this.getEduProcess();
-      }
+  //暂停流程
+  async onStatusChange(
+    data: Parse.Object,
+    type: string,
+    end?: boolean
+  ): Promise<void> {
+    console.log(data, type);
+    switch (type) {
+      case 'strat':
+        if (data?.get('status') == '100') {
+          data?.set('status', null);
+        }
+        if (data?.get('startDate') > new Date()) {
+          data?.set('startDate', new Date());
+        }
+        if (data?.get('deadline') < new Date()) {
+          data?.set(
+            'deadline',
+            new Date(new Date().getTime() + 60 * 1000 * 60 * 24 * 7)
+          );
+          console.warn('结束时间延长一周之后');
+        }
+        break;
+      case 'stop':
+        data?.set('status', '100');
+        break;
+      case 'end':
+        data?.set('status', '400');
+        data?.set('deadline', new Date());
+        break;
+      case 'del':
+        data?.set('isDeleted', true);
+        break;
+    }
+    await data.save();
+    if (end) {
+      this.getEduProcess();
     }
+  }
 
   toUrl(url: string, params?: object) {
     if (params) {

+ 9 - 3
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.ts

@@ -862,9 +862,15 @@ export class PageRoleComponent implements OnInit {
       nzOkType: 'primary',
       nzOkDanger: true,
       nzOnOk: async () => {
-        let selectedList = this.profiles.filter((item: any) =>
-          this.setOfCheckedId.has(item?.id)
-        );
+        let selectedList: Array<any> = [];
+        if (!data?.id) {
+          selectedList = this.profiles.filter((item: any) =>
+            this.setOfCheckedId.has(item?.id)
+          );
+        } else {
+          selectedList = [data];
+        }
+
         let deletePromiseList = selectedList.map((item: any) => {
           return new Promise(async (resolve) => {
             await item.get('user')?.destroy()

+ 1 - 1
projects/textbook/src/services/majors.map.ts

@@ -1,6 +1,6 @@
 export const majors = {
     options:[
-        {"cate":""	,"code":"110000","name":"110000","degree":"110000"},
+        // {"cate":""	,"code":"110000","name":"110000","degree":"110000"},
 
         {"cate":"哲学类"	,"code":"010101","name":	"哲学","degree":	"哲学"},
         {"cate":"哲学类"	,"code":"010102","name":	"逻辑学","degree":	"哲学"},

+ 1 - 1
projects/textbook/src/services/majors4.map.ts

@@ -2,7 +2,7 @@ export const majors={
 options:[
 
 //cate  code  name     degree
-{degree:'1100',cate:'1100',code:'1100',name:'1100'},
+// {degree:'1100',cate:'1100',code:'1100',name:'1100'},
 
 {degree:'哲学',cate:'哲学类',code:'0101',name:'哲学'},
 {degree:'经济学',cate:'经济学类',code:'0201',name:'经济学'},