Commit bd08a093 authored by wangqinghua's avatar wangqinghua

兼容性测试

parent 9e8886d0
...@@ -40,7 +40,7 @@ Module ng g module my-module ...@@ -40,7 +40,7 @@ Module ng g module my-module
版本更新: 版本更新:
v2.0.1 修复选择节点之后 流量查询不出来 v2.0.1 修复选择节点之后 流量查询不出来
****上传文件到服务器******
scp -r 22 build/www root@10.10.38.99:/home/nginx scp -r 22 build/www root@10.10.38.99:/home/nginx
scp -r 22 build/wx root@10.10.38.99:/home/nginx/www scp -r 22 build/wx root@10.10.38.99:/home/nginx/www
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
</nz-select> </nz-select>
</div> </div>
<div nz-col nzSpan="7"> <div nz-col nzSpan="7">
<nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()" <nz-radio-group style="width: 100%;" [(ngModel)]="timeType" (ngModelChange)="changeType()">
[nzButtonStyle]="'solid'">
<label nz-radio-button nzValue="1">今天</label> <label nz-radio-button nzValue="1">今天</label>
<label nz-radio-button nzValue="2">昨天</label> <label nz-radio-button nzValue="2">昨天</label>
<label nz-radio-button nzValue="3">三天</label> <label nz-radio-button nzValue="3">三天</label>
......
...@@ -31,6 +31,7 @@ export class ResourceUsabilComponent implements OnInit { ...@@ -31,6 +31,7 @@ export class ResourceUsabilComponent implements OnInit {
lastList; lastList;
obj = { obj = {
timeType:this.timeType,
type: '', type: '',
groupid: '', groupid: '',
startTime: '', startTime: '',
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
</div> </div>
</div> </div>
</div> </div>
<nz-tabset class="tabs-smart"> <nz-tabset class="tabs-smart" [nzType]="'card'">
<nz-tab nzTitle="网站监测"> <nz-tab nzTitle="网站监测">
<div style="min-height: 500px"> <div style="min-height: 500px">
<ng-container *ngIf="noData"> <ng-container *ngIf="noData">
...@@ -183,4 +183,4 @@ ...@@ -183,4 +183,4 @@
</nz-tab> </nz-tab>
</nz-tabset> </nz-tabset>
</div> </div>
</div> </div>
\ No newline at end of file
...@@ -17,262 +17,104 @@ import {Router} from '@angular/router'; ...@@ -17,262 +17,104 @@ import {Router} from '@angular/router';
] ]
}) })
export class HomeComponent implements OnInit,AfterViewInit { export class HomeComponent implements OnInit {
@ViewChild('smartSelectGroup') smartSelectGroup:SelectGroupComponent; @ViewChild('smartTopologyView') smartTopologyView: TopologyViewComponent;
@ViewChild("leftDiv") leftDiv:ElementRef;
@ViewChild("rightDiv") rightDiv:ElementRef;
color = color; color = color;
obj = {
leftGroupId: '',
};
noData = false;
groupList; //分组数组
timeList = [
{'label': '最近一小时', value: '1'},
{'label': '最近一天', value: '2'},
{'label': '最近三天', value: '3'},
{'label': '最近一周', value: '4'},
];
timeTypeTrend = "0";
leftOneChart; leftOneChart;
leftTwoChart; leftTwoChart;
rightOneChart; rightOneChart;
rightTwoChart; rightTwoChart;
warnList= []; charTrendOption; //告警综述趋势
totalNum;
groupList;
pageNum = 1;
pageCount = 10;
loading = false;
obj = {
leftGroupId:null,
alarmGroupId:null
};
leftOneData = { leftOneData = {
high:0, high: 0,
warning:0, warning: 0,
normal:0, normal: 0,
disabled:0, disabled: 0,
}; };
leftOneDataPre = { leftOneDataPre = {
highPer:0, highPer: 0,
warningPer:0, warningPer: 0,
normalPer:0, normalPer: 0,
disabledPer:0, disabledPer: 0,
}; };
leftOneTotal = 0; leftOneTotal = 0;
leftTwoData ={ leftTwoData = {
high:0, high: 0,
warning:0, warning: 0,
normal:0, normal: 0,
disabled:0, disabled: 0,
}; };
leftTwoDataPre = { leftTwoDataPre = {
highPer:0, highPer: 0,
warningPer:0, warningPer: 0,
normalPer:0, normalPer: 0,
disabledPer:0, disabledPer: 0,
}; };
leftTwoTotal = 0; leftTwoTotal = 0;
rightTotal = 0; rightTotal = 0;
//我的关注 flowListNum; //接口流量排行 数值
followList; flowListPre; //发送利用率排名 百分比
countOrderList; //cpu内存使用率排名列表
//资源设备数量 isTrendLoading = false;
deviceNo;
trendObj = {
startTime: '',
endTime: ''
};
dataSet; //拓扑图
topoId;
constructor( constructor(
private overAllSer:OverAllService,private message:NzMessageService, private overAllSer: OverAllService, private message: NzMessageService,
private alarmSer:AlarmService,private renderer:Renderer2, private alarmSer: AlarmService, private renderer: Renderer2,
private layoutSer:LayoutService, private layoutSer: LayoutService,private datePipe:DatePipe,
private principal: Principal, private principal: Principal, private topologySer: TopologyService,
private eventManager: JhiEventManager, private eventManager: JhiEventManager, private analysisSer: AnalysisService,
private router:Router private router: Router, private commonSer: CommonService,
) { ) {
} }
ngOnInit() { ngOnInit() {
this.getAlarmList();
this.findGroupCount(); this.findGroupCount();
this.findHostCount(); this.findHostCount();
this.getGroup(); this.getGroup();
this.getMyFollow(); this.flowRankNum();
this.flowRankPre();
this.findSize(); this.countOrde();
}
ngAfterViewInit(){
let rightHeight = this.rightDiv.nativeElement.clientHeight;
this.renderer.setStyle(this.leftDiv.nativeElement,"height",rightHeight +"px");
}
//查看详情
goToDetail(item) {
this.router.navigate(['app/main/basic-detail'], {
queryParams: {
hostId: item.hostid,
name: item.hostname,
hostName: item.hostname
}
});
}
//我的关注 this.getList();
getMyFollow(){
this.layoutSer.myFollow().subscribe(
(res)=>{
this.followList = res.data;
if(this.followList.length > 0 ){
let dataStyle = {
normal: {
label: {
show: false
},
labelLine: {
show: false
},
shadowBlur: 40,
borderWidth: 10,
shadowColor: 'rgba(0, 0, 0, 0)' //边框阴影
}
};
let placeHolderStyle = {
normal: {
color: '#eee',
label: {
show: false
},
labelLine: {
show: false
}
},
emphasis: {
color: '#393d50'
}
};
this.followList.forEach(e=>{
e.option = {
backgroundColor: '#fff',
title: {
text: '',
x: 'center',
y: 'center',
textStyle: {
fontWeight: 'normal',
fontSize: 24,
color: "red",
}
},
tooltip: {
trigger: 'item',
show: true,
formatter: "{b} : <br/>{d}%",
backgroundColor: 'rgba(0,0,0,0.7)', // 背景
padding: [8, 10], //内边距
extraCssText: 'box-shadow: 0 0 3px rgba(255, 255, 255, 0.4);', //添加阴影
},
series: [{
name: 'CPU使用率',
type: 'pie',
clockWise: false,
radius: [50, 58],
center:['30%','50%'],
itemStyle: dataStyle,
hoverAnimation: false,
startAngle: 90,
label:{
borderRadius:'10',
},
data: [{
value: e.cpu,
name: 'CPU使用率',
itemStyle: {
normal: {
color: "#f09363"
}
}
},
{
value: 100 - e.cpu,
name: '',
tooltip: {
show: false
},
itemStyle: placeHolderStyle
},
]
},
{
name: '内存使用率',
type: 'pie',
clockWise: false,
radius: [35, 43],
center:['30%','50%'],
itemStyle: dataStyle,
hoverAnimation: false,
startAngle: 90,
data: [{
value: e.memory,
name: '内存使用率',
itemStyle: {
normal: {
color: "#80ba78"
}
}
},
{
value: 100 - e.memory,
name: '',
tooltip: {
show: false
},
itemStyle: placeHolderStyle
},
]
},
// {
// name: '带宽使用率',
// type: 'pie',
// clockWise: false,
// radius: [20, 28],
// center:['30%','50%'],
// itemStyle: dataStyle,
// hoverAnimation: false,
// startAngle: 90,
// data: [{
// value: e.lose,
// name: '带宽使用率',
// itemStyle: {
// normal: {
// color: "#73b6e4"
// }
// }
// },
// {
// value: 100 - e.lose,
// name: '',
// tooltip: {
// show: false
// },
// itemStyle: placeHolderStyle
// },
// ]
// }
]
};
})
}
}
)
} }
//获取分组 //获取分组
getGroup() { getGroup() {
this.overAllSer.findGroup().subscribe( this.overAllSer.findGroup().subscribe(
(res) => { (res) => {
if(res.data){ if (res.errCode == 10000 && res.data) {
this.groupList = res.data; this.groupList = res.data;
this.obj.leftGroupId = this.groupList[0].groupid; this.obj.leftGroupId = this.groupList[0].groupid;
this.countGroupItem(); this.countGroupItem();
......
<!--告警推送--> <!--告警推送-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isShow" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading"> <nz-modal [nzWidth]="1080" [(nzVisible)]="isShow" [nzTitle]="title" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px"> <nz-tabset [nzType]="'card'" [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="选定告警目标"> <nz-tab nzTitle="选定告警目标">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
<nz-form-item> <nz-form-item>
......
<!--添加资源--> <!--添加资源-->
<nz-modal [nzWidth]="1080" [(nzVisible)]="isBasicEdit" [nzTitle]="modalTitle" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading"> <nz-modal [nzWidth]="1080" [(nzVisible)]="isBasicEdit" [nzTitle]="modalTitle" (nzOnCancel)="handleEditCancel()" (nzOnOk)="handEditleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [(nzSelectedIndex)]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px"> <nz-tabset [(nzSelectedIndex)]="tabNum" [nzType]="'card'" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="资源信息"> <nz-tab nzTitle="资源信息">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
<nz-form-item> <nz-form-item>
...@@ -232,7 +232,7 @@ ...@@ -232,7 +232,7 @@
全局值(配置) 全局值(配置)
</div> </div>
</div> </div>
<div nz-row [nzGutter]="12" *ngFor="let item of macroList2"> <div nz-row [nzGutter]="12" *ngFor="let item of macroList2;let i = index;">
<nz-form-control nz-col [nzOffset]="2" [nzSpan]="6"> <nz-form-control nz-col [nzOffset]="2" [nzSpan]="6">
<input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}"> <input nz-input placeholder="{$SNMP_COMMUNITY}" value="{{item.macro}}">
</nz-form-control> </nz-form-control>
......
<nz-modal [nzWidth]="880" [nzFooter]="null" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()" <nz-modal [nzWidth]="880" [nzFooter]="null" [(nzVisible)]="isVisible" [nzTitle]="title" (nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()"> (nzOnOk)="handleOk()">
<nz-tabset [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" <nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)"
style="padding-bottom: 25px;min-height: 500px"> style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="模版"> <nz-tab nzTitle="模版">
<div nz-form> <div nz-form>
......
<nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading"> <nz-modal [nzWidth]="1080" [(nzVisible)]="isVisible" nzTitle="{{title}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()" [nzOkLoading]="isOkLoading">
<nz-tabset [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px"> <nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" (nzSelectedIndexChange)="tabsChange($event)" style="padding-bottom: 25px;min-height: 500px">
<nz-tab nzTitle="1.场景"> <nz-tab nzTitle="1.场景">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
<form nz-form class="ant-advanced-search-form"> <form nz-form class="ant-advanced-search-form">
...@@ -318,4 +318,4 @@ ...@@ -318,4 +318,4 @@
</form> </form>
</nz-tab> </nz-tab>
</nz-tabset> </nz-tabset>
</nz-modal> </nz-modal>
\ No newline at end of file
<!--进出口流量--> <!--进出口流量-->
<nz-modal [nzWidth]="780" [(nzVisible)]="isLine" nzTitle="流量配置" (nzOnCancel)="handleLineCancel()" (nzOnOk)="handleLineOk()"> <nz-modal [nzWidth]="780" [(nzVisible)]="isLine" nzTitle="流量配置" (nzOnCancel)="handleLineCancel()" (nzOnOk)="handleLineOk()">
<form nz-form> <form nz-form>
<nz-tabset> <nz-tabset [nzType]="'card'">
<nz-tab nzTitle="进流量"> <nz-tab nzTitle="进流量">
<div class="padding-10"> <div class="padding-10">
<input (keyup.enter)="getInList()" name="inSearchName" style="width: 200px;" type="text" nz-input [(ngModel)]="inSearchName" placeholder="输入名称"> <input (keyup.enter)="getInList()" name="inSearchName" style="width: 200px;" type="text" nz-input [(ngModel)]="inSearchName" placeholder="输入名称">
...@@ -58,4 +58,4 @@ ...@@ -58,4 +58,4 @@
</nz-tab> </nz-tab>
</nz-tabset> </nz-tabset>
</form> </form>
</nz-modal> </nz-modal>
\ No newline at end of file
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
{{checkStatus.disabled}} {{checkStatus.disabled}}
</span> </span>
</div> </div>
<nz-tabset [nzSelectedIndex]="tabNum" class="tabs-smart"> <nz-tabset [nzType]="'card'" [nzSelectedIndex]="tabNum" class="tabs-smart">
<nz-tab nzTitle="资源详情"> <nz-tab nzTitle="资源详情">
<section> <section>
<p class="padding-8-0">{{hostName}}</p> <p class="padding-8-0">{{hostName}}</p>
......
...@@ -81,7 +81,7 @@ export class BasicComponent implements OnInit { ...@@ -81,7 +81,7 @@ export class BasicComponent implements OnInit {
totalNum; totalNum;
constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router, constructor(private fb: FormBuilder, private overAllSer: OverAllService, private router: Router,
private commonSer:CommonService, private commonSer: CommonService,
private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) { private modalService: NzModalService, private message: NzMessageService, private main: JhiMainComponent) {
} }
...@@ -176,10 +176,10 @@ export class BasicComponent implements OnInit { ...@@ -176,10 +176,10 @@ export class BasicComponent implements OnInit {
this.findOpStatus(); this.findOpStatus();
} }
changeStatus(status){ changeStatus(status) {
if(this.status == status){ if (this.status == status) {
this.status = null; this.status = null;
}else{ } else {
this.status = status; this.status = status;
} }
this.pageNum = 1; this.pageNum = 1;
...@@ -189,7 +189,7 @@ export class BasicComponent implements OnInit { ...@@ -189,7 +189,7 @@ export class BasicComponent implements OnInit {
/* /*
//waringName:(值为:正常,禁用,告警,严重) //waringName:(值为:正常,禁用,告警,严重)
*/ */
search(){ search() {
this.pageNum = 1; this.pageNum = 1;
this.searchRe(); this.searchRe();
} }
...@@ -198,28 +198,28 @@ export class BasicComponent implements OnInit { ...@@ -198,28 +198,28 @@ export class BasicComponent implements OnInit {
this.loading = true; this.loading = true;
this.searchStatus = true; this.searchStatus = true;
const data = { const data = {
pageNum:this.pageNum, pageNum: this.pageNum,
pageCount:this.pageCount, pageCount: this.pageCount,
obj:{ obj: {
name:this.searchName, name: this.searchName,
waringName:this.status, waringName: this.status,
groupids:[] groupids: []
} }
} };
this.overAllSer.findHostPageNew(data).subscribe( this.overAllSer.findHostPageNew(data).subscribe(
(res)=>{ (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.dataSet = res.data.data; this.dataSet = res.data.data;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
} }
this.loading = false; this.loading = false;
} }
) );
} }
//翻页 //翻页
change(event){ change(event) {
if(event > 0){ if (event > 0) {
this.pageNum = event; this.pageNum = event;
this.searchRe(); this.searchRe();
} }
...@@ -235,7 +235,7 @@ export class BasicComponent implements OnInit { ...@@ -235,7 +235,7 @@ export class BasicComponent implements OnInit {
//查询设备状态 //查询设备状态
findOpStatus() { findOpStatus() {
this.overAllSer.findHostCountByStatusByHost().subscribe( this.overAllSer.findHostCountByStatusByHost().subscribe(
(res)=>{ (res) => {
if (res.errCode == 10000) { if (res.errCode == 10000) {
this.green = res.data.normal; this.green = res.data.normal;
this.gray = res.data.disable; this.gray = res.data.disable;
...@@ -246,7 +246,7 @@ export class BasicComponent implements OnInit { ...@@ -246,7 +246,7 @@ export class BasicComponent implements OnInit {
this.message.info(res.Msg); this.message.info(res.Msg);
} }
} }
) );
} }
//添加资源 //添加资源
...@@ -261,7 +261,7 @@ export class BasicComponent implements OnInit { ...@@ -261,7 +261,7 @@ export class BasicComponent implements OnInit {
//添加监测点 //添加监测点
showBasicCheckModal(hostid, host) { showBasicCheckModal(hostid, host) {
this.smartCheck.showAddModal(hostid, host,'添加监测点'); this.smartCheck.showAddModal(hostid, host, '添加监测点');
} }
//列表 //列表
...@@ -325,7 +325,7 @@ export class BasicComponent implements OnInit { ...@@ -325,7 +325,7 @@ export class BasicComponent implements OnInit {
//删除单个资源 //删除单个资源
showDeleteConfirm(item) { showDeleteConfirm(item) {
this.commonSer.confirmThing("删除","确认删除该资源吗?",()=>{ this.commonSer.confirmThing('删除', '确认删除该资源吗?', () => {
const data = { const data = {
hostids: [] hostids: []
}; };
...@@ -340,7 +340,7 @@ export class BasicComponent implements OnInit { ...@@ -340,7 +340,7 @@ export class BasicComponent implements OnInit {
} }
} }
); );
}) });
} }
//批量删除资源 //批量删除资源
...@@ -350,7 +350,7 @@ export class BasicComponent implements OnInit { ...@@ -350,7 +350,7 @@ export class BasicComponent implements OnInit {
return false; return false;
} }
this.commonSer.confirmThing("删除","确认要删除所选设备吗?",()=>{ this.commonSer.confirmThing('删除', '确认要删除所选设备吗?', () => {
const data = { const data = {
hostids: this.batchDelList hostids: this.batchDelList
}; };
...@@ -406,7 +406,7 @@ export class BasicComponent implements OnInit { ...@@ -406,7 +406,7 @@ export class BasicComponent implements OnInit {
//添加告警 //添加告警
showAlarm() { showAlarm() {
this.smartAlarmModal.showAddModal('添加告警',null); this.smartAlarmModal.showAddModal('添加告警', null);
} }
handleOk(e) { handleOk(e) {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<button (click)="showDeleteConfirm()" nz-button nzType="default">删除</button> <button (click)="showDeleteConfirm()" nz-button nzType="default">删除</button>
</div> </div>
<div class="releative"> <div class="releative">
<nz-tabset class="tabs-smart "> <nz-tabset class="tabs-smart" [nzType]="'card'">
<nz-tab nzTitle="监测信息"> <nz-tab nzTitle="监测信息">
<section> <section>
<div nz-row nzGutter="24"> <div nz-row nzGutter="24">
......
import {Injectable, OnInit} from "@angular/core"; import {Injectable, OnInit} from '@angular/core';
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants'; import {SERVER_API_URL, SERVER_API_URL_COMS} from '../../app.constants';
import {DatePipe} from '@angular/common'; import {DatePipe} from '@angular/common';
declare var ActiveXObject: ActiveXObject;
interface ActiveXObject {
new (type: string): ActiveXObject;
SendKeys(key: string): void;
}
@Injectable() @Injectable()
export class CommonService implements OnInit { export class CommonService implements OnInit {
constructor(private modalSer:NzModalService,private datePipe:DatePipe, constructor(private modalSer: NzModalService, private datePipe: DatePipe,
private message:NzMessageService) { private message: NzMessageService) {
// 定义发射事件 // 定义发射事件
} }
...@@ -14,9 +20,9 @@ export class CommonService implements OnInit { ...@@ -14,9 +20,9 @@ export class CommonService implements OnInit {
} }
exists(list, parentId,myId){ exists(list, parentId, myId) {
for(let i=0; i<list.length; i++){ for (let i = 0; i < list.length; i++) {
if(list[i][myId] == parentId){ if (list[i][myId] == parentId) {
return true; return true;
} }
} }
...@@ -30,26 +36,26 @@ export class CommonService implements OnInit { ...@@ -30,26 +36,26 @@ export class CommonService implements OnInit {
* @param list * @param list
* @returns {any[]} * @returns {any[]}
*/ */
listToTree(myId,pId,list){ listToTree(myId, pId, list) {
const nodes = []; const nodes = [];
for(let i=0; i<list.length; i++){ for (let i = 0; i < list.length; i++) {
list[i].checked = false; list[i].checked = false;
const row = list[i]; const row = list[i];
if ( !this.exists(list, row[pId],myId) ){ if (!this.exists(list, row[pId], myId)) {
nodes.push(row); nodes.push(row);
} }
} }
const toDo = []; const toDo = [];
for(let i=0; i<nodes.length; i++){ for (let i = 0; i < nodes.length; i++) {
toDo.push(nodes[i]); toDo.push(nodes[i]);
} }
while(toDo.length){ while (toDo.length) {
const node = toDo.shift(); // the parent node const node = toDo.shift(); // the parent node
for(let i=0; i<list.length; i++){ for (let i = 0; i < list.length; i++) {
const row = list[i]; const row = list[i];
if (row[pId] == node[myId]){ if (row[pId] == node[myId]) {
if (node.children){ if (node.children) {
node.children.push(row); node.children.push(row);
} else { } else {
node.children = [row]; node.children = [row];
...@@ -66,7 +72,7 @@ export class CommonService implements OnInit { ...@@ -66,7 +72,7 @@ export class CommonService implements OnInit {
* @param data json格式的数据 * @param data json格式的数据
* @returns {string} * @returns {string}
*/ */
toQuery(data){ toQuery(data) {
let str = ''; let str = '';
for (let key in data) { for (let key in data) {
if (data.hasOwnProperty(key)) { if (data.hasOwnProperty(key)) {
...@@ -83,16 +89,16 @@ export class CommonService implements OnInit { ...@@ -83,16 +89,16 @@ export class CommonService implements OnInit {
* @param title 提示语 * @param title 提示语
* @param callback 回调函数 * @param callback 回调函数
*/ */
confirmThing(title,content,callback){ confirmThing(title, content, callback) {
this.modalSer.confirm({ this.modalSer.confirm({
nzTitle: title, nzTitle: title,
nzContent: '<b style="color: red;">'+content+'</b>', nzContent: '<b style="color: red;">' + content + '</b>',
nzOkText: '确定', nzOkText: '确定',
nzOkType: 'danger', nzOkType: 'danger',
nzOnOk: callback, nzOnOk: callback,
nzCancelText: '取消', nzCancelText: '取消',
nzOnCancel: () => console.log('Cancel'), nzOnCancel: () => console.log('Cancel'),
}) });
} }
/** /**
...@@ -131,11 +137,24 @@ export class CommonService implements OnInit { ...@@ -131,11 +137,24 @@ export class CommonService implements OnInit {
* @param method 全屏方法 * @param method 全屏方法
* @returns {any} * @returns {any}
*/ */
showInFullScreen(element, method){ showInFullScreen(element, method) {
let usablePrefixMethod; let usablePrefixMethod;
['webkit', 'moz', 'ms', 'o', ''].forEach( (prefix)=> { const ie = navigator.userAgent.match(/MSIE\s([\d.]+)/),
ie11 = navigator.userAgent.match(/Trident\/7.0/) && navigator.userAgent.match(/rv:11/),
ieEDGE = navigator.userAgent.match(/Edge/g),
ieVer = (ie ? ie[1] : (ie11 ? 11 : (ieEDGE ? 12 : -1)));
if (ieVer > -1) {
if(typeof (<any>window).ActiveXObject !== "undefined") {
//这的方法 模拟f11键,使浏览器全屏
const wscript = new ActiveXObject("WScript.Shell");
if(wscript != null) {
wscript.SendKeys("{F11}");
}
}
}
['webkit', 'moz', 'ms', 'o', ''].forEach((prefix) => {
if (usablePrefixMethod) { if (usablePrefixMethod) {
return return;
} }
if (prefix === '') { if (prefix === '') {
// 无前缀,方法首字母小写 // 无前缀,方法首字母小写
...@@ -144,13 +163,13 @@ export class CommonService implements OnInit { ...@@ -144,13 +163,13 @@ export class CommonService implements OnInit {
let typePrefixMethod = typeof element[prefix + method]; let typePrefixMethod = typeof element[prefix + method];
if (typePrefixMethod + '' !== 'undefined') { if (typePrefixMethod + '' !== 'undefined') {
if (typePrefixMethod === 'function') { if (typePrefixMethod === 'function') {
usablePrefixMethod = element[prefix + method]() usablePrefixMethod = element[prefix + method]();
} else { } else {
usablePrefixMethod = element[prefix + method] usablePrefixMethod = element[prefix + method];
} }
} }
} }
) );
return usablePrefixMethod; return usablePrefixMethod;
} }
...@@ -158,12 +177,12 @@ export class CommonService implements OnInit { ...@@ -158,12 +177,12 @@ export class CommonService implements OnInit {
* 根据type 查询时间段 * 根据type 查询时间段
* @param timeType 0:最近一小时 1:今天 2:昨天(最近一天) 3:最近三天 4:最近一周 5:最近一个月 * @param timeType 0:最近一小时 1:今天 2:昨天(最近一天) 3:最近三天 4:最近一周 5:最近一个月
*/ */
getTimeByType(timeType){ getTimeByType(timeType) {
const nowDate = new Date().getTime(); const nowDate = new Date().getTime();
let day1, day2; //当作变量使用 let day1, day2; //当作变量使用
let obj = {startTime:'',endTime:''}; let obj = {startTime: '', endTime: ''};
switch (timeType) { switch (timeType) {
case'0':{ //最近一小时 case'0': { //最近一小时
day1 = nowDate - 1 * 60 * 60 * 1000; day1 = nowDate - 1 * 60 * 60 * 1000;
obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd HH:mm:ss'); obj.startTime = this.datePipe.transform(day1, 'yyyy-MM-dd HH:mm:ss');
obj.endTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd HH:mm:ss'); obj.endTime = this.datePipe.transform(nowDate, 'yyyy-MM-dd HH:mm:ss');
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<button (click)="showEditModal()" nz-button nzType="default">编辑</button> <button (click)="showEditModal()" nz-button nzType="default">编辑</button>
<button (click)="deleteModal()" nz-button nzType="default">删除</button> <button (click)="deleteModal()" nz-button nzType="default">删除</button>
</div> </div>
<nz-tabset class="tabs-smart "> <nz-tabset [nzType]="'card'" class="tabs-smart ">
<nz-tab #thirdTabs nzTitle="资产信息"> <nz-tab #thirdTabs nzTitle="资产信息">
<div nz-form class="ant-advanced-search-form form-select"> <div nz-form class="ant-advanced-search-form form-select">
...@@ -255,4 +255,4 @@ ...@@ -255,4 +255,4 @@
<!--选择资源--> <!--选择资源-->
<smart-select-group #smartSelectGroup (done)="setLink($event)"></smart-select-group> <smart-select-group #smartSelectGroup (done)="setLink($event)"></smart-select-group>
<!--资产--> <!--资产-->
<smart-assets #smartAssets (done)="getDetail()"></smart-assets> <smart-assets #smartAssets (done)="getDetail()"></smart-assets>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment