Browse Source

update admin

warrior 7 months ago
parent
commit
beefb59039

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

@@ -34,11 +34,11 @@ export class CompManageComponent implements OnInit {
             path:"/nav-admin/manage/process",
             id:'1-1',
           },
-          {
-            name:'全部教材',
-            path:'/nav-admin/manage/textbook',
-            id:'1-2',
-          },
+          // {
+          //   name:'全部教材',
+          //   path:'/nav-admin/manage/textbook',
+          //   id:'1-2',
+          // },
         ]
       },
       {
@@ -86,11 +86,11 @@ export class CompManageComponent implements OnInit {
             path:"/nav-province-contact/manage/process",
             id:'1-1',
           },
-          {
-            name:'全部教材',
-            path:'/nav-province-contact/manage/textbook',
-            id:'1-2',
-          },
+          // {
+          //   name:'全部教材',
+          //   path:'/nav-province-contact/manage/textbook',
+          //   id:'1-2',
+          // },
         ]
       },
       {
@@ -111,30 +111,30 @@ export class CompManageComponent implements OnInit {
       },
     ],
     "高校联系人":[
+      // {
+      //   id:'1',
+      //   name:'教材申报',
+      //   child:[
+      //     {
+      //       id:'1-1',
+      //       name:'全部教材',
+      //       path:'/nav-province-school-contact/manage/textbook',
+      //     }
+      //   ]
+      // },
       {
         id:'1',
-        name:'教材申报',
-        child:[
-          {
-            id:'1-1',
-            name:'全部教材',
-            path:'/nav-province-school-contact/manage/textbook',
-          }
-        ]
-      },
-      {
-        id:'2',
         name:'用户管理',
         child:[
           {
-            id:'2-1',
+            id:'1-1',
             name:'用户列表',
             path:'/nav-province-school-contact/manage/user',
           },
           {
             name:'申报单位管理',
             path:"/nav-province-school-contact/manage/role",
-            id:'2-2',
+            id:'1-2',
           },
         ]
       },

+ 33 - 13
projects/textbook/src/app/textbook/textbook.component.html

@@ -15,9 +15,12 @@
       ></ng-template>
     </div>
     @if (filterObj?.btns?.verify && count != 0) {
-      <div class="sbt" (click)="toUrl('/nav-province-contact/manage/submitted/'+eduProcessId)">
-        提交推荐教材列表
-      </div>
+    <div
+      class="sbt"
+      (click)="toUrl('/nav-province-contact/manage/submitted/' + eduProcessId)"
+    >
+      提交推荐教材列表
+    </div>
     }
   </div>
   <nz-table
@@ -45,11 +48,16 @@
           nzLabel="Select all"
           (nzCheckedChange)="onAllChecked($event)"
         ></th>
+        @if (!filterObj?.btns?.submit) {
         <th nzEllipsis nzWidth="80px">申报编号</th>
+        }
+        <th nzEllipsis nzWidth="120px">教材名称</th>
+        }@else if(filterObj?.btns?.submit){
+        <th nzEllipsis nzLeft nzWidth="120px">教材名称</th>
         }@else {
         <th nzEllipsis nzWidth="80px" nzLeft>申报编号</th>
-        }
         <th nzEllipsis nzWidth="120px">教材名称</th>
+        }
         <th nzEllipsis nzWidth="50px">册数</th>
         <th nzEllipsis nzWidth="120px">第一主编/作者</th>
         <th nzEllipsis nzWidth="80px">所属单位</th>
@@ -71,22 +79,32 @@
           [nzChecked]="setOfCheckedId.has(data.id)"
           (nzCheckedChange)="onItemChecked(data.id, $event)"
         ></td>
+        @if (!filterObj?.btns?.submit) {
         <td nzEllipsis class="activeTd" (click)="toUrl(path + '/' + data.id)">
-          {{ $index + 1 }}
+          {{ data?.get('code') }}
         </td>
-        }@else {
+        }
+        <td nzEllipsis class="activeTd" (click)="toUrl(path + '/' + data.id)">
+          {{ data?.get("title") || "-" }}
+        </td>
+        }@else if(filterObj?.btns?.submit){
         <td
           nzEllipsis
           nzLeft
+          class="activeTd"
+          (click)="toUrl(path + '/' + data.id)"
         >
-          {{ $index + 1 }}
+          {{ data?.get("title") || "-" }}
         </td>
-        }
-        <td nzEllipsis 
-        class="activeTd"
-        (click)="toUrl(path + '/' + data.id)">
+        } @else {
+        <td nzEllipsis nzLeft>
+          {{ data?.get('code') }}
+        </td>
+        <td nzEllipsis class="activeTd" (click)="toUrl(path + '/' + data.id)">
           {{ data?.get("title") || "-" }}
         </td>
+        }
+
         <td nzEllipsis>
           {{
             data?.get("type") == "单册"
@@ -140,7 +158,9 @@
               <li nz-menu-item>
                 <button
                   nz-button
-                  (click)="toUrl('/nav-admin/manage/textbook/details/' + data.id)"
+                  (click)="
+                    toUrl('/nav-admin/manage/textbook/details/' + data.id)
+                  "
                   nzType="link"
                   style="color: #231c1f"
                 >
@@ -296,4 +316,4 @@
   </div>
 </div>
 
-}
+}

+ 9 - 1
projects/textbook/src/app/textbook/textbook.component.ts

