|
|
|
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 { MatSort } from '@angular/material/sort';
|
|
|
|
import { MatTableDataSource } from '@angular/material/table';
|
|
|
|
import { truncateSync } from 'fs';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-key-unit-management',
|
|
|
|
templateUrl: './key-unit-management.component.html',
|
|
|
|
styleUrls: ['./key-unit-management.component.scss']
|
|
|
|
})
|
|
|
|
export class KeyUnitManagementComponent implements OnInit {
|
|
|
|
|
|
|
|
constructor(private http:HttpClient,private router:Router,private route:ActivatedRoute,private tree: TreeService,public dialog: MatDialog,public snackBar: MatSnackBar) { }
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
private _transformer = (node, level: number) => { //初始化tree
|
|
|
|
return {
|
|
|
|
expandable: !!node.children && node.children.length > 0,
|
|
|
|
name: node.name,
|
|
|
|
level: level,
|
|
|
|
id: node.id,
|
|
|
|
parentId: node.parentId,
|
|
|
|
children: node.children
|
|
|
|
};
|
|
|
|
}
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable);
|
|
|
|
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
|
|
|
|
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
|
|
myControl = new FormControl();
|
|
|
|
hasChild = (_: number, node: any) => node.expandable;
|
|
|
|
|
|
|
|
@ViewChild(MatSort) sort: MatSort;
|
|
|
|
|
|
|
|
allunittype:any //获取所有的单位类型
|
|
|
|
|
|
|
|
//分页
|
|
|
|
@ViewChild(MatPaginator, {static: true})
|
|
|
|
pageEvent: PageEvent;
|
|
|
|
paginator: MatPaginator;
|
|
|
|
length:any; //共多少条数据
|
|
|
|
pageSize:any; //每页条数
|
|
|
|
pageSizeOptions: number[] = [10] //设置每页条数
|
|
|
|
PageNumber:any //第几页
|
|
|
|
|
|
|
|
displayedColumns: string[] = ['checked','Follow','unitname','integrity','jurisdictionsquadron', 'unittype','scc', 'time','operation'];
|
|
|
|
tabledataSource:any
|
|
|
|
allorganizations:any
|
|
|
|
oldDataSource:any; //原始表格数据
|
|
|
|
integrityScoreMin//下界
|
|
|
|
integrityScoreMax//上界
|
|
|
|
//表头排序
|
|
|
|
sortData (e) {
|
|
|
|
let data = this.tabledataSource.filteredData;
|
|
|
|
//console.log(data.filteredData)
|
|
|
|
// data.filteredData.forEach(element => {
|
|
|
|
// if(element.key.indexOf(".") != -1){
|
|
|
|
// let typeArr = element.key.split('.')
|
|
|
|
// element.type = typeArr[typeArr.length - 1]
|
|
|
|
// element.newTime = new Date(element.lastModified).getTime()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
if( e.direction=='asc' ) { //从小到大排序
|
|
|
|
data.sort( function(a,b) {
|
|
|
|
return a.newTime - b.newTime
|
|
|
|
} )
|
|
|
|
this.tabledataSource = new MatTableDataSource(data);
|
|
|
|
} else if ( e.direction=='desc' ) {//从大到小排序
|
|
|
|
data.sort( function(a,b) {
|
|
|
|
return b.newTime - a.newTime
|
|
|
|
} )
|
|
|
|
this.tabledataSource = new MatTableDataSource(data);
|
|
|
|
} else { //原始数据
|
|
|
|
this.tabledataSource = new MatTableDataSource(this.oldDataSource);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
colorRgb(sColor){
|
|
|
|
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
|
|
var sColor = sColor.toLowerCase();
|
|
|
|
if (sColor && reg.test(sColor)) {
|
|
|
|
if (sColor.length === 4) {
|
|
|
|
var sColorNew = "#";
|
|
|
|
for (var i = 1; i < 4; i += 1) {
|
|
|
|
sColorNew += sColor.slice(i, i + 1).concat(sColor.slice(i, i + 1));
|
|
|
|
}
|
|
|
|
sColor = sColorNew;
|
|
|
|
}
|
|
|
|
//处理六位的颜色值
|
|
|
|
var sColorChange = [];
|
|
|
|
for (var i = 1; i < 7; i += 2) {
|
|
|
|
sColorChange.push(parseInt("0x" + sColor.slice(i, i + 2)));
|
|
|
|
}
|
|
|
|
return sColorChange;
|
|
|
|
} else {
|
|
|
|
return sColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
colorHex(rgb){
|
|
|
|
var _this = rgb;
|
|
|
|
var reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
|
|
|
|
if (/^(rgb|RGB)/.test(_this)) {
|
|
|
|
var aColor = _this.replace(/(?:(|)|rgb|RGB)*/g, "").split(",");
|
|
|
|
var strHex = "#";
|
|
|
|
for (var i = 0; i < aColor.length; i++) {
|
|
|
|
var hex:any = Number(aColor[i]).toString(16);
|
|
|
|
hex = hex < 10 ? 0 + '' + hex : hex;// 保证每个rgb的值为2位
|
|
|
|
if (hex === "0") {
|
|
|
|
hex += hex;
|
|
|
|
}
|
|
|
|
strHex += hex;
|
|
|
|
}
|
|
|
|
if (strHex.length !== 7) {
|
|
|
|
strHex = _this;
|
|
|
|
}
|
|
|
|
return strHex;
|
|
|
|
} else if (reg.test(_this)) {
|
|
|
|
var aNum = _this.replace(/#/, "").split("");
|
|
|
|
if (aNum.length === 6) {
|
|
|
|
return _this;
|
|
|
|
} else if (aNum.length === 3) {
|
|
|
|
var numHex = "#";
|
|
|
|
for (var i = 0; i < aNum.length; i += 1) {
|
|
|
|
numHex += (aNum[i] + aNum[i]);
|
|
|
|
}
|
|
|
|
return numHex;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gradientColor(startColor, endColor, step) {
|
|
|
|
let _this = this
|
|
|
|
let startRGB = _this.colorRgb(startColor);//转换为rgb数组模式
|
|
|
|
let startR = startRGB[0];
|
|
|
|
let startG = startRGB[1];
|
|
|
|
let startB = startRGB[2];
|
|
|
|
|
|
|
|
let endRGB = _this.colorRgb(endColor);
|
|
|
|
let endR = endRGB[0];
|
|
|
|
let endG = endRGB[1];
|
|
|
|
let endB = endRGB[2];
|
|
|
|
|
|
|
|
let sR = (endR - startR) / step;//总差值
|
|
|
|
let sG = (endG - startG) / step;
|
|
|
|
let sB = (endB - startB) / step;
|
|
|
|
|
|
|
|
var colorArr = [];
|
|
|
|
for (var i = 0; i < step; i++) {
|
|
|
|
//计算每一步的hex值
|
|
|
|
var hex = _this.colorHex('rgb('+ parseInt((sR * i + startR))+ ',' + parseInt((sG * i + startG))+ ',' + parseInt((sB * i + startB)) + ')');
|
|
|
|
colorArr.push(hex);
|
|
|
|
}
|
|
|
|
return colorArr;
|
|
|
|
}
|
|
|
|
integrity(width){
|
|
|
|
let _this = this
|
|
|
|
|
|
|
|
let style:any = {}
|
|
|
|
style.width = width +'%';
|
|
|
|
if(width < 30){
|
|
|
|
let colorArr = this.gradientColor('#D50000', '#E53935', 30);
|
|
|
|
for(let i = 0; i < 30; i++){
|
|
|
|
if( i == width){
|
|
|
|
style.background = colorArr[i]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(width >= 30 && width < 60){
|
|
|
|
let colorArr = this.gradientColor('#FF9800', '#E65100', 30);
|
|
|
|
for(let i = 30; i < 60; i++){
|
|
|
|
if( i == width){
|
|
|
|
style.background = colorArr[i-30]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(width >= 60){
|
|
|
|
let colorArr = this.gradientColor('#81C784', '#2E7D32', 41);
|
|
|
|
for(let i = 60; i <= 100; i++){
|
|
|
|
if( i == width){
|
|
|
|
style.background = colorArr[i-60]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return style
|
|
|
|
}
|
|
|
|
integrityDetails(width,zong){
|
|
|
|
let style:any = {}
|
|
|
|
style.width = (width/zong)*100 +'%';
|
|
|
|
return style
|
|
|
|
}
|
|
|
|
//分页事件
|
|
|
|
chagePage(e){
|
|
|
|
this.PageNumber = e.pageIndex+1
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
|
|
// alert(document.documentElement.clientHeight)
|
|
|
|
this.getunitdata();
|
|
|
|
this.getOrganizations();
|
|
|
|
this.getUnittype();
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
if(window.matchMedia("(max-width: 1290px)").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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获得所有重点单位
|
|
|
|
|
|
|
|
wanzhengduArr = [
|
|
|
|
{id:0,zong:94,details:[
|
|
|
|
{name:'单位信息',score:5,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:8,totalpoints:10},
|
|
|
|
{name:'平面图',score:8,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:25,totalpoints:25},
|
|
|
|
{name:'消防设施',score:10,totalpoints:10},
|
|
|
|
{name:'重点部位',score:10,totalpoints:10},
|
|
|
|
{name:'功能分区',score:8,totalpoints:10},
|
|
|
|
{name:'实景图',score:10,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:10,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:1,zong:82,details:[
|
|
|
|
{name:'单位信息',score:5,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:8,totalpoints:10},
|
|
|
|
{name:'平面图',score:8,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:25,totalpoints:25},
|
|
|
|
{name:'消防设施',score:8,totalpoints:10},
|
|
|
|
{name:'重点部位',score:8,totalpoints:10},
|
|
|
|
{name:'功能分区',score:6,totalpoints:10},
|
|
|
|
{name:'实景图',score:8,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:6,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:2,zong:72,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:5,totalpoints:10},
|
|
|
|
{name:'平面图',score:8,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:22,totalpoints:25},
|
|
|
|
{name:'消防设施',score:7,totalpoints:10},
|
|
|
|
{name:'重点部位',score:7,totalpoints:10},
|
|
|
|
{name:'功能分区',score:6,totalpoints:10},
|
|
|
|
{name:'实景图',score:8,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:6,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:3,zong:61,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:5,totalpoints:10},
|
|
|
|
{name:'平面图',score:7,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:18,totalpoints:25},
|
|
|
|
{name:'消防设施',score:5,totalpoints:10},
|
|
|
|
{name:'重点部位',score:3,totalpoints:10},
|
|
|
|
{name:'功能分区',score:5,totalpoints:10},
|
|
|
|
{name:'实景图',score:8,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:6,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:4,zong:60,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:5,totalpoints:10},
|
|
|
|
{name:'平面图',score:6,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:18,totalpoints:25},
|
|
|
|
{name:'消防设施',score:5,totalpoints:10},
|
|
|
|
{name:'重点部位',score:3,totalpoints:10},
|
|
|
|
{name:'功能分区',score:5,totalpoints:10},
|
|
|
|
{name:'实景图',score:8,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:6,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:5,zong:53,details:[
|
|
|
|
{name:'单位信息',score:5,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:5,totalpoints:10},
|
|
|
|
{name:'平面图',score:5,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:10,totalpoints:25},
|
|
|
|
{name:'消防设施',score:5,totalpoints:10},
|
|
|
|
{name:'重点部位',score:5,totalpoints:10},
|
|
|
|
{name:'功能分区',score:5,totalpoints:10},
|
|
|
|
{name:'实景图',score:7,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:6,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:6,zong:45,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:5,totalpoints:10},
|
|
|
|
{name:'平面图',score:5,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:15,totalpoints:25},
|
|
|
|
{name:'消防设施',score:5,totalpoints:10},
|
|
|
|
{name:'重点部位',score:5,totalpoints:10},
|
|
|
|
{name:'功能分区',score:3,totalpoints:10},
|
|
|
|
{name:'实景图',score:5,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:4,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:7,zong:30,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:0,totalpoints:10},
|
|
|
|
{name:'平面图',score:4,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:2,totalpoints:25},
|
|
|
|
{name:'消防设施',score:5,totalpoints:10},
|
|
|
|
{name:'重点部位',score:5,totalpoints:10},
|
|
|
|
{name:'功能分区',score:2,totalpoints:10},
|
|
|
|
{name:'实景图',score:6,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:3,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:8,zong:20,details:[
|
|
|
|
{name:'单位信息',score:3,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:2,totalpoints:10},
|
|
|
|
{name:'平面图',score:0,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:3,totalpoints:25},
|
|
|
|
{name:'消防设施',score:3,totalpoints:10},
|
|
|
|
{name:'重点部位',score:3,totalpoints:10},
|
|
|
|
{name:'功能分区',score:3,totalpoints:10},
|
|
|
|
{name:'实景图',score:2,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:1,totalpoints:10},
|
|
|
|
]},
|
|
|
|
{id:9,zong:13,details:[
|
|
|
|
{name:'单位信息',score:5,totalpoints:5},
|
|
|
|
{name:'建筑信息',score:3,totalpoints:10},
|
|
|
|
{name:'平面图',score:0,totalpoints:10},
|
|
|
|
{name:'四周毗邻',score:2,totalpoints:25},
|
|
|
|
{name:'消防设施',score:0,totalpoints:10},
|
|
|
|
{name:'重点部位',score:3,totalpoints:10},
|
|
|
|
{name:'功能分区',score:0,totalpoints:10},
|
|
|
|
{name:'实景图',score:0,totalpoints:10},
|
|
|
|
{name:'CAD上传',score:0,totalpoints:10},
|
|
|
|
]}
|
|
|
|
]
|
|
|
|
|
|
|
|
allKeyUnitInfo:any //所有的重点单位
|
|
|
|
getAllKeyUnit(){
|
|
|
|
// console.log(Boolean(Number(this.follow)))
|
|
|
|
let follow
|
|
|
|
if(this.follow == ''){
|
|
|
|
follow = ''
|
|
|
|
}
|
|
|
|
if(this.follow == '0'){
|
|
|
|
follow = false
|
|
|
|
}
|
|
|
|
if(this.follow == '1'){
|
|
|
|
follow = true
|
|
|
|
}
|
|
|
|
|
|
|
|
let paramsdata:any = {
|
|
|
|
Name: this.companyName || '',
|
|
|
|
OrganizationId: this.jsId || '',
|
|
|
|
HasChildren:this.jscheck || '',
|
|
|
|
USCI:this.shehui || '',
|
|
|
|
IsFollowed: follow,
|
|
|
|
BuildingTypeId: this.unittype || '',
|
|
|
|
PageNumber: this.PageNumber || '1',
|
|
|
|
PageSize: this.pageSizeOptions[0],
|
|
|
|
Sort: this.integritySort ? 'integrityscore' : '',
|
|
|
|
SortType: this.integritySort || '',
|
|
|
|
IsNewData:true,
|
|
|
|
IntegrityScoreMin:this.integrityScoreMin/100||0,
|
|
|
|
IntegrityScoreMax:this.integrityScoreMax/100||1
|
|
|
|
}
|
|
|
|
this.http.get("/api/Companies",{params:paramsdata}).subscribe((data:any)=>{
|
|
|
|
this.length = data.totalCount
|
|
|
|
this.allKeyUnitInfo = data
|
|
|
|
// data.items.sort( (a,b) => {
|
|
|
|
// return a.usci - b.usci
|
|
|
|
// })
|
|
|
|
data.items.forEach( (item,index) => {
|
|
|
|
item.integrity = this.wanzhengduArr[index]
|
|
|
|
})
|
|
|
|
//console.log(789,data.items)
|
|
|
|
this.tabledataSource = new MatTableDataSource(data.items);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
//得到当前单位信息
|
|
|
|
getunitdata(){
|
|
|
|
this.http.get("/api/Account/Profiles").subscribe(
|
|
|
|
(data:any)=>{
|
|
|
|
this.organizationName = data.organizationName
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
organizationName:any //当前单位组织机构名称
|
|
|
|
treedata:any //组织机构树型数据
|
|
|
|
newArr:any = []
|
|
|
|
newallorganizations:any //用于存储在原始数据基础上的每个机构增加children字段
|
|
|
|
newallorganizations2:any
|
|
|
|
//得到当前单位所在组织机构的tree型数据
|
|
|
|
getpresentOrganization(){
|
|
|
|
this.newallorganizations = this.allorganizations
|
|
|
|
this.newallorganizations.forEach(item => {
|
|
|
|
item.children = []
|
|
|
|
this.newallorganizations.forEach(element => {
|
|
|
|
if(element.parentId == item.id){
|
|
|
|
item.children.push(element)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
this.http.get("/api/Account/Profiles").subscribe(
|
|
|
|
(data:any)=>{
|
|
|
|
this.organizationName = data.organizationName
|
|
|
|
if(this.organizationName){
|
|
|
|
this.newallorganizations.forEach(item => {
|
|
|
|
if(item.name == this.organizationName){
|
|
|
|
this.dataSource.data = [item]
|
|
|
|
this.newallorganizations2 = [item]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}else{
|
|
|
|
this.newallorganizations2 = this.treedata
|
|
|
|
this.dataSource.data = this.treedata
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
}
|
|
|
|
//获得所有组织机构
|
|
|
|
getOrganizations(){
|
|
|
|
this.http.get('/api/Organizations').subscribe(
|
|
|
|
(data:any)=>{
|
|
|
|
this.allorganizations = data
|
|
|
|
this.treedata = this.tree.toTree(data);
|
|
|
|
this.getpresentOrganization();
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
//获得所有单位类型
|
|
|
|
getUnittype(){
|
|
|
|
this.http.get('/api/BuildingTypes/Simple').subscribe(
|
|
|
|
data=>{
|
|
|
|
this.allunittype = data
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
|
|
|
selectedunitArr:any =[] //选中单位的数组
|
|
|
|
//勾选框事件
|
|
|
|
verifyState //判断是否可以修改
|
|
|
|
checkChange(e,element){
|
|
|
|
if(element.contentVerify!=null){
|
|
|
|
this.verifyState=element.contentVerify.verifyState
|
|
|
|
|
|
|
|
}else{
|
|
|
|
this.verifyState=null
|
|
|
|
}
|
|
|
|
if(e.checked){
|
|
|
|
//this.deleteArr=element
|
|
|
|
this.deleteAll.push(element)
|
|
|
|
}else{
|
|
|
|
for(var i=0;i<this.deleteAll.length;i++ ){
|
|
|
|
if(this.deleteAll[i].id==element.id){
|
|
|
|
this.deleteAll.splice(i,1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
element.checked = e.checked
|
|
|
|
|
|
|
|
}
|
|
|
|
deleteArr//单个删除
|
|
|
|
deleteAll=[]//批量删除
|
|
|
|
checkClick(element,e){
|
|
|
|
if(element.contentVerify!=null){
|
|
|
|
if(element.contentVerify.verifyState==0||element.contentVerify.verifyState==3){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('该单位正在审核不能选中','确定',config);
|
|
|
|
}
|
|
|
|
|
|
|
|
}else{
|
|
|
|
this.deleteArr=element
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//编辑单位信息
|
|
|
|
editunit(){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
let selectedunitArr = []
|
|
|
|
let selectedunitobj = []
|
|
|
|
this.allKeyUnitInfo.items.forEach(item => {
|
|
|
|
if(item.checked){
|
|
|
|
selectedunitArr.push(item.id)
|
|
|
|
selectedunitobj.push(item)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if(selectedunitArr.length == 0){
|
|
|
|
this.snackBar.open('请先选择要修改的单位','确定',config);
|
|
|
|
}
|
|
|
|
if(selectedunitArr.length != 1 && selectedunitArr.length != 0){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('只能选择一个单位修改','确定',config);
|
|
|
|
}
|
|
|
|
if(selectedunitArr.length == 1){ //带着id跳到修改页面
|
|
|
|
this.allKeyUnitInfo.items.forEach(item => {
|
|
|
|
if(item.id == selectedunitArr[0]){
|
|
|
|
let companyName = item.name
|
|
|
|
sessionStorage.setItem("companyName",companyName)
|
|
|
|
sessionStorage.setItem("companyId",item.id)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
sessionStorage.setItem("editable","1")
|
|
|
|
sessionStorage.setItem(selectedunitobj[0].id,JSON.stringify(selectedunitobj[0].companyIntegrityScore))
|
|
|
|
window.open(`/keyUnit/editplaninfo?id=${selectedunitArr[0]}&usci=${selectedunitobj[0].usci}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//关注重点单位
|
|
|
|
Follow(element){
|
|
|
|
// console.log(element)
|
|
|
|
this.http.put(`/api/Companies/${element.id}/Follow`,'').subscribe(data=>{
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('关注成功','确定',config);
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
|
|
|
|
})
|
|
|
|
}
|
|
|
|
//取消关注
|
|
|
|
unFollow(element){
|
|
|
|
// console.log(element)
|
|
|
|
this.http.put(`/api/Companies/${element.id}/Unfollow`,'').subscribe(data=>{
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('取消成功','确定',config);
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
})
|
|
|
|
}
|
|
|
|
//删除单位信息
|
|
|
|
deleteAudia=[]//批量删除提交数组
|
|
|
|
deleteunit(){
|
|
|
|
this.deleteAudia=[]
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
//console.log(this.deleteAll)
|
|
|
|
if(this.verifyState==0||this.verifyState==3){
|
|
|
|
this.snackBar.open('审核中,不能删除','确定',config);
|
|
|
|
}else{
|
|
|
|
let selectedunitArr = []
|
|
|
|
this.allKeyUnitInfo.items.forEach(item => {
|
|
|
|
if(item.checked){
|
|
|
|
selectedunitArr.push(item.id)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if(selectedunitArr.length == 0){
|
|
|
|
|
|
|
|
this.snackBar.open('请先选择要删除的单位','确定',config);
|
|
|
|
}
|
|
|
|
/* if(selectedunitArr.length != 1 && selectedunitArr.length != 0){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('只能选择一个单位删除','确定',config);
|
|
|
|
} */
|
|
|
|
if(this.deleteAll.length == 1){ //带着id跳到删除页面
|
|
|
|
let isTrue = confirm('重点单位删除需审核员审核,审核通过方可删除')
|
|
|
|
if(isTrue){
|
|
|
|
let body:any = {
|
|
|
|
title:this.deleteAll[0].name,
|
|
|
|
Operation:2,
|
|
|
|
itemId:this.deleteAll[0].id,
|
|
|
|
verifyState:3,
|
|
|
|
contentType:11
|
|
|
|
}
|
|
|
|
this.http.post(`/api/ContentVerifies`,body).subscribe(data=>{
|
|
|
|
this.snackBar.open('操作成功','确定',config);
|
|
|
|
this.getAllKeyUnit()
|
|
|
|
},err=>{
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}else if(this.deleteAll.length > 1){
|
|
|
|
let isTrue = confirm('重点单位删除需审核员审核,审核通过方可删除')
|
|
|
|
if(isTrue){
|
|
|
|
for(var i=0;i<this.deleteAll.length;i++ ){
|
|
|
|
let body:any = {
|
|
|
|
title:this.deleteAll[i].name,
|
|
|
|
Operation:2,
|
|
|
|
itemId:this.deleteAll[i].id,
|
|
|
|
verifyState:3,
|
|
|
|
contentType:11
|
|
|
|
}
|
|
|
|
this.deleteAudia.push(body)
|
|
|
|
}
|
|
|
|
|
|
|
|
this.http.post(`/api/ContentVerifies/Batch`,this.deleteAudia).subscribe(data=>{
|
|
|
|
this.snackBar.open('操作成功','确定',config);
|
|
|
|
this.getAllKeyUnit()
|
|
|
|
this.deleteAll=[]
|
|
|
|
},err=>{
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//重置
|
|
|
|
js:any //辖区中队输入框
|
|
|
|
jsId:any //辖区中队选择的id
|
|
|
|
companyName:any //单位名称
|
|
|
|
shehui:any //统一社会信用代码
|
|
|
|
unittype:any //单位类型
|
|
|
|
jscheck:any //辖区中队包含下级
|
|
|
|
OrganizationId //
|
|
|
|
follow:any = '' //是否为关注单位
|
|
|
|
integritySort:any //完整度排序
|
|
|
|
reset(){
|
|
|
|
this.js='' //辖区中队输入框
|
|
|
|
this.jscheck='' //辖区中队包含下级
|
|
|
|
this.companyName='' //单位名称
|
|
|
|
this.shehui='' //统一社会信用代码
|
|
|
|
this.unittype='' //单位类型
|
|
|
|
this.jsId = ''
|
|
|
|
this.follow = ''
|
|
|
|
this.PageNumber = 1
|
|
|
|
this.pageEvent.pageIndex = 0
|
|
|
|
this.integritySort = ''
|
|
|
|
this.integrityScoreMax=undefined
|
|
|
|
this.integrityScoreMin=undefined
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
}
|
|
|
|
//编辑单位名称
|
|
|
|
editUnitName(element){
|
|
|
|
//console.log(element)
|
|
|
|
const dialogRef = this.dialog.open(upname, {
|
|
|
|
width: '340px',
|
|
|
|
height:'280px',
|
|
|
|
data: element
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe(result => {
|
|
|
|
//console.log(result);
|
|
|
|
element.name=result
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
//跳转查看基本信息页面
|
|
|
|
unitdetails(element){
|
|
|
|
// console.log(element)
|
|
|
|
sessionStorage.setItem("editable","0")
|
|
|
|
sessionStorage.setItem("companyName",element.name)
|
|
|
|
sessionStorage.setItem("companyId",element.id)
|
|
|
|
sessionStorage.setItem(element.id,JSON.stringify(element.companyIntegrityScore))
|
|
|
|
window.open(`/keyUnit/viewunitinfo?id=${element.id}&usci=${element.usci}`,'_blank');
|
|
|
|
}
|
|
|
|
//提交查询表单
|
|
|
|
onSubmit(value){
|
|
|
|
this.PageNumber = 1
|
|
|
|
this.pageEvent.pageIndex = 0
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
if(this.integrityScoreMax<this.integrityScoreMin){
|
|
|
|
this.snackBar.open('最大值不能小于最小值!','确定',config);
|
|
|
|
}else{
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
bigclosediv(e){
|
|
|
|
this.isorganizationbox = false
|
|
|
|
}
|
|
|
|
stopclose(e){
|
|
|
|
e.stopPropagation();
|
|
|
|
}
|
|
|
|
//辖区中队div是否显示
|
|
|
|
isorganizationbox:boolean = false
|
|
|
|
//点击辖区中队树,将选择的辖区中队添加到变量
|
|
|
|
add(node) {
|
|
|
|
this.isorganizationbox = false
|
|
|
|
this.js = node.name
|
|
|
|
this.jsId = node.id
|
|
|
|
}
|
|
|
|
//关闭辖区中队隐藏框
|
|
|
|
closeorganizationbox() {
|
|
|
|
this.isorganizationbox = false
|
|
|
|
}
|
|
|
|
//打开辖区中队隐藏框
|
|
|
|
openorganizationbox() {
|
|
|
|
this.isorganizationbox = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//关闭出现的组织机构div
|
|
|
|
closediv(){
|
|
|
|
this.isorganizationbox = false
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增重点单位
|
|
|
|
createunit(){
|
|
|
|
// console.log(this.newallorganizations2)
|
|
|
|
const dialogRef = this.dialog.open(CreateUnit, {//调用open方法打开对话框并且携带参数过去
|
|
|
|
width: '625px',
|
|
|
|
data: {allunittype:this.allunittype,allorganizations:this.newallorganizations2}
|
|
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe(
|
|
|
|
data=>{
|
|
|
|
if(data){
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open('创建成功','确定',config);
|
|
|
|
this.getAllKeyUnit();
|
|
|
|
sessionStorage.setItem("companyName",data.name)
|
|
|
|
sessionStorage.setItem("editable","1")
|
|
|
|
sessionStorage.setItem("companyId",data.id)
|
|
|
|
window.open(`/keyUnit/editplaninfo?id=${data.id}&usci=${data.usci}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
//提交审核
|
|
|
|
submitAudit(element){
|
|
|
|
console.log(element)
|
|
|
|
let body:any = {
|
|
|
|
title:element.name,
|
|
|
|
Operation:element.contentVerify==null? 0:1,
|
|
|
|
itemId:element.id,
|
|
|
|
verifyState:3,
|
|
|
|
contentType:11
|
|
|
|
}
|
|
|
|
this.http.post(`/api/ContentVerifies`,body).subscribe(data=>{
|
|
|
|
this.getAllKeyUnit()
|
|
|
|
},err=>{
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
|
|
|
|
}
|
|
|
|
//撤销审核
|
|
|
|
cancelAudit(element){
|
|
|
|
this.deleteAll=[]
|
|
|
|
this.http.delete(`/api/ContentVerifies/${element.contentVerify.id}`).subscribe(data=>{
|
|
|
|
this.getAllKeyUnit()
|
|
|
|
},
|
|
|
|
err=>{
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
//审核结果
|
|
|
|
auditResult(element){
|
|
|
|
const dialogRef = this.dialog.open(companyAuditResult, {
|
|
|
|
width:"400px",
|
|
|
|
//height:"300px",
|
|
|
|
data: {element:element}
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建重点单位
|
|
|
|
@Component({
|
|
|
|
selector: 'createunit',
|
|
|
|
templateUrl: './createunit.component.html',
|
|
|
|
styleUrls: ['./key-unit-management.component.scss']
|
|
|
|
})
|
|
|
|
export class CreateUnit {
|
|
|
|
myControl = new FormControl();
|
|
|
|
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,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
treeControl = new FlatTreeControl<any>(node => node.level, node => node.expandable);
|
|
|
|
treeFlattener = new MatTreeFlattener(this._transformer, node => node.level, node => node.expandable, node => node.children);
|
|
|
|
dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener);
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<CreateUnit>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar,private tree: TreeService) {}
|
|
|
|
hasChild = (_: number, node: any) => node.expandable;
|
|
|
|
allunittype = this.data.allunittype
|
|
|
|
js:any //所属辖区中队
|
|
|
|
jsId:any //所属辖区中队的id
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.dataSource.data = this.data.allorganizations
|
|
|
|
}
|
|
|
|
onNoClick(): void {
|
|
|
|
this.dialogRef.close();
|
|
|
|
}
|
|
|
|
add(node){
|
|
|
|
this.js = node.name
|
|
|
|
this.jsId = node.id
|
|
|
|
}
|
|
|
|
onSubmit(value){
|
|
|
|
let myDate = new Date();
|
|
|
|
let usci = new Date().getTime() + '00000'
|
|
|
|
let body = {
|
|
|
|
id: "",
|
|
|
|
name: value.name,
|
|
|
|
usci: value.usci || usci,
|
|
|
|
contacts: "",
|
|
|
|
phone: "",
|
|
|
|
address: "",
|
|
|
|
imageUrl: "",
|
|
|
|
location: {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
|
|
|
},
|
|
|
|
modifiedTime: myDate,
|
|
|
|
organizationId: this.jsId,
|
|
|
|
organizationName: this.js,
|
|
|
|
buildingTypes: [
|
|
|
|
{
|
|
|
|
id: value.unittype,
|
|
|
|
name: ""
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
this.http.post("/api/Companies",body).subscribe(
|
|
|
|
data=>{
|
|
|
|
this.dialogRef.close(data);
|
|
|
|
},
|
|
|
|
err=>{
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//修改单位名称
|
|
|
|
@Component({
|
|
|
|
selector: 'upname',
|
|
|
|
templateUrl: './upname.html',
|
|
|
|
styleUrls: ['./upname.scss']
|
|
|
|
})
|
|
|
|
export class upname{
|
|
|
|
constructor(private router:Router,private http: HttpClient,public dialog: MatDialog,public snackBar: MatSnackBar,public dialogRef: MatDialogRef<upname>,@Inject(MAT_DIALOG_DATA) public data: any) {}
|
|
|
|
unitname:string//修改后的名称
|
|
|
|
oldname=this.data.name//原名
|
|
|
|
oldid=this.data.id
|
|
|
|
|
|
|
|
//取消
|
|
|
|
close(){
|
|
|
|
this.dialogRef.close(this.oldname);
|
|
|
|
}
|
|
|
|
//确定
|
|
|
|
updateName(){
|
|
|
|
//console.log(this.unitname)
|
|
|
|
const config = new MatSnackBarConfig();
|
|
|
|
config.verticalPosition = 'top';
|
|
|
|
config.duration = 3000
|
|
|
|
if(this.unitname==''||this.unitname==undefined){
|
|
|
|
this.snackBar.open('请填写新单位名称','确定',config);
|
|
|
|
}else if(this.unitname==this.oldname){
|
|
|
|
this.snackBar.open('新单位名称不能和旧单位名称一样','确定',config);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
let paramsdata:any = {
|
|
|
|
id:this.oldid,
|
|
|
|
name: this.unitname
|
|
|
|
}
|
|
|
|
this.http.put(`/api/Companies/${this.oldid}/UpdateName`,paramsdata).subscribe((data:any)=>{
|
|
|
|
this.snackBar.open("修改名字成功",'确定',config);
|
|
|
|
},err => {
|
|
|
|
this.snackBar.open(err,'确定',config);
|
|
|
|
})
|
|
|
|
this.dialogRef.close(this.unitname);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//查看审核结果
|
|
|
|
@Component({
|
|
|
|
selector: 'resultmeet',
|
|
|
|
templateUrl: './resultcompanyPlan.html',
|
|
|
|
styleUrls: ['./key-unit-management.component.scss']
|
|
|
|
})
|
|
|
|
export class companyAuditResult{
|
|
|
|
constructor(private http: HttpClient,public dialogRef: MatDialogRef<companyAuditResult>,@Inject(MAT_DIALOG_DATA) public data,public snackBar: MatSnackBar) {}
|
|
|
|
planName:any = this.data.element.name
|
|
|
|
createTime=''
|
|
|
|
organizationName=this.data.element.organizationName
|
|
|
|
verifyTime=''
|
|
|
|
remark=''
|
|
|
|
verifyOrganizationName
|
|
|
|
verifyState=100
|
|
|
|
ngOnInit(): void {
|
|
|
|
if(this.data.element.contentVerify!=null){
|
|
|
|
this.createTime=this.data.element.contentVerify.createTime
|
|
|
|
//this.organizationName=this.data.element.organizationName
|
|
|
|
this.verifyTime=this.data.element.contentVerify.verifyTime
|
|
|
|
//this.remark=this.data.element.remark
|
|
|
|
this.verifyState=this.data.element.contentVerify.verifyState
|
|
|
|
this.verifyOrganizationName=this.data.element.contentVerify.verifyOrganizationName
|
|
|
|
this.remark=this.data.element.contentVerify.remark
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onNoClick(): void {
|
|
|
|
this.dialogRef.close();
|
|
|
|
}
|
|
|
|
}
|