操作 |
- 演练
+
查看详情
+
@@ -24,7 +24,7 @@
-
+
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
-
+
\ No newline at end of file
diff --git a/src/app/key-unit/view-unit-details/view-unit-details.component.html b/src/app/key-unit/view-unit-details/view-unit-details.component.html
index 008636b..5e87bd8 100644
--- a/src/app/key-unit/view-unit-details/view-unit-details.component.html
+++ b/src/app/key-unit/view-unit-details/view-unit-details.component.html
@@ -44,7 +44,7 @@
-
+
+
-
+
-
+
diff --git a/src/app/plan-audit/plan-record/plan-record.component.ts b/src/app/plan-audit/plan-record/plan-record.component.ts
index d293d38..3a3bfbc 100644
--- a/src/app/plan-audit/plan-record/plan-record.component.ts
+++ b/src/app/plan-audit/plan-record/plan-record.component.ts
@@ -9,8 +9,7 @@ import {
import { HttpClient } from "@angular/common/http";
import { DomSanitizer } from "@angular/platform-browser";
import { Viewer } from "photo-sphere-viewer";
-declare var CryptoJS;
-
+import * as ViewerJs from "viewerjs";
@Component({
selector: "app-plan-record",
templateUrl: "./plan-record.component.html",
@@ -152,9 +151,9 @@ export class PlanRecordComponent implements OnInit {
postlevel: any;
bianzhi = false;
tableClick(e, item) {
+ console.log(item);
+
this.showtype = -1;
- //e.target.parentElement.bgColor='#2196F3'
- // console.log(item)
this.organizationName = "";
this.itemid = item.itemId;
this.id = item.id;
@@ -206,9 +205,9 @@ export class PlanRecordComponent implements OnInit {
this.http
.get(`/api/PlanComponents/${item.itemId}`)
.subscribe((data: any) => {
+ console.log("预案详情", data);
this.companyId = data.companyId;
this.companyName = data.companyName;
- //this.bianzhi = false
if (data.planType != 2 && data.planType != 1) {
if (data.planMode == 2) {
this.showtype = 0;
@@ -217,11 +216,17 @@ export class PlanRecordComponent implements OnInit {
this.iframeSrc = this.sanitizer.bypassSecurityTrustResourceUrl(
this.src
);
- //this.src=`/keyUnit/viewunitinfoplan?id=${data.companyId}&orName=${data.company.organizationId}&orId=${data.company.organizationName}`
} else {
this.bianzhi = false;
this.fetchUrl = data.attachmentUrls[0];
var index = this.fetchUrl.indexOf("/");
+ let isImg;
+ if (
+ this.fetchUrl.indexOf("png") !== -1 ||
+ this.fetchUrl.indexOf("jpg") !== -1
+ ) {
+ isImg = true;
+ }
if (this.fetchUrl.substr(0, index) == "psw") {
this.showtype = 1;
var obj = document.getElementById("viewer");
@@ -234,6 +239,26 @@ export class PlanRecordComponent implements OnInit {
panorama: "/api/Objects/PlanPlatform/" + this.fetchUrl,
});
});
+ } else if (isImg) {
+ let dom = document.getElementById(`viewerjs`);
+ let pObjs = dom.childNodes;
+ let node = document.createElement("img");
+ node.style.display = "none";
+ node.src = "/api/Objects/PlanPlatform/" + this.fetchUrl;
+ node.id = "img";
+ dom.appendChild(node);
+ setTimeout(() => {
+ let viewer = new ViewerJs(
+ document.getElementById(`viewerjs`),
+ {
+ hidden: () => {
+ dom.removeChild(pObjs[0]);
+ viewer.destroy();
+ },
+ }
+ );
+ node.click();
+ }, 0);
} else {
this.lookWord();
}
@@ -243,10 +268,6 @@ export class PlanRecordComponent implements OnInit {
this.planData = data;
this.handleData();
return;
-
- //this.src=`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`
- //this.iframeSrc=this.sanitizer.bypassSecurityTrustResourceUrl(this.src);
- //window.open(`/planAudit/planpass?id=${data.companyId}&companyName=${data.companyName}&auditPlanId=${data.id}&auditStatus=${data.auditStatus}&planType=1`)
}
});
}
@@ -261,8 +282,6 @@ export class PlanRecordComponent implements OnInit {
}
}
this.radioid = item.itemId;
- /* this.chuorzhong=item.verifyState
- this.radioid=item.itemId */
}
//毕升
diff --git a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
index fad479a..661202b 100644
--- a/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
+++ b/src/app/plan-audit/wait-examineer/wait-examineer.component.ts
@@ -18,9 +18,8 @@ import { HttpClient } from "@angular/common/http";
declare var CryptoJS;
import { DomSanitizer } from "@angular/platform-browser";
import { Viewer as photoViewer } from "photo-sphere-viewer";
-import Viewer from "viewerjs";
declare var echarts: any;
-
+import * as ViewerJs from "viewerjs";
@Component({
selector: "app-wait-examineer",
templateUrl: "./wait-examineer.component.html",
@@ -111,7 +110,7 @@ export class WaitExamineerComponent implements OnInit {
fetchUrl;
companyName;
plantypes;
- IsNewData:any = [true, false];
+ IsNewData: any = [true, false];
//获取表格数据
PageNumber = 1;
@@ -197,8 +196,6 @@ export class WaitExamineerComponent implements OnInit {
bianzhi = false;
radioClick(e, item) {
this.selectedItem = item;
-
- // console.log('当前选择的信息',JSON.parse(this.selectedItem.differentContent) )
if (item.contentType == 11 && this.selectedItem.differentContent) {
let differentContent = JSON.parse(this.selectedItem.differentContent);
@@ -272,9 +269,6 @@ export class WaitExamineerComponent implements OnInit {
});
}
}
-
- // console.log('功能分区', this.differentContentOfFunction)
-
this.showtype = -1;
this.organizationName = "";
this.itemid = item.itemId;
@@ -349,6 +343,13 @@ export class WaitExamineerComponent implements OnInit {
this.bianzhi = false;
this.fetchUrl = data.attachmentUrls[0];
var index = this.fetchUrl.indexOf("/");
+ let isImg;
+ if (
+ this.fetchUrl.indexOf("png") !== -1 ||
+ this.fetchUrl.indexOf("jpg") !== -1
+ ) {
+ isImg = true;
+ }
if (this.fetchUrl.substr(0, index) == "psw") {
this.showtype = 1;
var obj = document.getElementById("viewer");
@@ -361,6 +362,26 @@ export class WaitExamineerComponent implements OnInit {
panorama: "/api/Objects/PlanPlatform/" + this.fetchUrl,
});
});
+ } else if (isImg) {
+ let dom = document.getElementById(`viewerjs`);
+ let pObjs = dom.childNodes;
+ let node = document.createElement("img");
+ node.style.display = "none";
+ node.src = "/api/Objects/PlanPlatform/" + this.fetchUrl;
+ node.id = "img";
+ dom.appendChild(node);
+ setTimeout(() => {
+ let viewer = new ViewerJs(
+ document.getElementById(`viewerjs`),
+ {
+ hidden: () => {
+ dom.removeChild(pObjs[0]);
+ viewer.destroy();
+ },
+ }
+ );
+ node.click();
+ }, 0);
} else {
this.lookWord();
}
diff --git a/src/app/plan-management/entry-plan-look/AddPlanone.html b/src/app/plan-management/entry-plan-look/AddPlanone.html
index 45e896c..f4ae373 100644
--- a/src/app/plan-management/entry-plan-look/AddPlanone.html
+++ b/src/app/plan-management/entry-plan-look/AddPlanone.html
@@ -61,12 +61,12 @@
(已上传)
-
+
查看
下载
diff --git a/src/app/test/test.component.html b/src/app/test/test.component.html
deleted file mode 100644
index 16e1975..0000000
--- a/src/app/test/test.component.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
- ![]()
-
-
-
diff --git a/src/app/test/test.component.scss b/src/app/test/test.component.scss
deleted file mode 100644
index c5e4774..0000000
--- a/src/app/test/test.component.scss
+++ /dev/null
@@ -1,17 +0,0 @@
-.box{
- width: 100%;
- height: 100%;
- display: flex;
- #mapxxx{
- width: 500px;
- height: 500px;
- }
- .img{
- width: 500px;
- height: 500px;
- img{
- width: 500px;
- height: 500px;
- }
- }
-}
diff --git a/src/app/test/test.component.spec.ts b/src/app/test/test.component.spec.ts
deleted file mode 100644
index ef4e38c..0000000
--- a/src/app/test/test.component.spec.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { TestComponent } from './test.component';
-
-describe('TestComponent', () => {
- let component: TestComponent;
- let fixture: ComponentFixture ;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [ TestComponent ]
- })
- .compileComponents();
- }));
-
- beforeEach(() => {
- fixture = TestBed.createComponent(TestComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
- });
-});
diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts
deleted file mode 100644
index 2fee582..0000000
--- a/src/app/test/test.component.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { Component, OnInit } from '@angular/core';
-declare var html2canvas: any;
-declare var AMap: any;
-@Component({
- selector: 'app-test',
- templateUrl: './test.component.html',
- styleUrls: ['./test.component.scss']
-})
-export class TestComponent implements OnInit {
-
- constructor() { }
- map: any
- ngOnInit(): void {
- setTimeout(() => {
- this.map = new AMap.Map('mapxxx', {
- WebGLParams: {
- preserveDrawingBuffer: true
- }
- });
-
- this.map.setCity('上海市');
- }, 0);
- }
- //生成图片
- canvasImg
- createimg() {
-
- // 使用html2canvas插件,将数据源中的数据转换成画布。
- html2canvas(document.querySelector("#mapxxx"), {
- useCORS: true,
- onrendered: function (canvas) {
- var dataUrl = canvas.toDataURL("image/png");
- }
- }).then(canvas => {
- // 修改生成的宽度
- // canvas.style.width = "1000px";
- console.log(canvas, "生成的画布文件");
- this.canvasImg = canvas.toDataURL("image/png");
- // console.log(this.canvasImg)
- }).then(() => {
- this.downloadFile("导出图片", this.canvasImg);
-
- })
-
- }
- downloadFile(filename, content) {
- var base64Img = content;
- var oA = document.createElement('a');
- oA.href = base64Img;
- oA.download = filename;
- var event = document.createEvent('MouseEvents');
- event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
- oA.dispatchEvent(event);
- }
-
-}
diff --git a/src/app/ui/organization/organization.component.html b/src/app/ui/organization/organization.component.html
index 37cdc29..4736180 100644
--- a/src/app/ui/organization/organization.component.html
+++ b/src/app/ui/organization/organization.component.html
@@ -1,4 +1,7 @@
+
+
+
@@ -37,32 +40,5 @@
-
-
-
-
- ({{selectedOrg.name}})组织机构下属机关
-
-
-
-
-
- -
- {{item.officeName}}
-
-
-
-
-
-
-
- 暂无下属机关
-
-
-
-
diff --git a/src/app/ui/organization/organization.component.ts b/src/app/ui/organization/organization.component.ts
index fbfb589..2fac51f 100644
--- a/src/app/ui/organization/organization.component.ts
+++ b/src/app/ui/organization/organization.component.ts
@@ -1,485 +1,477 @@
-import { Component, OnInit, Inject } from '@angular/core';
-import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree';
-import {FlatTreeControl} from '@angular/cdk/tree';
-import { HttpClient } from '@angular/common/http';
-import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
-import {FormControl} from '@angular/forms';
-import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
-import { TreeService } from '../../http-interceptors/tree.service'
+import { Component, OnInit, Inject } from "@angular/core";
+import {
+ MatTreeFlatDataSource,
+ MatTreeFlattener,
+} from "@angular/material/tree";
+import { FlatTreeControl } from "@angular/cdk/tree";
+import { HttpClient } from "@angular/common/http";
+import {
+ MatDialog,
+ MatDialogRef,
+ MAT_DIALOG_DATA,
+} from "@angular/material/dialog";
+import { FormControl } from "@angular/forms";
+import { MatSnackBar, MatSnackBarConfig } from "@angular/material/snack-bar";
+import { TreeService } from "../../http-interceptors/tree.service";
@Component({
- selector: 'app-organization',
- templateUrl: './organization.component.html',
- styleUrls: ['./organization.component.scss']
+ selector: "app-organization",
+ templateUrl: "./organization.component.html",
+ styleUrls: ["./organization.component.scss"],
})
export class OrganizationComponent implements OnInit {
- data:any =[] //存储所有组织机构
+ data: any = []; //存储所有组织机构
newdata = [];
- private _transformer = (node, level: number) => {//要给渲染节点传那些属性参数
+ private _transformer = (node, level: number) => {
+ //要给渲染节点传那些属性参数
return {
expandable: !!node.children && node.children.length > 0,
name: node.name,
level: level,
id: node.id,
parentId: node.parentId,
- enabled:node.enabled,
- order:node.order,
- children:node.children,
- isTop:node.isTop,
- isBottom:node.isBottom,
- code:node.code,
- division:node.division
+ enabled: node.enabled,
+ order: node.order,
+ children: node.children,
+ isTop: node.isTop,
+ isBottom: node.isBottom,
+ code: node.code,
+ division: node.division,
};
- }
- treeControl = new FlatTreeControl(node => node.level, node => node.expandable);
- treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
+ };
+ treeControl = new FlatTreeControl(
+ (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,public snackBar: MatSnackBar,private tree: TreeService) {
- }
- isloading:any = false //loading效果
+ constructor(
+ private http: HttpClient,
+ public dialog: MatDialog,
+ public snackBar: MatSnackBar,
+ private tree: TreeService
+ ) {}
+ isloading: any = false; //loading效果
//重新获取列表并且展开到上次位置的方法
- getlist = ():void=>{
- this.http.get('/api/Organizations').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);
- }
- });
-
-
- 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
-
- }
- )
- }
+ getlist = (): void => {
+ this.http.get("/api/Organizations").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);
+ }
+ });
+
+ 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;
+ });
+ };
//初始化视图
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").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){
- const dialogRef = this.dialog.open(CreateOrganization, {//调用open方法打开对话框并且携带参数过去
- width: '260px',
- data: {id:value.id,childlength:value.children,level:value.level}
+ create(value) {
+ const dialogRef = this.dialog.open(CreateOrganization, {
+ //调用open方法打开对话框并且携带参数过去
+ width: "260px",
+ data: { id: value.id, childlength: value.children, level: value.level },
});
- dialogRef.afterClosed().subscribe(
- data=>{
- if(data){
- this.getlist()
- }
+ dialogRef.afterClosed().subscribe((data) => {
+ if (data) {
+ this.getlist();
}
- );
+ });
}
- //编辑组织按钮
- edit(node){
- const dialogRef = this.dialog.open(EditOrganization, {//调用open方法打开对话框并且携带参数过去
- data: node
+ createOne() {
+ const dialogRef = this.dialog.open(CreateOrganization, {
+ //调用open方法打开对话框并且携带参数过去
+ width: "260px",
+ data: { id: "", childlength: "", level: "" },
});
- dialogRef.afterClosed().subscribe(
- data=>{
- this.getlist()
+ dialogRef.afterClosed().subscribe((data) => {
+ if (data) {
+ this.getlist();
}
- );
+ });
+ }
+ //编辑组织按钮
+ edit(node) {
+ const dialogRef = this.dialog.open(EditOrganization, {
+ //调用open方法打开对话框并且携带参数过去
+ data: node,
+ });
+ dialogRef.afterClosed().subscribe((data) => {
+ this.getlist();
+ });
}
//删除组织按钮
- delete(value){
- var isdeleted = confirm("确定要删除此组织?")
- if(isdeleted){
+ delete(value) {
+ var isdeleted = confirm("确定要删除此组织?");
+ if (isdeleted) {
//请求删除接口
- this.isloading = true
- this.http.delete(`/api/Organizations/${value.id}`).subscribe( data=>{
- this.getlist()
-
- })
+ this.isloading = true;
+ this.http.delete(`/api/Organizations/${value.id}`).subscribe((data) => {
+ this.getlist();
+ });
}
}
//禁用按钮
- disable(value){
- this.isloading = true
- if(!value.enabled){
- this.http.put(
- `/api/Organizations/${value.id}`,
- {
- id:value.id,
- code:value.code,
- name: value.name,
- level:value.level,
- order: value.order,
- location: null,
- enabled: true,
- parentId: value.parentId
- }
- ).subscribe(
- data=>{
+ disable(value) {
+ this.isloading = true;
+ if (!value.enabled) {
+ this.http
+ .put(`/api/Organizations/${value.id}`, {
+ id: value.id,
+ code: value.code,
+ name: value.name,
+ level: value.level,
+ order: value.order,
+ location: null,
+ enabled: true,
+ parentId: value.parentId,
+ })
+ .subscribe(
+ (data) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('启用成功','确定',config);
- this.getlist()
-
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("启用成功", "确定", config);
+ this.getlist();
},
- err=>{
+ (err) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('操作无效','确定',config);
- this.isloading = false
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("操作无效", "确定", config);
+ this.isloading = false;
}
- )
-
- }else{
+ );
+ } else {
// var isdeleted = confirm("确定要禁用此组织?")
// if(isdeleted){
- this.http.put(
- `/api/Organizations/${value.id}`,
- {
- id:value.id,
- code:value.code,
- name: value.name,
- level:value.level,
- order: value.order,
- location: null,
- enabled: false,
- parentId: value.parentId
- }
- ).subscribe(
- data=>{
+ this.http
+ .put(`/api/Organizations/${value.id}`, {
+ id: value.id,
+ code: value.code,
+ name: value.name,
+ level: value.level,
+ order: value.order,
+ location: null,
+ enabled: false,
+ parentId: value.parentId,
+ })
+ .subscribe(
+ (data) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('禁用成功','确定',config);
- this.getlist()
-
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("禁用成功", "确定", config);
+ this.getlist();
},
- err=>{
+ (err) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('操作无效','确定',config);
- this.isloading = false
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("操作无效", "确定", config);
+ this.isloading = false;
}
- )
+ );
// }
}
-
-
}
-
//向上箭头
- updata = []
- up(node){
- this.isloading = true
+ updata = [];
+ up(node) {
+ this.isloading = true;
var olddata = this.data;
// console.log(1,olddata)
// console.log(2,node)
- this.updata = []
- olddata.forEach(item => {
- if(item.id == node.parentId){
- this.updata = item.children
+ this.updata = [];
+ olddata.forEach((item) => {
+ if (item.id == node.parentId) {
+ this.updata = item.children;
}
});
// console.log(this.updata)
- this.updata.forEach((item,index)=>{
- if(item.name == node.name){
- this.http.put(//更改点击的节点为上一节点的order
- `/api/Organizations/${this.updata[index].id}`,
- {
- id:this.updata[index].id,
- code:this.updata[index].code,
- name: this.updata[index].name,
- level: this.updata[index].level,
- order: this.updata[index - 1].order,
- location: null,
- enabled: true,
- parentId: this.updata[index].parentId,
- }
- ).subscribe(
- data=>{
- // this.getlist()
- this.http.put(//更改上一节点为点击节点的order
- `/api/Organizations/${this.updata[index - 1].id}`,
- {
- id:this.updata[index - 1].id,
- code:this.updata[index - 1].code,
- name: this.updata[index - 1].name,
- level: this.updata[index - 1].level,
- order: this.updata[index].order,
- location: null,
- enabled: true,
- parentId: this.updata[index].parentId,
- }
- ).subscribe(
- data=>{
- this.getlist()
-
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('更改order失败','确定',config);
- this.isloading = false
- }
- )
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('更改order失败','确定',config);
- this.isloading = false
- }
- )
-
-
+ this.updata.forEach((item, index) => {
+ if (item.name == node.name) {
+ this.http
+ .put(
+ //更改点击的节点为上一节点的order
+ `/api/Organizations/${this.updata[index].id}`,
+ {
+ id: this.updata[index].id,
+ code: this.updata[index].code,
+ name: this.updata[index].name,
+ level: this.updata[index].level,
+ order: this.updata[index - 1].order,
+ location: null,
+ enabled: true,
+ parentId: this.updata[index].parentId,
+ }
+ )
+ .subscribe(
+ (data) => {
+ // this.getlist()
+ this.http
+ .put(
+ //更改上一节点为点击节点的order
+ `/api/Organizations/${this.updata[index - 1].id}`,
+ {
+ id: this.updata[index - 1].id,
+ code: this.updata[index - 1].code,
+ name: this.updata[index - 1].name,
+ level: this.updata[index - 1].level,
+ order: this.updata[index].order,
+ location: null,
+ enabled: true,
+ parentId: this.updata[index].parentId,
+ }
+ )
+ .subscribe(
+ (data) => {
+ this.getlist();
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("更改order失败", "确定", config);
+ this.isloading = false;
+ }
+ );
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("更改order失败", "确定", config);
+ this.isloading = false;
+ }
+ );
}
-
-
-
- })
-
+ });
}
-
-
//向下箭头
- downdata = []
- down(node){
- this.isloading = true
+ downdata = [];
+ down(node) {
+ this.isloading = true;
var olddata = this.data;
- this.downdata = []
- olddata.forEach(item => {
- if(item.id == node.parentId){
- this.downdata = item.children
+ this.downdata = [];
+ olddata.forEach((item) => {
+ if (item.id == node.parentId) {
+ this.downdata = item.children;
}
});
// console.log(this.downdata)
- this.downdata.forEach((item,index)=>{
- if(item.name == node.name){
- this.http.put(//更改点击的节点为下一节点的order
- `/api/Organizations/${this.downdata[index].id}`,
- {
- id:this.downdata[index].id,
- code:this.downdata[index].code,
- name: this.downdata[index].name,
- level: this.downdata[index].level,
- order: this.downdata[index + 1].order,
- location: null,
- enabled: true,
- parentId: this.downdata[index].parentId,
- }
- ).subscribe(
- data=>{
- // this.getlist()
- this.http.put(//更改上一节点为点击节点的order
- `/api/Organizations/${this.downdata[index + 1].id}`,
- {
- id:this.downdata[index + 1].id,
- code:this.downdata[index + 1].code,
- name: this.downdata[index + 1].name,
- level: this.downdata[index + 1].level,
- order: this.downdata[index].order,
- location: null,
- enabled: true,
- parentId: this.downdata[index].parentId,
- }
- ).subscribe(
- data=>{
- this.getlist()
-
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('更改order失败','确定',config);
- this.isloading = false
- }
- )
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('更改order失败','确定',config);
- this.isloading = false
- }
- )
-
-
+ this.downdata.forEach((item, index) => {
+ if (item.name == node.name) {
+ this.http
+ .put(
+ //更改点击的节点为下一节点的order
+ `/api/Organizations/${this.downdata[index].id}`,
+ {
+ id: this.downdata[index].id,
+ code: this.downdata[index].code,
+ name: this.downdata[index].name,
+ level: this.downdata[index].level,
+ order: this.downdata[index + 1].order,
+ location: null,
+ enabled: true,
+ parentId: this.downdata[index].parentId,
+ }
+ )
+ .subscribe(
+ (data) => {
+ // this.getlist()
+ this.http
+ .put(
+ //更改上一节点为点击节点的order
+ `/api/Organizations/${this.downdata[index + 1].id}`,
+ {
+ id: this.downdata[index + 1].id,
+ code: this.downdata[index + 1].code,
+ name: this.downdata[index + 1].name,
+ level: this.downdata[index + 1].level,
+ order: this.downdata[index].order,
+ location: null,
+ enabled: true,
+ parentId: this.downdata[index].parentId,
+ }
+ )
+ .subscribe(
+ (data) => {
+ this.getlist();
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("更改order失败", "确定", config);
+ this.isloading = false;
+ }
+ );
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("更改order失败", "确定", config);
+ this.isloading = false;
+ }
+ );
}
-
-
-
- })
+ });
}
- selectedOrg:any//当前选择的组织机构
- OfficesList:any //获得的下级列表
+ selectedOrg: any; //当前选择的组织机构
+ OfficesList: any; //获得的下级列表
//获得点击组织机构的下级机关单位
- getOffices(node){
+ getOffices(node) {
// console.log(node)
- this.selectedOrg = node
- this.http.get(`/api/OrganizationsOffices/${node.id}`).subscribe(data => {
+ this.selectedOrg = node;
+ this.http.get(`/api/OrganizationsOffices/${node.id}`).subscribe((data) => {
// console.log("获取成功",data)
- this.OfficesList = data
- })
+ this.OfficesList = data;
+ });
}
//新增下属机关
- addOffices(){
- const dialogRef = this.dialog.open(addOffices, {//调用open方法打开对话框并且携带参数过去
- data: {selectedOrg:this.selectedOrg,OfficesList:this.OfficesList}
+ addOffices() {
+ const dialogRef = this.dialog.open(addOffices, {
+ //调用open方法打开对话框并且携带参数过去
+ data: { selectedOrg: this.selectedOrg, OfficesList: this.OfficesList },
});
- dialogRef.afterClosed().subscribe(
- data=>{
- if(data == '创建成功'){
- this.getOffices(this.selectedOrg)
- }
+ dialogRef.afterClosed().subscribe((data) => {
+ if (data == "创建成功") {
+ this.getOffices(this.selectedOrg);
}
- );
+ });
}
//编辑机关
- editOffice(item){
- const dialogRef = this.dialog.open(editOffices, {//调用open方法打开对话框并且携带参数过去
- data: {item:item}
+ editOffice(item) {
+ const dialogRef = this.dialog.open(editOffices, {
+ //调用open方法打开对话框并且携带参数过去
+ data: { item: item },
});
- dialogRef.afterClosed().subscribe(
- data=>{
- if(data == '修改成功'){
- this.getOffices(this.selectedOrg)
- }
+ dialogRef.afterClosed().subscribe((data) => {
+ if (data == "修改成功") {
+ this.getOffices(this.selectedOrg);
}
- );
+ });
}
//删除机关
- deleteOffice(item){
- let isDelete = window.confirm('确定要删除此机关吗?')
- if(isDelete){
- this.http.delete(`/api/OrganizationsOffices/${item.id}`).subscribe(data => {
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('删除成功','确定',config);
- this.getOffices(this.selectedOrg)
- })
+ deleteOffice(item) {
+ let isDelete = window.confirm("确定要删除此机关吗?");
+ if (isDelete) {
+ this.http
+ .delete(`/api/OrganizationsOffices/${item.id}`)
+ .subscribe((data) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("删除成功", "确定", config);
+ this.getOffices(this.selectedOrg);
+ });
}
}
-
}
-
-
-
-
//创建组织
@Component({
- selector: 'createorganization',
- templateUrl: './createorganization.component.html',
- styleUrls: ['./organization.component.scss']
+ selector: "createorganization",
+ templateUrl: "./createorganization.component.html",
+ styleUrls: ["./organization.component.scss"],
})
export class CreateOrganization {
myControl = new FormControl();
- ishttp: boolean =false
- constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,
- public snackBar: MatSnackBar) {}
+ ishttp: boolean = false;
+ constructor(
+ private http: HttpClient,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data,
+ public snackBar: MatSnackBar
+ ) {}
onNoClick(): void {
this.dialogRef.close();
}
- onSubmit(value){
- if(this.data.childlength){//如果点击节点存在children
- this.http.post(
- '/api/Organizations',
- {
- id:"",
- code:value.number,
- division:value.division,
- name: value.name,
- level:this.data.level + 1,
- order: this.data.childlength[this.data.childlength.length -1].order + 1,
- location: null,
- enabled: true,
- parentId: this.data.id,
- }
- ).subscribe(
- data=>{
- this.dialogRef.close(data);
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('创建组织成功','确定',config);
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写正确格式','确定',config);
- }
- )
- }else{
- this.http.post(
- '/api/Organizations',
- {
- id:"",
- code:value.number,
- division:value.division,
- name: value.name,
- level:this.data.level + 1,
- order:0,
- location: null,
- enabled: true,
- parentId: this.data.id,
- }
- ).subscribe(
- data=>{
+ onSubmit(value) {
+ let obj = {
+ id: "",
+ code: "12000000",
+ division: "12000000",
+ name: "天津总队",
+ level: 0,
+ order: null,
+ location: null,
+ enabled: true,
+ parentId: null,
+ };
+ //如果点击节点存在children
+ this.http
+ .post("/api/Organizations", {
+ id: "",
+ code: value.number,
+ division: value.division,
+ name: value.name,
+ level: this.data.level + 1,
+ order: this.data.childlength
+ ? this.data.childlength[this.data.childlength.length - 1].order + 1
+ : 0,
+ location: null,
+ enabled: true,
+ parentId: this.data.id,
+ })
+ .subscribe(
+ (data) => {
this.dialogRef.close(data);
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('创建组织成功','确定',config);
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("创建组织成功", "确定", config);
},
- err=>{
+ (err) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写正确格式','确定',config);
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写正确格式", "确定", config);
}
- )
- }
-
+ );
}
}
//编辑组件
@Component({
- selector: 'editorganization',
- templateUrl: './editorganization.component.html',
- styleUrls: ['./organization.component.scss']
+ selector: "editorganization",
+ templateUrl: "./editorganization.component.html",
+ styleUrls: ["./organization.component.scss"],
})
export class EditOrganization {
newdata = [];
@@ -490,170 +482,189 @@ export class EditOrganization {
level: level,
id: node.id,
parentId: node.parentId,
- children:node.children,
- division:node.division
+ children: node.children,
+ division: node.division,
};
- }
- treeControl = new FlatTreeControl(node => node.level, node => node.expandable);
- treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
+ };
+ treeControl = new FlatTreeControl(
+ (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();
- organizationname:string=""//自己组织的名字
- organizationcode:any//自己组织的编号
- organizationName:any =''//上级组织的名字
- organizationId:any =''//上级组织的id
- organizationLevel:number =null//上级组织的层级
- organizationchildlength:number = null
- allOrganizations:any //所有组织机构
- division:any //区划
- constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,
- private tree:TreeService,public snackBar: MatSnackBar) {}
+ organizationname: string = ""; //自己组织的名字
+ organizationcode: any; //自己组织的编号
+ organizationName: any = ""; //上级组织的名字
+ organizationId: any = ""; //上级组织的id
+ organizationLevel: number = null; //上级组织的层级
+ organizationchildlength: number = null;
+ allOrganizations: any; //所有组织机构
+ division: any; //区划
+ constructor(
+ private http: HttpClient,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data,
+ private tree: TreeService,
+ public snackBar: MatSnackBar
+ ) {}
//获取所有组织机构
- getMechanism () {
- this.http.get('/api/Organizations').subscribe(
- (data:any)=>{
- this.allOrganizations = data
- this.dataSource.data = this.tree.toTree(data);
- data.forEach(item=>{
- if(item.id == this.data.parentId){
- this.organizationName = item.name
- }
- })
- }
- )
+ getMechanism() {
+ this.http.get("/api/Organizations").subscribe((data: any) => {
+ this.allOrganizations = data;
+ this.dataSource.data = this.tree.toTree(data);
+ data.forEach((item) => {
+ if (item.id == this.data.parentId) {
+ this.organizationName = item.name;
+ }
+ });
+ });
}
-
+
ngOnInit() {
// console.log(this.data)
- this.getMechanism()
- this.organizationname = this.data.name
- this.organizationcode = this.data.code
- this.division = this.data.division
+ this.getMechanism();
+ this.organizationname = this.data.name;
+ this.organizationcode = this.data.code;
+ this.division = this.data.division;
}
hasChild = (_: number, node: any) => node.expandable;
onNoClick(): void {
this.dialogRef.close();
}
- add(e){
- this.organizationName=e.name
- this.organizationId=e.id
- this.organizationLevel=e.level
- if(e.children){//如果点击的父组织有子节点
- this.organizationchildlength = e.children.length
- }else{
- this.organizationchildlength = 0
+ add(e) {
+ this.organizationName = e.name;
+ this.organizationId = e.id;
+ this.organizationLevel = e.level;
+ if (e.children) {
+ //如果点击的父组织有子节点
+ this.organizationchildlength = e.children.length;
+ } else {
+ this.organizationchildlength = 0;
}
}
- onSubmit(value){
- if(this.organizationLevel){//如果点击了右边的树
- this.http.put(
- `/api/Organizations/${this.data.id}`,
- {
- id:this.data.id,
- code:value.number,
- division:value.division,
+ onSubmit(value) {
+ if (this.organizationLevel) {
+ //如果点击了右边的树
+ this.http
+ .put(`/api/Organizations/${this.data.id}`, {
+ id: this.data.id,
+ code: value.number,
+ division: value.division,
name: value.name,
- level:this.organizationLevel + 1,
- order: this.organizationchildlength,
+ level: this.organizationLevel + 1,
+ order: this.organizationchildlength,
location: null,
enabled: true,
parentId: this.organizationId,
- }
- ).subscribe(
- data=>{
- this.dialogRef.close();
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('修改成功','确定',config);
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写正确格式','确定',config);
- }
- )
- }else{ //如果只改了姓名
- this.http.put(
- `/api/Organizations/${this.data.id}`,
- {
- id:this.data.id,
+ })
+ .subscribe(
+ (data) => {
+ this.dialogRef.close();
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("修改成功", "确定", config);
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写正确格式", "确定", config);
+ }
+ );
+ } else {
+ //如果只改了姓名
+ this.http
+ .put(`/api/Organizations/${this.data.id}`, {
+ id: this.data.id,
code: value.number,
- division:value.division,
+ division: value.division,
name: value.name,
- level:this.data.level,
+ level: this.data.level,
order: this.data.order,
location: null,
enabled: true,
parentId: this.data.parentId,
- }
- ).subscribe(
- data=>{
- this.dialogRef.close();
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('修改成功','确定',config);
- },
- err=>{
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('请填写正确格式','确定',config);
- }
- )
+ })
+ .subscribe(
+ (data) => {
+ this.dialogRef.close();
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("修改成功", "确定", config);
+ },
+ (err) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("请填写正确格式", "确定", config);
+ }
+ );
}
-
}
}
-
//增加下属机关
@Component({
- selector: 'addOffices',
- templateUrl: './addOffices.html',
- styleUrls: ['./organization.component.scss']
+ selector: "addOffices",
+ templateUrl: "./addOffices.html",
+ styleUrls: ["./organization.component.scss"],
})
export class addOffices {
-
- constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
+ constructor(
+ private http: HttpClient,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data,
+ public snackBar: MatSnackBar
+ ) {}
onNoClick(): void {
this.dialogRef.close();
}
- onSubmit(value){
+ onSubmit(value) {
// console.log(value)
let body = {
id: null,
organizationId: this.data.selectedOrg.id,
officeName: value.name,
- order: this.data.OfficesList.length == 0 ? 0 : this.data.OfficesList[this.data.OfficesList.length - 1].order,
- enabled: true
- }
- this.http.post('/api/OrganizationsOffices',body).subscribe(data => {
+ order:
+ this.data.OfficesList.length == 0
+ ? 0
+ : this.data.OfficesList[this.data.OfficesList.length - 1].order,
+ enabled: true,
+ };
+ this.http.post("/api/OrganizationsOffices", body).subscribe((data) => {
const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('创建成功','确定',config);
- this.dialogRef.close('创建成功');
- })
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("创建成功", "确定", config);
+ this.dialogRef.close("创建成功");
+ });
}
}
-
//编辑下属机关
@Component({
- selector: 'editOffices',
- templateUrl: './editOffices.html',
- styleUrls: ['./organization.component.scss']
+ selector: "editOffices",
+ templateUrl: "./editOffices.html",
+ styleUrls: ["./organization.component.scss"],
})
export class editOffices {
-
- constructor(private http: HttpClient,public dialogRef: MatDialogRef,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
-
+ constructor(
+ private http: HttpClient,
+ public dialogRef: MatDialogRef,
+ @Inject(MAT_DIALOG_DATA) public data,
+ public snackBar: MatSnackBar
+ ) {}
ngOnInit(): void {
// console.log(this.data)
@@ -661,22 +672,24 @@ export class editOffices {
onNoClick(): void {
this.dialogRef.close();
}
- officeName:any = this.data.item.officeName
- onSubmit(value){
+ officeName: any = this.data.item.officeName;
+ onSubmit(value) {
// console.log(value)
let body = {
id: this.data.item.id,
organizationId: this.data.item.organizationId,
officeName: value.name,
order: this.data.item.order,
- enabled: true
- }
- this.http.put(`/api/OrganizationsOffices/${this.data.item.id}`,body).subscribe(data => {
- const config = new MatSnackBarConfig();
- config.verticalPosition = 'top';
- config.duration = 3000
- this.snackBar.open('修改成功','确定',config);
- this.dialogRef.close('修改成功');
- })
+ enabled: true,
+ };
+ this.http
+ .put(`/api/OrganizationsOffices/${this.data.item.id}`, body)
+ .subscribe((data) => {
+ const config = new MatSnackBarConfig();
+ config.verticalPosition = "top";
+ config.duration = 3000;
+ this.snackBar.open("修改成功", "确定", config);
+ this.dialogRef.close("修改成功");
+ });
}
-}
\ No newline at end of file
+}
diff --git a/src/index.html b/src/index.html
index 3931af2..052f70a 100644
--- a/src/index.html
+++ b/src/index.html
@@ -6,7 +6,6 @@
数字化预案编制管理平台
-
@@ -17,22 +16,9 @@
|