@@ -282,8 +282,12 @@ export class TextbookComponent implements OnInit {
       nzOkDanger: false,
       nzOnOk: async () => {
         if (data?.id) {
+          let t =
+            this.tbookSer.formatTime('YYYYmmdd', new Date()) +
+            Math.random().toString().slice(-4);
           data.set('render', true);
           data.set('status', '200');
+          data.set('code', t);
           await data.save();
         } else {
           let selectedList = this.textbookList.filter((item: any) =>
@@ -291,8 +295,12 @@ export class TextbookComponent implements OnInit {
           );
           let deletePromiseList = selectedList.map((item: any) => {
             return new Promise((resolve) => {
+              let t =
+                this.tbookSer.formatTime('YYYYmmdd', new Date()) +
+                Math.random().toString().slice(-4);
               item.set('render', true);
               item.set('status', '200');
+              item.set('code', t);
               item.save().then(() => resolve(true));
             });
           });
@@ -317,7 +325,7 @@ export class TextbookComponent implements OnInit {
 
   //导出
   async export() {
-    let data: any = await this.getTextbook('',true);
+    let data: any = await this.getTextbook('', true);
     let table = `<table border="1px" cellspacing="0" cellpadding="0">
         <thead>
           <tr>

+ 141 - 97
projects/textbook/src/modules/common/textbook-details/textbook-details.component.html

@@ -1,6 +1,8 @@
 <div class="site-page-header">
   <nz-page-header
-    nzTitle="教材详情 - {{textBook.title}}"
+    nzTitle="教材详情 - {{ textBook?.title }}"
+    nzSubtitle=""
+    style="padding: 0"
   >
     <nz-breadcrumb nz-page-header-breadcrumb>
       <div class="back" (click)="back()">
@@ -17,79 +19,96 @@
         <div class="base-content">
           <div class="row">
             <div class="label">申报教材名称</div>
-            <div class="value">{{textBook.title}}</div>
+            <div class="value">{{ textBook?.title }}</div>
           </div>
           <div class="row">
             <div class="label">第一主编(作者)</div>
-            <div class="value">{{textBook.author}}</div>
+            <div class="value">{{ textBook?.author }}</div>
           </div>
           <div class="row">
             <div class="label">第一主编(作者)单位</div>
-            <div class="value">{{textBook.unit}}</div>
+            <div class="value">{{ textBook?.unit }}</div>
           </div>
           <div class="row">
             <div class="label">申报类型</div>
-            <div class="value">{{textBook.type}} {{textBook.type == '全册' ? textBook.typeNumber + '册': ''}}</div>
+            <div class="value">
+              {{ textBook?.type }}
+              {{ textBook?.type == "全册" ? textBook?.typeNumber + "册" : "" }}
+            </div>
           </div>
           <div class="row">
             <div class="label">教材应用对象及所属学科专业类</div>
-            <div class="value">{{textBook.majorPoniter}}</div>
+            <div class="value">{{ textBook?.majorPoniter }}</div>
           </div>
           <div class="row">
             <div class="label">教材主要语种类型</div>
-            <div class="value">{{textBook.lang}}</div>
+            <div class="value">{{ textBook?.lang }}</div>
           </div>
           <div class="row">
             <div class="label">国际标准书号</div>
-            <div class="value">{{textBook.ISBN}}</div>
+            <div class="value">{{ textBook?.ISBN }}</div>
           </div>
           <div class="row">
             <div class="label">其他主编姓名</div>
-            <div class="value">{{textBook.authors}}</div>
+            <div class="value">{{ textBook?.authors }}</div>
           </div>
           <div class="row">
             <div class="label">其他编者姓名</div>
-            <div class="value">{{textBook.editor}}</div>
+            <div class="value">{{ textBook?.editor }}</div>
           </div>
           <div class="row">
             <div class="label">是否为重点立项教材</div>
-            <div class="value">{{textBook.approval ? '是否' : '否'}}</div>
+            <div class="value">{{ textBook?.approval }}</div>
           </div>
           <div class="row">
             <div class="label">出版单位</div>
-            <div class="value">{{textBook.editionUnit}}</div>
+            <div class="value">{{ textBook?.editionUnit }}</div>
           </div>
           <div class="row">
             <div class="label">初版时间</div>
-            <div class="value">{{textBook.editionFirst?.iso | date :'yyyy-MM'}}</div>
+            <div class="value">
+              {{ textBook?.editionFirst?.iso | date : "yyyy-MM" }}
+            </div>
           </div>
           <div class="row">
             <div class="label">载体形式</div>
-            <div class="value">{{textBook.carrierShape}}</div>
+            <div class="value">{{ textBook?.carrierShape }}</div>
           </div>
           <div class="row">
             <div class="label">本版出版时间及版次</div>
-            <div class="value">{{textBook.editionDate?.iso | date :'yyyy-MM'}}/{{textBook.editionNumber}}</div>
+            <div class="value">
+              {{ textBook?.editionDate?.iso | date : "yyyy-MM" }}/{{
+                textBook?.editionNumber
+              }}
+            </div>
           </div>
           <div class="row">
             <div class="label">最新印次时间及印次</div>
-            <div class="value">{{textBook.printDate?.iso | date :'yyyy-MM'}}/{{textBook.printNumber}}</div>
+            <div class="value">
+              {{ textBook?.printDate?.iso | date : "yyyy-MM" }}/{{
+                textBook?.printNumber
+              }}
+            </div>
           </div>
           <div class="row">
             <div class="label">初版以来合计印数</div>
-            <div class="value">{{textBook.printSum}}</div>
+            <div class="value">{{ textBook?.printSum }}</div>
           </div>
           <div class="row">
             <div class="label">初版以来是否曾列为重点项目</div>
-            <div class="value">{{textBook.importantProject}}</div>
+            <div class="value">{{ textBook?.importantProject }}</div>
           </div>
           <div class="row">
             <div class="label">版权页截图</div>
-            <div class="value"><a href="textBook.copyrightImgUrl">截图文件</a></div>
+            <div class="value">
+              <a (click)="openFile(textBook?.copyrightImgUrl)">截图文件</a>
+            </div>
           </div>
           <div class="row">
             <div class="label">中国版本图书馆 CIP 查询截图</div>
-            <div class="value"><a href="textBook.CIPImgUrl">查询截图</a></div>
+            <div class="value">
+              <a (click)="openFile(textBook?.CIPImgUrl)">查询截图</a>
+            </div>
           </div>
         </div>
       </div>
@@ -98,24 +117,26 @@
         <div class="base-content">
           <div class="row">
             <div class="label">适用专业代码(六位)及名称</div>
-            <div class="value">{{textBook.major.code}}/{{textBook.major.name}}</div>
+            <div class="value">
+              {{ textBook?.major?.code }}/{{ textBook?.major?.name }}
+            </div>
           </div>
           <div class="row">
             <div class="label">适用课程</div>
-            <div class="value">{{textBook.lessons}}</div>
+            <div class="value">{{ textBook?.lessons }}</div>
           </div>
           <div class="row">
             <div class="label">课程学时</div>
-            <div class="value">{{textBook.period}}</div>
+            <div class="value">{{ textBook?.period }}</div>
           </div>
           <div class="row">
             <div class="label">适用课程性质</div>
             <div class="value">
-              @for (tag of textBook.characteristic; track tag) {
-                @if (tag.checked){
-                  <nz-tag>{{tag.label}}</nz-tag>
-                }
-              }</div>
+              @for (tag of textBook?.characteristic; track tag) { @if
+              (tag.checked){
+              <nz-tag>{{ tag.label }}</nz-tag>
+              } }
+            </div>
           </div>
         </div>
       </div>
@@ -128,7 +149,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.authorList"
+            [nzData]="textBook?.authorList"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -136,46 +157,46 @@
           >
             <thead>
               <tr>
-                <th nzWidth="160px" nzLeft>姓名</th>
-                <th nzWidth="160px">单位</th>
-                <th nzWidth="160px">出生年月</th>
-                <th nzWidth="160px">国籍</th>
-                <th nzWidth="160px">职务</th>
-                <th nzWidth="160px">职称</th>
-                <th nzWidth="160px">手机号码</th>
-                <th nzWidth="160px">电子邮箱</th>
-                <th nzWidth="160px" nzRight>分工</th>
+                <th nzEllipsis nzWidth="120px" nzLeft>姓名</th>
+                <th nzEllipsis nzWidth="120px">单位</th>
+                <th nzEllipsis nzWidth="120px">出生年月</th>
+                <th nzEllipsis nzWidth="120px">国籍</th>
+                <th nzEllipsis nzWidth="120px">职务</th>
+                <th nzEllipsis nzWidth="120px">职称</th>
+                <th nzEllipsis nzWidth="120px">手机号码</th>
+                <th nzEllipsis nzWidth="120px">电子邮箱</th>
+                <th nzEllipsis nzRight nzWidth="120px">分工</th>
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.authorList; track data.mobile;let index =
+              @for (data of textBook?.authorList; track data.mobile;let index =
               $index) {
               <tr>
-                <td nzLeft>
+                <td nzEllipsis nzLeft>
                   {{ data.name }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.unit }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.birth?.iso | date : "yyyy-MM" }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.nationality }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.job }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.title }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.mobile }}
                 </td>
-                <td>
+                <td nzEllipsis nzWidth="120px">
                   {{ data.email }}
                 </td>
-                <td nzRight>
+                <td nzEllipsis nzRight nzWidth="120px">
                   {{ data.work }}
                 </td>
               </tr>
@@ -188,13 +209,13 @@
         <div class="base-content">
           <div class="text-tips">相关教学经历</div>
           <div class="note">
-            {{ textBook.authorDetails }}
+            {{ textBook?.authorDetails }}
           </div>
           <div class="text-tips">相关科学研究项目、成果或论文专著(限5项)</div>
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.achievementOptions"
+            [nzData]="textBook?.achievementOptions"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -209,17 +230,17 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.achievementOptions; track data.name;let
+              @for (data of textBook?.achievementOptions; track data.name;let
               index = $index) {
               <tr>
-                <td nzLeft nzAlign="right">{{ index + 1 }}</td>
-                <td nzLeft>
+                <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
+                <td nzEllipsis nzLeft>
                   {{ data.name }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.unit }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.date?.iso | date : "yyyy-MM" }}
                 </td>
               </tr>
@@ -234,7 +255,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.courses"
+            [nzData]="textBook?.courses"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -251,22 +272,22 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.courses; track data;let index = $index) {
+              @for (data of textBook?.courses; track data;let index = $index) {
               <tr>
-                <td nzLeft nzAlign="right">{{ index + 1 }}</td>
-                <td>
+                <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
+                <td nzEllipsis>
                   {{ data.date?.iso | date : "yyyy-MM" }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.wordage }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.num }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.sumNum }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.accolade }}
                 </td>
               </tr>
@@ -279,7 +300,7 @@
         <div class="title">申报教材特色及创新</div>
         <div class="base-content">
           <div class="note">
-            {{ textBook.innovateExplain }}
+            {{ textBook?.innovateExplain }}
           </div>
         </div>
       </div>
@@ -287,7 +308,7 @@
         <div class="title">申报教材应用情况及社会影响力</div>
         <div class="base-content">
           <div class="note">
-            {{ textBook.influence }}
+            {{ textBook?.influence }}
           </div>
         </div>
       </div>
@@ -297,8 +318,8 @@
           <div class="row">
             <div class="label">教材电子版</div>
             <div class="value">
-              @for (item of textBook.textbookFiles; track item.name) {
-              <a style="margin-right: 10px" [href]="item.url">{{
+              @for (item of textBook?.textbookFiles; track item.name) {
+              <a style="margin-right: 10px" (click)="openFile(item.url)">{{
                 item.name
               }}</a>
               }
@@ -307,7 +328,7 @@
           <div class="row">
             <div class="label">教材数字内容链接地址、账号</div>
             <div class="value">
-              @for (item of textBook.links; track item) {
+              @for (item of textBook?.links; track item) {
               <li>{{ item }}</li>
               }
             </div>
@@ -316,7 +337,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.opinions"
+            [nzData]="textBook?.opinions"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -333,24 +354,26 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.opinions; track data.name;let index =
+              @for (data of textBook?.opinions; track data.name;let index =
               $index) {
               <tr>
-                <td nzLeft nzAlign="right">{{ index + 1 }}</td>
-                <td>
+                <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
+                <td nzEllipsis>
                   {{ data.name }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.unit }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.birth | date : "yyyy-MM" }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.nationality }}
                 </td>
-                <td nzRight>
-                  <a [href]="data.reviewFile.url">{{ data.reviewFile.name }}</a>
+                <td nzEllipsis nzRight>
+                  <a (click)="openFile(data.reviewFile?.url)">{{
+                    data.reviewFile?.name
+                  }}</a>
                 </td>
               </tr>
               }
@@ -359,30 +382,32 @@
           <div class="row" style="margin-top: 10px">
             <div class="label">图书编校质量自查结果记录表</div>
             <div class="value">
-              <a [href]="textBook.selfResults.url">{{
-                textBook.selfResults.name
+              <a (click)="openFile(textBook?.selfResults?.url)">{{
+                textBook?.selfResults?.name
               }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">专家审核意见表</div>
             <div class="value">
-              <a [href]="textBook.expertOpinion.url">{{
-                textBook.expertOpinion.name
+              <a (click)="openFile(textBook?.expertOpinion?.url)">{{
+                textBook?.expertOpinion?.name
               }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">教材使用情况证明材料</div>
             <div class="value">
-              <a [href]="textBook.evidence.url">{{ textBook.evidence.name }}</a>
+              <a (click)="openFile(textBook?.evidence?.url)">{{
+                textBook?.evidence?.name
+              }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">其他材料</div>
             <div class="value">
-              @for (item of textBook.moreMaterial; track item.name) {
-              <a style="margin-right: 10px" [href]="item.url">{{
+              @for (item of textBook?.moreMaterial; track item.name) {
+              <a (click)="openFile(item.url)" style="margin-right: 10px">{{
                 item.name
               }}</a>
               }
@@ -396,7 +421,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.authorSign"
+            [nzData]="textBook?.authorSign"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -413,24 +438,26 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.authorSign; track data.name;let index =
+              @for (data of textBook?.authorSign; track data.name;let index =
               $index) {
               <tr>
-                <td nzLeft nzAlign="right">{{ index + 1 }}</td>
-                <td>
+                <td nzEllipsis nzLeft nzAlign="right">{{ index + 1 }}</td>
+                <td nzEllipsis>
                   {{ data.name }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.unit }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.birth?.iso | date : "yyyy-MM" }}
                 </td>
-                <td>
+                <td nzEllipsis>
                   {{ data.nationality }}
                 </td>
-                <td nzRight>
-                  <a [href]="data.reviewFile.url">{{ data.reviewFile.name }}</a>
+                <td nzEllipsis nzRight>
+                  <a (click)="openFile(data.reviewFile?.url)">{{
+                    data.reviewFile?.name
+                  }}</a>
                 </td>
               </tr>
               }
@@ -444,7 +471,11 @@
           <div class="row">
             <div class="label">申报单位承诺意见材料</div>
             <div class="value">
-              <a style="margin-right: 10px" [href]="textBook.unitMaterial.url">{{textBook.unitMaterial.name}}</a>
+              <a
+                (click)="openFile(textBook?.unitMaterial?.url)"
+                style="margin-right: 10px"
+                >{{ textBook?.unitMaterial?.name }}</a
+              >
             </div>
           </div>
         </div>
@@ -455,13 +486,13 @@
           <div class="row">
             <div class="label">省级教育行政部门初评专家组意见</div>
             <div class="value">
-              <span style="color:#231C1F99">暂未填写</span>
+              <span style="color: #231c1f99">暂未填写</span>
             </div>
           </div>
           <div class="row">
             <div class="label">省级教育行政部门意见</div>
             <div class="value">
-              <span style="color:#231C1F99">暂无</span>
+              <span style="color: #231c1f99">暂无</span>
             </div>
           </div>
         </div>
@@ -497,4 +528,17 @@
       </nz-anchor>
     </div>
   </div>
-</div>
+</div>
+@if (user?.id == textBook?.user?.objectId && !textBook?.discard && !textBook?.render)
+{
+<div class="footer">
+  <button
+    nz-button
+    nzType="primary"
+    style="background: #3e49b3; border: 1px #3e49b3"
+    (click)="edit()"
+  >
+    编辑教材
+  </button>
+</div>
+}

+ 6 - 0
projects/textbook/src/modules/common/textbook-details/textbook-details.component.ts

@@ -24,11 +24,13 @@ import Parse from 'parse';
 })
 export class TextbookDetailsComponent implements OnInit {
   @ViewChild('templ1') templ1: any;
+  user?:Parse.Object
   textBook: object | any = {}
   constructor(private router: Router, private activeRoute: ActivatedRoute) {}
 
   ngOnInit() {
     this.activeRoute.paramMap.subscribe(async (params) => {
+      this.user = Parse.User.current()
       let id = params.get('id');
       if (id) {
         let query = new Parse.Query('EduTextbook');
@@ -49,4 +51,8 @@ export class TextbookDetailsComponent implements OnInit {
   edit(){
     this.router?.navigate(['/nav-author/manage/apply',{id:this.textBook.objectId}],{ replaceUrl: true })
   }
+  openFile(url:string){
+    console.log(url);
+    window.open(url)
+  }
 }

+ 7 - 5
projects/textbook/src/modules/nav-admin/page-role/page-role.component.html

@@ -77,9 +77,9 @@
         <span nz-icon nzType="team" nzTheme="outline"></span>
         {{ profiles.length }}人
       </div>
-      <label nz-checkbox [(ngModel)]="checkedShowFilter"
+      <!-- <label nz-checkbox [(ngModel)]="checkedShowFilter"
         >仅显示部门直属成员</label
-      >
+      > -->
     </div>
     <div class="tool-right">
       <a nz-button nzType="link" (click)="addMember()">
@@ -110,8 +110,10 @@
       <nz-dropdown-menu #menu="nzDropdownMenu">
         <ul nz-menu>
           <li nz-menu-item (click)="showModalDepart('add')">添加下级部门</li>
-          <li nz-menu-item (click)="showModalDepart('edit')">编辑部门</li>
-          <li nz-menu-item (click)="onDelDepart()">删除部门</li>
+          @if (activatedNode?.origin?.branch) {
+            <li nz-menu-item (click)="showModalDepart('edit')">编辑部门</li>
+            <li nz-menu-item (click)="onDelDepart()">删除部门</li>
+          }
         </ul>
       </nz-dropdown-menu>
     </div>
@@ -149,7 +151,7 @@
             <th nzWidth="120px">邮箱</th>
             <th nzWidth="120px">人员类型</th>
             <th nzWidth="120px">所属部门</th>
-            <th nzWidth="120px" nzRight>操作</th>
+            <th nzWidth="50px" nzRight>操作</th>
           </tr>
         </thead>
         <tbody>

+ 44 - 14
projects/textbook/src/modules/nav-admin/page-role/page-role.component.ts

@@ -320,6 +320,7 @@ export class PageRoleComponent implements OnInit {
     };
     if (type == 'edit') {
       let query = new Parse.Query('Department');
+      query.include('parent','parent.parent')
       let r = await query.get(this.activatedNode?.key);
       this.activeDepart = r;
       this.editObject = {
@@ -335,23 +336,24 @@ export class PageRoleComponent implements OnInit {
       this.parentMap = await this.formatNode(
         this.activeDepart.get('parent')?.id
       );
-      if (this.activatedNode?.parentNode?.origin?.parentNode?.origin.key) {
-        this.parentList = await this.getDepart(
-          this.activatedNode?.parentNode?.origin?.parentNode?.origin.key
-        );
+      if (r?.get('parent')?.get('parent')?.id) {
+        this.parentList = await this.getDepart(r.get('parent')?.get('parent').id);
+      }else{
+        this.parentList = this.parents
       }
+      this.radio = this.activeDepart.get('parent')?.id
     } else if (type == 'add' && this.activatedNode) {
-      console.log(this.activatedNode);
       this.editObject.parent = {
         title: this.activatedNode.origin.title,
         id: this.activatedNode.origin.key,
       };
+      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);
-      if (this.activatedNode?.parentNode?.origin.key) {
+      if (this.activatedNode?.origin.branch) {
         this.parentList = await this.getDepart(
-          this.activatedNode.parentNode.origin.key
+          this.activatedNode?.origin.branch
         );
       }
     }
@@ -391,9 +393,9 @@ export class PageRoleComponent implements OnInit {
     this.radio = e.key;
     if (type == 'account') this.account.identity = '';
     this.parentMap = await this.formatNode(e.key);
-    if (checked && e.parent) {
+    if (checked) {
       // this.editObject.name = e.title
-      if (type == 'account') {
+      if (type == 'account' && e.parent) {
         this.account.department = { title: e.title, id: e.key };
         this.account.companyType = e.branch || e.title;
         this.userType = this.parents.some((item) => e.parent == item.key)
@@ -413,10 +415,6 @@ export class PageRoleComponent implements OnInit {
     if (e.isLeaf) {
       return;
     }
-    // this.parentMap.push({
-    //   title: e.title,
-    //   key: e.key,
-    // });
     this.parentList = await this.getDepart(e?.key);
   }
   async handleOk(): Promise<void> {
@@ -447,13 +445,45 @@ export class PageRoleComponent implements OnInit {
       });
       this.activeDepart?.set('branch', this.editObject.branch);
     }
+    let type
+    let filters = ['出版单位','教育部直属高校']
+    if(filters.includes(this.editObject.parent?.title)){
+      type = '单位'
+    }
+    this.activeDepart?.set('type', type);
     await this.activeDepart?.save();
+    if(!type && this.activeDepart?.id){
+      //判断添加的是部门还是单位
+      let leng = await this.formatNode(this.activeDepart.id)
+      if(leng.length > 2){
+        console.log(leng.length);
+        if(filters.includes(leng[0].title)){
+          this.activeDepart?.set('type', '部门');
+        }else{
+          this.activeDepart?.set('type',leng.length > 3 ? '部门' : '单位');
+        }
+        leng.slice()
+        await this.activeDepart?.save();
+      }
+    }
+    await this.updateChildren();
     this.isVisible = false;
     this.message.success(this.editType == 'edit' ? '保存' : '添加' + '成功');
     this.activeDepart = undefined;
     this.nodes = await this.getDepart();
   }
-
+  //更新上级children字段
+  async updateChildren() {
+    let query = new Parse.Query('Department');
+    query.equalTo('objectId', this.editObject.parent?.id);
+    query.select('hasChildren')
+    let r = await query.first();
+    if (r?.id && !r.get('hasChildren')) {
+      r?.set('hasChildren', true);
+      await r.save();
+    }
+    return;
+  }
   handleCancel(): void {
     console.log('Button cancel clicked!');
     this.isVisible = false;

+ 2 - 6
projects/textbook/src/modules/nav-author/modules.routes.ts

@@ -4,7 +4,7 @@ import { PageTextbookComponent } from './components/page-textbook/page-textbook.
 import { ApplyComponent } from './apply/apply.component';
 // import { ProfileComponent } from '../user/profile/profile.component';
 import { SpaceComponent } from './space/space.component'
-import { TextbookDetailsComponent } from './textbook-details/textbook-details.component'
+import { TextbookDetailsComponent } from '../common/textbook-details/textbook-details.component'
 import { RecycleComponent } from './recycle/recycle.component'
 const routes: Routes = [
   {
@@ -24,13 +24,9 @@ const routes: Routes = [
         component: ApplyComponent,
       },
       {
-        path: 'dateils',//创建教材
+        path: 'details/:id',//详情
         component: TextbookDetailsComponent,
       },
-      // {
-      //   path: 'textbook',//列表
-      //   component: PageTextbookComponent,
-      // },
       {
         path: 'recycle',//回收站
         component: RecycleComponent,

+ 7 - 6
projects/textbook/src/modules/nav-author/recycle/recycle.component.html

@@ -1,18 +1,19 @@
 <div class="space-page">
   <div class="space-head">
     <div class="content">
-      <div class="title">
-        回收站
-      </div>
+      <div class="title">回收站</div>
       <div class="text">
         在此查看已删除教材,将需要重新编辑的教材恢复至个人空间
       </div>
     </div>
-    <div class="btn">
-    </div>
+    <div class="btn"></div>
   </div>
   <div class="space-content">
     <!-- <app-page-textbook [discard]="true"></app-page-textbook> -->
-    <app-textbook [uid]="user?.id" [discard]="true"></app-textbook>
+    <app-textbook
+      [uid]="user?.id"
+      path="/nav-author/manage/details"
+      [discard]="true"
+    ></app-textbook>
   </div>
 </div>

+ 10 - 2
projects/textbook/src/modules/nav-author/space/space.component.html

@@ -30,13 +30,21 @@
       <nz-tab nzTitle="我的教材">
         @if (active == 0) {
         <!-- <app-page-textbook></app-page-textbook> -->
-        <app-textbook [filterObj]="myTextBook"  [uid]="user?.id"></app-textbook>
+        <app-textbook
+          path="/nav-author/manage/details"
+          [filterObj]="myTextBook"
+          [uid]="user?.id"
+        ></app-textbook>
         }
       </nz-tab>
       <nz-tab nzTitle="已提交评审教材">
         @if (active == 1) {
         <!-- <app-page-textbook [render]="true"></app-page-textbook> -->
-        <app-textbook [filterObj]="submitTextBook"  [uid]="user?.id"></app-textbook>
+        <app-textbook
+          path="/nav-author/manage/details"
+          [filterObj]="submitTextBook"
+          [uid]="user?.id"
+        ></app-textbook>
         }
       </nz-tab>
     </nz-tabset>

+ 49 - 49
projects/textbook/src/modules/nav-author/textbook-details/textbook-details.component.html

@@ -1,6 +1,6 @@
 <div class="site-page-header">
   <nz-page-header
-    nzTitle="教材详情 - {{textBook.title}}"
+    nzTitle="教材详情 - {{textBook?.title}}"
     nzSubtitle=""
     style="padding: 0"
   >
@@ -19,79 +19,79 @@
         <div class="base-content">
           <div class="row">
             <div class="label">申报教材名称</div>
-            <div class="value">{{textBook.title}}</div>
+            <div class="value">{{textBook?.title}}</div>
           </div>
           <div class="row">
             <div class="label">第一主编(作者)</div>
-            <div class="value">{{textBook.author}}</div>
+            <div class="value">{{textBook?.author}}</div>
           </div>
           <div class="row">
             <div class="label">第一主编(作者)单位</div>
-            <div class="value">{{textBook.unit}}</div>
+            <div class="value">{{textBook?.unit}}</div>
           </div>
           <div class="row">
             <div class="label">申报类型</div>
-            <div class="value">{{textBook.type}} {{textBook.type == '全册' ? textBook.typeNumber + '册': ''}}</div>
+            <div class="value">{{textBook?.type}} {{textBook?.type == '全册' ? textBook?.typeNumber + '册': ''}}</div>
           </div>
           <div class="row">
             <div class="label">教材应用对象及所属学科专业类</div>
-            <div class="value">{{textBook.majorPoniter}}</div>
+            <div class="value">{{textBook?.majorPoniter}}</div>
           </div>
           <div class="row">
             <div class="label">教材主要语种类型</div>
-            <div class="value">{{textBook.lang}}</div>
+            <div class="value">{{textBook?.lang}}</div>
           </div>
           <div class="row">
             <div class="label">国际标准书号</div>
-            <div class="value">{{textBook.ISBN}}</div>
+            <div class="value">{{textBook?.ISBN}}</div>
           </div>
           <div class="row">
             <div class="label">其他主编姓名</div>
-            <div class="value">{{textBook.authors}}</div>
+            <div class="value">{{textBook?.authors}}</div>
           </div>
           <div class="row">
             <div class="label">其他编者姓名</div>
-            <div class="value">{{textBook.editor}}</div>
+            <div class="value">{{textBook?.editor}}</div>
           </div>
           <div class="row">
             <div class="label">是否为重点立项教材</div>
-            <div class="value">{{textBook.approval ? '是否' : '否'}}</div>
+            <div class="value">{{textBook?.approval}}</div>
           </div>
           <div class="row">
             <div class="label">出版单位</div>
-            <div class="value">{{textBook.editionUnit}}</div>
+            <div class="value">{{textBook?.editionUnit}}</div>
           </div>
           <div class="row">
             <div class="label">初版时间</div>
-            <div class="value">{{textBook.editionFirst?.iso | date :'yyyy-MM'}}</div>
+            <div class="value">{{textBook?.editionFirst?.iso | date :'yyyy-MM'}}</div>
           </div>
           <div class="row">
             <div class="label">载体形式</div>
-            <div class="value">{{textBook.carrierShape}}</div>
+            <div class="value">{{textBook?.carrierShape}}</div>
           </div>
           <div class="row">
             <div class="label">本版出版时间及版次</div>
-            <div class="value">{{textBook.editionDate?.iso | date :'yyyy-MM'}}/{{textBook.editionNumber}}</div>
+            <div class="value">{{textBook?.editionDate?.iso | date :'yyyy-MM'}}/{{textBook?.editionNumber}}</div>
           </div>
           <div class="row">
             <div class="label">最新印次时间及印次</div>
-            <div class="value">{{textBook.printDate?.iso | date :'yyyy-MM'}}/{{textBook.printNumber}}</div>
+            <div class="value">{{textBook?.printDate?.iso | date :'yyyy-MM'}}/{{textBook?.printNumber}}</div>
           </div>
           <div class="row">
             <div class="label">初版以来合计印数</div>
-            <div class="value">{{textBook.printSum}}</div>
+            <div class="value">{{textBook?.printSum}}</div>
           </div>
           <div class="row">
             <div class="label">初版以来是否曾列为重点项目</div>
-            <div class="value">{{textBook.importantProject}}</div>
+            <div class="value">{{textBook?.importantProject}}</div>
           </div>
           <div class="row">
             <div class="label">版权页截图</div>
-            <div class="value"><a href="textBook.copyrightImgUrl">截图文件</a></div>
+            <div class="value"><a (click)="openFile(textBook?.copyrightImgUrl)">截图文件</a></div>
           </div>
           <div class="row">
             <div class="label">中国版本图书馆 CIP 查询截图</div>
-            <div class="value"><a href="textBook.CIPImgUrl">查询截图</a></div>
+            <div class="value"><a (click)="openFile(textBook?.CIPImgUrl)">查询截图</a></div>
           </div>
         </div>
       </div>
@@ -100,20 +100,20 @@
         <div class="base-content">
           <div class="row">
             <div class="label">适用专业代码(六位)及名称</div>
-            <div class="value">{{textBook.major.code}}/{{textBook.major.name}}</div>
+            <div class="value">{{textBook?.major?.code}}/{{textBook?.major?.name}}</div>
           </div>
           <div class="row">
             <div class="label">适用课程</div>
-            <div class="value">{{textBook.lessons}}</div>
+            <div class="value">{{textBook?.lessons}}</div>
           </div>
           <div class="row">
             <div class="label">课程学时</div>
-            <div class="value">{{textBook.period}}</div>
+            <div class="value">{{textBook?.period}}</div>
           </div>
           <div class="row">
             <div class="label">适用课程性质</div>
             <div class="value">
-              @for (tag of textBook.characteristic; track tag) {
+              @for (tag of textBook?.characteristic; track tag) {
                 @if (tag.checked){
                   <nz-tag>{{tag.label}}</nz-tag>
                 }
@@ -130,7 +130,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.authorList"
+            [nzData]="textBook?.authorList"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -146,11 +146,11 @@
                 <th nzWidth="160px">职称</th>
                 <th nzWidth="160px">手机号码</th>
                 <th nzWidth="160px">电子邮箱</th>
-                <th nzWidth="160px" nzRight>分工</th>
+                <th nzRight>分工</th>
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.authorList; track data.mobile;let index =
+              @for (data of textBook?.authorList; track data.mobile;let index =
               $index) {
               <tr>
                 <td nzLeft>
@@ -190,13 +190,13 @@
         <div class="base-content">
           <div class="text-tips">相关教学经历</div>
           <div class="note">
-            {{ textBook.authorDetails }}
+            {{ textBook?.authorDetails }}
           </div>
           <div class="text-tips">相关科学研究项目、成果或论文专著(限5项)</div>
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.achievementOptions"
+            [nzData]="textBook?.achievementOptions"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -211,7 +211,7 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.achievementOptions; track data.name;let
+              @for (data of textBook?.achievementOptions; track data.name;let
               index = $index) {
               <tr>
                 <td nzLeft nzAlign="right">{{ index + 1 }}</td>
@@ -236,7 +236,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.courses"
+            [nzData]="textBook?.courses"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -253,7 +253,7 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.courses; track data;let index = $index) {
+              @for (data of textBook?.courses; track data;let index = $index) {
               <tr>
                 <td nzLeft nzAlign="right">{{ index + 1 }}</td>
                 <td>
@@ -281,7 +281,7 @@
         <div class="title">申报教材特色及创新</div>
         <div class="base-content">
           <div class="note">
-            {{ textBook.innovateExplain }}
+            {{ textBook?.innovateExplain }}
           </div>
         </div>
       </div>
@@ -289,7 +289,7 @@
         <div class="title">申报教材应用情况及社会影响力</div>
         <div class="base-content">
           <div class="note">
-            {{ textBook.influence }}
+            {{ textBook?.influence }}
           </div>
         </div>
       </div>
@@ -299,7 +299,7 @@
           <div class="row">
             <div class="label">教材电子版</div>
             <div class="value">
-              @for (item of textBook.textbookFiles; track item.name) {
+              @for (item of textBook?.textbookFiles; track item.name) {
               <a style="margin-right: 10px" [href]="item.url">{{
                 item.name
               }}</a>
@@ -309,7 +309,7 @@
           <div class="row">
             <div class="label">教材数字内容链接地址、账号</div>
             <div class="value">
-              @for (item of textBook.links; track item) {
+              @for (item of textBook?.links; track item) {
               <li>{{ item }}</li>
               }
             </div>
@@ -318,7 +318,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.opinions"
+            [nzData]="textBook?.opinions"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -335,7 +335,7 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.opinions; track data.name;let index =
+              @for (data of textBook?.opinions; track data.name;let index =
               $index) {
               <tr>
                 <td nzLeft nzAlign="right">{{ index + 1 }}</td>
@@ -361,29 +361,29 @@
           <div class="row" style="margin-top: 10px">
             <div class="label">图书编校质量自查结果记录表</div>
             <div class="value">
-              <a [href]="textBook.selfResults.url">{{
-                textBook.selfResults.name
+              <a [href]="textBook?.selfResults?.url">{{
+                textBook?.selfResults?.name
               }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">专家审核意见表</div>
             <div class="value">
-              <a [href]="textBook.expertOpinion.url">{{
-                textBook.expertOpinion.name
+              <a [href]="textBook?.expertOpinion?.url">{{
+                textBook?.expertOpinion?.name
               }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">教材使用情况证明材料</div>
             <div class="value">
-              <a [href]="textBook.evidence.url">{{ textBook.evidence.name }}</a>
+              <a [href]="textBook?.evidence?.url">{{ textBook?.evidence?.name }}</a>
             </div>
           </div>
           <div class="row">
             <div class="label">其他材料</div>
             <div class="value">
-              @for (item of textBook.moreMaterial; track item.name) {
+              @for (item of textBook?.moreMaterial; track item.name) {
               <a style="margin-right: 10px" [href]="item.url">{{
                 item.name
               }}</a>
@@ -398,7 +398,7 @@
           <nz-table
             #basicTable
             [nzShowPagination]="false"
-            [nzData]="textBook.authorSign"
+            [nzData]="textBook?.authorSign"
             [nzScroll]="{
               x: (templ1.style.width || '1000') + 'px',
               y: '240px'
@@ -415,7 +415,7 @@
               </tr>
             </thead>
             <tbody>
-              @for (data of textBook.authorSign; track data.name;let index =
+              @for (data of textBook?.authorSign; track data.name;let index =
               $index) {
               <tr>
                 <td nzLeft nzAlign="right">{{ index + 1 }}</td>
@@ -432,7 +432,7 @@
                   {{ data.nationality }}
                 </td>
                 <td nzRight>
-                  <a [href]="data.reviewFile.url">{{ data.reviewFile.name }}</a>
+                  <a [href]="data.reviewFile?.url">{{ data.reviewFile?.name }}</a>
                 </td>
               </tr>
               }
@@ -446,7 +446,7 @@
           <div class="row">
             <div class="label">申报单位承诺意见材料</div>
             <div class="value">
-              <a style="margin-right: 10px" [href]="textBook.unitMaterial.url">{{textBook.unitMaterial.name}}</a>
+              <a style="margin-right: 10px" [href]="textBook?.unitMaterial?.url">{{textBook?.unitMaterial?.name}}</a>
             </div>
           </div>
         </div>
@@ -500,7 +500,7 @@
     </div>
   </div>
 </div>
-@if (!textBook.discard && !textBook.render) {
+@if (!textBook?.discard && !textBook?.render) {
   <div class="footer">
     <button
       nz-button

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

@@ -228,4 +228,8 @@ export class TextbookDetailsComponent implements OnInit {
   edit(){
     this.router?.navigate(['/nav-author/manage/apply',{id:this.textBook.objectId}],{ replaceUrl: true })
   }
+  openFile(url:string){
+    console.log(url);
+    window.open(url)
+  }
 }

+ 2 - 2
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.html

@@ -76,9 +76,9 @@
         <span nz-icon nzType="team" nzTheme="outline"></span>
         {{ profiles.length }}人
       </div>
-      <label nz-checkbox [(ngModel)]="checkedShowFilter"
+      <!-- <label nz-checkbox [(ngModel)]="checkedShowFilter"
         >仅显示部门直属成员</label
-      >
+      > -->
     </div>
     <div class="tool-right">
       <a nz-button nzType="link" (click)="addMember()">

+ 16 - 0
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.ts

@@ -464,6 +464,21 @@ export class PageRoleComponent implements OnInit {
       this.activeDepart?.set('branch', this.editObject.branch);
     }
     await this.activeDepart?.save();
+    if(this.activeDepart?.id){
+      //判断添加的是部门还是单位
+      let filters = ['出版单位','教育部直属高校']
+      let leng = await this.formatNode(this.activeDepart.id)
+      if(leng.length > 2){
+        console.log(leng.length);
+        if(filters.includes(leng[0].title)){
+          this.activeDepart?.set('type', '部门');
+        }else{
+          this.activeDepart?.set('type',leng.length > 3 ? '部门' : '单位');
+        }
+        leng.slice()
+        await this.activeDepart?.save();
+      }
+    }
     await this.updateChildren();
     this.isVisible = false;
     this.message.success(this.editType == 'edit' ? '保存' : '添加' + '成功');
@@ -474,6 +489,7 @@ export class PageRoleComponent implements OnInit {
   async updateChildren() {
     let query = new Parse.Query('Department');
     query.equalTo('objectId', this.editObject.parent?.id);
+    query.select('hasChildren')
     let r = await query.first();
     if (r?.id && !r.get('hasChildren')) {
       r?.set('hasChildren', true);

+ 16 - 0
projects/textbook/src/services/textbook.ts

@@ -31,4 +31,20 @@ export class textbookServer {
     }
     return str.join('')
   }
+
+  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(),   // 秒
+        // 有其他格式化字符需求可以继续添加,必须转化成字符串
+    };
+    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;
+}
 }

+ 4 - 0
server/db/schemas/EduTextbook.js

@@ -221,6 +221,10 @@ export const EduTextbook = {
             "targetClass":"EduProcess",
             "required": false
         },
+        "code":{//编号
+            "type":'String',
+            "required": false
+        },
     },
     "classLevelPermissions": {
         "find": {