浏览代码

update admin

warrior 7 月之前
父节点
当前提交
fbeb9d0a9e

+ 4 - 20
projects/textbook/src/modules/nav-admin/page-role/page-role.component.ts

@@ -333,7 +333,7 @@ export class PageRoleComponent implements OnInit {
         },
         branch: this.activeDepart.get('branch'),
       };
-      this.parentMap = await this.formatNode(
+      this.parentMap = await this.tbookSer.formatNode(
         this.activeDepart.get('parent')?.id
       );
       if (r?.get('parent')?.get('parent')?.id) {
@@ -350,7 +350,7 @@ export class PageRoleComponent implements OnInit {
       this.radio = this.activatedNode.origin.key
       this.editObject.branch =
         this.activatedNode.origin.branch || this.activatedNode.origin.title;
-      this.parentMap = await this.formatNode(this.activatedNode.origin.key);
+      this.parentMap = await this.tbookSer.formatNode(this.activatedNode.origin.key);
       if (this.activatedNode?.origin.branch) {
         this.parentList = await this.getDepart(
           this.activatedNode?.origin.branch
@@ -361,22 +361,6 @@ export class PageRoleComponent implements OnInit {
     this.editType = type;
     this.isVisible = true;
   }
-  //格式化链
-  async formatNode(id: string): Promise<Array<any>> {
-    let query = new Parse.Query('Department');
-    query.select('name', 'parent');
-    let r = await query.get(id);
-    let arr = [
-      {
-        title: r.get('name'),
-        key: r.id,
-      },
-    ];
-    if (r?.get('parent')) {
-      arr.unshift(...(await this.formatNode(r?.get('parent').id)));
-    }
-    return arr;
-  }
   async onPre(data?: any, index?: number) {
     if (!data) {
       this.parentList = await this.getDepart();
@@ -392,7 +376,7 @@ export class PageRoleComponent implements OnInit {
   async onCheckedDepart(type: string, e: any, checked?: boolean) {
     this.radio = e.key;
     if (type == 'account') this.account.identity = '';
-    this.parentMap = await this.formatNode(e.key);
+    this.parentMap = await this.tbookSer.formatNode(e.key);
     if (checked) {
       // this.editObject.name = e.title
       if (type == 'account' && e.parent) {
@@ -454,7 +438,7 @@ export class PageRoleComponent implements OnInit {
     await this.activeDepart?.save();
     if(!type && this.activeDepart?.id){
       //判断添加的是部门还是单位
-      let leng = await this.formatNode(this.activeDepart.id)
+      let leng = await this.tbookSer.formatNode(this.activeDepart.id)
       if(leng.length > 2){
         console.log(leng.length);
         if(filters.includes(leng[0].title)){

+ 7 - 12
projects/textbook/src/modules/nav-admin/page-user/page-user.component.ts

@@ -79,14 +79,6 @@ export class PageUserComponent implements OnInit {
     private activeRoute: ActivatedRoute
   ) {
     this.user = Parse.User.current();
-    // this.className = this.ProfileList.className;
-    // this.fieldsArray = this.ProfileList.fieldsArray;
-    // this.queryParams = {
-    //   where: {
-    //     // user:this.user?.toPointer(),
-    //     isDeleted: { $ne: true },
-    //   },
-    // };
     if (this.tbookSer.profile.identity != '国家级管理员') {
       this.userType = ['评审专家', '高校联系人', '个人'];
     }
@@ -219,6 +211,7 @@ export class PageUserComponent implements OnInit {
               break;
             case '删除':
               // r?.set('isDeleted', true);
+              this.setOfCheckedId.delete(data.id);
               await data.destroy();
               await r.destroy();
               break;
@@ -243,14 +236,16 @@ export class PageUserComponent implements OnInit {
           this.setOfCheckedId.has(item?.id)
         );
         let deletePromiseList = selectedList.map((item: any) => {
-          return new Promise((resolve) => {
-            // item.set('isDeleted', true);
-            // item.save();
-            item.destroy().then(() => resolve);
+          return new Promise(async (resolve) => {
+            await item.get('user')?.destroy()
+            await item.destroy()
+            resolve(true)
           });
         });
         try {
           await Promise.all(deletePromiseList);
+          this.setOfCheckedId = new Set<string>();
+          this.checkedAll = false
           this.getProfile();
         } catch (err) {}
       },

+ 8 - 8
projects/textbook/src/modules/nav-author/components/attachment/attachment.component.ts

@@ -82,7 +82,7 @@ export class AttachmentComponent implements OnInit {
     // textbookFiles: [
     //   [
     //     {
-    //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+    //       url: '',
     //     },
     //   ],
     //   [Validators.required]
@@ -91,14 +91,14 @@ export class AttachmentComponent implements OnInit {
     selfResults: [
       {
         name: '自查表.pdf',
-        url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+        url: '',
       },
       [Validators.required]
     ],
     expertOpinion: [
       {
         name: '自查表.pdf',
-        url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+        url: '',
       },
       [Validators.required]
     ],
@@ -109,18 +109,18 @@ export class AttachmentComponent implements OnInit {
       [
         {
           name: '材料1.pdf',
-          url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+          url: '',
         },
         {
           name: '材料2.pdf',
-          url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+          url: '',
         },
       ],
     ],
     unitMaterial: [
       {
         name: '承诺意见表.pdf',
-        url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+        url: '',
       },
       [Validators.required]
     ],
@@ -141,7 +141,7 @@ export class AttachmentComponent implements OnInit {
   //     nationality: '', //国籍
   //     reviewFile: {
   //       name: '自查表.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     }, //作者政治审查表/作者签名
   //   },
   // ];
@@ -154,7 +154,7 @@ export class AttachmentComponent implements OnInit {
   //     nationality: '', //国籍
   //     reviewFile: {
   //       name: '审查表.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     }, //作者政治审查表/作者签名
   //   },
   // ];

+ 3 - 29
projects/textbook/src/modules/nav-author/components/basic-in/basic-in.component.ts

@@ -201,9 +201,9 @@ export class BasicInComponent implements OnInit {
       printSum: [this.eduTextbook?.get('printSum') || 0, [Validators.required]],
       importantProject: [this.eduTextbook?.get('importantProject') || '', [Validators.required]],
       importantProjectOther: [this.eduTextbook?.get('importantProjectOther') || ''],
-      approvedImgUrl: [this.eduTextbook?.get('approvedImgUrl') || 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf', [Validators.required]],
-      // copyrightImgUrl: [this.eduTextbook?.get('copyrightImgUrl') || 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf', [Validators.required]],
-      // CIPImgUrl: [this.eduTextbook?.get('CIPImgUrl') || 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf', [Validators.required]],
+      approvedImgUrl: [this.eduTextbook?.get('approvedImgUrl') || '', [Validators.required]],
+      // copyrightImgUrl: [this.eduTextbook?.get('copyrightImgUrl') || '', [Validators.required]],
+      // CIPImgUrl: [this.eduTextbook?.get('CIPImgUrl') || '', [Validators.required]],
     });
     this.onChangeRadio()
   }
@@ -251,32 +251,6 @@ export class BasicInComponent implements OnInit {
   async submitForm(event?: string): Promise<void> {
     console.log(this.validateForm.value);
     if (this.validateForm.valid) {
-      // console.log(this.validateForm.value);
-      // let {
-      //   title,
-      //   ISBN,
-      //   author,
-      //   unit,
-      //   type,
-      //   typeNumber,
-      //   majorPoniter,
-      //   lang,
-      //   authors,
-      //   editor,
-      //   approval,
-      //   editionUnit,
-      //   editionFirst,
-      //   carrierShape,
-      //   editionDate,
-      //   editionNumber,
-      //   printDate,
-      //   printNumber,
-      //   printSum,
-      //   importantProject,
-      //   importantProjectOther,
-      //   copyrightImgUrl,
-      //   CIPImgUrl,
-      // } = this.validateForm.value
       let params = this.validateForm.value
       if(event == 'next'){
         await this.saveEduTextbook(params, this.validateForm.valid)

+ 10 - 10
projects/textbook/src/modules/nav-author/textbook-details/textbook-details.component.ts

@@ -130,11 +130,11 @@ export class TextbookDetailsComponent implements OnInit {
   //     //附件教材
   //     {
   //       name: '汉语版.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     },
   //     {
   //       name: '维语版.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     },
   //   ],
   //   links: [
@@ -152,34 +152,34 @@ export class TextbookDetailsComponent implements OnInit {
   //       reviewFile: {
   //         //作者政治审查表
   //         name: '维语版.pdf',
-  //         url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //         url: '',
   //       },
   //     },
   //   ],
   //   selfResults: {
   //     //图书编校质量自查结果记录表
   //     name: '自查表.pdf',
-  //     url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //     url: '',
   //   },
   //   //专家审核意见表
   //   expertOpinion:{
   //     name: '意见表.pdf',
-  //     url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //     url: '',
   //   },
   //   //教材使用情况证明材料
   //   evidence:{
   //     name: '材料.pdf',
-  //     url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //     url: '',
   //   },
   //   //其他材料
   //   moreMaterial:[
   //     {
   //       name: '材料1.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     },
   //     {
   //       name: '材料2.pdf',
-  //       url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //       url: '',
   //     },
   //   ],
   //   //所有作者签名&教材作者诚信承诺
@@ -192,14 +192,14 @@ export class TextbookDetailsComponent implements OnInit {
   //       reviewFile: {
   //         //作者政治审查表/作者签名
   //         name: '曹春海签名.pdf',
-  //         url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //         url: '',
   //       },
   //     },
   //   ],
   //   //申报单位承诺意见材料
   //   unitMaterial:{
   //     name: '承诺意见表.pdf',
-  //     url: 'https://www.jyvtc.edu.cn/yssj/resource/cms/2022/01/2022010610314324023.pdf',
+  //     url: '',
   //   },
   // };
   constructor(private router: Router, private activeRoute: ActivatedRoute) {}

+ 4 - 21
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.ts

@@ -340,7 +340,7 @@ export class PageRoleComponent implements OnInit {
         },
         branch: this.activeDepart.get('branch'),
       };
-      this.parentMap = await this.formatNode(
+      this.parentMap = await this.tbookSer.formatNode(
         this.activeDepart.get('parent')?.id
       );
       if (this.activatedNode?.parentNode?.origin?.parentNode?.origin.key) {
@@ -356,7 +356,7 @@ export class PageRoleComponent implements OnInit {
       };
       this.editObject.branch =
         this.activatedNode.origin.branch || this.activatedNode.origin.title;
-      this.parentMap = await this.formatNode(this.activatedNode.origin.key);
+      this.parentMap = await this.tbookSer.formatNode(this.activatedNode.origin.key);
       if (this.activatedNode?.parentNode?.origin.key) {
         this.parentList = await this.getDepart(
           this.activatedNode.parentNode.origin.key
@@ -367,23 +367,6 @@ export class PageRoleComponent implements OnInit {
     this.editType = type;
     this.isVisible = true;
   }
-  //格式化链
-  async formatNode(id: string): Promise<Array<any>> {
-    let query = new Parse.Query('Department');
-    query.select('name', 'parent', 'hasChildren');
-    let r = await query.get(id);
-    let arr = [
-      {
-        title: r.get('name'),
-        key: r.id,
-        hasChildren: r.get('hasChildren'), //是否是最下级
-      },
-    ];
-    if (r?.get('parent')) {
-      arr.unshift(...(await this.formatNode(r?.get('parent').id)));
-    }
-    return arr;
-  }
   async onPre(data?: any, index?: number) {
     console.log(data);
     if (!data?.key || !data.hasChildren) {
@@ -400,7 +383,7 @@ export class PageRoleComponent implements OnInit {
     this.radio = e.key;
     console.log(e);
     if (type == 'account') this.account.identity = '';
-    this.parentMap = await this.formatNode(e.key);
+    this.parentMap = await this.tbookSer.formatNode(e.key);
     let index = this.parentMap.findIndex(
       (item) => this.tbookSer.profile.user.department?.objectId == item.key
     );
@@ -467,7 +450,7 @@ export class PageRoleComponent implements OnInit {
     if(this.activeDepart?.id){
       //判断添加的是部门还是单位
       let filters = ['出版单位','教育部直属高校']
-      let leng = await this.formatNode(this.activeDepart.id)
+      let leng = await this.tbookSer.formatNode(this.activeDepart.id)
       if(leng.length > 2){
         console.log(leng.length);
         if(filters.includes(leng[0].title)){

+ 47 - 23
projects/textbook/src/services/textbook.ts

@@ -1,16 +1,15 @@
-import { Injectable } from "@angular/core";
-import Parse from "parse";
-import { HttpClient } from "@angular/common/http";
+import { Injectable } from '@angular/core';
+import Parse from 'parse';
+import { HttpClient } from '@angular/common/http';
 
 @Injectable({
-  providedIn: "root",
+  providedIn: 'root',
 })
 export class textbookServer {
-  company: string = localStorage.getItem("company")!;
+  company: string = localStorage.getItem('company')!;
   theme: boolean = false; //深色主题模式
-  profile:any = JSON.parse(localStorage.getItem('profile')!)
-  constructor(private http: HttpClient) {
-  }
+  profile: any = JSON.parse(localStorage.getItem('profile')!);
+  constructor(private http: HttpClient) {}
   authMobile(mobile: string): boolean {
     let a = /^1[3456789]\d{9}$/;
     if (!String(mobile).match(a)) {
@@ -18,33 +17,58 @@ export class textbookServer {
     }
     return true;
   }
-  randomPassword():string {
+  randomPassword(): string {
     let sCode =
       'A,B,C,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,W,X,Y,Z,1,2,3,4,5,6,7,8,9,0,q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m';
     let aCode = sCode.split(',');
     let aLength = aCode.length; //获取到数组的长度
-    let str = []
+    let str = [];
     for (let i = 0; i <= 16; i++) {
       let j = Math.floor(Math.random() * aLength); //获取到随机的索引值
       let txt = aCode[j]; //得到随机的一个内容
-      str.push(txt)
+      str.push(txt);
     }
-    return str.join('')
+    return str.join('');
   }
 
-  formatTime(fmt:string, date1:Date) {
+  formatTime(fmt: string, date1: Date) {
     let ret;
     let date = new Date(date1);
-    const opt:any = {
-        "Y+": date.getFullYear().toString(),   // 年
-        "m+": (date.getMonth() + 1).toString(),   // 月
-        "d+": date.getDate().toString(),   // 日
-        "H+": date.getHours().toString(),   // 时
-        "M+": date.getMinutes().toString(),   // 分
-        "S+": date.getSeconds().toString(),   // 秒
-        // 有其他格式化字符需求可以继续添加,必须转化成字符串
+    const opt: any = {
+      'Y+': date.getFullYear().toString(), // 年
+      'm+': (date.getMonth() + 1).toString(), // 月
+      'd+': date.getDate().toString(), // 日
+      'H+': date.getHours().toString(), // 时
+      'M+': date.getMinutes().toString(), // 分
+      'S+': date.getSeconds().toString(), // 秒
+      // 有其他格式化字符需求可以继续添加,必须转化成字符串
     };
-    for (let k in opt) { ret = new RegExp("(" + k + ")").exec(fmt); if (ret) { fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0")); } }
+    for (let k in opt) {
+      ret = new RegExp('(' + k + ')').exec(fmt);
+      if (ret) {
+        fmt = fmt.replace(
+          ret[1],
+          ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, '0')
+        );
+      }
+    }
     return fmt;
-}
+  }
+  //格式化链
+  async formatNode(id: string): Promise<Array<any>> {
+    let query = new Parse.Query('Department');
+    query.select('name', 'parent', 'hasChildren');
+    let r = await query.get(id);
+    let arr = [
+      {
+        title: r.get('name'),
+        key: r.id,
+        hasChildren: r.get('hasChildren'), //是否是最下级
+      },
+    ];
+    if (r?.get('parent')) {
+      arr.unshift(...(await this.formatNode(r?.get('parent').id)));
+    }
+    return arr;
+  }
 }