Browse Source

[新增]报表查询和预案级别修改

guangxi
邵佳豪 2 years ago
parent
commit
fbe5cdc154
  1. 792
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html
  2. 3561
      src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts
  3. 18
      src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.html
  4. 0
      src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.scss
  5. 25
      src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.spec.ts
  6. 37
      src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.ts
  7. 5
      src/app/plan-management/entry-plan-look/entry-plan-look.component.html
  8. 387
      src/app/plan-management/entry-plan-look/entry-plan-look.component.scss
  9. 18
      src/app/plan-management/entry-plan-look/entry-plan-look.component.ts
  10. 5
      src/app/plan-management/plan-management.module.ts
  11. 20
      src/app/statistic-analysis/combined-query/combined-query.component.html
  12. 811
      src/app/statistic-analysis/combined-query/combined-query.component.ts

792
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.html

File diff suppressed because it is too large Load Diff

3561
src/app/plan-management/create-plan-online-five/create-plan-online-five.component.ts

File diff suppressed because it is too large Load Diff

18
src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.html

@ -0,0 +1,18 @@
<form (ngSubmit)="onSubmit(form.value)" #form="ngForm" class="example-container">
<div class="topbox" style="text-align: center;">
<span mat-dialog-title>修改预案级别</span>
</div>
<div class="mainbox">
<mat-form-field>
<mat-select placeholder='请选择预案级别' [(ngModel)]="planCategory" name="integritySort">
<mat-option [value]='3'>Ⅲ级预案</mat-option>
<mat-option [value]='4'>Ⅳ级预案</mat-option>
<mat-option [value]='5'>Ⅴ级预案</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="btn" style="margin-top:10px;">
<button mat-raised-button color="primary" style="margin-right: 12px;">确定</button>
<button type="button" mat-button (click)="onNoClick()" mat-raised-button>取消</button>
</div>
</form>

0
src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.scss

