From c74bcea2850e7558322c4f4b1d90dc3143b50af8 Mon Sep 17 00:00:00 2001 From: SHAOJIAHAO <55341701@qq.com> Date: Thu, 7 Apr 2022 17:19:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E6=94=B9]=E4=BF=AE=E6=94=B9=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E8=80=83=E9=A2=98=E5=BC=B9=E5=87=BA=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.component.spec.ts | 35 ----------- src/app/app.module.ts | 2 + .../examiner-index.component.html | 2 +- .../examiner-index.component.ts | 60 +++++++++++++------ .../examiner/examiner-index/finishDia.html | 10 ++-- .../examiner/examiner-index/finishDia.scss | 1 - src/app/examiner/examiner.module.ts | 6 +- src/styles.scss | 4 +- 8 files changed, 58 insertions(+), 62 deletions(-) delete mode 100644 src/app/app.component.spec.ts diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts deleted file mode 100644 index 6ee0c27..0000000 --- a/src/app/app.component.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - RouterTestingModule - ], - declarations: [ - AppComponent - ], - }).compileComponents(); - })); - - it('should create the app', () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - }); - - it(`should have as title 'anxin119'`, () => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('anxin119'); - }); - - it('should render title', () => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('.content span').textContent).toContain('anxin119 app is running!'); - }); -}); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 70298a2..c612b79 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -29,6 +29,7 @@ import { registerLocaleData } from '@angular/common'; import zh from '@angular/common/locales/zh'; import { ExaminerModule } from './examiner/examiner.module'; import { StudentModule} from './student/student.module' +import { NzModalModule } from 'ng-zorro-antd/modal'; registerLocaleData(zh); @NgModule({ @@ -48,6 +49,7 @@ registerLocaleData(zh); HttpClientModule, ExaminerModule, StudentModule, + NzModalModule ], providers: [httpInterceptorProviders, CacheTokenService,TreeService,ComponentServiceService], bootstrap: [AppComponent] diff --git a/src/app/examiner/examiner-index/examiner-index.component.html b/src/app/examiner/examiner-index/examiner-index.component.html index 73ffa6c..ec56fc6 100644 --- a/src/app/examiner/examiner-index/examiner-index.component.html +++ b/src/app/examiner/examiner-index/examiner-index.component.html @@ -12,7 +12,7 @@
+ [nzNodes]="nodes" nzPlaceHolder="请选择" [nzExpandedIcon]="multiExpandedIconTpl" [nzExpandedKeys]="expandedKeys" (click)="zIndex()"> diff --git a/src/app/examiner/examiner-index/examiner-index.component.ts b/src/app/examiner/examiner-index/examiner-index.component.ts index d2a57c5..fb3ada9 100644 --- a/src/app/examiner/examiner-index/examiner-index.component.ts +++ b/src/app/examiner/examiner-index/examiner-index.component.ts @@ -6,7 +6,7 @@ * @LastEditors: sueRimn * @LastEditTime: 2021-02-25 11:44:34 */ -import { Component, OnInit, ViewChild, Inject, Input } from '@angular/core'; +import { Component, OnInit, ViewChild, Inject, Input, ViewContainerRef } from '@angular/core'; import { HttpClient } from '@angular/common/http' import { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatPaginator } from '@angular/material/paginator'; @@ -19,6 +19,7 @@ import { MatTreeFlatDataSource, MatTreeFlattener } from '@angular/material/tree' import { FlatTreeControl } from '@angular/cdk/tree'; import { TreeService } from '../../http-interceptors/tree.service' import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro-antd/tree' +import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; @Component({ selector: 'app-examiner-index', @@ -27,8 +28,8 @@ import { NzFormatEmitEvent, NzTreeComponent, NzTreeNodeOptions } from 'ng-zorro- }) export class ExaminerIndexComponent implements OnInit { - constructor(private router: Router, private activatedRoute: ActivatedRoute, public http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private tree: TreeService) { } - //displayedColumns: string[] = ['name', 'organization', 'startTime', 'overTime', 'testState', 'operation']; + constructor(private router: Router, private activatedRoute: ActivatedRoute, public http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private tree: TreeService, private modal: NzModalService, private viewContainerRef: ViewContainerRef) { } + ngOnInit(): void { @@ -252,18 +253,42 @@ export class ExaminerIndexComponent implements OnInit { } //新增考题跳转 newExamination() { - //this.router.navigate(['/home/createexam-index/examiner-new-one']) - const dialogRef = this.dialog.open(FinishDia, { - width: '685px', - data: { + + + // const dialogRef = this.dialog.open(FinishDia, { + // width: '685px', + // data: { + // Profiles: this.Profiles, + // treedata: this.treedata, + // } + // }); + + + const modal: any = this.modal.create({ + nzTitle: '新增考题', + nzContent: FinishDia, + nzViewContainerRef: this.viewContainerRef, + nzWidth: 688, + nzFooter: null, + nzComponentParams: { Profiles: this.Profiles, - treedata: this.treedata + treedata: this.treedata, + }, + nzOnOk: async () => { + } }); + const instance = modal.getContentComponent(); + modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); + // Return a result when closed + modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); + } js: any //辖区中队输入框 + zIndex() { + } } @@ -275,18 +300,20 @@ export class ExaminerIndexComponent implements OnInit { }) export class FinishDia { // @ViewChild('nzTreSelect', { static: false }) nzTreSelect!: NzTreeComponent; - constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any) { } + constructor(private router: Router, private http: HttpClient, public dialog: MatDialog, public snackBar: MatSnackBar, private modal: NzModalRef) { } //获取登录账号的个人资料 Profiles: any - treedata + treedata: any + selectedOr nodes = [] - + expandedKeys = [] ngOnInit(): void { - this.Profiles = this.data.Profiles - this.nodes = this.data.treedata + this.Profiles = this.Profiles + this.nodes = [...this.treedata] + this.expandedKeys = [this.treedata[0].key] } - selectedOr + onChange($event: string[]): void { console.log($event); @@ -341,8 +368,7 @@ export class FinishDia { console.log(this.selectedOr) this.http.post('/api/Papers', body).subscribe(data => { this.snackBar.open('创建成功', '确定', config); - this.dialogRef.close(); - //sessionStorage.removeItem("checkedWork") + this.modal.triggerOk() this.tabledate = data console.log(this.tabledate) sessionStorage.setItem("paperId", this.tabledate.id) @@ -368,7 +394,7 @@ export class FinishDia { close() { - this.dialogRef.close(); + // this.dialogRef.close(); } } diff --git a/src/app/examiner/examiner-index/finishDia.html b/src/app/examiner/examiner-index/finishDia.html index adb6717..d41f4ca 100644 --- a/src/app/examiner/examiner-index/finishDia.html +++ b/src/app/examiner/examiner-index/finishDia.html @@ -13,9 +13,9 @@
- + [nzExpandedIcon]="multiExpandedIconTpl" [nzExpandedKeys]="expandedKeys"> @@ -44,10 +44,10 @@
-
+
+ style="background-color: #07CDCF;color: #fff;margin-right: 3px;">确定 + style=" background-color: #FF8678;color: #fff;margin-left: 3px;">取消
\ No newline at end of file diff --git a/src/app/examiner/examiner-index/finishDia.scss b/src/app/examiner/examiner-index/finishDia.scss index 9451607..c8eae2b 100644 --- a/src/app/examiner/examiner-index/finishDia.scss +++ b/src/app/examiner/examiner-index/finishDia.scss @@ -1,7 +1,6 @@ .box { display: flex; flex-direction: column; - margin-left: 10px; box-sizing: border-box; padding: 16px; input { diff --git a/src/app/examiner/examiner.module.ts b/src/app/examiner/examiner.module.ts index 0fab9bf..a17e011 100644 --- a/src/app/examiner/examiner.module.ts +++ b/src/app/examiner/examiner.module.ts @@ -112,9 +112,11 @@ import { NzTreeSelectModule } from 'ng-zorro-antd/tree-select'; NavigationModule, NzTreeModule, NzDatePickerModule, - NzTreeSelectModule + NzTreeSelectModule, + ], providers: [{ provide: MatPaginatorIntl, useValue: myPaginator() }], - exports: [PlanLevel] + exports: [PlanLevel], + entryComponents:[FinishDia] }) export class ExaminerModule { } diff --git a/src/styles.scss b/src/styles.scss index fd28ff3..aa72e22 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -3,7 +3,7 @@ @import "./assets/css/ngZorroTree.css"; /* 引入组件样式 */ @import "~ng-zorro-antd/tree-select/style/index.min.css"; - +@import "~ng-zorro-antd/modal/style/index.min.css"; /* 引入组件样式 */ @import "./assets/css/time.scss"; @@ -193,9 +193,11 @@ table td.mat-footer-cell:last-of-type { .maxHeightTreeSelect { max-height: 280px; + z-index: 1001; } .ant-select-selector { + z-index: 1001; max-height: 191px; overflow-y: auto; }