Browse Source

update 提交教材优化限制

cehn 8 tháng trước cách đây
mục cha
commit
7a29028612

+ 4 - 0
projects/textbook/src/app/textbook/textbook.component.ts

@@ -350,6 +350,10 @@ export class TextbookComponent implements OnInit {
   }
   //退回
   reject(data?: Parse.Object) {
+    if (this.eduProcess?.get('status') != '200') {
+      this.message.warning('当前流程状态非遴选中,不可此操作');
+      return;
+    }
     this.modal.confirm({
       nzTitle: '退回教材',
       nzContent: `确定退回吗?`,

+ 2 - 0
projects/textbook/src/modules/nav-admin/modules.routes.ts

@@ -13,6 +13,7 @@ import { PageProcessComponent } from './page-process/page-process.component';
 import { TextbookDetailsComponent } from '../common/textbook-details/textbook-details.component';
 import { UserCreateComponent } from './page-user/user-create/user-create.component';
 import { ReuseService } from "../../services/route-reuse.service";
+import { LeaveGuard } from './user-edit/auth.guard';
 const routes: Routes = [
   {
     path: '',
@@ -61,6 +62,7 @@ const routes: Routes = [
       {
         path: 'user/edit', //用户管理&编辑
         component: UserEditComponent,
+        canDeactivate: [LeaveGuard],
       },
       {
         path: 'user/create', //创建用户

+ 18 - 0
projects/textbook/src/modules/nav-admin/user-edit/auth.guard.ts

@@ -0,0 +1,18 @@
+import { Injectable } from '@angular/core';
+import { CanDeactivate } from '@angular/router';
+import { UserEditComponent } from './user-edit.component';
+import { Observable, of } from 'rxjs';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class LeaveGuard implements CanDeactivate<UserEditComponent> {
+
+  public canDeactivate(component: UserEditComponent): Observable<boolean> {
+    if (component.moduleChange && typeof(component.moduleChange) === 'function') {
+      return component.moduleChange();
+    } else {
+      return of(true);
+    }
+  }
+}

+ 13 - 5
projects/textbook/src/modules/nav-admin/user-edit/user-edit.component.html

@@ -1,7 +1,9 @@
 <nz-page-header>
   <nz-breadcrumb nz-page-header-breadcrumb>
     <nz-breadcrumb-item>用户管理</nz-breadcrumb-item>
-    <nz-breadcrumb-item><a (click)="goUserList()">用户列表</a></nz-breadcrumb-item>
+    <nz-breadcrumb-item
+      ><a (click)="goUserList()">用户列表</a></nz-breadcrumb-item
+    >
     <nz-breadcrumb-item><a>用户详情</a></nz-breadcrumb-item>
   </nz-breadcrumb>
   <nz-page-header-content>
@@ -136,7 +138,9 @@
             <div class="value pd4-8">{{ user?.get("loginsCount") || "-" }}</div>
           </div>
           <div nz-col nzSpan="8">
-            <div class="lable">用户类型 <span style="color: #e8353e">*</span></div>
+            <div class="lable">
+              用户类型 <span style="color: #e8353e">*</span>
+            </div>
             <nz-select
               style="width: 80%"
               nzShowSearch
@@ -182,7 +186,9 @@
       <div class="fill-template">
         <div nz-row>
           <div nz-col nzSpan="8">
-            <div class="lable">手机号 <span style="color: #e8353e">*</span></div>
+            <div class="lable">
+              手机号 <span style="color: #e8353e">*</span>
+            </div>
             <div class="value">
               <input
                 nz-input
@@ -223,7 +229,9 @@
         </div>
         <div nz-row>
           <div nz-col nzSpan="8">
-            <div class="lable">用户名 <span style="color: #e8353e">*</span></div>
+            <div class="lable">
+              用户名 <span style="color: #e8353e">*</span>
+            </div>
             <div class="value">
               <input
                 nz-input
@@ -509,4 +517,4 @@
 </nz-modal>
 <div class="loading" [hidden]="!loading">
   <nz-spin nzSimple [nzSize]="'large'"></nz-spin>
-</div>
+</div>

+ 75 - 8
projects/textbook/src/modules/nav-admin/user-edit/user-edit.component.ts

@@ -19,7 +19,7 @@ import { NzSelectModule } from 'ng-zorro-antd/select';
 import { MatButtonModule } from '@angular/material/button';
 import { provinces } from '../../../services/provinces';
 import { NzModalService } from 'ng-zorro-antd/modal';
-
+import { Observable, of } from 'rxjs';
 @Component({
   selector: 'app-user-edit',
   templateUrl: './user-edit.component.html',
@@ -94,12 +94,15 @@ export class UserEditComponent implements OnInit {
     private modal: NzModalService
   ) {}
 
-  goUserList(){
-    this.router.navigate(["/nav-admin/manage/user"],{
-      queryParams:{page:this.route.snapshot.queryParamMap.get("page")}
-    })
+  goUserList() {
+    this.router.navigate(['/nav-admin/manage/user'], {
+      queryParams: { page: this.route.snapshot.queryParamMap.get('page') },
+    });
   }
   ngOnInit() {
+    // window.onbeforeunload = (event) => {
+    //   (event || window.event).returnValue = '还未保存是否离开';
+    // };
     this.activeRoute.paramMap.subscribe(async (params) => {
       let id = params.get('id');
       console.log(id);
@@ -113,6 +116,7 @@ export class UserEditComponent implements OnInit {
         queryProfile.equalTo('user', id);
         this.profile = await queryProfile.first();
         this.profileJson = this.profile.toJSON();
+        this.userJson.email = this.profileJson.email
         this.userDataJson = {
           companyType: this.profile?.get('companyType'),
           department: this.user.get('department'),
@@ -342,7 +346,7 @@ export class UserEditComponent implements OnInit {
       this.user?.set('phone', this.userJson?.phone);
       this.userJson?.email && this.user?.set('email', this.userJson?.email);
       await this.user.save();
-      
+
       this.profile?.set('companyType', this.userDataJson.companyType);
       this.profile?.set('email', this.userJson.email);
       this.profile?.set('identity', this.profileJson.identity);
@@ -375,10 +379,19 @@ export class UserEditComponent implements OnInit {
     this.userJson.email = this.userJson?.email?.trim();
     this.userJson.phone = this.userJson?.phone?.trim();
     this.userJson.name = this.userJson?.name?.trim();
-    if (!this.userJson?.username || !this.userJson?.name || !this.userJson.phone || !this.userJson?.email) {
+    if (
+      !this.userJson?.username ||
+      !this.userJson?.name ||
+      !this.userJson.phone ||
+      !this.userJson?.email
+    ) {
       this.message.warning('请填写必填项');
       return;
     }
+    if (!this.userDataJson?.department) {
+      this.message.error('请选择所属部门');
+      return;
+    }
     if (!this.profileJson.identity) {
       this.message.error('请选择人员类型');
       return;
@@ -394,10 +407,64 @@ export class UserEditComponent implements OnInit {
       this.message.error('邮箱格式有误');
       return;
     }
-    if (this.userJson.phone != this.user.get('phone') && !(await this.tbookSer.userFind(this.userJson.phone))) {
+    if (
+      this.userJson.phone != this.user.get('phone') &&
+      !(await this.tbookSer.userFind(this.userJson.phone))
+    ) {
       this.message.error('手机号已存在');
       return;
     }
     return true;
   }
+  //页面数据变化时
+  vrifly: boolean = false;
+  moduleChange(): Observable<boolean> {
+    let a =
+      this.userJson.username != this.user.get('username') ||
+      this.userJson.name != this.user.get('name') ||
+      this.userJson.email != this.profile.get('email') ||
+      this.userJson.phone != this.user.get('phone');
+    let b =
+      this.profileJson.identity != this.profile.get('identity') ||
+      this.profileJson.telephone != this.profile.get('telephone') ||
+      this.profileJson.province != this.profile.get('province') ||
+      this.profileJson.departmentName != this.profile.get('departmentName') ||
+      this.profileJson.postName != this.profile.get('postName') ||
+      this.profileJson.majorSubject != this.profile.get('majorSubject');
+    console.log(a, b);
+    if (
+      a ||
+      b ||
+      this.userDataJson.companyType != this.profile?.get('companyType')
+    ) {
+      if (this.vrifly) return of(this.vrifly);
+      this.updateCanDeActivate();
+      return of(false);
+    }
+    return of(true);
+  }
+  //提示保存
+  updateCanDeActivate() {
+    new Promise((result) => {
+      this.modal.confirm({
+        nzTitle: '离开当前页面?',
+        nzContent: '<p>当前编辑未保存,是否保存?</p>',
+        nzOkText: '保存',
+        nzOkType: 'primary',
+        nzOkDanger: true,
+        nzClosable: false,
+        nzMaskClosable: false,
+        nzOnOk: async () => {
+          await this.updateUserJson();
+          this.goUserList();
+          result(true);
+        },
+        nzCancelText: '取消',
+        nzOnCancel: () => {
+          this.vrifly = true;
+          this.goUserList();
+        },
+      });
+    });
+  }
 }

+ 40 - 17
projects/textbook/src/modules/nav-province-contact/page-process/page-process.component.ts

@@ -8,6 +8,7 @@ import Parse from 'parse';
 import { CompTableListComponent } from '../../../app/comp-table/comp-table-list/comp-table-list.component';
 import { ProcessCreateComponent } from './process-create/process-create.component';
 import { TextbookComponent } from '../../../app/textbook/textbook.component';
+import { textbookServer } from '../../../services/textbook';
 @Component({
   selector: 'app-page-process',
   templateUrl: './page-process.component.html',
@@ -19,11 +20,11 @@ import { TextbookComponent } from '../../../app/textbook/textbook.component';
     NzTabsModule,
     ProcessCreateComponent,
     CompTableListComponent,
-    TextbookComponent
+    TextbookComponent,
   ],
   standalone: true,
 })
-export class PageProcessComponent  implements OnInit {
+export class PageProcessComponent implements OnInit {
   active: number = 0;
   eduProcess: Parse.Object | undefined;
 
@@ -32,29 +33,30 @@ export class PageProcessComponent  implements OnInit {
   beforeFilterObj: any = {
     showMore: true, //显示更多字段
     isCheck: true,
-    noStared:true,
-    status: ['200','201','400'],
+    noStared: true,
+    status: ['200'],
     btns: {
-      reject: true, //退回教材
-      star: true, //移除推荐
-      export:true
+      // reject: true, //退回教材
+      // star: true, //移除推荐
+      export: true,
     },
   };
   //已加入推荐
   afterFilterObj: any = {
     showMore: true, //显示更多字段
     isCheck: true,
-    status: ['200','201','400'],
+    status: ['200', '201', '400'],
     btns: {
-      verify:true,
-      remove: true, //移除推荐
-      export:true
+      // verify:true,
+      // remove: true, //移除推荐
+      export: true,
     },
   };
 
   constructor(
-    private activeRoute:ActivatedRoute,
-    private router: Router,
+    private activeRoute: ActivatedRoute,
+    public tbookSer: textbookServer,
+    private router: Router
   ) {
     this.user = Parse.User.current();
   }
@@ -66,12 +68,33 @@ export class PageProcessComponent  implements OnInit {
         let query = new Parse.Query('EduProcess');
         query.include('branch', 'department');
         query.equalTo('objectId', id);
-        this.eduProcess = await query.first();
+        let res = await query.first();
+        if (res?.id) {
+          let vrifly = await this.tbookSer.getEduProcess(
+            res.get('department').id
+          );
+          if (vrifly) {
+            this.beforeFilterObj.btns = {
+              reject: true, //退回教材
+              star: true, //移除推荐
+              export: true,
+            };
+            this.afterFilterObj.btns = {
+              verify: true,
+              remove: true, //移除推荐
+              export: true,
+            };
+          }
+        }
+        this.eduProcess = res;
       }
-    })
+    });
   }
 
-  onCreateProcess(){
-    this.router.navigate(['/nav-admin/manage/process/create',{cid:this.eduProcess?.id}])
+  onCreateProcess() {
+    this.router.navigate([
+      '/nav-admin/manage/process/create',
+      { cid: this.eduProcess?.id },
+    ]);
   }
 }

+ 31 - 17
projects/textbook/src/modules/nav-province-contact/page-textbook/page-textbook.component.ts

@@ -49,22 +49,22 @@ export class PageTextbookComponent implements OnInit {
     noStared: true,
     status: ['200'],
     btns: {
-      reject: true, //退回教材
-      star: true, //移除推荐
-      export:true
+      // reject: true, //退回教材
+      // star: true, //移除推荐
+      export: true,
     },
   };
   //已加入推荐
   afterFilterObj: any = {
     showMore: true, //显示更多字段
     isCheck: true,
-    status: ['200','201','400'],
+    status: ['200', '201', '400'],
     btns: {
-      remove: true, //移除推荐
-      export:true
+      // remove: true, //移除推荐
+      export: true,
     },
   };
-  eduProcess?:Parse.Object
+  eduProcess?: Parse.Object;
 
   constructor(
     public tbookSer: textbookServer,
@@ -86,9 +86,9 @@ export class PageTextbookComponent implements OnInit {
   }
 
   ngOnInit(): void {
-    this.getProcess()
+    this.getProcess();
   }
-  async getProcess(){
+  async getProcess() {
     let parentMap = await this.tbookSer.formatNode(
       this.tbookSer?.profile?.user?.department?.objectId
     );
@@ -100,7 +100,19 @@ export class PageTextbookComponent implements OnInit {
     query.notEqualTo('isDeleted', true);
     // query.notEqualTo('status', '100');
     let res = await query.first();
-    this.eduProcess = res
+    let vrifly = await this.tbookSer.getEduProcess(parentMap[1]?.key);
+    if (vrifly) {
+      this.beforeFilterObj.btns = {
+        reject: true, //退回教材
+        star: true, //移除推荐
+        export: true,
+      };
+      this.afterFilterObj.btns = {
+        remove: true, //移除推荐
+        export: true,
+      };
+    }
+    this.eduProcess = res;
   }
   toUrl(url: string, params?: object) {
     if (params) {
@@ -111,10 +123,12 @@ export class PageTextbookComponent implements OnInit {
   }
   //报送
   async submitted() {
-    if(this.eduProcess?.get('status') == '400'){
-      this.message.warning('已提交报送,无需重复提交')
-      this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`)
-      return
+    if (this.eduProcess?.get('status') == '400') {
+      this.message.warning('已提交报送,无需重复提交');
+      this.toUrl(
+        `/nav-province-contact/manage/submitted/${this.eduProcess?.id}`
+      );
+      return;
     }
     this.eduProcess?.set('status', '400');
     this.eduProcess?.set('releaseDate', new Date());
@@ -132,7 +146,7 @@ export class PageTextbookComponent implements OnInit {
     ]);
     let count = await query.count();
     if (count > this.eduProcess?.get('num')) {
-      this.message.warning('当前推荐教材数量已超额')
+      this.message.warning('当前推荐教材数量已超额');
       return;
     }
     await this.eduProcess?.save();
@@ -141,7 +155,7 @@ export class PageTextbookComponent implements OnInit {
       item.set('status', '400');
       await item.save();
     }
-    this.message.success('提交成功')
-    this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`)
+    this.message.success('提交成功');
+    this.toUrl(`/nav-province-contact/manage/submitted/${this.eduProcess?.id}`);
   }
 }

+ 2 - 2
projects/textbook/src/modules/nav-province-contact/submitted/export-file/export-file.component.html

@@ -17,11 +17,11 @@
   <div class="left">
     <div class="row">
       <div class="lable">推荐教材</div>
-      <div class="val">{{allCount}}</div>
+      <div class="val">{{otherCount}}</div>
     </div>
     <div class="row">
       <div class="lable">申报限额外推荐教材</div>
-      <div class="val">{{otherCount}}</div>
+      <div class="val">{{allCount - otherCount}}</div>
     </div>
     <div class="row">
       <div class="lable">推荐表总份数</div>

+ 113 - 104
projects/textbook/src/services/textbook.ts

@@ -9,9 +9,7 @@ export class textbookServer {
   company: string = localStorage.getItem('company')!;
   theme: boolean = false; //深色主题模式
   profile: any = JSON.parse(localStorage.getItem('profile')!);
-  constructor(
-    private http:HttpClient
-  ) {}
+  constructor(private http: HttpClient) {}
   authMobile(mobile: string): boolean {
     let a = /^1[3456789]\d{9}$/;
     if (!String(mobile).match(a)) {
@@ -59,14 +57,14 @@ export class textbookServer {
   //格式化链
   async formatNode(id: string): Promise<Array<any>> {
     let query = new Parse.Query('Department');
-    query.select('name', 'parent', 'hasChildren','type','branch');
+    query.select('name', 'parent', 'hasChildren', 'type', 'branch');
     let r = await query.get(id);
     let arr = [
       {
         title: r.get('name'),
         key: r.id,
         hasChildren: r.get('hasChildren'), //是否是最下级
-        type:r.get('type'),
+        type: r.get('type'),
         branch: r?.get('branch'),
         parent: r?.get('parent')?.id, //上级
       },
@@ -77,37 +75,39 @@ export class textbookServer {
     return arr;
   }
   //获取下级所有部门
-  async getChild(id:string):Promise<Array<string>>{
+  async getChild(id: string): Promise<Array<string>> {
     console.log(id);
-    let arr:Array<string> = [id]
-    let query = new Parse.Query('Department')
-    query.equalTo('parent',id)
-    query.notEqualTo('isDeleted',true)
-    query.select('id','hasChildren')
-    query.limit(200)
-    let r = await query.find()
+    let arr: Array<string> = [id];
+    let query = new Parse.Query('Department');
+    query.equalTo('parent', id);
+    query.notEqualTo('isDeleted', true);
+    query.select('id', 'hasChildren');
+    query.limit(200);
+    let r = await query.find();
     for (let index = 0; index < r.length; index++) {
-      if(r[index].get('hasChildren')){
-        let child:Array<string> = await this.getChild(r[index].id)
-        arr.push(...child)
-      }else{
-        arr.push(r[index].id)
+      if (r[index].get('hasChildren')) {
+        let child: Array<string> = await this.getChild(r[index].id);
+        arr.push(...child);
+      } else {
+        arr.push(r[index].id);
       }
     }
-    return Array.from(new Set([...arr]))
+    return Array.from(new Set([...arr]));
   }
-  userFind(phone:string){
-    return new Promise((res)=>{
-      Parse.Cloud.run('userFind',{mobile:phone}).then(data=>{
-        if(data){
-          res(false)
-        }else{
-          res(true)
-        }
-      }).catch(()=> res(true))
-    })
+  userFind(phone: string) {
+    return new Promise((res) => {
+      Parse.Cloud.run('userFind', { mobile: phone })
+        .then((data) => {
+          if (data) {
+            res(false);
+          } else {
+            res(true);
+          }
+        })
+        .catch(() => res(true));
+    });
   }
-  
+
   /* 批量预设(临时) */
   async saveProcess() {
     // let count = 0;
@@ -123,87 +123,96 @@ export class textbookServer {
     //   count++
     //   console.log(count);
     // }
-  //   let query = new Parse.Query('Department')
-  //   query.equalTo('parent',null)
-  //   query.equalTo('name','省级教育行政部门')
-  //   let r = await query.find()
-  //   for (let index = 0; index < r.length; index++) {
-  //     const element = r[index];
-  //     let queryPareet = new Parse.Query('Department')
-  //     queryPareet.equalTo('parent', element.id)
-  //     queryPareet.limit(2000)
-  //     let prents = await queryPareet.find()
-  //     for (let index = 0; index < prents.length; index++) {
-  //       let item = prents[index];
-  //       let obj = Parse.Object.extend('EduProcess');
-  //       let eduProcess = new obj()
-  //       eduProcess?.set('company', {
-  //         __type: 'Pointer',
-  //         className: 'Company',
-  //         objectId: 'RbIKpmuaMC',
-  //       });
-  //       eduProcess?.set('branch', {
-  //         __type: 'Pointer',
-  //         className: 'Department',
-  //         objectId:element.id,
-  //       });
-  //       eduProcess?.set('department', {
-  //         __type: 'Pointer',
-  //         className: 'Department',
-  //         objectId: item.id,
-  //       });
-  //       eduProcess?.set('name', item.get('name'));
-  //       eduProcess?.set('desc', item.get('name') + '流程');
-  //       eduProcess?.set('code', item.get('code') || item.id);
-  //       if(element.get('name') == '全国出版单位') {
-  //         eduProcess?.set('startDate', new Date('2024-07-20 18:00'));
-  //         eduProcess?.set('deadline', new Date('2024-09-20 18:00'));
-  //       }
-  //       await eduProcess?.save();
-  //       count ++
-  //       console.log(count);
-  //     }
-  //   }
-}
-async tbookExportReport(options:{processId?:string,bookList?:any[]}){
-
-  let url = Parse.serverURL + "/api/tbook/export"
-  // console.log(url)
-  let response = await fetch(url, {
-    method: 'POST',
-    headers: {
-        'Content-Type': 'application/json',
-        'X-Parse-Application-Id': 'edu-textbook'
-    },
-    body: JSON.stringify(options)
-  })
-  let result = await response.json()
-  let zipUrl = result?.result?.zipUrl;
-  if(result?.code==200){
-    zipUrl = zipUrl.replaceAll("http://","https://");
-    const a = document.createElement('a'); // 创建一个&lt;a&gt;元素
-    a.href = zipUrl; // 设置链接的href属性为要下载的文件的URL
-    a.download = '报送流程'; // 设置下载文件的名称
-    document.body.appendChild(a); // 将&lt;a&gt;元素添加到文档中
-    a.click(); // 模拟点击&lt;a&gt;元素
-    document.body.removeChild(a); // 下载后移除&lt;a&gt;元素
+    //   let query = new Parse.Query('Department')
+    //   query.equalTo('parent',null)
+    //   query.equalTo('name','省级教育行政部门')
+    //   let r = await query.find()
+    //   for (let index = 0; index < r.length; index++) {
+    //     const element = r[index];
+    //     let queryPareet = new Parse.Query('Department')
+    //     queryPareet.equalTo('parent', element.id)
+    //     queryPareet.limit(2000)
+    //     let prents = await queryPareet.find()
+    //     for (let index = 0; index < prents.length; index++) {
+    //       let item = prents[index];
+    //       let obj = Parse.Object.extend('EduProcess');
+    //       let eduProcess = new obj()
+    //       eduProcess?.set('company', {
+    //         __type: 'Pointer',
+    //         className: 'Company',
+    //         objectId: 'RbIKpmuaMC',
+    //       });
+    //       eduProcess?.set('branch', {
+    //         __type: 'Pointer',
+    //         className: 'Department',
+    //         objectId:element.id,
+    //       });
+    //       eduProcess?.set('department', {
+    //         __type: 'Pointer',
+    //         className: 'Department',
+    //         objectId: item.id,
+    //       });
+    //       eduProcess?.set('name', item.get('name'));
+    //       eduProcess?.set('desc', item.get('name') + '流程');
+    //       eduProcess?.set('code', item.get('code') || item.id);
+    //       if(element.get('name') == '全国出版单位') {
+    //         eduProcess?.set('startDate', new Date('2024-07-20 18:00'));
+    //         eduProcess?.set('deadline', new Date('2024-09-20 18:00'));
+    //       }
+    //       await eduProcess?.save();
+    //       count ++
+    //       console.log(count);
+    //     }
+    //   }
   }
-  // console.log(result)
-  return result
- 
-  
-  Parse.Cloud.run('tbookExportReport', options).then(
-    (data) => {
+  async tbookExportReport(options: { processId?: string; bookList?: any[] }) {
+    let url = Parse.serverURL + '/api/tbook/export';
+    // console.log(url)
+    let response = await fetch(url, {
+      method: 'POST',
+      headers: {
+        'Content-Type': 'application/json',
+        'X-Parse-Application-Id': 'edu-textbook',
+      },
+      body: JSON.stringify(options),
+    });
+    let result = await response.json();
+    let zipUrl = result?.result?.zipUrl;
+    if (result?.code == 200) {
+      zipUrl = zipUrl.replaceAll('http://', 'https://');
+      const a = document.createElement('a'); // 创建一个&lt;a&gt;元素
+      a.href = zipUrl; // 设置链接的href属性为要下载的文件的URL
+      a.download = '报送流程'; // 设置下载文件的名称
+      document.body.appendChild(a); // 将&lt;a&gt;元素添加到文档中
+      a.click(); // 模拟点击&lt;a&gt;元素
+      document.body.removeChild(a); // 下载后移除&lt;a&gt;元素
+    }
+    // console.log(result)
+    return result;
+
+    Parse.Cloud.run('tbookExportReport', options).then((data) => {
       console.log(data);
       let url = data.zipUrl;
-      url = url.replaceAll("http://","https://");
+      url = url.replaceAll('http://', 'https://');
       const a = document.createElement('a'); // 创建一个&lt;a&gt;元素
       a.href = url; // 设置链接的href属性为要下载的文件的URL
       a.download = '报送流程'; // 设置下载文件的名称
       document.body.appendChild(a); // 将&lt;a&gt;元素添加到文档中
       a.click(); // 模拟点击&lt;a&gt;元素
       document.body.removeChild(a); // 下载后移除&lt;a&gt;元素
-    }
-  );
-}
+    });
+  }
+
+  async getEduProcess(id: string): Promise<string | undefined> {
+    if (!id) return;
+    let query = new Parse.Query('EduProcess');
+    query.equalTo('department', id);
+    query.lessThanOrEqualTo('startDate', new Date());
+    query.greaterThan('deadline', new Date());
+    query.notEqualTo('isDeleted', true);
+    query.containedIn('status', ['200', '300']);
+    query.select('objectId');
+    let res = await query.first();
+    return res?.id;
+  }
 }