Browse Source

[完善]多个顶级组织机构

master
邵佳豪 10 months ago
parent
commit
1d34e328e3
  1. 2
      proxy.config.json
  2. 404
      src/app/plan-management/reinforce-plan/reinforce-plan.component.ts
  3. 3
      src/app/ui/organization/organization.component.html
  4. 5
      src/app/ui/organization/organization.component.scss
  5. 92
      src/app/ui/organization/organization.component.ts
  6. 887
      src/app/ui/usermanagement/usermanagement.component.ts
  7. 4
      src/index.html

2
proxy.config.json

@ -1,6 +1,6 @@
{
"/api": {
"target": "http://10.81.73.39:8000/",
"target": "http://121.36.37.70:8201/",
"生产": "http://10.81.73.39:8000/",
"测试": "http://121.36.37.70:8201/",
"生产2": "http://183.194.244.232:8088/",

404
src/app/plan-management/reinforce-plan/reinforce-plan.component.ts

@ -1,251 +1,297 @@
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';
declare var CryptoJS
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";
declare var CryptoJS;
@Component({
selector: 'app-reinforce-plan',
templateUrl: './reinforce-plan.component.html',
styleUrls: ['./reinforce-plan.component.scss']
selector: "app-reinforce-plan",
templateUrl: "./reinforce-plan.component.html",
styleUrls: ["./reinforce-plan.component.scss"],
})
export class ReinforcePlanComponent implements OnInit {
constructor(
private http: HttpClient,
private router: Router,
private route: ActivatedRoute,
private tree: TreeService,
public dialog: MatDialog,
public snackBar: MatSnackBar
) {}
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
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;
//分页
@ViewChild(MatPaginator, {static: true})
//分页
@ViewChild(MatPaginator, { static: true })
pageEvent: PageEvent;
paginator: MatPaginator;
length:any; //共多少条数据
pageSize:any; //每页条数
pageSizeOptions: number[] = [10] //设置每页条数
PageNumber:any; //第几页
length: any; //共多少条数据
pageSize: any; //每页条数
pageSizeOptions: number[] = [10]; //设置每页条数
PageNumber: any; //第几页
displayedColumns: string[] = ['state','unitname','planname', 'addpeople','level','addtime','plantype','auditStatus','weihuStatus','openRange','projectlevel','operation'];
allorganizations:any //所有组织机构
allunittype:any //所有单位类型
tabledataSource:any //表格数据
IsNewData='' //维护更新活新增
displayedColumns: string[] = [
"state",
"unitname",
"planname",
"addpeople",
"level",
"addtime",
"plantype",
"auditStatus",
"weihuStatus",
"openRange",
"projectlevel",
"operation",
];
allorganizations: any; //所有组织机构
allunittype: any; //所有单位类型
tabledataSource: any; //表格数据
IsNewData = ""; //维护更新活新增
preparelevels:any
ngOnInit(): void {
if(window.matchMedia("(max-width: 1400px)").matches){
this.pcMore=false
this.padMore=true
this.pcfind=false
this.padjt=true
}else{
this.pcfind=true
this.pcMore=true
this.padMore=false
this.padjt=false
preparelevels: any;
async ngOnInit(): Promise<void> {
if (window.matchMedia("(max-width: 1400px)").matches) {
this.pcMore = false;
this.padMore = true;
this.pcfind = false;
this.padjt = true;
} else {
this.pcfind = true;
this.pcMore = true;
this.padMore = false;
this.padjt = false;
}
this.getunitdata();
this.getOrganizations();
await this.getOrganizations();
this.jsId = this.dataSource.data[0].id;
this.getUnittype();
this.getAllPlanInfo();
let level = sessionStorage.getItem("level");
if(level == "0"){//如果是总队
if (level == "0") {
//如果是总队
this.preparelevels = [
{name:"总队",value:"1"},
{name:"支队",value:"2"},
{name:"大队",value:"4"},
{name:"中队",value:"8"}
]
{ name: "总队", value: "1" },
{ name: "支队", value: "2" },
{ name: "大队", value: "4" },
{ name: "中队", value: "8" },
];
}
if(level == "1"){//如果是支队
if (level == "1") {
//如果是支队
this.preparelevels = [
{name:"支队",value:"2"},
{name:"大队",value:"4"},
{name:"中队",value:"8"}
]
{ name: "支队", value: "2" },
{ name: "大队", value: "4" },
{ name: "中队", value: "8" },
];
}
if(level == "2"){//如果是大队
if (level == "2") {
//如果是大队
this.preparelevels = [
{name:"大队",value:"4"},
{name:"中队",value:"8"}
]
{ name: "大队", value: "4" },
{ name: "中队", value: "8" },
];
}
if(level == "3"){//如果是中队
this.preparelevels = [
{name:"中队",value:"8"}
]
if (level == "3") {
//如果是中队
this.preparelevels = [{ name: "中队", value: "8" }];
}
}
pcMore//pc更多
pcput=false//pc收起
pcfind//pc查询
padjt=false
padMore=true//pad收缩控制
padput=false//pad收起按钮
imgsrcopen="../../../assets/images/routdown2.png"
imgsrcdown="../../../assets/images/routup2.png"
pcInfo(){
this.pcMore=!this.pcMore
this.pcput=!this.pcput
pcMore; //pc更多
pcput = false; //pc收起
pcfind; //pc查询
padjt = false;
padMore = true; //pad收缩控制
padput = false; //pad收起按钮
imgsrcopen = "../../../assets/images/routdown2.png";
imgsrcdown = "../../../assets/images/routup2.png";
pcInfo() {
this.pcMore = !this.pcMore;
this.pcput = !this.pcput;
}
padInfo(){
this.padMore=!this.padMore
this.padput=!this.padput
padInfo() {
this.padMore = !this.padMore;
this.padput = !this.padput;
}
allPlanInfo:any //存储所有预案信息
allPlanInfo: any; //存储所有预案信息
//获得所有预案信息
IsNewCompanyData=''//单位维护更新或者新增
getAllPlanInfo(){
let paramsdata:any = {
CompanyName: this.companyName || '',
OrganizationId: this.jsId || '',
HasChildrenOrganization:this.jscheck || '',
BuildingTypeId: this.unittype || '',
PlanType: this.reservePlanType || '',
AuditStatus:'', //审核状态
PlanLevel: this.preparelevel || '',
HasChildrenPlanLevel: this.plcheck || '',
CreationTimeRangeStart:this.addtime||'',
CreationTimeRangeEnd:this.endtime||'',
PageNumber: this.PageNumber || '1',
PageSize: this.pageSizeOptions[0],
Sort: '',
IsNewData:this.IsNewData,
IsNewCompanyData:this.IsNewCompanyData
}
this.http.get("/api/ApprovedPlans/GetReinforcementPlanComponents",{params:paramsdata}).subscribe((data:any)=>{
// console.log('增援预案列表',data)
this.length = data.totalCount
this.allPlanInfo = data
this.tabledataSource = data.items
})
IsNewCompanyData = ""; //单位维护更新或者新增
getAllPlanInfo() {
let paramsdata: any = {
CompanyName: this.companyName || "",
OrganizationId: this.jsId || "",
HasChildrenOrganization: this.jscheck || "",
BuildingTypeId: this.unittype || "",
PlanType: this.reservePlanType || "",
AuditStatus: "", //审核状态
PlanLevel: this.preparelevel || "",
HasChildrenPlanLevel: this.plcheck || "",
CreationTimeRangeStart: this.addtime || "",
CreationTimeRangeEnd: this.endtime || "",
PageNumber: this.PageNumber || "1",
PageSize: this.pageSizeOptions[0],
Sort: "",
IsNewData: this.IsNewData,
IsNewCompanyData: this.IsNewCompanyData,
};
this.http
.get("/api/ApprovedPlans/GetReinforcementPlanComponents", {
params: paramsdata,
})
.subscribe((data: any) => {
// console.log('增援预案列表',data)
this.length = data.totalCount;
this.allPlanInfo = data;
this.tabledataSource = data.items;
});
}
//得到当前单位信息
getunitdata(){
this.http.get("/api/Account/Profiles").subscribe(
(data:any)=>{
this.organizationName = data.organizationName
}
)
getunitdata() {
this.http.get("/api/Account/Profiles").subscribe((data: any) => {
this.organizationName = data.organizationName;
});
}
addtime//开始时间
endtime//结束时间
integrityScoreMin//完整度最小值
integrityScoreMax//完整度最大值
organizationName:any //当前单位组织机构名称
treedata:any //组织机构树型数据
newArr:any = []
newallorganizations:any //用于存储在原始数据基础上的每个机构增加children字段
addtime; //开始时间
endtime; //结束时间
integrityScoreMin; //完整度最小值
integrityScoreMax; //完整度最大值
organizationName: any; //当前单位组织机构名称
treedata: any; //组织机构树型数据
newArr: any = [];
newallorganizations: any; //用于存储在原始数据基础上的每个机构增加children字段
//获得所有组织机构
getOrganizations(){
this.http.get('/api/Organizations').subscribe(
(data:any)=>{
this.allorganizations = data
this.dataSource.data = this.tree.toTree(data);
}
)
getOrganizations() {
return new Promise<void>((resolve, reject) => {
this.http
.get("/api/Organizations", {
params: {
strict: "true",
},
})
.subscribe((data: any) => {
this.allorganizations = data;
this.dataSource.data = this.tree.toTree(data);
resolve();
});
});
}
//获得所有单位类型
getUnittype(){
this.http.get('/api/BuildingTypes/Simple').subscribe(
data=>{
this.allunittype = data
}
)
getUnittype() {
this.http.get("/api/BuildingTypes/Simple").subscribe((data) => {
this.allunittype = data;
});
}
//分页事件
chagePage(e){
this.PageNumber = e.pageIndex+1
chagePage(e) {
this.PageNumber = e.pageIndex + 1;
this.getAllPlanInfo();
}
//辖区中队div是否显示
isorganizationbox:boolean = false
isorganizationbox: boolean = false;
//点击辖区中队树,将选择的辖区中队添加到变量
add(node) {
this.isorganizationbox = false
this.js = node.name
this.jsId = node.id
this.isorganizationbox = false;
this.js = node.name;
this.jsId = node.id;
}
//关闭辖区中队隐藏框
closeorganizationbox() {
this.isorganizationbox = false
this.isorganizationbox = false;
}
//打开辖区中队隐藏框
openorganizationbox() {
this.isorganizationbox = true
this.isorganizationbox = true;
}
//关闭出现的组织机构div
closediv(){
this.isorganizationbox = false
closediv() {
this.isorganizationbox = false;
}
//查询
onSubmit (e) {
this.PageNumber = 1
this.pageEvent.pageIndex = 0
this.getAllPlanInfo()
onSubmit(e) {
this.PageNumber = 1;
this.pageEvent.pageIndex = 0;
this.getAllPlanInfo();
}
companyName:any //单位名称
js:any //所选组织机构
jsId:any //所选组织机构的id
jscheck:boolean //所选组织机构勾选框
unittype:any //单位类型
reservePlanType:any //预案类型
preparelevel:any //编制级别
plcheck:boolean //编制级别勾选框
companyName: any; //单位名称
js: any; //所选组织机构
jsId: any; //所选组织机构的id
jscheck: boolean; //所选组织机构勾选框
unittype: any; //单位类型
reservePlanType: any; //预案类型
preparelevel: any; //编制级别
plcheck: boolean; //编制级别勾选框
//重置
reset(){
this.IsNewData=''
this.IsNewCompanyData=''
this.companyName = ''
this.js = ''
this.jsId = ''
this.jscheck = false
this.unittype = ''
this.reservePlanType = ''
this.preparelevel = ''
this.addtime=''
this.endtime=''
this.plcheck = false
reset() {
this.IsNewData = "";
this.IsNewCompanyData = "";
this.companyName = "";
this.js = "";
this.jsId = "";
this.jscheck = false;
this.unittype = "";
this.reservePlanType = "";
this.preparelevel = "";
this.addtime = "";
this.endtime = "";
this.plcheck = false;
//重新获取初始化列表
this.pageEvent.pageIndex = 0
this.PageNumber = 1
this.pageEvent.pageIndex = 0;
this.PageNumber = 1;
this.getAllPlanInfo();
}
//查看预案
openPlan(e){
openPlan(e) {
// console.log(e)
let id = e.id
sessionStorage.setItem("planId",id)
sessionStorage.setItem("companyId",e.companyId)
let id = e.id;
sessionStorage.setItem("planId", id);
sessionStorage.setItem("companyId", e.companyId);
//sessionStorage.setItem("buildingTypeId",this.unittypeId)
sessionStorage.setItem("editable","0")
sessionStorage.setItem("planName",e.name)
let companyId = sessionStorage.getItem("companyId")
window.open(`/keyUnit/viewunitinfoplan?id=${companyId}&orName=${e.company.organizationName}&orId=${e.company.organizationId}`);
sessionStorage.setItem("editable", "0");
sessionStorage.setItem("planName", e.name);
let companyId = sessionStorage.getItem("companyId");
window.open(
`/keyUnit/viewunitinfoplan?id=${companyId}&orName=${e.company.organizationName}&orId=${e.company.organizationId}`
);
}
}

3
src/app/ui/organization/organization.component.html

@ -1,5 +1,6 @@
<div class="box" style="height: 100%; overflow-y: auto;position: relative">
<div class="box">
<div style="position: relative;">
<button mat-raised-button color="primary" (click)="create(null)">新增</button>
<mat-tree [dataSource]="dataSource" [treeControl]="treeControl">
<mat-tree-node *matTreeNodeDef="let node;" matTreeNodePadding (click)="getOffices(node)">
<button mat-icon-button disabled></button>

5
src/app/ui/organization/organization.component.scss

@ -70,6 +70,11 @@ form {
}
.box {
box-sizing: border-box;
padding: 12px;
height: 100%;
overflow-y: auto;
position: relative;
div {
float: left;
}

92
src/app/ui/organization/organization.component.ts

@ -60,46 +60,66 @@ export class OrganizationComponent implements OnInit {
isloading: any = false; //loading效果
//重新获取列表并且展开到上次位置的方法
getlist = (): void => {
this.http.get("/api/Organizations").subscribe((data: any) => {
this.data = data;
this.newdata = this.tree.toTree(data);
this.http
.get("/api/Organizations", {
params: {
strict: "true",
},
})
.subscribe((data: any) => {
this.data = data;
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);
}
});
const nodes = this.treeControl.dataNodes;
const expandNodes = [];
nodes.forEach((item) => {
if (item.expandable && this.treeControl.isExpanded(item)) {
expandNodes.push(item.id);
}
});
console.log("tree", this.newdata);
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);
console.log("tree", this.newdata);
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);
});
this.isloading = false;
});
this.isloading = false;
});
};
//初始化视图
ngOnInit() {
this.http.get("/api/Organizations").subscribe((data: any) => {
this.data = data;
this.dataSource.data = this.tree.toTree(data);
this.treeControl.expand(this.treeControl.dataNodes[0]);
});
this.http
.get("/api/Organizations", {
params: {
strict: "true",
},
})
.subscribe((data: any) => {
this.data = data;
this.dataSource.data = this.tree.toTree(data);
this.treeControl.expand(this.treeControl.dataNodes[0]);
});
}
hasChild = (_: number, node: any) => node.expandable;
//创建组织按钮
create(value) {
let data = null;
value
? (data = {
id: value.id,
childlength: value.children,
level: value.level,
})
: (data = null);
const dialogRef = this.dialog.open(CreateOrganization, {
//调用open方法打开对话框并且携带参数过去
width: "260px",
data: { id: value.id, childlength: value.children, level: value.level },
data: data,
});
dialogRef.afterClosed().subscribe((data) => {
if (data) {
@ -342,6 +362,26 @@ export class CreateOrganization {
}
onSubmit(value) {
if (!this.data) {
this.http
.post("/api/Organizations", {
code: value.number,
division: value.division,
name: value.name,
level: 0,
enabled: true,
parentId: null,
})
.subscribe((data) => {
this.dialogRef.close(data);
const config = new MatSnackBarConfig();
config.verticalPosition = "top";
config.duration = 3000;
this.snackBar.open("创建组织成功", "确定", config);
});
return;
}
if (this.data.childlength) {
//如果点击节点存在children
this.http

887
src/app/ui/usermanagement/usermanagement.component.ts

File diff suppressed because it is too large Load Diff

4
src/index.html

@ -24,9 +24,9 @@
securityJsCode: 'dca2583973d0448116433fd64f97f8f8'
}
</script>
<script
<!-- <script
src="http://10.81.73.39:8000/webapi/maps?v=2.0&key=2584e43582b85680d76a515979503538&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script>
<script src="http://10.81.73.39:8000/webapi/ui/1.1/main.js"></script> -->
<!-- <script
src="https://webapi.amap.com/maps?v=2.0&key=2584e43582b85680d76a515979503538&plugin=AMap.Driving,AMap.MouseTool,AMap.RangingTool"></script>
<script src="https://webapi.amap.com/ui/1.1/main.js"></script> -->

Loading…
Cancel
Save