Browse Source

[完善]完善演练功能

tianjin
邵佳豪 2 years ago
parent
commit
d72f15ab8f
  1. 2
      src/app/key-unit/key-unit-management/key-unit-management.component.ts
  2. 47
      src/app/key-unit/key-unit-management/upload-drill/upload-drill.component.html
  3. 30
      src/app/key-unit/key-unit-management/upload-drill/upload-drill.component.ts
  4. 106
      src/app/plan-management/drill-record/drill-record.component.html
  5. 149
      src/app/plan-management/drill-record/drill-record.component.scss
  6. 171
      src/app/plan-management/drill-record/drill-record.component.ts
  7. 236
      src/app/plan-management/plan-management.module.ts
  8. 284
      src/app/ui/navmenus/navmenus.component.ts
  9. 1
      src/index.html
  10. 4
      src/styles.scss

2
src/app/key-unit/key-unit-management/key-unit-management.component.ts

@ -891,7 +891,7 @@ export class KeyUnitManagementComponent implements OnInit {
console.log(element);
const dialogRef = this.dialog.open(UploadDrillComponent, {
width: "700px",
data: { unitInfo: element },
data: { unitInfo: element, isEditMode: true },
});
dialogRef.afterClosed().subscribe((result) => {

47
src/app/key-unit/key-unit-management/upload-drill/upload-drill.component.html

@ -1,4 +1,4 @@
<h2 mat-dialog-title>上传演练记录</h2>
<h2 mat-dialog-title>演练记录</h2>
<div class="box">
<div class="contentItem">
<div class="title">
@ -30,21 +30,24 @@
<div class="content peoplecontent">
<div>
<span class="name">带队人员:</span>
<input name="teamLeader" [(ngModel)]="teamLeader" nz-input placeholder="带队人员" />
<input [disabled]="!isEditMode" name="teamLeader" [(ngModel)]="teamLeader" nz-input
placeholder="带队人员" />
</div>
<div>
<span class="name">熟悉时间:</span>
<nz-range-picker [nzShowTime]="{ nzFormat: 'HH:mm' }" nzFormat="yyyy-MM-dd HH:mm"
[nzPlaceHolder]="['开始时间', '结束时间']" name="time" [(ngModel)]="time"></nz-range-picker>
<nz-range-picker [disabled]="!isEditMode" [nzShowTime]="{ nzFormat: 'HH:mm' }"
nzFormat="yyyy-MM-dd HH:mm" [nzPlaceHolder]="['开始时间', '结束时间']" name="time"
[(ngModel)]="time"></nz-range-picker>
</div>
<div>
<span class="name">调研照片:</span>
<div class="uploadbox">
<input type="file" (change)="upload($event,'调研')">
<button nz-button nzType="default">上传照片</button>
<input *ngIf="isEditMode" type="file" (change)="upload($event,'调研')">
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button>
<ul class="imgbox">
<li *ngFor="let item of surveyPhoto;let key = index"><img [src]="item" alt="">
<span class="close material-icons" (click)="deleteImg(surveyPhoto,key)">
<li *ngFor="let item of surveyPhoto;let key = index"><img [src]="item" alt=""
(click)="viewImg(item)">
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(surveyPhoto,key)">
cancel
</span>
</li>
@ -61,11 +64,12 @@
<div>
<span class="name">水源照片:</span>
<div class="uploadbox">
<input type="file" (change)="upload($event,'水源')">
<button nz-button nzType="default">上传照片</button>
<input *ngIf="isEditMode" type="file" (change)="upload($event,'水源')">
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button>
<ul class="imgbox">
<li *ngFor="let item of waterPhoto;let key = index"><img [src]="item" alt="">
<span class="close material-icons" (click)="deleteImg(waterPhoto,key)">
<li *ngFor="let item of waterPhoto;let key = index"><img [src]="item" alt=""
(click)="viewImg(item)">
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(waterPhoto,key)">
cancel
</span>
</li>
@ -75,11 +79,12 @@
<div>
<span class="name">疏散通道:</span>
<div class="uploadbox">
<input type="file" (change)="upload($event,'疏散通道')">
<button nz-button nzType="default">上传照片</button>
<input *ngIf="isEditMode" type="file" (change)="upload($event,'疏散通道')">
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button>
<ul class="imgbox">
<li *ngFor="let item of routePhoto;let key = index"><img [src]="item" alt="">
<span class="close material-icons" (click)="deleteImg(routePhoto,key)">
<li *ngFor="let item of routePhoto;let key = index"><img [src]="item" alt=""
(click)="viewImg(item)">
<span *ngIf="isEditMode" class="close material-icons" (click)="deleteImg(routePhoto,key)">
cancel
</span>
</li>
@ -89,11 +94,13 @@
<div>
<span class="name">消控室:</span>
<div class="uploadbox">
<input type="file" (change)="upload($event,'消控室')">
<button nz-button nzType="default">上传照片</button>
<input *ngIf="isEditMode" type="file" (change)="upload($event,'消控室')">
<button *ngIf="isEditMode" nz-button nzType="default">上传照片</button>
<ul class="imgbox">
<li *ngFor="let item of fireControlPhoto;let key = index"><img [src]="item" alt="">
<span class="close material-icons" (click)="deleteImg(fireControlPhoto,key)">
<li *ngFor="let item of fireControlPhoto;let key = index"><img [src]="item" alt=""
(click)="viewImg(item)">
<span *ngIf="isEditMode" class="close material-icons"
(click)="deleteImg(fireControlPhoto,key)">
cancel
</span>
</li>

30
src/app/key-unit/key-unit-management/upload-drill/upload-drill.component.ts

@ -4,6 +4,7 @@ import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { ObjectsService } from "@src/app/services/objects.service";
import { DatePipe } from "@angular/common";
import { MatSnackBar } from "@angular/material/snack-bar";
import Viewer from "viewerjs";
@Component({
selector: "app-upload-drill",
templateUrl: "./upload-drill.component.html",
@ -20,8 +21,11 @@ export class UploadDrillComponent implements OnInit {
public snackBar: MatSnackBar
) {}
isEditMode = true;
ngOnInit(): void {
console.log(this.data);
this.isEditMode = this.data.isEditMode;
this.getData();
}
@ -128,6 +132,11 @@ export class UploadDrillComponent implements OnInit {
drillId;
isLoadingSave = false;
save() {
if (!this.isEditMode) {
this.dialogRef.close();
return;
}
if (!this.teamLeader || !this.time) {
this.snackBar.open("请输入带队人员和熟悉时间", "确定", {
verticalPosition: "top",
@ -146,7 +155,6 @@ export class UploadDrillComponent implements OnInit {
escapeRoute: JSON.stringify(this.routePhoto),
fireControlRoom: JSON.stringify(this.fireControlPhoto),
};
console.log(body);
if (this.isHttpPost) {
this.http.post("/api/DrillRecords", body).subscribe((data: any) => {
this.drillId = data.id;
@ -172,4 +180,24 @@ export class UploadDrillComponent implements OnInit {
});
}
}
//查看图片
viewImg(url) {
let dom = document.getElementById(`viewerjs`);
let pObjs = dom.childNodes;
let node = document.createElement("img");
node.style.display = "none";
node.src = url;
node.id = "img";
dom.appendChild(node);
setTimeout(() => {
let viewer = new Viewer(document.getElementById(`viewerjs`), {
hidden: () => {
dom.removeChild(pObjs[0]);
viewer.destroy();
},
});
node.click();
}, 0);
}
}

106
src/app/plan-management/drill-record/drill-record.component.html

@ -1,63 +1,59 @@
<!-- <p>演练记录</p> -->
<div class="box">
<div class="header">
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm">
<div class="queryBox">
<div class="queryField">
<label style="margin-right: 10px;">演练对象:</label>
<mat-form-field class="example-full-width">
<input matInput placeholder="请输入演练对象" name="companyName" [(ngModel)]="name" autocomplete="off">
</mat-form-field>
</div>
<div class="queryField">
<label style="margin-right: 10px;">演练时间:</label>
<mat-form-field class="example-full-width">
<input matInput placeholder="请选择演练时间" name="companyName" [(ngModel)]="time" autocomplete="off">
</mat-form-field>
</div>
<div class="queryField">
<button mat-raised-button color="primary">查询</button>
<button mat-raised-button style="margin-left: 25px;" type="button" (click)="reset()">重置</button>
</div>
<form class="queryBox" (ngSubmit)="onSubmit()">
<div class="queryField">
<span style="width: 108px;">单位名称:</span>
<input name="name" nz-input placeholder="请输入单位名称" [(ngModel)]="name" />
</div>
<div class="queryField" style="margin-right: 35px;">
<span>组织机构:</span>
<nz-tree-select [nzDropdownClassName]="'maxHeightTreeSelect'" style="width: 250px"
[nzExpandedKeys]="expandKeys" [nzNodes]="nodes" nzShowSearch nzPlaceHolder="请选择组织机构" name="orId"
[(ngModel)]="orId">
</nz-tree-select>
</div>
<div class="queryField">
<span>熟悉时间:</span>
<nz-range-picker name="time" [(ngModel)]="time"></nz-range-picker>
</div>
<div class="queryField btnbox">
<button nz-button nzType="primary">查询</button>
<button nz-button type="button" nzType="default" (click)="reset()">重置</button>
</div>
</form>
</div>
<div class="body">
<div class="tablebox">
<table mat-table [dataSource]="tabledataSource" class="mat-elevation-z8">
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>演练对象</th>
<td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container>
<ng-container matColumnDef="time1">
<th mat-header-cell *matHeaderCellDef>演练时间</th>
<td mat-cell *matCellDef="let element">{{element.time1}}</td>
</ng-container>
<ng-container matColumnDef="time2">
<th mat-header-cell *matHeaderCellDef>演练时段</th>
<td mat-cell *matCellDef="let element">{{element.time2}}</td>
</ng-container>
<ng-container matColumnDef="type">
<th mat-header-cell *matHeaderCellDef>演练形式</th>
<td mat-cell *matCellDef="let element">{{element.type}}</td>
</ng-container>
<ng-container matColumnDef="operate">
<th mat-header-cell *matHeaderCellDef>操作</th>
<td mat-cell *matCellDef="let element" class="operate">
<span>查看</span>
<span>详情</span>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator [length]="length" [pageSize]="pageSize" [pageSizeOptions]="pageSizeOptions"
(page)="chagePage($event)">
</mat-paginator>
</div>
<div class="tablebox">
<table mat-table [dataSource]="tabledataSource" class="mat-elevation-z8">
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>演练对象</th>
<td mat-cell *matCellDef="let element">{{element.company.name}}</td>
</ng-container>
<ng-container matColumnDef="or">
<th mat-header-cell *matHeaderCellDef>组织机构</th>
<td mat-cell *matCellDef="let element">{{element.company.organizationName}}</td>
</ng-container>
<ng-container matColumnDef="people">
<th mat-header-cell *matHeaderCellDef>带队人员</th>
<td mat-cell *matCellDef="let element">{{element.teamLeader}}</td>
</ng-container>
<ng-container matColumnDef="time">
<th mat-header-cell *matHeaderCellDef>演练时间</th>
<td mat-cell *matCellDef="let element">{{element.startTime | date:'yyyy-MM-dd HH:mm'}} -
{{element.endTime | date:'yyyy-MM-dd HH:mm'}}</td>
</ng-container>
<ng-container matColumnDef="operate">
<th mat-header-cell *matHeaderCellDef style="width: 200px;">操作</th>
<td mat-cell *matCellDef="let element" class="operate">
<span (click)="look(element)">查看</span>
<!-- <span (click)="delete(element)">删除</span> -->
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator [length]="length" [pageSize]="pageSize"
(page)="chagePage($event)">
</mat-paginator>
</div>
</div>

149
src/app/plan-management/drill-record/drill-record.component.scss

@ -6,153 +6,41 @@
.header {
width: 100%;
padding: 12px 10px;
box-sizing: border-box;
padding: 20px 30px 8px 30px;
.queryBox {
box-sizing: border-box;
padding: 5px 0 0 5px;
// margin-left: 50px;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
// justify-content:center;
.queryField {
margin: 0 10px;
display: flex;
align-items: center;
margin-right: 20px;
input {
width: 180px;
height: 22px;
line-height: 22px;
border-radius: 3px;
}
@media screen and (max-device-width:1400px)and (min-device-width:1200px) {
//margin: 3px 10px;
mat-form-field {
width: 180px;
}
}
@media screen and (max-device-width:1200px) {
//margin: 3px 0 3px 10px;
mat-form-field {
width: 110px;
}
span {
display: inline-block;
width: 80px;
}
}
}
//queryBox
.butclass {
button {
width: 80px;
height: 36px;
font-size: 16px;
}
}
.ordiv {
position: relative;
.organizationbox {
width: 450px;
height: 200px;
background: white;
position: absolute;
top: 48px;
left: 77px;
z-index: 999;
border: 1px solid grey;
overflow-y: auto;
li {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
mat-tree-node {
cursor: pointer;
white-space: pre;
}
mat-tree-node:hover {
background: rgba(225, 225, 225, 0.8);
}
.closediv {
z-index: 100;
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 30px;
cursor: pointer;
line-height: 30px;
text-align: center;
}
.closediv:hover {
background: rgba(225, 225, 225, 0.8);
.btnbox{
button{
margin-right: 12px;
}
}
}
}
.body {
.buttonbox {
padding-left: 50px;
}
button {
margin: 0 10px
}
.tablebox {
table {
width: 100%;
margin-top: 15px;
}
.tablebox {
.add {
cursor: auto;
text-decoration: none;
display: block;
width: 40px;
height: 20px;
background: #1AE2AC;
font-size: 12px;
line-height: 20px;
color: #FFFFFF;
margin-left: 50px;
}
.weihu {
cursor: auto;
text-decoration: none;
display: block;
width: 64px;
height: 20px;
background: #FFC94B;
font-size: 12px;
color: #FFFFFF;
line-height: 20px;
margin-left: 40px;
}
table {
width: 100%;
// margin-left: 2%;
margin-top: 15px;
}
mat-paginator {
width: 100%;
// margin-left: 2%;
// margin-top: 30px;
}
mat-paginator {
width: 100%;
}
}
@ -164,8 +52,7 @@
.operate {
span {
color: blue;
margin: 0 3px;
color: #40a9ff;
cursor: pointer;
}
}

171
src/app/plan-management/drill-record/drill-record.component.ts

@ -1,114 +1,141 @@
import { Component, OnInit, ViewChild, Inject } from "@angular/core";
import { HttpClient } from "@angular/common/http";
import {
MatTreeFlatDataSource,
MatTreeFlattener,
} from "@angular/material/tree";
import { MatPaginator } from "@angular/material/paginator";
import { FlatTreeControl } from "@angular/cdk/tree";
import { FormControl } from "@angular/forms";
import { Router, ActivatedRoute } from "@angular/router";
import { PageEvent } from "@angular/material/paginator";
import { MatDialog } from "@angular/material/dialog";
import { MatSnackBar } from "@angular/material/snack-bar";
import { TreeService } from "../../http-interceptors/tree.service";
import { DatePipe } from "@angular/common";
import { UploadDrillComponent } from "@src/app/key-unit/key-unit-management/upload-drill/upload-drill.component";
@Component({
selector: "app-drill-record",
templateUrl: "./drill-record.component.html",
styleUrls: ["./drill-record.component.scss"],
providers: [DatePipe],
})
export class DrillRecordComponent implements OnInit {
constructor(
private http: HttpClient,
private router: Router,
private route: ActivatedRoute,
private tree: TreeService,
public dialog: MatDialog,
public snackBar: MatSnackBar
public snackBar: MatSnackBar,
private datePipe: DatePipe
) {}
private _transformer = (node, level: number) => {
//初始化tree
return {
expandable: !!node.children && node.children.length > 0,
name: node.name,
level: level,
id: node.id,
parentId: node.parentId,
children: node.children,
};
};
treeControl = new FlatTreeControl<any>(
(node) => node.level,
(node) => node.expandable
);
treeFlattener = new MatTreeFlattener(
this._transformer,
(node) => node.level,
(node) => node.expandable,
(node) => node.children
);
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
myControl = new FormControl();
hasChild = (_: number, node: any) => node.expandable;
//分页
@ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent;
paginator: MatPaginator;
length: any = 4; //共多少条数据
pageSize: any = 10; //每页条数
pageSizeOptions: number[] = [10]; //设置每页条数
PageNumber: any = 1; //第几页
displayedColumns: string[] = ["name", "time1", "time2", "type", "operate"];
allorganizations: any; //所有组织机构
allunittype: any; //所有单位类型
displayedColumns: string[] = ["name", "or", "people", "time", "operate"];
tabledataSource: any; //表格数据
IsNewData = ""; //维护更新活新增
preparelevels: any;
ngOnInit(): void {
this.tabledataSource = [
{
name: "中保大厦有限公司",
time1: "2023-5-18 07:19",
time2: "2023.5.18-2023.5.19",
type: "二维预案演练",
},
{
name: "上海通高制造有限公司",
time1: "2023-5-19 09:09",
time2: "2023.5.19-2023.5.19",
type: "二维预案演练",
},
{
name: "怡莲超市",
time1: "2023-5-20 08:23",
time2: "2023.5.20-2023.5.21",
type: "二维预案演练",
},
{
name: "永兴商务广场",
time1: "2023-5-25 12:50",
time2: "2023.5.25-2023.5.26",
type: "二维预案演练",
},
];
this.getOrganizations();
}
//获得所有组织机构
allorganizations: any; //所有组织机构
getOrganizations() {
this.http.get("/api/Organizations").subscribe((data: any) => {
this.allorganizations = data;
this.getpresentOrganization();
});
}
//得到当前单位所在组织机构的tree型数据
expandKeys = [];
nodes = [];
organizationId;
getpresentOrganization() {
this.allorganizations.forEach((item) => {
item.key = item.id;
item.title = item.name;
item.children = [];
this.allorganizations.forEach((element) => {
if (element.parentId == item.id) {
item.children.push(element);
}
if (item.children.length === 0) {
item.isLeaf = true;
} else {
item.isLeaf = false;
}
});
});
this.http.get("/api/Account/Profiles").subscribe((data: any) => {
this.allorganizations.forEach((item) => {
if (item.name == data.organizationName) {
this.expandKeys = [item.id];
this.organizationId = item.id;
this.orId = item.id;
this.nodes = [...[item]];
this.getTabledataSource();
}
});
});
}
length: any; //共多少条数据
pageSize: any = 10; //每页条数
PageNumber: any = 1; //第几页
getTabledataSource() {
let params = {
OrganizationId: this.orId,
CompanyName: this.name || "",
StartTime: this.time
? this.datePipe.transform(this.time[0], "yyyy-MM-ddT00:00:00")
: "2020-01-01T00:00:00",
EndTime: this.time
? this.datePipe.transform(this.time[1], "yyyy-MM-ddT23:59:59")
: "2030-01-01T00:00:00",
PageNumber: this.PageNumber,
PageSize: this.pageSize,
};
this.http
.get("/api/DrillRecords", { params: params })
.subscribe((data: any) => {
this.tabledataSource = data.items;
this.length = data.totalCount;
});
}
//分页事件
chagePage(e) {
this.PageNumber = e.pageIndex + 1;
this.getTabledataSource();
}
name;
orId;
time;
//查询
onSubmit(e) {
onSubmit() {
this.PageNumber = 1;
this.pageEvent.pageIndex = 0;
this.getTabledataSource();
}
//重置
reset() {}
reset() {
this.name = "";
this.orId = this.organizationId;
this.time = null;
this.onSubmit();
}
look(element) {
this.dialog.open(UploadDrillComponent, {
width: "700px",
data: { unitInfo: element.company, isEditMode: false },
});
}
delete(element) {
if (confirm("确认删除此记录吗")) {
this.http
.delete(`/api/DrillRecords/${element.id}`)
.subscribe((data: any) => {
alert('删除成功')
this.getTabledataSource();
});
}
}
}

236
src/app/plan-management/plan-management.module.ts

@ -1,91 +1,145 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { PlanManagementRoutingModule } from './plan-management-routing.module';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
import { A11yModule } from '@angular/cdk/a11y';
import { DragDropModule } from '@angular/cdk/drag-drop';
import { PortalModule } from '@angular/cdk/portal';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { CdkStepperModule } from '@angular/cdk/stepper';
import { CdkTableModule } from '@angular/cdk/table';
import { CdkTreeModule } from '@angular/cdk/tree';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatBadgeModule } from '@angular/material/badge';
import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatButtonModule } from '@angular/material/button';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatChipsModule } from '@angular/material/chips';
import { MatStepperModule } from '@angular/material/stepper';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatNativeDateModule, MatRippleModule } from '@angular/material/core';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatSortModule } from '@angular/material/sort';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { EntryPlanComponent } from './entry-plan/entry-plan.component';
import { PassPlanComponent, UnitInfo } from './pass-plan/pass-plan.component';
import { OpenPlanComponent } from './open-plan/open-plan.component';
import { EntryPlanLookComponent, AddPlanone, DownloadFile, AuditResult, ChangeName, ImgDetails } from './entry-plan-look/entry-plan-look.component';
import { PlanType, AuditSatus, PlanLevel, state } from '../pipes/boolean.pipe';
import { WebLookComponent } from './web-look/web-look.component';
import { OnetwoEntryPlanComponent } from './onetwo-entry-plan/onetwo-entry-plan.component';
import { newunitComponent } from './onetwo-entry-plan/onetwo-entry-plan.component';
import { MeetPlanComponent } from './meet-plan/meet-plan.component';
import { newunitMeet } from './meet-plan/meet-plan.component';
import { TypePlanComponent } from './type-plan/type-plan.component';
import { newunitType } from './type-plan/type-plan.component';
import { PsViewer } from './entry-plan-look/entry-plan-look.component'
import { onetwoAuditResult } from './onetwo-entry-plan/onetwo-entry-plan.component';
import { meetAuditResult } from './meet-plan/meet-plan.component';
import { typeAuditResult } from './type-plan/type-plan.component';
import { MaintainUpComponent } from './maintain-up/maintain-up.component'
import { GkPsViewer } from './pass-plan/pass-plan.component'
import { GkhtmlPsViewer } from './open-plan/open-plan.component';
import { ReinforcePlanComponent } from './reinforce-plan/reinforce-plan.component';
import { CreatePlanOnlineFiveComponent, OpenPlanToolDialog } from './create-plan-online-five/create-plan-online-five.component';
import { CreatePlanOnlineThreeComponent } from './create-plan-online-three/create-plan-online-three.component'
import { UiModule } from '../ui/ui.module';
import { TreeDiagramModule } from '../ui/ng-tree-diagram/src/ng-tree-diagram';
import { KeyUnitModule } from '../key-unit/key-unit.module';
import { yinYong } from './create-plan-online-five/create-plan-online-five.component'
import { newTitle } from './create-plan-online-five/create-plan-online-five.component'
import { disaster } from './create-plan-online-five/create-plan-online-five.component'
import { updataHl } from './create-plan-online-five/create-plan-online-five.component'
import {ChangeUrl} from './entry-plan-look/entry-plan-look.component'
import {adddwsurveys} from './create-plan-online-five/create-plan-online-five.component'
import { editUpload } from './entry-plan-look/entry-plan-look.component'
import { wenbenUpload } from './entry-plan-look/entry-plan-look.component';
import { EditPlanCategoryComponent } from './entry-plan-look/edit-plan-category/edit-plan-category.component';
import { SixFamiliarityComponent } from './six-familiarity/six-familiarity.component';
import { DrillRecordComponent } from './drill-record/drill-record.component'
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { PlanManagementRoutingModule } from "./plan-management-routing.module";
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
import { A11yModule } from "@angular/cdk/a11y";
import { DragDropModule } from "@angular/cdk/drag-drop";
import { PortalModule } from "@angular/cdk/portal";
import { ScrollingModule } from "@angular/cdk/scrolling";
import { CdkStepperModule } from "@angular/cdk/stepper";
import { CdkTableModule } from "@angular/cdk/table";
import { CdkTreeModule } from "@angular/cdk/tree";
import { MatAutocompleteModule } from "@angular/material/autocomplete";
import { MatBadgeModule } from "@angular/material/badge";
import { MatBottomSheetModule } from "@angular/material/bottom-sheet";
import { MatButtonModule } from "@angular/material/button";
import { MatButtonToggleModule } from "@angular/material/button-toggle";
import { MatCardModule } from "@angular/material/card";
import { MatCheckboxModule } from "@angular/material/checkbox";
import { MatChipsModule } from "@angular/material/chips";
import { MatStepperModule } from "@angular/material/stepper";
import { MatDatepickerModule } from "@angular/material/datepicker";
import { MatDialogModule } from "@angular/material/dialog";
import { MatDividerModule } from "@angular/material/divider";
import { MatExpansionModule } from "@angular/material/expansion";
import { MatGridListModule } from "@angular/material/grid-list";
import { MatIconModule } from "@angular/material/icon";
import { MatInputModule } from "@angular/material/input";
import { MatListModule } from "@angular/material/list";
import { MatMenuModule } from "@angular/material/menu";
import { MatNativeDateModule, MatRippleModule } from "@angular/material/core";
import { MatPaginatorModule } from "@angular/material/paginator";
import { MatProgressBarModule } from "@angular/material/progress-bar";
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
import { MatRadioModule } from "@angular/material/radio";
import { MatSelectModule } from "@angular/material/select";
import { MatSidenavModule } from "@angular/material/sidenav";
import { MatSliderModule } from "@angular/material/slider";
import { MatSlideToggleModule } from "@angular/material/slide-toggle";
import { MatSnackBarModule } from "@angular/material/snack-bar";
import { MatSortModule } from "@angular/material/sort";
import { MatTableModule } from "@angular/material/table";
import { MatTabsModule } from "@angular/material/tabs";
import { MatToolbarModule } from "@angular/material/toolbar";
import { MatTooltipModule } from "@angular/material/tooltip";
import { MatTreeModule } from "@angular/material/tree";
import { EntryPlanComponent } from "./entry-plan/entry-plan.component";
import { PassPlanComponent, UnitInfo } from "./pass-plan/pass-plan.component";
import { OpenPlanComponent } from "./open-plan/open-plan.component";
import {
EntryPlanLookComponent,
AddPlanone,
DownloadFile,
AuditResult,
ChangeName,
ImgDetails,
} from "./entry-plan-look/entry-plan-look.component";
import { PlanType, AuditSatus, PlanLevel, state } from "../pipes/boolean.pipe";
import { WebLookComponent } from "./web-look/web-look.component";
import { OnetwoEntryPlanComponent } from "./onetwo-entry-plan/onetwo-entry-plan.component";
import { newunitComponent } from "./onetwo-entry-plan/onetwo-entry-plan.component";
import { MeetPlanComponent } from "./meet-plan/meet-plan.component";
import { newunitMeet } from "./meet-plan/meet-plan.component";
import { TypePlanComponent } from "./type-plan/type-plan.component";
import { newunitType } from "./type-plan/type-plan.component";
import { PsViewer } from "./entry-plan-look/entry-plan-look.component";
import { onetwoAuditResult } from "./onetwo-entry-plan/onetwo-entry-plan.component";
import { meetAuditResult } from "./meet-plan/meet-plan.component";
import { typeAuditResult } from "./type-plan/type-plan.component";
import { MaintainUpComponent } from "./maintain-up/maintain-up.component";
import { GkPsViewer } from "./pass-plan/pass-plan.component";
import { GkhtmlPsViewer } from "./open-plan/open-plan.component";
import { ReinforcePlanComponent } from "./reinforce-plan/reinforce-plan.component";
import {
CreatePlanOnlineFiveComponent,
OpenPlanToolDialog,
} from "./create-plan-online-five/create-plan-online-five.component";
import { CreatePlanOnlineThreeComponent } from "./create-plan-online-three/create-plan-online-three.component";
import { UiModule } from "../ui/ui.module";
import { TreeDiagramModule } from "../ui/ng-tree-diagram/src/ng-tree-diagram";
import { KeyUnitModule } from "../key-unit/key-unit.module";
import { yinYong } from "./create-plan-online-five/create-plan-online-five.component";
import { newTitle } from "./create-plan-online-five/create-plan-online-five.component";
import { disaster } from "./create-plan-online-five/create-plan-online-five.component";
import { updataHl } from "./create-plan-online-five/create-plan-online-five.component";
import { ChangeUrl } from "./entry-plan-look/entry-plan-look.component";
import { adddwsurveys } from "./create-plan-online-five/create-plan-online-five.component";
import { editUpload } from "./entry-plan-look/entry-plan-look.component";
import { wenbenUpload } from "./entry-plan-look/entry-plan-look.component";
import { EditPlanCategoryComponent } from "./entry-plan-look/edit-plan-category/edit-plan-category.component";
import { SixFamiliarityComponent } from "./six-familiarity/six-familiarity.component";
import { DrillRecordComponent } from "./drill-record/drill-record.component";
import { NzDatePickerModule } from "ng-zorro-antd/date-picker";
import { NzInputModule } from "ng-zorro-antd/input";
import { NzButtonModule } from "ng-zorro-antd/button";
import { NzTreeSelectModule } from "ng-zorro-antd/tree-select";
@NgModule({
declarations: [EntryPlanComponent, PassPlanComponent, OpenPlanComponent, EntryPlanLookComponent, AddPlanone, PlanType, AuditSatus, PlanLevel, DownloadFile, AuditResult, ChangeName,
WebLookComponent, OnetwoEntryPlanComponent, newunitComponent, MeetPlanComponent, newunitMeet, TypePlanComponent, newunitType, PsViewer, onetwoAuditResult, meetAuditResult,
typeAuditResult, MaintainUpComponent, GkPsViewer, GkhtmlPsViewer, UnitInfo, ReinforcePlanComponent, state, ImgDetails, CreatePlanOnlineFiveComponent, CreatePlanOnlineThreeComponent,
OpenPlanToolDialog,yinYong,newTitle,disaster,updataHl,ChangeUrl,adddwsurveys,editUpload,wenbenUpload, EditPlanCategoryComponent, SixFamiliarityComponent, DrillRecordComponent],
declarations: [
EntryPlanComponent,
PassPlanComponent,
OpenPlanComponent,
EntryPlanLookComponent,
AddPlanone,
PlanType,
AuditSatus,
PlanLevel,
DownloadFile,
AuditResult,
ChangeName,
WebLookComponent,
OnetwoEntryPlanComponent,
newunitComponent,
MeetPlanComponent,
newunitMeet,
TypePlanComponent,
newunitType,
PsViewer,
onetwoAuditResult,
meetAuditResult,
typeAuditResult,
MaintainUpComponent,
GkPsViewer,
GkhtmlPsViewer,
UnitInfo,
ReinforcePlanComponent,
state,
ImgDetails,
CreatePlanOnlineFiveComponent,
CreatePlanOnlineThreeComponent,
OpenPlanToolDialog,
yinYong,
newTitle,
disaster,
updataHl,
ChangeUrl,
adddwsurveys,
editUpload,
wenbenUpload,
EditPlanCategoryComponent,
SixFamiliarityComponent,
DrillRecordComponent,
],
imports: [
CommonModule,
PlanManagementRoutingModule,
@ -135,8 +189,12 @@ import { DrillRecordComponent } from './drill-record/drill-record.component'
MatTreeModule,
UiModule,
TreeDiagramModule,
KeyUnitModule
KeyUnitModule,
NzDatePickerModule,
NzInputModule,
NzButtonModule,
NzTreeSelectModule,
],
exports: [PlanType, AuditSatus, PlanLevel, state]
exports: [PlanType, AuditSatus, PlanLevel, state],
})
export class PlanManagementModule { }
export class PlanManagementModule {}

284
src/app/ui/navmenus/navmenus.component.ts

@ -1,18 +1,23 @@
import { Component, OnInit,Inject } from '@angular/core';
import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree';
import {FlatTreeControl} from '@angular/cdk/tree';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
import {FormControl} from '@angular/forms';
import { HttpClient } from '@angular/common/http';
import { TreeService } from '../../http-interceptors/tree.service'
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { Component, OnInit, Inject } from "@angular/core";
import {
MatTreeFlatDataSource,
MatTreeFlattener,
} from "@angular/material/tree";
import { FlatTreeControl } from "@angular/cdk/tree";
import {
MatDialog,
MatDialogRef,
MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { FormControl } from "@angular/forms";
import { HttpClient } from "@angular/common/http";
import { TreeService } from "../../http-interceptors/tree.service";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
@Component({
selector: 'app-navmenus',
templateUrl: './navmenus.component.html',
styleUrls: ['./navmenus.component.scss']
selector: "app-navmenus",
templateUrl: "./navmenus.component.html",
styleUrls: ["./navmenus.component.scss"],
})
export class NavmenusComponent implements OnInit {
newdata = [];
@ -23,108 +28,132 @@ export class NavmenusComponent implements OnInit {
level: level,
id: node.id,
parentId: node.parentId,
children:node.children,
url:node.url,
icon:node.icon
children: node.children,
url: node.url,
icon: node.icon,
};
}
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable);
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
};
treeControl = new FlatTreeControl<any>(
(node) => node.level,
(node) => node.expandable
);
treeFlattener = new MatTreeFlattener(
this._transformer,
(node) => node.level,
(node) => node.expandable,
(node) => node.children
);
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
constructor(private http: HttpClient,public dialog: MatDialog,private tree:TreeService,public snackBar: MatSnackBar) { }
getlist = ():void=>{
this.http.get('/api/NavMenus').subscribe((data: any[])=>{
this.newdata = this.tree.toTree(data)
constructor(
private http: HttpClient,
public dialog: MatDialog,
private tree: TreeService,
public snackBar: MatSnackBar
) {}
getlist = (): void => {
this.http.get("/api/NavMenus").subscribe((data: any[]) => {
this.newdata = this.tree.toTree(data);
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if(item.expandable && this.treeControl.isExpanded(item)){
expandNodes.push(item.id);
}
});
this.dataSource.data = this.newdata;
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter(n => {
return expandNodes.indexOf(n.id) >= 0;
});
newNodes.forEach(item => {
this.treeControl.expand(item);
});
})
}
treedata:any
const expandNodes = [];
nodes.forEach((item) => {
if (item.expandable && this.treeControl.isExpanded(item)) {
expandNodes.push(item.id);
}
});
this.dataSource.data = this.newdata;
let newNodes = this.treeControl.dataNodes;
newNodes = newNodes.filter((n) => {
return expandNodes.indexOf(n.id) >= 0;
});
newNodes.forEach((item) => {
this.treeControl.expand(item);
});
});
};
treedata: any;
//初始化页面时渲染出tree
ngOnInit() {
this.http.get('/api/NavMenus').subscribe((data: any[])=>{
this.http.get("/api/NavMenus").subscribe((data: any[]) => {
// console.log(111,this.data)
// this.treedata = this.tree.toTree(data)
let _data = this.tree.toTree(data)
this.dataSource.data = _data
this.treedata = _data
})
let _data = this.tree.toTree(data);
this.dataSource.data = _data;
this.treedata = _data;
});
}
hasChild = (_: number, node: any) => node.expandable;
//弹出创建窗口按钮
createauthority(value){
const dialogRef = this.dialog.open(CreateMenus, {//调用open方法打开对话框并且携带参数过去
width: '260px',
data: {id:value.id,children:value.children,icon:value.icon,url:value.url}
createauthority(value) {
const dialogRef = this.dialog.open(CreateMenus, {
//调用open方法打开对话框并且携带参数过去
width: "260px",
data: {
id: value.id,
children: value.children,
icon: value.icon,
url: value.url,
},
});
dialogRef.afterClosed().subscribe((data) => {
this.newdata = [];
this.getlist();
});
dialogRef.afterClosed().subscribe(
data=>{
this.newdata = []
this.getlist()
}
);
}
//删除按钮
deleted(authority){
var isdeleted = confirm("确定要删除此用户吗?")
if(isdeleted){
deleted(authority) {
var isdeleted = confirm("确定要删除此用户吗?");
if (isdeleted) {
//请求删除接口
this.newdata = []
this.http.delete(`/api/NavMenus/${authority.id}`).subscribe( data=>{
this.getlist()
})
this.newdata = [];
this.http.delete(`/api/NavMenus/${authority.id}`).subscribe((data) => {
this.getlist();
});
}
}
//编辑按钮
edit(value){
const dialogRef = this.dialog.open(EditMenus, {//调用open方法打开对话框并且携带参数过去
width: '260px',
data: {id:value.id,parentId:value.parentId,order:value.order,node:value}
edit(value) {
const dialogRef = this.dialog.open(EditMenus, {
//调用open方法打开对话框并且携带参数过去
width: "260px",
data: {
id: value.id,
parentId: value.parentId,
order: value.order,
node: value,
},
});
dialogRef.afterClosed().subscribe((data) => {
this.newdata = [];
this.getlist();
});
dialogRef.afterClosed().subscribe(
data=>{
this.newdata = []
this.getlist()
}
);
}
}
//创建组件
@Component({
selector: 'createmenus',
templateUrl: './createmenus.component.html',
styleUrls: ['./navmenus.component.scss']
selector: "createmenus",
templateUrl: "./createmenus.component.html",
styleUrls: ["./navmenus.component.scss"],
})
export class CreateMenus {
myControl = new FormControl();
//注入MatDialogRef,可以用来关闭对话框
//要访问对话框组件中的数据,必须使用MAT_DIALOG_DATA注入令牌
constructor(private http: HttpClient,public dialogRef: MatDialogRef<CreateMenus>,
public snackBar: MatSnackBar,@Inject(MAT_DIALOG_DATA) public data) {}
constructor(
private http: HttpClient,
public dialogRef: MatDialogRef<CreateMenus>,
public snackBar: MatSnackBar,
@Inject(MAT_DIALOG_DATA) public data
) {}
onNoClick(): void {
this.dialogRef.close();
}
onSubmit(value){
onSubmit(value) {
if(this.data.children){
this.http.post(
'/api/NavMenus',
'/api/NavMenus',
{
id: '',
name: value.name,
@ -135,7 +164,7 @@ export class CreateMenus {
}
).subscribe(
data=>{
this.dialogRef.close();
this.dialogRef.close();
},
err=>{
const config = new MatSnackBarConfig();
@ -146,7 +175,7 @@ export class CreateMenus {
)
}else{
this.http.post(
'/api/NavMenus',
'/api/NavMenus',
{
id: '',
name: value.name,
@ -157,7 +186,7 @@ export class CreateMenus {
}
).subscribe(
data=>{
this.dialogRef.close();
this.dialogRef.close();
},
err=>{
const config = new MatSnackBarConfig();
@ -167,26 +196,48 @@ export class CreateMenus {
}
)
}
// this.http
// .post("/api/NavMenus", {
// id: "",
// name: '预案熟悉',
// icon:'featured_play_list',
// // url: value.url,
// order: 4,
// parentId: null,
// })
// .subscribe(
// (data) => {
// this.dialogRef.close();
// },
// (err) => {
// const config = new MatSnackBarConfig();
// config.verticalPosition = "top";
// config.duration = 3000;
// this.snackBar.open("请填写正确格式", "确定", config);
// }
// );
}
}
//编辑组件
@Component({
selector: 'editmenus',
templateUrl: './editmenus.component.html',
styleUrls: ['./navmenus.component.scss']
selector: "editmenus",
templateUrl: "./editmenus.component.html",
styleUrls: ["./navmenus.component.scss"],
})
export class EditMenus {
myControl = new FormControl();
//注入MatDialogRef,可以用来关闭对话框
//要访问对话框组件中的数据,必须使用MAT_DIALOG_DATA注入令牌
constructor(private http: HttpClient,public dialogRef: MatDialogRef<EditMenus>,public snackBar: MatSnackBar,@Inject(MAT_DIALOG_DATA) public data) {}
menuname:any //菜单名称
menuiconurl:any //菜单图标地址
menuweburl:any //菜单地址
constructor(
private http: HttpClient,
public dialogRef: MatDialogRef<EditMenus>,
public snackBar: MatSnackBar,
@Inject(MAT_DIALOG_DATA) public data
) {}
menuname: any; //菜单名称
menuiconurl: any; //菜单图标地址
menuweburl: any; //菜单地址
ngOnInit(): void {
this.menuname = this.data.node.name;
this.menuiconurl = this.data.node.icon;
@ -195,33 +246,32 @@ export class EditMenus {
onNoClick(): void {
this.dialogRef.close();
}
onSubmit(value){
if(value.icon){
this.data.icon = value.icon
onSubmit(value) {
if (value.icon) {
this.data.icon = value.icon;
}
if(value.url){
this.data.url = value.url
if (value.url) {
this.data.url = value.url;
}
this.http.put(
` /api/NavMenus/${this.data.id}`,
{
this.http
.put(` /api/NavMenus/${this.data.id}`, {
id: this.data.id,
name: value.name,
icon: this.data.icon,
url: this.data.url,
order:this.data.order,
parentId: this.data.parentId
}
).subscribe(
data=>{
this.dialogRef.close();
},
err=>{
const config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请填写正确格式','确定',config);
}
)
order: this.data.order,
parentId: this.data.parentId,
})
.subscribe(
(data) => {
this.dialogRef.close();
},
(err) => {
const config = new MatSnackBarConfig();
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("请填写正确格式", "确定", config);
}
);
}
}
}

1
src/index.html

@ -14,6 +14,7 @@
<body>
<app-root></app-root>
<div id="viewerjs" style="display:none"></div>
</body>
<!-- <script type="text/javascript" src="./assets/kmap/kmap-service-main-kd.js"></script> -->

4
src/styles.scss

@ -522,3 +522,7 @@ td {
justify-content: center;
}
}
.maxHeightTreeSelect {
max-height: 280px;
}
Loading…
Cancel
Save