25
src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.spec.ts

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EditPlanCategoryComponent } from './edit-plan-category.component';
describe('EditPlanCategoryComponent', () => {
let component: EditPlanCategoryComponent;
let fixture: ComponentFixture<EditPlanCategoryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditPlanCategoryComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditPlanCategoryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

37
src/app/plan-management/entry-plan-look/edit-plan-category/edit-plan-category.component.ts

@ -0,0 +1,37 @@
import { HttpClient } from "@angular/common/http";
import { Component, OnInit, Inject } from "@angular/core";
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
import { MatSnackBar } from "@angular/material/snack-bar";
@Component({
selector: "app-edit-plan-category",
templateUrl: "./edit-plan-category.component.html",
styleUrls: ["./edit-plan-category.component.scss"],
})
export class EditPlanCategoryComponent implements OnInit {
constructor(
private http: HttpClient,
public dialogRef: MatDialogRef<EditPlanCategoryComponent>,
@Inject(MAT_DIALOG_DATA) public data,
public snackBar: MatSnackBar
) {}
planCategory;
ngOnInit(): void {
this.planCategory = this.data.planCategory;
}
onNoClick(): void {
this.dialogRef.close();
}
onSubmit(value) {
let body = {
planCategory: this.planCategory,
};
this.http
.put(`/api/PlanComponents/${this.data.id}`, body)
.subscribe((data) => {
this.dialogRef.close("success");
});
}
}

5
src/app/plan-management/entry-plan-look/entry-plan-look.component.html

@ -67,7 +67,10 @@
<ng-container matColumnDef="planCategory">
<th mat-header-cell *matHeaderCellDef>预案级别</th>
<td mat-cell *matCellDef="let element">
{{element.planCategory=='3'?'Ⅲ级预案':element.planCategory=='4'?'Ⅳ级预案':'Ⅴ级预案'}}</td>
{{element.planCategory=='3'?'Ⅲ级预案':element.planCategory=='4'?'Ⅳ级预案':'Ⅴ级预案'}}
<mat-icon *ngIf="element.auditStatus==8 || element.maintenanceVerifyState=='未提交审核'"
class="editPlanCategory" (click)="editPlanCategory(element)">create</mat-icon>
</td>
</ng-container>
<ng-container matColumnDef="plantype">
<th mat-header-cell *matHeaderCellDef style="width: 150px;">预案类型</th>

387
src/app/plan-management/entry-plan-look/entry-plan-look.component.scss

@ -1,160 +1,203 @@
.header{
height: 130px;
// border-bottom: 1px solid rgba(0, 0, 0, 0.12);
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items:center;
// justify-content:center;
div{
width: 300px;
height: 30px;
// margin: 0 30px;
margin-left: 80px;
}
// margin-bottom: 30px;
.header {
height: 130px;
// border-bottom: 1px solid rgba(0, 0, 0, 0.12);
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
// justify-content:center;
div {
width: 300px;
height: 30px;
// margin: 0 30px;
margin-left: 80px;
}
// margin-bottom: 30px;
}
.body{
.body {
overflow: auto;
.btn {
button {
width: 80px;
height: 40px;
margin-left: 2%;
}
}
.tablebox {
overflow: auto;
.btn{
button{
width: 80px;
height: 40px;
margin-left: 2%;
}
.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;
}
.tablebox{
overflow: auto;
.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: 0%;
margin-top: 15px;
}
mat-paginator{
width: 100%;
margin-left: 0%;
// margin-top: 30px;
}
.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;
}
}
.upbox{
height: 100px;
margin-bottom: 15px;
mat-radio-group{
div{
margin: 10px 0;
}
.editPlanCategory {
width: 13px;
height: 13px;
font-size: 18px;
vertical-align: sub;
cursor: pointer;
}
table {
width: 100%;
margin-left: 0%;
margin-top: 15px;
}
mat-paginator {
width: 100%;
margin-left: 0%;
// margin-top: 30px;
}
}
}
.createbtnbox{
button{
margin: 0 6px;
.upbox {
height: 100px;
margin-bottom: 15px;
mat-radio-group {
div {
margin: 10px 0;
}
}
}
.mat-header-cell{
text-align: center;
.createbtnbox {
button {
margin: 0 6px;
}
}
.mat-cell{
text-align: center;
span{
color: #0000BF;
margin: 0 3px;
cursor: pointer;
}
.grey{
color: grey;
pointer-events: none;
}
.mat-header-cell {
text-align: center;
}
.mat-cell {
text-align: center;
span {
color: #0000BF;
margin: 0 3px;
cursor: pointer;
}
.grey {
color: grey;
pointer-events: none;
}
}
//进度条
.progressBox{
line-height: 49px;
height: 49px;
position: relative;
.progressBox {
line-height: 49px;
height: 49px;
position: relative;
display: inline-block;
width: 100%;
button {
float: right;
}
.progress {
display: inline-block;
width: 100%;
button{
float: right;
}
.progress{
display: inline-block;
position: absolute;
width: 500px;
top: 22px;
left: 32px;
}
position: absolute;
width: 500px;
top: 22px;
left: 32px;
}
.filename{
display: inline-block;
max-width: 180px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// margin-left: 160px;
}
.filename {
display: inline-block;
max-width: 180px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
// margin-left: 160px;
}
}
.fileDiv{
cursor: pointer;
}
.fileDiv:hover{
background-color: #fafafa;
.fileDiv {
cursor: pointer;
}
.auditDiv{
p{
margin: 8px 0;
margin-left: 16px;
}
.fileDiv:hover {
background-color: #fafafa;
}
.btn{
text-align: center;
button{
margin: 0 3px;
}
.auditDiv {
p {
margin: 8px 0;
margin-left: 16px;
}
}
.btn {
text-align: center;
button {
margin: 0 3px;
}
}
#viewer {
width: 100%;
height: 100%;
}
.mat-dialog-container{
padding: 0;
}
//预览图片旋转角度
.rotateA {transform: rotate(90deg) scale(0.75);}
.rotateB {transform: rotate(180deg)}
.rotateC {transform: rotate(270deg) scale(0.75);}
@media screen and (max-width:1200px){
.bigimgbox{
width: 100%;
height: 100%;
}
.mat-dialog-container {
padding: 0;
}
//预览图片旋转角度
.rotateA {
transform: rotate(90deg) scale(0.75);
}
.rotateB {
transform: rotate(180deg)
}
.rotateC {
transform: rotate(270deg) scale(0.75);
}
@media screen and (max-width:1200px) {
.bigimgbox {
width: 880px;
height: 580px;
//预览图片
.previewImgBox {
width: 800px;
@ -163,10 +206,12 @@
}
}
}
@media screen and (min-width:1200px) and (max-width:1400px){
.bigimgbox{
width:880px;
@media screen and (min-width:1200px) and (max-width:1400px) {
.bigimgbox {
width: 880px;
height: 610px;
//预览图片
.previewImgBox {
width: 800px;
@ -174,47 +219,53 @@
text-align: center;
}
}
}
@media screen and (min-width:1400px){
.bigimgbox{
width:1110px;
@media screen and (min-width:1400px) {
.bigimgbox {
width: 1110px;
height: 860px;
//预览图片
.previewImgBox {
width: 900px;
height: 100%;
text-align: center;
}
.previewImgBottom {
text-align: center;
height: 30px;
margin: 20px auto;
}
}
}
.shadow{
height: 100%;
width: 100%;
z-index:998;
background-color:#FFFFFF;
opacity:0.3;
mat-spinner{
position: relative;
top: 40%;
left: 40%;
text-align: center;
height: 30px;
margin: 20px auto;
}
}
}
.shadow {
height: 100%;
width: 100%;
z-index: 998;
background-color: #FFFFFF;
opacity: 0.3;
mat-spinner {
position: relative;
top: 40%;
left: 40%;
}
}
//修改上传文件
.upload{
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
.file{
text-align: center;
}
}
.upload {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
.file {
text-align: center;
}
}

18
src/app/plan-management/entry-plan-look/entry-plan-look.component.ts

@ -27,6 +27,7 @@ import { STEPPER_GLOBAL_OPTIONS } from "@angular/cdk/stepper";
import Swiper from "swiper";
import { resolve } from "dns";
import { DomSanitizer } from "@angular/platform-browser";
import { EditPlanCategoryComponent } from "./edit-plan-category/edit-plan-category.component";
declare var CryptoJS;
@Component({
selector: "app-entry-plan-look",
@ -614,6 +615,23 @@ export class EntryPlanLookComponent implements OnInit {
}
});
}
//修改预案级别
editPlanCategory(data) {
console.log(data);
const dialogRef = this.dialog.open(EditPlanCategoryComponent, {
data: data,
});
dialogRef.afterClosed().subscribe((data) => {
if (data) {
const config = new MatSnackBarConfig();
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("修改成功!", "确定", config);
this.getAllPlanComponents();
}
});
}
//获得所有预案组件
audit: boolean;
getAllPlanComponents() {

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

@ -76,13 +76,14 @@ import { updataHl } from './create-plan-online-five/create-plan-online-five.comp
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 { wenbenUpload } from './entry-plan-look/entry-plan-look.component';
import { EditPlanCategoryComponent } from './entry-plan-look/edit-plan-category/edit-plan-category.component'
@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],
OpenPlanToolDialog,yinYong,newTitle,disaster,updataHl,ChangeUrl,adddwsurveys,editUpload,wenbenUpload, EditPlanCategoryComponent],
imports: [
CommonModule,
PlanManagementRoutingModule,

20
src/app/statistic-analysis/combined-query/combined-query.component.html

@ -121,6 +121,24 @@
</mat-select>
</mat-form-field>
</div>
<div class="queryField" *ngIf="preparelevels==0">
<label style="margin-right: 10px;">重点单位:</label>
<mat-form-field>
<mat-select placeholder='是否为重点单位' [(ngModel)]="unitIsFollowed" name="integritySort">
<mat-option [value]='true'>重点单位</mat-option>
<mat-option [value]='false'>一般单位</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="queryField" *ngIf="preparelevels==1">
<label style="margin-right: 10px;">重点单位:</label>
<mat-form-field>
<mat-select placeholder='是否为重点单位' [(ngModel)]="planIsFollowed" name="integritySort">
<mat-option [value]='true'>重点单位</mat-option>
<mat-option [value]='false'>一般单位</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="queryField" *ngIf="preparelevels==0||preparelevels==1">
<button mat-raised-button color="primary">查询</button>
<button mat-raised-button style="margin-left: 25px;" type="button" (click)="reset()">重置</button>
@ -177,4 +195,4 @@
</ng-template>
</mat-tab>
</mat-tab-group>
</div>
</div>

811
src/app/statistic-analysis/combined-query/combined-query.component.ts

@ -1,93 +1,104 @@
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 { MatDialogRef, MatDialog, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
import { TreeService } from '../../http-interceptors/tree.service'
import { Viewer } from 'photo-sphere-viewer';
import { timeStamp } from 'console';
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 {
MatDialogRef,
MatDialog,
MAT_DIALOG_DATA,
} from "@angular/material/dialog";
import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
import { TreeService } from "../../http-interceptors/tree.service";
import { Viewer } from "photo-sphere-viewer";
import { timeStamp } from "console";
@Component({
selector: 'app-combined-query',
templateUrl: './combined-query.component.html',
styleUrls: ['./combined-query.component.scss']
selector: "app-combined-query",
templateUrl: "./combined-query.component.html",
styleUrls: ["./combined-query.component.scss"],
})
export class CombinedQueryComponent implements OnInit {
constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute, private tree: TreeService, public dialog: MatDialog, public snackBar: MatSnackBar) { }
private _transformer = (node, level: number) => { //初始化tree
constructor(
private http: HttpClient,
private router: Router,
private route: ActivatedRoute,
private tree: TreeService,
public dialog: MatDialog,
public snackBar: MatSnackBar
) {}
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
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);
};
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;
displayedColumns: string[] = ["组织名称", "总数"]; //, 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation'
yuanColumns: string[] = ["组织名称", "总数"];
tabledataSource = []; //单位表格数据
yuanTable = []; //预案表格数据
excelData: any;
findTj = 0; //查询条件
displayedColumns: string[] = ['组织名称', '总数'];//, 'addtime', 'plantype', 'auditStatus', 'openRange', 'projectlevel', 'operation'
yuanColumns: string[] = ['组织名称', '总数'];
tabledataSource = [] //单位表格数据
yuanTable = []//预案表格数据
excelData: any
findTj = 0//查询条件
allPlanInfo: any //存储所有预案信息
lable = ['单位查询', '预案查询']
allPlanInfo: any; //存储所有预案信息
lable = ["单位查询", "预案查询"];
selected = new FormControl(0); //选项卡实例
//判断选了哪一个
selectedIndexChange(e) {
this.orRecord = []
this.selected.setValue(e)
this.preparelevels = Number(e)
this.orRecord = [];
this.selected.setValue(e);
this.preparelevels = Number(e);
if (this.preparelevels == 0) {
this.js = this.organizationName
this.jsId = this.organizationId
this.jscheck = true
this.unittype = []
this.allunittype.forEach(element => {
this.unittype.push(element.id)
this.js = this.organizationName;
this.jsId = this.organizationId;
this.jscheck = true;
this.unittype = [];
this.allunittype.forEach((element) => {
this.unittype.push(element.id);
});
this.preparelevel = [1]
this.dwaddtime = '2020-01-01'//单位查询开始时间
this.dwendtime = this.getNowFormatDate()//单位结束时间
this.preparelevel = [1];
this.dwaddtime = "2020-01-01"; //单位查询开始时间
this.dwendtime = this.getNowFormatDate(); //单位结束时间
} else if (this.preparelevels == 1) {
this.yuanjs = this.organizationName
this.yuanjsId = this.organizationId
this.yuanaddtime = '2020-01-01'//预案查询开始时间
this.yuanendtime = this.getNowFormatDate()//预案查询结束时间
this.yuanjscheck = true
this.reservePlanType = ['1', '2', '4', '16']
this.planCategory = ['1', '2', '3', '4', '5']
this.yuanjs = this.organizationName;
this.yuanjsId = this.organizationId;
this.yuanaddtime = "2020-01-01"; //预案查询开始时间
this.yuanendtime = this.getNowFormatDate(); //预案查询结束时间
this.yuanjscheck = true;
this.reservePlanType = ["1", "2", "4", "16"];
this.planCategory = ["1", "2", "3", "4", "5"];
}
this.getAllPlanInfo()
this.getAllPlanInfo();
}
getNowFormatDate() {
var date = new Date();
var seperator1 = "-";
@ -105,478 +116,498 @@ export class CombinedQueryComponent implements OnInit {
}
async ngOnInit(): Promise<void> {
await this.getunitdata();
await this.getOrganizations();
await this.getUnittype();
this.jscheck = true
this.yuanjscheck = true
this.dwaddtime = '2020-01-01'//单位查询开始时间
this.dwendtime = this.getNowFormatDate()//单位结束时间
this.yuanaddtime = '2020-01-01'//预案查询开始时间
this.yuanendtime = this.getNowFormatDate()//预案查询结束时间
this.reservePlanType = ['1', '2', '4', '16']
this.planCategory = ['1', '2', '3', '4', '5']
this.jscheck = true;
this.yuanjscheck = true;
this.dwaddtime = "2020-01-01"; //单位查询开始时间
this.dwendtime = this.getNowFormatDate(); //单位结束时间
this.yuanaddtime = "2020-01-01"; //预案查询开始时间
this.yuanendtime = this.getNowFormatDate(); //预案查询结束时间
this.reservePlanType = ["1", "2", "4", "16"];
this.planCategory = ["1", "2", "3", "4", "5"];
this.getAllPlanInfo();
}
//得到当前单位信息
organizationName: any //当前单位组织机构名称
organizationId: any //当前单位组织机构id
organizationName: any; //当前单位组织机构名称
organizationId: any; //当前单位组织机构id
async getunitdata() {
await new Promise<void>((resolve, reject) => {
this.http.get("/api/Account/Profiles").subscribe(
(data: any) => {
console.log('当前登陆用户信息', data)
resolve(data)
this.organizationName = data.organizationName
this.organizationId = data.organizationId
}
)
})
this.http.get("/api/Account/Profiles").subscribe((data: any) => {
console.log("当前登陆用户信息", data);
resolve(data);
this.organizationName = data.organizationName;
this.organizationId = data.organizationId;
});
});
}
//获得所有组织机构
allorganizations: any //所有组织机构
treedata: any //组织机构树型数据
newallorganizations: any //用于存储在原始数据基础上的每个机构增加children字段
allorganizations: any; //所有组织机构
treedata: any; //组织机构树型数据
newallorganizations: any; //用于存储在原始数据基础上的每个机构增加children字段
async getOrganizations() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/Organizations').subscribe(
(data: any) => {
this.allorganizations = data
this.treedata = this.tree.toTree(data);
this.getpresentOrganization();
resolve(data)
}
)
})
this.http.get("/api/Organizations").subscribe((data: any) => {
this.allorganizations = data;
this.treedata = this.tree.toTree(data);
this.getpresentOrganization();
resolve(data);
});
});
}
//得到当前单位所在组织机构的tree型数据
getpresentOrganization() {
this.newallorganizations = this.allorganizations
this.newallorganizations.forEach(item => {
item.children = []
this.newallorganizations.forEach(element => {
this.newallorganizations = this.allorganizations;
this.newallorganizations.forEach((item) => {
item.children = [];
this.newallorganizations.forEach((element) => {
if (element.parentId == item.id) {
item.children.push(element)
item.children.push(element);
}
});
});
if (this.organizationName) {
this.newallorganizations.forEach(item => {
this.newallorganizations.forEach((item) => {
if (item.name == this.organizationName) {
this.dataSource.data = [item]
this.dataSource.data = [item];
}
});
} else {
this.dataSource.data = this.tree.toTree(this.treedata);
}
this.js = this.organizationName
this.jsId = this.organizationId
this.yuanjs = this.organizationName
this.yuanjsId = this.organizationId
this.js = this.organizationName;
this.jsId = this.organizationId;
this.yuanjs = this.organizationName;
this.yuanjsId = this.organizationId;
}
//获得所有单位类型
allunittype: any //所有单位类型
allunittype: any; //所有单位类型
async getUnittype() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/BuildingTypes/Simple').subscribe(
(data: any) => {
this.allunittype = data
console.log('单位类型', data)
this.allunittype.forEach(element => {
this.unittype.push(element.id)
});
resolve(data)
}
)
})
this.http.get("/api/BuildingTypes/Simple").subscribe((data: any) => {
this.allunittype = data;
console.log("单位类型", data);
this.allunittype.forEach((element) => {
this.unittype.push(element.id);
});
resolve(data);
});
});
}
//获得所有预案或单位信息
tableDataNull = false
preparelevels: Number = 0
companyName: any //单位名称
js: any //单位所选组织机构
jsId: any //单位所选组织机构的id
jscheck: boolean //单位所选组织机构勾选框
yuanjs: any //预案所选组织机构
yuanjsId: any //预案所选组织机构的id
yuanjscheck: boolean //预案所选组织机构勾选框
dwaddtime//单位查询开始时间
dwendtime//单位结束时间
yuanaddtime//预案查询开始时间
yuanendtime//预案查询结束时间
unittype = [] //单位类型
reservePlanType = [] //预案类型
preparelevel = [1] //单位状态
plcheck: boolean //编制级别勾选框
planCategory = [] //预案级别
integritySort //单位排序字段
yuanintegritySort //预案排序字段
isMasklayer = false
tableDataNull = false;
preparelevels: Number = 0;
companyName: any; //单位名称
js: any; //单位所选组织机构
jsId: any; //单位所选组织机构的id
jscheck: boolean; //单位所选组织机构勾选框
yuanjs: any; //预案所选组织机构
yuanjsId: any; //预案所选组织机构的id
yuanjscheck: boolean; //预案所选组织机构勾选框
dwaddtime; //单位查询开始时间
dwendtime; //单位结束时间
yuanaddtime; //预案查询开始时间
yuanendtime; //预案查询结束时间
unittype = []; //单位类型
reservePlanType = []; //预案类型
preparelevel = [1]; //单位状态
plcheck: boolean; //编制级别勾选框
planCategory = []; //预案级别
integritySort; //单位排序字段
yuanintegritySort; //预案排序字段
unitIsFollowed = ""; //单位 重点
planIsFollowed = ""; //预案 重点单位
isMasklayer = false;
async getAllPlanInfo() {
console.log(this.preparelevel)
let paramsdata: any = {
QueryMode: this.preparelevels,
OrganizationId: this.jsId || '',
HasChildren: this.jscheck || '',
TimeIntervalStart: this.dwaddtime || '',
TimeIntervalEnd: this.dwendtime || '',
OrganizationId: this.jsId || "",
HasChildren: this.jscheck || "",
TimeIntervalStart: this.dwaddtime || "",
TimeIntervalEnd: this.dwendtime || "",
BuildingTypeIds: this.unittype || [],
CompanyStatuses: this.preparelevel || [],
SortBy: this.integritySort ? 'totalCount' : '',
SortType: this.integritySort || ''
}
SortBy: this.integritySort ? "totalCount" : "",
SortType: this.integritySort || "",
IsFollowed: String(this.unitIsFollowed) || "",
};
let yuandata = {
QueryMode: this.preparelevels,
OrganizationId: this.yuanjsId || '',
HasChildren: this.yuanjscheck || '',
TimeIntervalStart: this.yuanaddtime || '',
TimeIntervalEnd: this.yuanendtime || '',
OrganizationId: this.yuanjsId || "",
HasChildren: this.yuanjscheck || "",
TimeIntervalStart: this.yuanaddtime || "",
TimeIntervalEnd: this.yuanendtime || "",
PlanCategories: this.planCategory || [],
PlanTypes: this.reservePlanType || [],
SortBy: this.yuanintegritySort ? 'totalCount' : '',
SortType: this.yuanintegritySort || ''
}
// console.log(666, paramsdata)
this.isMasklayer = true
let result = await new Promise((resolve, reject) => {
this.http.get("/api/StatisticsAnalysis/ReportTable", { params: this.preparelevels == 0 ? paramsdata : yuandata }).subscribe((data: any) => {
console.log('接口数据', data)
this.excelData = data
if (data.length == 0) {
this.tableDataNull = true
} else {
this.tableDataNull = false
if (this.preparelevels == 0) {
//单位查询
if (this.preparelevel.length == 0) {
//必须选择单位状态
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
this.snackBar.open('请选择单位状态', '确定', config);
} else {
this.tabledataSource = []
this.displayedColumns = ['组织名称', '总数']
data.forEach((element, i, value) => {
this.tabledataSource.push({ name: [element.orgName, element.companyStatistics.totalCount] })
if (value[0].companyStatistics.buildingTypesCounts != null) {
value[i].companyStatistics.buildingTypesCounts.forEach((build, bi, bvalue) => {
if (i == 0) {
this.displayedColumns.push(value[0].companyStatistics.buildingTypesCounts[bi].buildingTypeName)
this.tabledataSource[0].name.push(value[0].companyStatistics.buildingTypesCounts[bi].count)
} else {
this.tabledataSource[i].name.push(bvalue[bi].count)
}
});
}
});
}
}
else if (this.preparelevels == 1) {
//预案查询
this.yuanColumns = ['组织名称', '总数']
this.yuanTable = [{ name: [0, 0] }]
if (this.planCategory.length != 0) {
this.planCategory.forEach(element => {
if (element == 1) {
this.yuanColumns.push('Ⅰ级')
this.yuanTable[0].name.push(0)
} else if (element == 2) {
this.yuanColumns.push('Ⅱ级')
this.yuanTable[0].name.push(0)
} else if (element == 3) {
this.yuanColumns.push('Ⅲ级')
this.yuanTable[0].name.push(0)
} else if (element == 4) {
this.yuanColumns.push('Ⅳ级')
this.yuanTable[0].name.push(0)
} else if (element == 5) {
this.yuanColumns.push('Ⅴ级')
this.yuanTable[0].name.push(0)
}
})
}
if (this.reservePlanType.length != 0) {
this.reservePlanType.forEach(element => {
if (element == 1) {
this.yuanColumns.push('二维')
this.yuanTable[0].name.push(0)
} else if (element == 2) {
this.yuanColumns.push('三维')
this.yuanTable[0].name.push(0)
} else if (element == 4) {
this.yuanColumns.push('其他')
this.yuanTable[0].name.push(0)
} else if (element == 16) {
this.yuanColumns.push('文本')
this.yuanTable[0].name.push(0)
}
});
}
data.forEach((element, i, value) => {
if (i == 0) {
this.yuanTable[0].name[0] = value[0].orgName
this.yuanTable[0].name[1] = value[0].planStatistics.totalCount
SortBy: this.yuanintegritySort ? "totalCount" : "",
SortType: this.yuanintegritySort || "",
IsFollowed: String(this.planIsFollowed) || "",
};
this.isMasklayer = true;
await new Promise((resolve, reject) => {
this.http
.get("/api/StatisticsAnalysis/ReportTable", {
params: this.preparelevels == 0 ? paramsdata : yuandata,
})
.subscribe((data: any) => {
console.log("接口数据", data);
this.excelData = data;
if (data.length == 0) {
this.tableDataNull = true;
} else {
this.tableDataNull = false;
if (this.preparelevels == 0) {
//单位查询
if (this.preparelevel.length == 0) {
//必须选择单位状态
let config = new MatSnackBarConfig();
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("请选择单位状态", "确定", config);
} else {
this.yuanTable.push({ name: [value[i].orgName, value[i].planStatistics.totalCount] })
}
});
this.yuanTable.forEach((element, i, value) => {
if (i > 0) {
for (let a = value[i].name.length; a < value[0].name.length; a++) {
value[i].name.push(0)
}
}
})
this.yuanTable.forEach((yuan, yuani, yuanval) => {
this.yuanColumns.forEach((th, thi, thvalu) => {
this.tabledataSource = [];
this.displayedColumns = ["组织名称", "总数"];
data.forEach((element, i, value) => {
//预案级别数据
if (value[i].planStatistics.planCategoryStatistics != null) {
value[i].planStatistics.planCategoryStatistics.planCategories.forEach((jibie, ji, jval) => {
if (thvalu[thi].indexOf(jval[ji].planCategoryName) != -1 && yuani == i) {
yuanval[yuani].name[thi] = jval[ji].count
this.tabledataSource.push({
name: [
element.orgName,
element.companyStatistics.totalCount,
],
});
if (value[0].companyStatistics.buildingTypesCounts != null) {
value[i].companyStatistics.buildingTypesCounts.forEach(
(build, bi, bvalue) => {
if (i == 0) {
this.displayedColumns.push(
value[0].companyStatistics.buildingTypesCounts[bi]
.buildingTypeName
);
this.tabledataSource[0].name.push(
value[0].companyStatistics.buildingTypesCounts[bi]
.count
);
} else {
this.tabledataSource[i].name.push(bvalue[bi].count);
}
}
});
);
}
if (value[i].planStatistics.planTypeStatistics != null) {
//预案类型数据
value[i].planStatistics.planTypeStatistics.planTypes.forEach((planlx, lxi, lxval) => {
if (thvalu[thi].indexOf(lxval[lxi].planTypeName) != -1 && yuani == i) {
yuanval[yuani].name[thi] = lxval[lxi].count
}
});
});
}
} else if (this.preparelevels == 1) {
//预案查询
this.yuanColumns = ["组织名称", "总数"];
this.yuanTable = [{ name: [0, 0] }];
if (this.planCategory.length != 0) {
this.planCategory.forEach((element) => {
if (element == 1) {
this.yuanColumns.push("Ⅰ级");
this.yuanTable[0].name.push(0);
} else if (element == 2) {
this.yuanColumns.push("Ⅱ级");
this.yuanTable[0].name.push(0);
} else if (element == 3) {
this.yuanColumns.push("Ⅲ级");
this.yuanTable[0].name.push(0);
} else if (element == 4) {
this.yuanColumns.push("Ⅳ级");
this.yuanTable[0].name.push(0);
} else if (element == 5) {
this.yuanColumns.push("Ⅴ级");
this.yuanTable[0].name.push(0);
}
});
})
}
if (this.reservePlanType.length != 0) {
this.reservePlanType.forEach((element) => {
if (element == 1) {
this.yuanColumns.push("二维");
this.yuanTable[0].name.push(0);
} else if (element == 2) {
this.yuanColumns.push("三维");
this.yuanTable[0].name.push(0);
} else if (element == 4) {
this.yuanColumns.push("其他");
this.yuanTable[0].name.push(0);
} else if (element == 16) {
this.yuanColumns.push("文本");
this.yuanTable[0].name.push(0);
}
});
}
})
data.forEach((element, i, value) => {
if (i == 0) {
this.yuanTable[0].name[0] = value[0].orgName;
this.yuanTable[0].name[1] =
value[0].planStatistics.totalCount;
} else {
this.yuanTable.push({
name: [
value[i].orgName,
value[i].planStatistics.totalCount,
],
});
}
});
this.yuanTable.forEach((element, i, value) => {
if (i > 0) {
for (
let a = value[i].name.length;
a < value[0].name.length;
a++
) {
value[i].name.push(0);
}
}
});
this.yuanTable.forEach((yuan, yuani, yuanval) => {
this.yuanColumns.forEach((th, thi, thvalu) => {
data.forEach((element, i, value) => {
//预案级别数据
if (
value[i].planStatistics.planCategoryStatistics != null
) {
value[
i
].planStatistics.planCategoryStatistics.planCategories.forEach(
(jibie, ji, jval) => {
if (
thvalu[thi].indexOf(jval[ji].planCategoryName) !=
-1 &&
yuani == i
) {
yuanval[yuani].name[thi] = jval[ji].count;
}
}
);
}
if (value[i].planStatistics.planTypeStatistics != null) {
//预案类型数据
value[
i
].planStatistics.planTypeStatistics.planTypes.forEach(
(planlx, lxi, lxval) => {
if (
thvalu[thi].indexOf(lxval[lxi].planTypeName) !=
-1 &&
yuani == i
) {
yuanval[yuani].name[thi] = lxval[lxi].count;
}
}
);
}
});
});
});
}
}
}
this.isMasklayer = false
resolve(this.excelData)
}
)
})
this.isMasklayer = false;
resolve(this.excelData);
});
});
}
integrityScoreMin; //完整度最小值
integrityScoreMax; //完整度最大值
integrityScoreMin//完整度最小值
integrityScoreMax//完整度最大值
newArr: any = []
newArr: any = [];
//辖区中队div是否显示
isorganizationbox: boolean = false
isorganizationbox: boolean = false;
//点击辖区中队树,将选择的辖区中队添加到变量
add(node) {
this.isorganizationbox = false
this.isorganizationbox = false;
if (this.preparelevels == 0) {
this.js = node.name
this.jsId = node.id
this.js = node.name;
this.jsId = node.id;
} else if (this.preparelevels == 1) {
this.yuanjs = node.name
this.yuanjsId = node.id
this.yuanjs = node.name;
this.yuanjsId = node.id;
}
}
//关闭辖区中队隐藏框
closeorganizationbox() {
this.isorganizationbox = false
this.isorganizationbox = false;
}
//打开辖区中队隐藏框
openorganizationbox() {
this.isorganizationbox = true
this.isorganizationbox = true;
}
//关闭出现的组织机构div
closediv() {
this.isorganizationbox = false
this.isorganizationbox = false;
}
//查询
onSubmit(e) {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
if (this.dwendtime < this.dwaddtime || this.yuanaddtime > this.yuanendtime) {
this.snackBar.open('开始时间不能早于结束时间', '确定', config);
config.verticalPosition = "top";
config.duration = 3000;
if (
this.dwendtime < this.dwaddtime ||
this.yuanaddtime > this.yuanendtime
) {
this.snackBar.open("开始时间不能早于结束时间", "确定", config);
}
this.getAllPlanInfo();
}
//重置
reset() {
this.orRecord = []
this.integritySort = ''
this.yuanintegritySort = ''
this.orRecord = [];
this.integritySort = "";
this.yuanintegritySort = "";
if (this.preparelevels == 0) {
this.js = this.organizationName
this.jsId = this.organizationId
this.jscheck = true
this.unittype = []
this.allunittype.forEach(element => {
this.unittype.push(element.id)
this.js = this.organizationName;
this.jsId = this.organizationId;
this.jscheck = true;
this.unittype = [];
this.allunittype.forEach((element) => {
this.unittype.push(element.id);
});
this.preparelevel = [1]
this.dwaddtime = '2020-01-01'//单位查询开始时间
this.dwendtime = this.getNowFormatDate()//单位结束时间
this.preparelevel = [1];
this.dwaddtime = "2020-01-01"; //单位查询开始时间
this.dwendtime = this.getNowFormatDate(); //单位结束时间
this.unitIsFollowed = ""; //单位 重点
} else if (this.preparelevels == 1) {
this.yuanjs = this.organizationName
this.yuanjsId = this.organizationId
this.yuanaddtime = '2020-01-01'//预案查询开始时间
this.yuanendtime = this.getNowFormatDate()//预案查询结束时间
this.yuanjscheck = true
this.reservePlanType = ['1', '2', '4', '16']
this.planCategory = ['1', '2', '3', '4', '5']
this.yuanjs = this.organizationName;
this.yuanjsId = this.organizationId;
this.yuanaddtime = "2020-01-01"; //预案查询开始时间
this.yuanendtime = this.getNowFormatDate(); //预案查询结束时间
this.yuanjscheck = true;
this.reservePlanType = ["1", "2", "4", "16"];
this.planCategory = ["1", "2", "3", "4", "5"];
this.planIsFollowed = ""; //预案 重点单位
}
//重新获取初始化列表
this.getAllPlanInfo();
}
orRecord = []
orRecord = [];
//进入下一层
clicktd(key, element) {
let config = new MatSnackBarConfig();
config.verticalPosition = 'top';
config.duration = 3000
if (key == 0 && element != '合计') {
let clickOr
this.allorganizations.forEach(item => {
config.verticalPosition = "top";
config.duration = 3000;
if (key == 0 && element != "合计") {
let clickOr;
this.allorganizations.forEach((item) => {
if (element === item.name) {
clickOr = item
clickOr = item;
}
});
// console.log(clickOr)
if (this.preparelevels == 0) {
if (element == this.js) {
this.snackBar.open('已在当前查询的消防救援站下,无法下钻', '确定', config);
return
this.snackBar.open(
"已在当前查询的消防救援站下,无法下钻",
"确定",
config
);
return;
}
} else if (this.preparelevels == 1) {
if (element == this.yuanjs) {
this.snackBar.open('已在当前查询的消防救援站下,无法下钻', '确定', config);
return
this.snackBar.open(
"已在当前查询的消防救援站下,无法下钻",
"确定",
config
);
return;
}
}
if (clickOr.children.length == 0 && this.excelData.length == 1) {
this.snackBar.open('无下级消防救援站,无法下钻', '确定', config);
return
this.snackBar.open("无下级消防救援站,无法下钻", "确定", config);
return;
}
//记录点击过的消防救援站
this.orRecord.push({ name: this.js, id: this.jsId })
this.orRecord.push({ name: this.js, id: this.jsId });
if (this.preparelevels == 0) {
this.js = element
this.jsId = clickOr.id
this.js = element;
this.jsId = clickOr.id;
} else if (this.preparelevels == 1) {
this.yuanjs = element
this.yuanjsId = clickOr.id
this.yuanjs = element;
this.yuanjsId = clickOr.id;
}
console.log(this.orRecord)
console.log(this.orRecord);
this.getAllPlanInfo();
}
}
goBack() {
if (this.preparelevels == 0) {
this.js = this.orRecord[this.orRecord.length - 1].name
this.jsId = this.orRecord[this.orRecord.length - 1].id
this.js = this.orRecord[this.orRecord.length - 1].name;
this.jsId = this.orRecord[this.orRecord.length - 1].id;
} else if (this.preparelevels == 1) {
this.yuanjs = this.orRecord[this.orRecord.length - 1].name
this.yuanjsId = this.orRecord[this.orRecord.length - 1].id
this.yuanjs = this.orRecord[this.orRecord.length - 1].name;
this.yuanjsId = this.orRecord[this.orRecord.length - 1].id;
}
this.orRecord.pop();
console.log(this.orRecord)
console.log(this.orRecord);
this.getAllPlanInfo();
}
exal() {
var uri = 'data:application/vnd.ms-excel;base64,',
template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
var uri = "data:application/vnd.ms-excel;base64,",
template =
'<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
base64 = function (s) {
return window.btoa(unescape(encodeURIComponent(s)))
return window.btoa(unescape(encodeURIComponent(s)));
},
format = function (s, c) {
return s.replace(/{(\w+)}/g, function (m, p) {
return c[p];
})
}
});
};
return function (table, name) {
if (!table.nodeType) table = document.getElementById(table);
var ctx = {
worksheet: name || "Worksheet",
worksheet: name || 'Worksheet',
table: table.innerHTML
table: table.innerHTML,
};
window.location.href = uri + base64(format(template, ctx));
}
};
}
export() {
const httpOptions = {
responseType: 'blob' as 'json'
responseType: "blob" as "json",
};
this.http.post(`/api/StatisticsAnalysis/Excel?queryMode=${this.preparelevels}`, this.excelData, httpOptions).subscribe((data: any) => {
// // 文件名中有中文 则对文件名进行转码
const link = document.createElement('a');
const blob = new Blob([data], { type: 'application/vnd.ms-excel' });
link.setAttribute('href', window.URL.createObjectURL(blob));
link.setAttribute('download', '报表统计' + '.xls');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
this.http
.post(
`/api/StatisticsAnalysis/Excel?queryMode=${this.preparelevels}`,
this.excelData,
httpOptions
)
.subscribe((data: any) => {
// // 文件名中有中文 则对文件名进行转码
const link = document.createElement("a");
const blob = new Blob([data], { type: "application/vnd.ms-excel" });
link.setAttribute("href", window.URL.createObjectURL(blob));
link.setAttribute("download", "报表统计" + ".xls");
link.style.visibility = "hidden";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
});
}
}

Loading…
Cancel
Save