소스 검색

新增单位工作联系人上传教材文件功能

cehn 1 개월 전
부모
커밋
9266669945

+ 1 - 1
projects/textbook/src/app/comp-manage/comp-manage.component.ts

@@ -177,7 +177,7 @@ export class CompManageComponent implements OnInit {
 
   ngOnInit() {
     console.log(this.tbookSer.profile.identity);
-    if (this.tbookSer.profile.identity == '工作联系人') {
+    if (this.tbookSer.profile.identity == '工作联系人' && this.tbookSer.profile.user?.department?.branch == '出版单位') {
       this.optionsMap['工作联系人'][0].child.push({
         name: '本社教材源文件',
         path: '/nav-province-contact/manage/collect',

+ 27 - 1
projects/textbook/src/modules/nav-admin/components/collect-textbook/collect-textbook.component.ts

@@ -248,8 +248,34 @@ export class CollectTextbookComponent implements OnInit {
     this.isVisible = true;
   }
   //短信提醒
-  onEmitMsg(data:Parse.Object){
+  async onEmitMsg(data:Parse.Object){
     console.log(data);
+    let unitList:Array<string> = []
+    data?.get('childrens')?.forEach((item:Parse.Object) => {
+      console.log(item);
+      unitList.push(item?.get('editionUnit'))
+    });
+    let query = new Parse.Query('EduProcess')
+    query.containedIn('name',[...new Set(unitList)])
+    query.notEqualTo('isDeleted',true)
+    query.select('profileSubmitted')
+    query.include('profileSubmitted.user')
+    let r = await query.find()
+    let users = r?.map(item=>{
+      console.log(item);
+      return item?.get('profileSubmitted')?.get('user')?.get('phone')
+    })
+    console.log(users);
+    this.modal.confirm({
+      nzTitle: '短信提醒',
+      nzContent: '是否短信通知单位工作联系人审核上传文件?',
+      nzOkText: '确定',
+      nzOkType: 'primary',
+      nzOkDanger: false,
+      nzOnOk: () => console.log('OK'),
+      nzCancelText: '取消',
+      nzOnCancel: () => console.log('Cancel')
+    });
   }
 
   //打开编辑收集文件弹窗

+ 29 - 8
projects/textbook/src/modules/nav-province-contact/collect-file/collect-file.component.ts

@@ -256,16 +256,37 @@ export class CollectFileComponent implements OnInit {
   async saveCollect(type: string): Promise<any> {
     console.log(type);
     this.btnLoading = true;
-    let isVrifly = await this.saveEduTextbookVolume(type);
-    if (!isVrifly) {
+    if (type == 'sbmit') {
+      this.modal.confirm({
+        nzTitle: '温馨提示',
+        nzContent: '由于“教材资源上传”工作阶段持续时间较短,教材资源一经上传将无法撤回或修改,请务必在确认无误之后再上传。',
+        nzOkText: '确定',
+        nzOkType: 'primary',
+        nzOkDanger: false,
+        nzOnOk: async () => {
+          let isVrifly = await this.saveEduTextbookVolume(type);
+          if (!isVrifly) {
+            this.btnLoading = false;
+            this.msg.warning('已保存,填写信息不完整');
+            return;
+          }
+          this.msg.success('提交成功');
+          this.btnLoading = false;
+          this.isVisible = false;
+          this.getTextbook(this.searchValue);
+        },
+        nzCancelText: '取消',
+        nzOnCancel: () => {
+          this.btnLoading = false;
+        },
+      });
+    } else {
+      await this.saveEduTextbookVolume(type);
+      this.msg.success('保存成功');
       this.btnLoading = false;
-      this.msg.warning('已保存,填写信息不完整');
-      return;
+      this.isVisible = false;
+      this.getTextbook(this.searchValue);
     }
-    this.msg.success(type == 'save' ? '保存成功' : '提交成功');
-    this.btnLoading = false;
-    this.isVisible = false;
-    this.getTextbook(this.searchValue);
   }
 
   /**上传分册数据 */

+ 9 - 125
projects/textbook/src/services/textbook.ts

@@ -275,133 +275,17 @@ export class textbookServer {
     //   }
     // }
     // console.log(count);
-
-    /* 开始时间 */
-    // let query = new Parse.Query('EduTextbook')
-    // // query.equalTo('num',null)
-    // query.notEqualTo('isDeleted',true)
-    // query.notEqualTo('user','6lcsp7jrYP')
-    // // query.select('name','num')
+    // let query = new Parse.Query('EduProcess');
     // query.limit(2000)
-    // query.select('objectId')
-    // let res = await query.find()
-    // console.log(res);
-    // for (let index = 0; index < res.length; index++) {
-    //     const item = res[index]
-    //     // item?.set('startDate', new Date('2024-08-05 8:00'));
-    //     // item?.set('deadline', new Date('2024-09-30 23:59'));
-    //     item.set('isDeleted',true)
-    //     await item.save()
-    //     console.log(count);
-    // }
-
-    /* 修改更新部门名称 */
-    // let list = updateDept.list2
-    // for (let index = 0; index < list.length; index++) {
-    //   const item = list[index]
-    //   let queryPareet = new Parse.Query('Department')
-    //   queryPareet.equalTo('code', item.code)
-    //   queryPareet.select('name')
-    //   let r = await queryPareet.first()
-    //   if(r?.id){
-    //     if(r.get('name') != item.new){
-    //       r.set('name',item.new)
-    //       await r.save()
-    //       let queryEdupro = new Parse.Query('EduProcess')
-    //       queryEdupro.equalTo('department', r.id)
-    //       queryEdupro.select('objectId')
-    //       let eduProcess = await queryEdupro.first()
-    //       eduProcess?.set('name', item.new);
-    //       eduProcess?.set('desc', item.new + '流程');
-    //       await eduProcess?.save()
-    //       count++
-    //       console.log('已修改:',item.old,item.new,count);
-    //     }
-    //   }else{
-    //     console.log('未找到code:',item);
-    //   }
+    // query.select('deadline')
+    // let eduProcess = await query.find()
+    // for (let index = 0; index < eduProcess.length; index++) {
+    //   const item = eduProcess[index];
+    //   item?.set('deadline', new Date('2024-09-30 16:00'));
+    //   await item?.save()
+    //   count++
+    //   console.log(count);
     // }
-
-    /* 批量导入部门 */
-    // let list = updateDept.list3
-    // for (let index = 0; index < list.length; index++) {
-    //   const item = list[index];
-    //   let queryPareet = new Parse.Query('Department')
-    //   queryPareet.equalTo('name', item.name)
-    //   let dep = await queryPareet.first()
-    //   console.log(dep?.get('name'));
-
-    //   // for (let index = 0; index < prents.length; index++) {
-    //   //   let item = prents[index];
-    //     let query = new Parse.Query('EduProcess')
-    //     query.equalTo('department',dep?.id)
-    //     query.notEqualTo('isDeleted',true)
-    //     let eduProcess = await query.first()
-    //     if(!eduProcess?.id){
-    //       console.log('不存在,新建'+dep?.get('name'),addCount);
-    //       let obj = Parse.Object.extend('EduProcess');
-    //       eduProcess = new obj()
-    //     }
-    //     eduProcess?.set('company', {
-    //       __type: 'Pointer',
-    //       className: 'Company',
-    //       objectId: 'RbIKpmuaMC',
-    //     });
-    //     eduProcess?.set('branch', {
-    //       __type: 'Pointer',
-    //       className: 'Department',
-    //       objectId:dep?.get('parent')?.id,
-    //     });
-    //     eduProcess?.set('department', {
-    //       __type: 'Pointer',
-    //       className: 'Department',
-    //       objectId: dep?.id,
-    //     });
-    //     eduProcess?.set('name', dep?.get('name'));
-    //     eduProcess?.set('desc',item.desc ? item.desc : dep?.get('name') + '流程');
-    //     eduProcess?.set('code', dep?.get('code') || dep?.id);
-    //     if(dep?.get('branch') == '出版单位') {
-    //       eduProcess?.set('startDate', new Date('2024-07-20 18:00'));
-    //       eduProcess?.set('deadline', new Date('2024-09-20 18:00'));
-    //     }
-    //     eduProcess?.set('num',item.num)
-    //     eduProcess?.set('status', '200');
-    //     await eduProcess?.save();
-    //     count ++
-    //     console.log('已完成'+dep?.get('name')+'流程');
-    //     console.log(count);
-
-    //   // }
-    // }
-
-    /* 去重出版单位 */
-    let list = updateDept.list4;
-    for (let index = 0; index < list.length; index++) {
-      const item = list[index];
-      let queryPareet = new Parse.Query('Department');
-      queryPareet.equalTo('name', item);
-      queryPareet.descending('createdAt');
-      let dep = await queryPareet.find();
-      for (let j = 0; j < dep.length; j++) {
-        const e = dep[j];
-        let queryEdupro = new Parse.Query('EduProcess');
-        queryEdupro.equalTo('department', e.id);
-        queryEdupro.select('objectId', 'profileSubmitted');
-        queryEdupro.descending('createdAt');
-        let eps = await queryEdupro.find();
-        console.log(eps);
-        if (eps.length > 1) {
-          eps[0].set('isDeleted', true);
-          await eps[0].save();
-        }
-        if (!eps || eps.length == 0) {
-          e.set('isDeleted', true);
-          await e.save();
-          count++;
-        }
-      }
-      console.log(count);
-    }
   }
 
   /* 获取所有未上传签名页附件教材 */