Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
smart
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangqinghua
smart
Commits
b4d7a00b
Commit
b4d7a00b
authored
Feb 20, 2019
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
business
parent
90972e43
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
67 deletions
+111
-67
b-config.component.html
...main/webapp/app/business/b-config/b-config.component.html
+25
-3
b-config.component.ts
src/main/webapp/app/business/b-config/b-config.component.ts
+30
-5
business.component.html
...ebapp/app/business/modal/business/business.component.html
+3
-3
business.component.ts
.../webapp/app/business/modal/business/business.component.ts
+21
-11
basic.component.ts
src/main/webapp/app/overAll/basic/basic.component.ts
+32
-45
No files found.
src/main/webapp/app/business/b-config/b-config.component.html
View file @
b4d7a00b
...
...
@@ -46,10 +46,32 @@
<ng-template
ngFor
let-item
[
ngForOf
]="
expandDataCache
[
data
.
serviceid
]"
>
<tr
*
ngIf=
"(item.parent&&item.parent.expand)||!(item.parent)"
>
<td
[
nzIndentSize
]="
item
.
level
*
20
"
[
nzShowExpand
]="!!
item
.
children
"
[(
nzExpand
)]="
item
.
expand
"
(
nzExpandChange
)="
getChildren
(
item
)"
>
{{item.name}}
<span
(
click
)="
showEditModal
(
item
)"
class=
"main-color cursor"
>
{{item.name}}
</span>
</td>
<td
class=
"round-tag tag-form"
>
<ng-container
*
ngIf=
"item.status == 0"
>
<nz-tag
class=
"tag-green"
[
nzColor
]="
color
.
green
"
></nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.status == 2 || item.status == 3"
>
<nz-tag
class=
"tag-yellow"
[
nzColor
]="
color
.
yellow
"
></nz-tag>
</ng-container>
<ng-container
*
ngIf=
"item.status == 4 || item.status == 5"
>
<nz-tag
class=
"tag-red"
[
nzColor
]="
color
.
red
"
></nz-tag>
</ng-container>
</td>
<td
class=
"cursor"
>
<span
class=
"main-color cursor"
(
click
)="
contract
(
item
)"
>
关联
</span>
</td>
<td
class=
"handle main-color"
>
<span
(
click
)="
showAddModal
()"
>
添加子节点
</span>
<ng-container
*
ngIf=
"item.level == 0"
>
<span
(
click
)="
showBasicEditModal
(
item
)"
>
配置告警推送
</span>
</ng-container>
<ng-container
*
ngIf=
"item.level > 0"
>
<span
(
click
)="
editBasicModal
(
item
)"
>
编辑
</span>
<span
(
click
)="
showDeleteConfirm
(
item
)"
>
移除
</span>
</ng-container>
</td>
<td>
{{item.age}}
</td>
<td>
{{item.address}}
</td>
</tr>
</ng-template>
</ng-template>
...
...
src/main/webapp/app/business/b-config/b-config.component.ts
View file @
b4d7a00b
...
...
@@ -4,6 +4,7 @@ import { BusinessService } from '../business.service';
import
{
TreeNodeInterface
}
from
'../../overAll/basic/basic.component'
;
import
{
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
color
}
from
'../../app.constants'
;
import
{
CommonService
}
from
'../../shared/common/common.service'
;
@
Component
({
selector
:
'smart-b-config'
,
...
...
@@ -19,7 +20,8 @@ export class BConfigComponent implements OnInit {
isLoading
=
false
;
//加载中
constructor
(
private
busineSer
:
BusinessService
,
private
message
:
NzMessageService
)
{
constructor
(
private
busineSer
:
BusinessService
,
private
message
:
NzMessageService
,
private
commonSer
:
CommonService
)
{
}
dataSet
:
any
[];
...
...
@@ -54,12 +56,10 @@ export class BConfigComponent implements OnInit {
}
}
}
// console.log(array);
return
array
;
}
visitNode
(
node
:
TreeNodeInterface
,
hashMap
:
object
,
array
:
TreeNodeInterface
[]):
void
{
console
.
log
(
hashMap
);
if
(
!
hashMap
[
node
.
serviceid
])
{
hashMap
[
node
.
serviceid
]
=
true
;
array
.
push
(
node
);
...
...
@@ -70,7 +70,6 @@ export class BConfigComponent implements OnInit {
this
.
dataSet
.
forEach
((
item
,
i
)
=>
{
this
.
expandDataCache
[
item
.
serviceid
]
=
this
.
convertTreeToList
(
item
);
});
console
.
log
(
this
.
expandDataCache
);
}
ngOnInit
()
{
...
...
@@ -100,7 +99,7 @@ export class BConfigComponent implements OnInit {
)
}
//
//
获取下级
getChildren
(
item
){
this
.
isLoading
=
true
;
const
data
=
{
...
...
@@ -109,6 +108,7 @@ export class BConfigComponent implements OnInit {
this
.
busineSer
.
findChild
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
data
)
{
res
.
data
.
forEach
(
e
=>
e
.
children
=
[]);
this
.
dataSet
.
forEach
(
e
=>
{
if
(
e
.
serviceid
==
item
.
serviceid
){
e
.
children
=
res
.
data
;
...
...
@@ -123,6 +123,31 @@ export class BConfigComponent implements OnInit {
)
}
//删除单个资源
showDeleteConfirm
(
item
)
{
this
.
commonSer
.
confirmThing
(
"删除"
,
"确定删除该服务"
,()
=>
{
const
data
=
{
serviceids
:[]
};
data
.
serviceids
.
push
(
item
.
serviceid
);
this
.
busineSer
.
deleteService
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
success
(
'删除成功'
);
this
.
getList
();
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
)
})
}
//关联网站
contract
(
item
){
}
//添加业务
showAddModal
()
{
this
.
smartBusiness
.
showModal
(
'添加业务'
);
...
...
src/main/webapp/app/business/modal/business/business.component.html
View file @
b4d7a00b
...
...
@@ -16,7 +16,7 @@
<nz-option
nzValue=
"2"
nzLabel=
"问题,都有问题"
></nz-option>
<nz-option
nzValue=
"0"
nzLabel=
"不计算"
></nz-option>
</nz-select>
<nz-form-explain
*
ngIf=
"validateForm.get('algorithm').dirty && validateForm.get('parentid').errors"
>
请选择
用于计算服务状态的算法
!
</nz-form-explain>
<nz-form-explain
*
ngIf=
"validateForm.get('algorithm').dirty && validateForm.get('parentid').errors"
>
请选择
上层服务
!
</nz-form-explain>
</nz-form-control>
</nz-form-item>
<nz-form-item>
...
...
@@ -40,8 +40,8 @@
<nz-form-item>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
nzFor=
"sortorder"
>
排序(0->999)
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<input
type=
"text"
nz-input
formControlName=
"sortorder"
placeholder=
"
组名称
"
>
<nz-form-explain
*
ngIf=
"validateForm.get('sortorder').dirty && validateForm.get('sortorder').errors"
>
请输入分组名称
</nz-form-explain>
<input
type=
"text"
nz-input
formControlName=
"sortorder"
placeholder=
"
排序(0->999)
"
>
<nz-form-explain
*
ngIf=
"validateForm.get('sortorder').dirty && validateForm.get('sortorder').errors"
>
最大值为999
</nz-form-explain>
</nz-form-control>
</nz-form-item>
</form>
...
...
src/main/webapp/app/business/modal/business/business.component.ts
View file @
b4d7a00b
...
...
@@ -47,10 +47,15 @@ export class BusinessComponent implements OnInit {
name
:
[
''
,
[
Validators
.
required
]],
algorithm
:
[
''
],
showsla
:
[
'99.9000'
],
sortorder
:
[
'1'
],
sortorder
:
[
'1'
,[
Validators
.
maxLength
(
3
)]
],
parentid
:
[
'1'
],
});
// this.validateForm.get('showsla').disable();
this
.
validateForm
.
get
(
'showsla'
).
disable
();
}
//获取服务列表
getServiceList
(){
}
showModal
(
title
):
void
{
...
...
@@ -59,6 +64,9 @@ export class BusinessComponent implements OnInit {
}
showEditModal
(
title
,
item
){
item
.
algorithm
+=
""
;
item
.
showsla
+=
""
;
item
.
sortorder
+=
""
;
this
.
title
=
title
;
this
.
serviceId
=
item
.
serviceid
;
this
.
isVisiable
=
true
;
...
...
@@ -84,10 +92,10 @@ export class BusinessComponent implements OnInit {
create
()
{
const
data
=
{
algorithm
:
0
,
name
:
'新增'
,
sortorder
:
0
,
showsla
:
0
,
algorithm
:
Number
(
this
.
validateForm
.
value
.
algorithm
)
,
name
:
this
.
validateForm
.
value
.
name
,
sortorder
:
Number
(
this
.
validateForm
.
value
.
sortorder
)
,
showsla
:
this
.
checked
?
this
.
validateForm
.
value
.
showsla
:
0
,
parentid
:
7
}
this
.
busineSer
.
createService
(
data
).
subscribe
(
...
...
@@ -107,11 +115,13 @@ export class BusinessComponent implements OnInit {
update
()
{
const
data
=
{
groupid
:
this
.
groupid
,
groupDescribe
:
this
.
validateForm
.
value
.
groupDescribe
,
name
:
this
.
validateForm
.
value
.
name
};
algorithm
:
Number
(
this
.
validateForm
.
value
.
algorithm
),
name
:
this
.
validateForm
.
value
.
name
,
sortorder
:
Number
(
this
.
validateForm
.
value
.
sortorder
),
showsla
:
this
.
checked
?
this
.
validateForm
.
value
.
showsla
:
0
,
parentid
:
7
,
serviceid
:
this
.
serviceId
}
this
.
busineSer
.
updateService
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
...
...
src/main/webapp/app/overAll/basic/basic.component.ts
View file @
b4d7a00b
...
...
@@ -15,6 +15,7 @@ import {PauseComponent} from '../../modal/pause/pause.component';
import
{
AlarmModalComponent
}
from
'../../modal/alarm-modal/alarm-modal.component'
;
import
{
color
}
from
'../../app.constants'
;
import
{
JhiMainComponent
}
from
'../../layouts'
;
import
{
CommonService
}
from
'../../shared/common/common.service'
;
export
interface
TreeNodeInterface
{
host
:
any
;
...
...
@@ -75,6 +76,7 @@ export class BasicComponent implements OnInit {
searchData
;
constructor
(
private
fb
:
FormBuilder
,
private
overAllSer
:
OverAllService
,
private
router
:
Router
,
private
commonSer
:
CommonService
,
private
modalService
:
NzModalService
,
private
message
:
NzMessageService
,
private
main
:
JhiMainComponent
)
{
}
...
...
@@ -282,30 +284,22 @@ export class BasicComponent implements OnInit {
//删除单个资源
showDeleteConfirm
(
item
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'删除'
,
nzContent
:
'<b style="color: red;">确认删除该资源吗?</b>'
,
nzOkText
:
'确定'
,
nzOkType
:
'danger'
,
nzOnOk
:
()
=>
{
const
data
=
{
hostids
:
[]
};
data
.
hostids
.
push
(
item
.
hostid
);
this
.
overAllSer
.
deleteHostPost
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
this
.
commonSer
.
confirmThing
(
"删除"
,
"确认删除该资源吗?"
,()
=>
{
const
data
=
{
hostids
:
[]
};
data
.
hostids
.
push
(
item
.
hostid
);
this
.
overAllSer
.
deleteHostPost
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
);
},
nzCancelText
:
'取消'
,
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
)
});
}
);
})
}
//批量删除资源
...
...
@@ -314,29 +308,22 @@ export class BasicComponent implements OnInit {
this
.
message
.
info
(
'请选择需要删除的设备'
);
return
false
;
}
this
.
modalService
.
confirm
({
nzTitle
:
'删除'
,
nzContent
:
'<b style="color: red;">确认要删除所选设备吗?</b>'
,
nzOkText
:
'确定'
,
nzOkType
:
'danger'
,
nzOnOk
:
()
=>
{
const
data
=
{
hostids
:
this
.
batchDelList
};
this
.
overAllSer
.
deleteHostPost
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
this
.
batchDelList
=
[];
this
.
select
();
}
else
{
this
.
message
.
info
(
res
.
errMsg
);
}
this
.
commonSer
.
confirmThing
(
"删除"
,
"确认要删除所选设备吗?"
,()
=>
{
const
data
=
{
hostids
:
this
.
batchDelList
};
this
.
overAllSer
.
deleteHostPost
(
data
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
info
(
'删除成功'
);
this
.
batchDelList
=
[];
this
.
select
();
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
);
},
nzCancelText
:
'取消'
,
nzOnCancel
:
()
=>
console
.
log
(
'Cancel'
)
}
);
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment