Browse Source

update 创建用户相关

warrior 7 months ago
parent
commit
c1a6c2643e

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

@@ -286,7 +286,7 @@
               <input
                 nz-input
                 placeholder="可击下方选择所属上级"
-                [(ngModel)]="editObject.parent?.title"
+                [(ngModel)]="modalValue"
                 (ngModelChange)="onSearchNodes($event, true)"
                 (blur)="onblur('editObject')"
                 type="text"
@@ -387,7 +387,7 @@
                 nz-radio
                 [ngModel]="data.key == radio"
                 [nzValue]="data.key"
-                (click)="onCheckedDepart('account', data, true)"
+                (click)="onCheckedDepart('account', data, data?.branch)"
                 >{{ data.title }}</label
               >
               @if (!data.isLeaf) {

+ 26 - 17
projects/textbook/src/modules/nav-admin/page-role/page-role.component.ts

@@ -341,6 +341,8 @@ export class PageRoleComponent implements OnInit {
   }
   //添加成员
   addMember() {
+    this.radio = '';
+    this.modalValue = ''
     this.parentList = this.nodes;
     this.account = {
       name: '',
@@ -363,6 +365,8 @@ export class PageRoleComponent implements OnInit {
       parent: '',
       branch: '',
     };
+    this.radio = '';
+    this.modalValue = ''
     if (type == 'edit') {
       let query = new Parse.Query('Department');
       query.include('parent','parent.parent')
@@ -419,26 +423,12 @@ export class PageRoleComponent implements OnInit {
   }
   //选择所属类别下级列表
   async onCheckedDepart(type: string, e: any, checked?: boolean) {
+    console.log(e);
     this.radio = e.key;
     if (type == 'account') this.account.identity = '';
     this.parentMap = await this.tbookSer.formatNode(e.key);
-    if (checked) {
-      // this.editObject.name = e.title
-      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)
-        ? !e.type ? ['工作联系人'] : ['评审专家', '工作联系人', '教师']
-        : e.type == '单位'
-        ? ['评审专家', '高校联系人', '教师']
-        : ['评审专家', '教师'];
-      } else {
-        this.editObject.parent = {
-          title: e.title,
-          id: e.key,
-        };
-        this.editObject.branch = e.branch || e.title;
-      }
+    if (checked || e.isLeaf) {
+      this.pushValue(type,e)
       return;
     }
     if (e.isLeaf) {
@@ -446,6 +436,25 @@ export class PageRoleComponent implements OnInit {
     }
     this.parentList = await this.getDepart(e?.key);
   }
+  //赋值
+  pushValue(type:string, e: any){
+    this.modalValue = e.title
+    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)
+      ? !e.type ? ['工作联系人'] : ['评审专家', '工作联系人', '教师']
+      : e.type == '单位'
+      ? ['评审专家', '高校联系人', '教师']
+      : ['评审专家', '教师'];
+    } else {
+      this.editObject.parent = {
+        title: e.title,
+        id: e.key,
+      };
+      this.editObject.branch = e.branch || e.title;
+    }
+  }
   async handleOk(): Promise<void> {
     if (!this.editObject?.name || !this.editObject.parent?.id) {
       this.message.error('请填写完整信息');