Jelajahi Sumber

update 管理员

warrior 7 bulan lalu
induk
melakukan
8686cdaf3a

+ 1 - 1
projects/textbook/src/app/textbook/textbook.component.html

@@ -28,7 +28,7 @@
     [nzData]="textbookList"
     [nzTotal]="count"
     [nzPageSize]="limit"
-    [nzPageIndex]="pageSize"
+    [nzPageIndex]="pageIndex"
     style="margin: 10px 0"
     [nzLoading]="loading"
     nzSize="middle"

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

@@ -38,7 +38,7 @@ export class TextbookComponent implements OnInit {
   textbookList: Array<Parse.Object> = [];
   count: number = 0;
   @Input('limit') limit: number = 10;
-  pageSize: number = 1;
+  pageIndex: number = 1;
 
   @Input('maxWidth') maxWidth: any; //最大宽度
   @Input('depart') depart: any; //指定申报单位
@@ -236,7 +236,7 @@ export class TextbookComponent implements OnInit {
     query.include('department');
     this.count = await query.count();
     query.limit(this.limit);
-    query.skip(this.limit * (this.pageSize - 1));
+    query.skip(this.limit * (this.pageIndex - 1));
     // query.include('user')
     this.textbookList = await query.find();
     console.log(this.textbookList);
@@ -274,7 +274,7 @@ export class TextbookComponent implements OnInit {
   //筛选
   onFilter(){
     this.textbookList = []
-    this.pageSize = 1
+    this.pageIndex = 1
     this.getTextbook(this.searchValue)
   }
   onSearch(e: string) {
@@ -284,7 +284,7 @@ export class TextbookComponent implements OnInit {
   //分页切换
   pageIndexChange(e: any) {
     console.log(e);
-    this.pageSize = e;
+    this.pageIndex = e;
     this.getTextbook(this.searchValue);
   }
   //全选
@@ -324,6 +324,7 @@ export class TextbookComponent implements OnInit {
       nzOnOk: async () => {
         if (data?.id) {
           data.set('status', '300');
+          data.set('render', null);
           data.set('code', null);
           await data.save();
         } else {
@@ -333,6 +334,7 @@ export class TextbookComponent implements OnInit {
           let deletePromiseList = selectedList.map((item: any) => {
             return new Promise((resolve) => {
               item.set('status', '300');
+              item.set('render', null);
               item.set('code', null);
               item.save().then(() => resolve(true));
             });

+ 74 - 73
projects/textbook/src/modules/nav-admin/page-role/page-role.component.html

@@ -24,7 +24,7 @@
   <div class="tool">
     <div class="tool-left">
       <div class="search">
-        <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
+        <!-- <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
           <input
             type="text"
             nz-input
@@ -32,7 +32,7 @@
             [(ngModel)]="searchValue"
             (ngModelChange)="onSearchNodes($event)"
           />
-        </nz-input-group>
+        </nz-input-group> -->
         <ng-template #prefixTemplateUser
           ><span nz-icon nzType="search"></span
         ></ng-template>
@@ -42,7 +42,7 @@
           nz-dropdown
           [nzDropdownMenu]="menutep"
           [nzPlacement]="'bottomLeft'"
-          style="margin-left: 10px"
+          style="margin-left: 0px; width: 220px;"
         >
           <span nz-icon nzType="plus" nzTheme="outline"></span>新建
         </button>
@@ -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()">
@@ -332,6 +332,69 @@
 >
   <ng-container *nzModalContent>
     <div nz-row class="depart-modal">
+      <div nz-col nzSpan="12">
+        <div class="row" style="margin-bottom: 6px;">
+          <div class="label">
+            选择所属部门 <span style="color: #e8353e">*</span>
+          </div>
+          <div class="value">
+            <input
+              nz-input
+              placeholder="请选择所属部门"
+              [ngModel]="account.department?.title"
+              (ngModelChange)="onSearchNodes($event, true)"
+              type="text"
+            />
+          </div>
+        </div>
+        <div class="select">
+          <div class="bar">
+            <a style="color: #86909c" (click)="onPre()">教材遴选</a>
+            @for (data of parentMap; track data.title) {
+            <span style="margin: 0 10px">/</span>
+            <a (click)="onPre(data, $index)">{{ data.title }}</a>
+            }
+          </div>
+          <div class="tree">
+            @if(parentList.length > 0){ @for (data of parentList; track $index)
+            {
+            <div class="li" (click)="onCheckedDepart('account', data)">
+              <label
+                nz-radio
+                [ngModel]="data.key == radio"
+                [nzValue]="data.key"
+                (click)="onCheckedDepart('account', data, true)"
+                >{{ data.title }}</label
+              >
+              @if (!data.isLeaf) {
+              <span nz-icon nzType="right" nzTheme="outline"></span>
+              }
+            </div>
+            }}@else {
+            <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
+            }
+          </div>
+        </div>
+        <div class="row">
+          <div class="label">人员类型</div>
+          <div class="value">
+            <nz-select
+              style="width: 100%"
+              [disabled]="!this.account.department?.id"
+              nzShowSearch
+              nzAllowClear
+              [(ngModel)]="account.identity"
+              nzPlaceHolder="请选择所属的身份类型"
+            >
+              @for(item of userType; track item;let index = $index){
+              <nz-option nzCustomContent [nzValue]="item" [nzLabel]="item">{{
+                item
+              }}</nz-option>
+              }
+            </nz-select>
+          </div>
+        </div>
+      </div>
       <div nz-col nzSpan="12">
         <div class="row">
           <div class="label">姓名 <span style="color: #e8353e">*</span></div>
@@ -345,7 +408,7 @@
           </div>
         </div>
         <div class="row">
-          <div class="label">手机号</div>
+          <div class="label">手机号 <span style="color: #e8353e">*</span></div>
           <div class="value">
             <input
               nz-input
@@ -357,7 +420,7 @@
           </div>
         </div>
         <div class="row">
-          <div class="label">邮箱</div>
+          <div class="label">邮箱 <span style="color: #e8353e">*</span></div>
           <div class="value">
             <input
               nz-input
@@ -370,7 +433,7 @@
         <div class="row">
           <div class="label">密码 <span style="color: #e8353e">*</span></div>
           <div class="value">
-            <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
+            <nz-input-group nzSearch [nzAddOnAfter]="">
               <input
                 type="password"
                 [(ngModel)]="account.password"
@@ -378,7 +441,7 @@
                 placeholder="请输入密码"
               />
             </nz-input-group>
-            <ng-template #suffixIconButton>
+            <!-- <ng-template #suffixIconButton>
               <button
                 nz-button
                 (click)="randomPassword()"
@@ -387,72 +450,10 @@
               >
                 自动生成密码
               </button>
-            </ng-template>
-          </div>
-        </div>
-        <div class="row">
-          <div class="label">人员类型</div>
-          <div class="value">
-            <nz-select
-              style="width: 100%"
-              [disabled]="!this.account.department?.id"
-              nzShowSearch
-              nzAllowClear
-              [(ngModel)]="account.identity"
-              nzPlaceHolder="请选择所属的身份类型"
-            >
-              @for(item of userType; track item;let index = $index){
-              <nz-option nzCustomContent [nzValue]="item" [nzLabel]="item">{{
-                item
-              }}</nz-option>
-              }
-            </nz-select>
-          </div>
-        </div>
-      </div>
-      <div nz-col nzSpan="12">
-        <div class="row">
-          <div class="label">
-            上级部门 <span style="color: #e8353e">*</span>
-          </div>
-          <div class="value">
-            <input
-              nz-input
-              placeholder="请选择所属部门"
-              [ngModel]="account.department?.title"
-              (ngModelChange)="onSearchNodes($event, true)"
-              type="text"
-            />
-          </div>
-        </div>
-        <div class="select">
-          <div class="bar">
-            <a style="color: #86909c" (click)="onPre()">教材遴选</a>
-            @for (data of parentMap; track data.title) {
-            <span style="margin: 0 10px">/</span>
-            <a (click)="onPre(data, $index)">{{ data.title }}</a>
-            }
-          </div>
-          <div class="tree">
-            @if(parentList.length > 0){ @for (data of parentList; track $index)
-            {
-            <div class="li" (click)="onCheckedDepart('account', data)">
-              <label
-                nz-radio
-                [ngModel]="data.key == radio"
-                [nzValue]="data.key"
-                (click)="onCheckedDepart('account', data, true)"
-                >{{ data.title }}</label
-              >
-              @if (!data.isLeaf) {
-              <span nz-icon nzType="right" nzTheme="outline"></span>
-              }
-            </div>
-            }}@else {
-            <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
-            }
+            </ng-template> -->
           </div>
         </div>
+     
       </div>
     </div>
   </ng-container>

+ 17 - 13
projects/textbook/src/modules/nav-admin/page-role/page-role.component.scss

@@ -76,21 +76,25 @@
 .depart-modal{
   .row{
     width: 90%;
-    margin-bottom: 20px;
+    margin-bottom: 26px;
   }
-  .tree{
-    height: 180px;
-    overflow-y: scroll;
-    .li{
-      display: flex;
-      justify-content: space-between;
-      padding: 8px 4px;
-      span{
-        flex-shrink: 0;
+  .select{
+    width: 90%;
+    margin-bottom: 20px;
+    .tree{
+      height: 140px;
+      overflow-y: scroll;
+      .li{
+        display: flex;
+        justify-content: space-between;
+        padding: 8px 4px;
+        span{
+          flex-shrink: 0;
+        }
+      }
+      .li:hover{
+        background-color: #f9f9f9;
       }
-    }
-    .li:hover{
-      background-color: #f9f9f9;
     }
   }
 }

+ 42 - 19
projects/textbook/src/modules/nav-admin/page-role/page-role.component.ts

@@ -492,25 +492,11 @@ export class PageRoleComponent implements OnInit {
   }
   /* 添加账号 */
   async accountComplete(){
-    if(!this.account?.name.trim() || !this.account.department?.id || !this.account.password.trim()){
-      this.message.warning('请填写必填项');
-      return
-    }
-    if(!this.account.identity){
-      this.message.error("请选择人员类型");
-      return;
-    }
-    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
-    if(this.account.phone && !String(this.account.phone).match(a)){
-      this.message.error("请填写正确手机号");
-      return;
-    }
-    this.account.email = this.account?.email.trim()
-    this.account.phone = this.account?.phone.trim()
-    if(!this.account?.email && !this.account?.phone){
-      this.message.error("邮箱或手机号必须填写一项");
-      return;
-    }
+    this.account.email = this.account?.email.trim();
+    this.account.phone = this.account?.phone.trim();
+    this.account.name = this.account?.name.trim();
+    this.account.password = this.account?.password.trim();
+    if(!this.authVrifly()) return
     try{
       let obj = Parse.Object.extend('_User');
       let user = new obj()
@@ -549,6 +535,43 @@ export class PageRoleComponent implements OnInit {
       return;
     }
   }
+  authVrifly():boolean | undefined{
+    this.account.email = this.account?.email.trim();
+    this.account.phone = this.account?.phone.trim();
+    this.account.name = this.account?.name.trim();
+    this.account.password = this.account?.password.trim();
+    if(!this.account?.name|| !this.account.department?.id || !this.account.password
+      || !this.account.phone || !this.account?.email){
+      this.message.warning('请填写必填项');
+      return
+    }
+    if(!this.account.identity){
+      this.message.error("请选择人员类型");
+      return;
+    }
+    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
+    if(this.account.phone && !String(this.account.phone).match(a)){
+      this.message.error("请填写正确手机号");
+      return;
+    }
+    let m = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+    if(!String(this.account.email).match(m)){
+      this.message.error("邮箱格式有误");
+      return;
+    }
+    // if(!this.account?.email && !this.account?.phone){
+    //   this.message.error("邮箱或手机号必须填写一项");
+    //   return;
+    // }
+    console.log(this.account.password);
+    if(!(this.account.password.length >= 6 && this.account.password.length <= 18)){
+      this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
+      return;
+    }
+    return true
+  }
+
+
   setOfCheckedId = new Set<string>();
   //移除部门
   async removeBranch(data:Parse.Object){

+ 97 - 82
projects/textbook/src/modules/nav-admin/page-user/page-user.component.html

@@ -7,6 +7,7 @@
     </div>
   </nz-page-header-title>
   <nz-page-header-extra>
+    @if (this.tbookSer.profile.identity == '国家级管理员') {
     <nz-space>
       <button
         style="background: #3e49b3; border: 1px #3e49b3"
@@ -18,17 +19,18 @@
         创建用户
       </button>
     </nz-space>
+    }
   </nz-page-header-extra>
 </nz-page-header>
 <div class="content">
   <div class="tool">
     <div class="tool-left">
       <div class="search">
-        <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
+        <nz-input-group style="width: 300px" [nzPrefix]="prefixTemplateUser">
           <input
             type="text"
             nz-input
-            placeholder="输入关键词"
+            placeholder="输入用户姓名/手机号/邮箱/用户名搜索"
             [(ngModel)]="searchValue"
             (ngModelChange)="getProfile()"
           />
@@ -79,9 +81,24 @@
         <th nzWidth="120px">用户</th>
         <th nzWidth="120px">手机号</th>
         <th nzWidth="120px">邮箱</th>
-        <th nzWidth="120px">人员类型</th>
+        <th
+          nzWidth="120px"
+          [nzShowFilter]="true"
+          [nzFilters]="listOfColumns.identity.listOfFilter"
+          (nzFilterChange)="onChangeFilter($event,'identity')"
+        >
+          人员类型
+        </th>
         <th nzWidth="80px">认证状态</th>
-        <th nzWidth="150px" nzEllipsis>单位类型</th>
+        <th
+          nzWidth="150px"
+          nzEllipsis
+          [nzShowFilter]="true"
+          [nzFilters]="listOfColumns.companyType.listOfFilter"
+          (nzFilterChange)="onChangeFilter($event,'companyType')"
+        >
+          单位类型
+        </th>
         <th nzWidth="50px" nzRight>操作</th>
       </tr>
     </thead>
@@ -220,6 +237,76 @@
 >
   <ng-container *nzModalContent>
     <div nz-row class="depart-modal">
+      <div nz-col nzSpan="12">
+        <div class="row" style="margin-bottom: 6px;">
+          <div class="label">
+            选择所属部门 <span style="color: #e8353e">*</span>
+          </div>
+          <div class="value">
+            <input
+              nz-input
+              placeholder="请选择所属部门"
+              [ngModel]="account.department?.title"
+              (ngModelChange)="onSearchNodes($event)"
+              type="text"
+            />
+          </div>
+        </div>
+        <div class="select">
+          <div class="bar">
+            @if (this.tbookSer.profile.identity == '国家级管理员') {
+            <a style="color: #86909c" (click)="onPre()">教材遴选</a>
+            }@else {
+            <a style="color: #86909c">教材遴选</a>
+            } @for (data of parentMap; track data.title) {
+            <span style="margin: 0 10px">/</span>
+            @if (this.tbookSer.profile.identity == '国家级管理员' ||
+            data?.verify) {
+            <a (click)="onPre(data, $index)">{{ data.title }}</a>
+            }@else {
+            <a style="color: #86909c">{{ data.title }}</a>
+            } }
+          </div>
+          <div class="tree">
+            @if(parentList.length > 0){ @for (data of parentList; track $index)
+            {
+            <div class="li" (click)="onCheckedDepart(data)">
+              <label
+                nz-radio
+                [ngModel]="data.key == radio"
+                [nzValue]="data.key"
+                (click)="onCheckedDepart(data, true)"
+                >{{ data.title }}</label
+              >
+              @if (!data.isLeaf) {
+              <span nz-icon nzType="right" nzTheme="outline"></span>
+              }
+            </div>
+            } }@else {
+            <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
+            }
+          </div>
+        </div>
+        <div class="row">
+          <div class="label">人员类型(需要先选择所属部门)</div>
+          <div class="value">
+            <nz-select
+              style="width: 100%"
+              nzShowSearch
+              nzAllowClear
+              [disabled]="!this.account.department?.id"
+              [(ngModel)]="account.identity"
+              nzPlaceHolder="请选择身份类型"
+            >
+              @for(item of userType; track item;let index = $index){
+              <nz-option nzCustomContent [nzValue]="item" [nzLabel]="item">{{
+                item
+              }}</nz-option>
+              }
+            </nz-select>
+          </div>
+        </div>
+      </div>
       <div nz-col nzSpan="12">
         <div class="row">
           <div class="label">姓名 <span style="color: #e8353e">*</span></div>
@@ -245,7 +332,7 @@
           </div>
         </div>
         <div class="row">
-          <div class="label">手机号</div>
+          <div class="label">手机号 <span style="color: #e8353e">*</span></div>
           <div class="value">
             <input
               nz-input
@@ -257,7 +344,7 @@
           </div>
         </div>
         <div class="row">
-          <div class="label">邮箱</div>
+          <div class="label">邮箱 <span style="color: #e8353e">*</span></div>
           <div class="value">
             <input
               nz-input
@@ -270,7 +357,7 @@
         <div class="row">
           <div class="label">密码 <span style="color: #e8353e">*</span></div>
           <div class="value">
-            <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
+            <nz-input-group nzSearch [nzAddOnAfter]="">
               <input
                 type="password"
                 [(ngModel)]="account.password"
@@ -278,7 +365,7 @@
                 placeholder="请输入密码"
               />
             </nz-input-group>
-            <ng-template #suffixIconButton>
+            <!-- <ng-template #suffixIconButton>
               <button
                 nz-button
                 (click)="randomPassword()"
@@ -287,82 +374,10 @@
               >
                 自动生成密码
               </button>
-            </ng-template>
-          </div>
-        </div>
-        <div class="row">
-          <div class="label">人员类型(需要先选择所属部门)</div>
-          <div class="value">
-            <nz-select
-              style="width: 100%"
-              nzShowSearch
-              nzAllowClear
-              [disabled]="!this.account.department?.id"
-              [(ngModel)]="account.identity"
-              nzPlaceHolder="请选择身份类型"
-            >
-              @for(item of userType; track item;let index = $index){
-              <nz-option nzCustomContent [nzValue]="item" [nzLabel]="item">{{
-                item
-              }}</nz-option>
-              }
-            </nz-select>
-          </div>
-        </div>
-      </div>
-      <div nz-col nzSpan="12">
-        <div class="row">
-          <div class="label">
-            上级部门 <span style="color: #e8353e">*</span>
-          </div>
-          <div class="value">
-            <input
-              nz-input
-              placeholder="请选择所属部门"
-              [ngModel]="account.department?.title"
-              (ngModelChange)="onSearchNodes($event)"
-              type="text"
-            />
-          </div>
-        </div>
-        <div class="select">
-          <div class="bar">
-            @if (this.tbookSer.profile.identity == '国家级管理员') {
-              <a style="color: #86909c" (click)="onPre()">教材遴选</a>
-            }@else {
-              <a style="color: #86909c">教材遴选</a>
-            }
-            @for (data of parentMap; track data.title) {
-              <span style="margin: 0 10px">/</span>
-              @if (this.tbookSer.profile.identity == '国家级管理员' ||
-              data?.verify) {
-                <a (click)="onPre(data, $index)">{{ data.title }}</a>
-              }@else {
-                <a style="color: #86909c">{{ data.title }}</a>
-              }
-            }
-          </div>
-          <div class="tree">
-            @if(parentList.length > 0){
-              @for (data of parentList; track $index) {
-                <div class="li" (click)="onCheckedDepart(data)">
-                  <label
-                    nz-radio
-                    [ngModel]="data.key == radio"
-                    [nzValue]="data.key"
-                    (click)="onCheckedDepart(data, true)"
-                    >{{ data.title }}</label
-                  >
-                  @if (!data.isLeaf) {
-                  <span nz-icon nzType="right" nzTheme="outline"></span>
-                  }
-                </div>
-                }
-            }@else {
-              <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
-            }
+            </ng-template> -->
           </div>
         </div>
+
       </div>
     </div>
   </ng-container>

+ 17 - 13
projects/textbook/src/modules/nav-admin/page-user/page-user.component.scss

@@ -69,21 +69,25 @@
 .depart-modal{
   .row{
     width: 90%;
-    margin-bottom: 20px;
+    margin-bottom: 26px;
   }
-  .tree{
-    height: 320px;
-    overflow-y: scroll;
-    .li{
-      display: flex;
-      justify-content: space-between;
-      padding: 8px 4px;
-      span{
-        flex-shrink: 0;
+  .select{
+    width: 90%;
+    margin-bottom: 20px;
+    .tree{
+      height: 220px;
+      overflow-y: scroll;
+      .li{
+        display: flex;
+        justify-content: space-between;
+        padding: 8px 4px;
+        span{
+          flex-shrink: 0;
+        }
+      }
+      .li:hover{
+        background-color: #f9f9f9;
       }
-    }
-    .li:hover{
-      background-color: #f9f9f9;
     }
   }
 }

+ 78 - 23
projects/textbook/src/modules/nav-admin/page-user/page-user.component.ts

@@ -36,7 +36,24 @@ import { NzRadioModule } from 'ng-zorro-antd/radio';
 })
 export class PageUserComponent implements OnInit {
   @ViewChild(CompTableListComponent) list: CompTableListComponent | undefined;
-
+  listOfColumns: any = {
+    identity: {
+      listOfFilter: [
+        { value: '工作联系人', text: '工作联系人' },
+        { value: '高校联系人', text: '高校联系人' },
+        { value: '评审专家', text: '评审专家' },
+        { value: '个人', text: '个人' },
+      ],
+    },
+    companyType: {
+      listOfFilter: [
+        { value: '教育部直属高校', text: '教育部直属高校' },
+        { value: '中央有关部门(单位)教育司(局)', text: '中央有关部门(单位)教育司(局)' },
+        { value: '省级教育行政部门', text: '省级教育行政部门' },
+        { value: '出版单位', text: '出版单位' },
+      ],
+    },
+  }
   // _User = _User;
   // ProfileList = Profile;
   // className: string | undefined;
@@ -70,7 +87,11 @@ export class PageUserComponent implements OnInit {
     companyType: '',
   };
   parents: Array<any> = []; //所有一级列表
-
+  //筛选条件
+  filters: any = {
+    identity: { type: 'string', value: [] },
+    companyType: { type: 'string', value: [] },
+  };
   constructor(
     public tbookSer: textbookServer,
     private modal: NzModalService,
@@ -131,6 +152,12 @@ export class PageUserComponent implements OnInit {
       };
     }
     let query = Parse.Query.fromJSON('Profile', queryParams);
+    for (const key in this.filters) {
+      const element = this.filters[key];
+      if (element.value?.length > 0) {
+        query.containedIn(key, element.value);
+      }
+    }
     query.include('user');
     query.notEqualTo('identity', '国家级管理员');
     query.descending('createdAt');
@@ -152,6 +179,14 @@ export class PageUserComponent implements OnInit {
     this.pageIndex = e;
     this.getProfile();
   }
+  //筛选条件
+  onChangeFilter(data: any, type:string){
+    console.log(data);
+    this.filters[type].value = data
+    this.profiles = []
+    this.pageIndex = 1
+    this.getProfile()
+  }
   createUser() {
     this.route.navigate(['/nav-admin/manage/user/create']);
   }
@@ -402,30 +437,12 @@ export class PageUserComponent implements OnInit {
   }
   /* 添加账号 */
   async accountComplete() {
-    if (
-      !this.account?.name.trim() ||
-      !this.account.department?.id ||
-      !this.account.password.trim()
-    ) {
-      this.message.warning('请填写必填项');
-      return;
-    }
-    if (!this.account.identity) {
-      this.message.error('请选择人员类型');
-      return;
-    }
-    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
-    if (this.account.phone && !String(this.account.phone).match(a)) {
-      this.message.error('请填写正确手机号');
-      return;
-    }
     this.account.username = this.account?.username.trim();
     this.account.email = this.account?.email.trim();
     this.account.phone = this.account?.phone.trim();
-    if (!this.account?.email.trim() && !this.account?.phone.trim()) {
-      this.message.error('邮箱或手机号必须填写一项');
-      return;
-    }
+    this.account.name = this.account?.name.trim();
+    this.account.password = this.account?.password.trim();
+    if(!this.authVrifly()) return
     try {
       let obj = Parse.Object.extend('_User');
       let user = new obj();
@@ -469,4 +486,42 @@ export class PageUserComponent implements OnInit {
       return;
     }
   }
+  authVrifly():boolean | undefined{
+    this.account.password = this.account?.password.trim();
+    this.account.email = this.account?.email.trim();
+    this.account.phone = this.account?.phone.trim();
+    this.account.name = this.account?.name.trim();
+    if (
+      !this.account?.name ||
+      !this.account.department?.id ||
+      !this.account.password||
+      !this.account.phone || !this.account?.email
+    ) {
+      this.message.warning('请填写必填项');
+      return;
+    }
+    if (!this.account.identity) {
+      this.message.error('请选择人员类型');
+      return;
+    }
+    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
+    if (this.account.phone && !String(this.account.phone).match(a)) {
+      this.message.error('请填写正确手机号');
+      return;
+    }
+    let m = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+    if(!String(this.account.email).match(m)){
+      this.message.error("邮箱格式有误");
+      return;
+    }
+    // if (!this.account?.email&& !this.account?.phone) {
+    //   this.message.error('邮箱或手机号必须填写一项');
+    //   return;
+    // }
+    if(!(this.account.password.length >= 6 && this.account.password.length <= 18)){
+      this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
+      return;
+    }
+    return true
+  }
 }

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

@@ -24,7 +24,7 @@
   <div class="tool">
     <div class="tool-left">
       <div class="search">
-        <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
+        <!-- <nz-input-group style="width: 210px" [nzPrefix]="prefixTemplateUser">
           <input
             type="text"
             nz-input
@@ -34,14 +34,14 @@
         </nz-input-group>
         <ng-template #prefixTemplateUser
           ><span nz-icon nzType="search"></span
-        ></ng-template>
+        ></ng-template> -->
         <button
           nz-button
           nzType="default"
           nz-dropdown
           [nzDropdownMenu]="menutep"
           [nzPlacement]="'bottomLeft'"
-          style="margin-left: 10px"
+          style="margin-left: 0px; width: 180px;"
         >
           <span nz-icon nzType="plus" nzTheme="outline"></span>新建
         </button>
@@ -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()">
@@ -324,61 +324,49 @@
   <ng-container *nzModalContent>
     <div nz-row class="depart-modal">
       <div nz-col nzSpan="12">
-        <div class="row">
-          <div class="label">姓名 <span style="color: #e8353e">*</span></div>
-          <div class="value">
-            <input
-              nz-input
-              placeholder="请输入姓名"
-              [(ngModel)]="account.name"
-              type="text"
-            />
+        <div class="row" style="margin-bottom: 6px;">
+          <div class="label">
+            选择所属部门 <span style="color: #e8353e">*</span>
           </div>
-        </div>
-        <div class="row">
-          <div class="label">手机号</div>
           <div class="value">
             <input
               nz-input
-              maxlength="12"
-              placeholder="请输入手机号"
-              [(ngModel)]="account.phone"
+              placeholder="请选择所属部门"
+              [ngModel]="account.department?.title"
+              (ngModelChange)="onSearchNodes($event, true)"
               type="text"
             />
           </div>
         </div>
-        <div class="row">
-          <div class="label">邮箱</div>
-          <div class="value">
-            <input
-              nz-input
-              placeholder="请输入邮箱"
-              [(ngModel)]="account.email"
-              type="email"
-            />
+        <div class="select">
+          <div class="bar">
+            <a style="color: #86909c">教材遴选</a>
+            @for (data of parentMap; track data.title) {
+            <span style="margin: 0 10px">/</span>
+            @if ($index !=0 && data?.verify) {
+            <a (click)="onPre(data, $index)">{{ data.title }}</a>
+            }@else {
+            <a style="color: #86909c">{{ data.title }}</a>
+            } }
           </div>
-        </div>
-        <div class="row">
-          <div class="label">密码 <span style="color: #e8353e">*</span></div>
-          <div class="value">
-            <nz-input-group nzSearch [nzAddOnAfter]="suffixIconButton">
-              <input
-                type="password"
-                [(ngModel)]="account.password"
-                nz-input
-                placeholder="请输入密码"
-              />
-            </nz-input-group>
-            <ng-template #suffixIconButton>
-              <button
-                nz-button
-                (click)="randomPassword()"
-                nzType="primary"
-                nzSearch
+          <div class="tree">
+            @if(parentList.length > 0){ @for (data of parentList; track $index)
+            {
+            <div class="li" (click)="onCheckedDepart('account', data)">
+              <label
+                nz-radio
+                [ngModel]="data.key == radio"
+                [nzValue]="data.key"
+                (click)="onCheckedDepart('account', data, true)"
+                >{{ data.title }}</label
               >
-                自动生成密码
-              </button>
-            </ng-template>
+              @if (!data.isLeaf) {
+              <span nz-icon nzType="right" nzTheme="outline"></span>
+              }
+            </div>
+            } }@else {
+            <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
+            }
           </div>
         </div>
         <div class="row">
@@ -409,48 +397,60 @@
       </div>
       <div nz-col nzSpan="12">
         <div class="row">
-          <div class="label">
-            上级部门 <span style="color: #e8353e">*</span>
+          <div class="label">姓名 <span style="color: #e8353e">*</span></div>
+          <div class="value">
+            <input
+              nz-input
+              placeholder="请输入姓名"
+              [(ngModel)]="account.name"
+              type="text"
+            />
           </div>
+        </div>
+        <div class="row">
+          <div class="label">手机号 <span style="color: #e8353e">*</span></div>
           <div class="value">
             <input
               nz-input
-              placeholder="请选择所属部门"
-              [ngModel]="account.department?.title"
-              (ngModelChange)="onSearchNodes($event, true)"
+              maxlength="12"
+              placeholder="请输入手机号"
+              [(ngModel)]="account.phone"
               type="text"
             />
           </div>
         </div>
-        <div class="select">
-          <div class="bar">
-            <a style="color: #86909c">教材遴选</a>
-            @for (data of parentMap; track data.title) {
-            <span style="margin: 0 10px">/</span>
-            @if ($index !=0 && data?.verify) {
-            <a (click)="onPre(data, $index)">{{ data.title }}</a>
-            }@else {
-            <a style="color: #86909c">{{ data.title }}</a>
-            } }
+        <div class="row">
+          <div class="label">邮箱 <span style="color: #e8353e">*</span></div>
+          <div class="value">
+            <input
+              nz-input
+              placeholder="请输入邮箱"
+              [(ngModel)]="account.email"
+              type="email"
+            />
           </div>
-          <div class="tree">
-            @if(parentList.length > 0){ @for (data of parentList; track $index)
-            {
-            <div class="li" (click)="onCheckedDepart('account', data)">
-              <label
-                nz-radio
-                [ngModel]="data.key == radio"
-                [nzValue]="data.key"
-                (click)="onCheckedDepart('account', data, true)"
-                >{{ data.title }}</label
+        </div>
+        <div class="row">
+          <div class="label">密码 <span style="color: #e8353e">*</span></div>
+          <div class="value">
+            <nz-input-group nzSearch [nzAddOnAfter]="">
+              <input
+                type="password"
+                [(ngModel)]="account.password"
+                nz-input
+                placeholder="请输入密码"
+              />
+            </nz-input-group>
+            <!-- <ng-template #suffixIconButton>
+              <button
+                nz-button
+                (click)="randomPassword()"
+                nzType="primary"
+                nzSearch
               >
-              @if (!data.isLeaf) {
-              <span nz-icon nzType="right" nzTheme="outline"></span>
-              }
-            </div>
-            } }@else {
-            <nz-empty nzNotFoundContent="暂无下级部门"></nz-empty>
-            }
+                自动生成密码
+              </button>
+            </ng-template> -->
           </div>
         </div>
       </div>

+ 19 - 15
projects/textbook/src/modules/nav-province-contact/page-role/page-role.component.scss

@@ -21,7 +21,7 @@
       align-items: center;
       .search{
         display: flex;
-        width: 280px;
+        width: 200px;
         margin-right: 20px;
       }
       .tag{
@@ -39,7 +39,7 @@
     display: flex;
     width: 100%;
     .sider{
-      width: 280px;
+      width: 200px;
       margin: 10px 0;
       height: calc(100vh - 192px);
       overflow-y: scroll;
@@ -76,21 +76,25 @@
 .depart-modal{
   .row{
     width: 90%;
-    margin-bottom: 20px;
+    margin-bottom: 26px;
   }
-  .tree{
-    height: 180px;
-    overflow-y: scroll;
-    .li{
-      display: flex;
-      justify-content: space-between;
-      padding: 8px 4px;
-      span{
-        flex-shrink: 0;
+  .select{
+    width: 90%;
+    margin-bottom: 20px;
+    .tree{
+      height: 140px;
+      overflow-y: scroll;
+      .li{
+        display: flex;
+        justify-content: space-between;
+        padding: 8px 4px;
+        span{
+          flex-shrink: 0;
+        }
+      }
+      .li:hover{
+        background-color: #f9f9f9;
       }
-    }
-    .li:hover{
-      background-color: #f9f9f9;
     }
   }
 }

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

@@ -502,29 +502,11 @@ export class PageRoleComponent implements OnInit {
   }
   /* 添加账号 */
   async accountComplete() {
-    if (
-      !this.account?.name.trim() ||
-      !this.account.department?.id ||
-      !this.account.password.trim()
-    ) {
-      this.message.warning('请填写必填项');
-      return;
-    }
-    if (!this.account.identity) {
-      this.message.error('请选择人员类型');
-      return;
-    }
-    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/;
-    if (this.account.phone && !String(this.account.phone).match(a)) {
-      this.message.error('请填写正确手机号');
-      return;
-    }
     this.account.email = this.account?.email.trim();
     this.account.phone = this.account?.phone.trim();
-    if (!this.account?.email && !this.account?.phone) {
-      this.message.error('邮箱或手机号必须填写一项');
-      return;
-    }
+    this.account.name = this.account?.name.trim();
+    this.account.password = this.account?.password.trim();
+    if(!this.authVrifly()) return
     try {
       let obj = Parse.Object.extend('_User');
       let user = new obj();
@@ -562,6 +544,43 @@ export class PageRoleComponent implements OnInit {
       return;
     }
   }
+  authVrifly():boolean | undefined{
+    this.account.email = this.account?.email.trim();
+    this.account.phone = this.account?.phone.trim();
+    this.account.name = this.account?.name.trim();
+    this.account.password = this.account?.password.trim();
+    if(!this.account?.name|| !this.account.department?.id || !this.account.password
+      || !this.account.phone || !this.account?.email){
+      this.message.warning('请填写必填项');
+      return
+    }
+    if(!this.account.identity){
+      this.message.error("请选择人员类型");
+      return;
+    }
+    let a = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
+    if(this.account.phone && !String(this.account.phone).match(a)){
+      this.message.error("请填写正确手机号");
+      return;
+    }
+    let m = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+    if(!String(this.account.email).match(m)){
+      this.message.error("邮箱格式有误");
+      return;
+    }
+    // if(!this.account?.email && !this.account?.phone){
+    //   this.message.error("邮箱或手机号必须填写一项");
+    //   return;
+    // }
+    console.log(this.account.password);
+    if(!(this.account.password.length >= 6 && this.account.password.length <= 18)){
+      this.message.error('密码格式错误,请填写6-18位非空字符串(数字、大小写字母或英文符号)');
+      return;
+    }
+    return true
+  }
+
+
   setOfCheckedId = new Set<string>();
   //移除部门
   async removeBranch(data: Parse.Object) {