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
02b292ee
Commit
02b292ee
authored
Dec 25, 2018
by
wangqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4cb63820
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
80 deletions
+82
-80
icon.component.html
...ain/webapp/app/netTopology/model/icon/icon.component.html
+12
-19
icon.component.ts
src/main/webapp/app/netTopology/model/icon/icon.component.ts
+52
-43
topology-img.component.html
.../app/netTopology/topology-img/topology-img.component.html
+1
-11
topology-img.component.ts
...pp/app/netTopology/topology-img/topology-img.component.ts
+10
-5
topology.service.ts
src/main/webapp/app/netTopology/topology.service.ts
+7
-2
No files found.
src/main/webapp/app/netTopology/model/icon/icon.component.html
View file @
02b292ee
<nz-modal
[(
nzVisible
)]="
isVisible
"
nzTitle=
"{{title}}"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<nz-modal
[(
nzVisible
)]="
isVisible
"
nzTitle=
"{{title}}"
(
nzOnCancel
)="
handleCancel
()"
(
nzOnOk
)="
handleOk
()"
>
<form
[
formGroup
]="
validateForm
"
nz-form
>
<form
nz-form
>
<nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
nzFor=
"group"
>
选择图标
</nz-form-label>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
nzFor=
"group"
>
选择图标
</nz-form-label>
<nz-form-control
[
nzSpan
]="
12
"
>
<nz-form-control
[
nzSpan
]="
12
"
>
...
@@ -12,23 +12,16 @@
...
@@ -12,23 +12,16 @@
</nz-upload>
</nz-upload>
</nz-form-control>
</nz-form-control>
</nz-form-item>
</nz-form-item>
<nz-form-item>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
nzFor=
"firstTypeId"
>
选择一级类型
</nz-form-label>
<ng-container
*
ngIf=
"!iconId"
>
<nz-form-control
[
nzSpan
]="
12
"
>
<nz-form-item>
<nz-select
name=
"firstTypeId"
nzPlaceHolder=
"请选择一级类型"
nzAllowClear
formControlName=
"firstTypeId"
(
ngModelChange
)="
onChanges
($
event
)"
>
<nz-form-label
[
nzSpan
]="
7
"
nzRequired
>
选择一级类型
</nz-form-label>
<nz-option
*
ngFor=
"let item of options"
[
nzValue
]="
item
.
id
"
[
nzLabel
]="
item
.
name
"
></nz-option>
<nz-form-control
[
nzSpan
]="
12
"
>
</nz-select>
<nz-select
name=
"firstTypeId"
nzPlaceHolder=
"请选择一级类型"
[(
ngModel
)]="
firstTypeId
"
>
<nz-form-explain
*
ngIf=
"validateForm.get('firstTypeId').dirty && validateForm.get('firstTypeId').errors"
>
请选择一级类型
</nz-form-explain>
<nz-option
*
ngFor=
"let item of options"
[
nzValue
]="
item
.
id
"
[
nzLabel
]="
item
.
name
"
></nz-option>
</nz-form-control>
</nz-select>
</nz-form-item>
</nz-form-control>
<nz-form-item>
</nz-form-item>
<nz-form-label
[
nzSpan
]="
7
"
nzFor=
"secondTypeId"
>
选择二级类型
</nz-form-label>
</ng-container>
<nz-form-control
[
nzSpan
]="
12
"
>
<nz-select
name=
"secondTypeId"
nzAllowClear
formControlName=
"secondTypeId"
nzPlaceHolder=
"请选择二级类型"
>
<nz-option
*
ngFor=
"let item of childrenList"
[
nzValue
]="
item
.
id
"
[
nzLabel
]="
item
.
name
"
></nz-option>
</nz-select>
<nz-form-explain
*
ngIf=
"validateForm.get('secondTypeId').dirty && validateForm.get('secondTypeId').errors"
>
请选择二级类型
</nz-form-explain>
</nz-form-control>
</nz-form-item>
</form>
</form>
</nz-modal>
</nz-modal>
src/main/webapp/app/netTopology/model/icon/icon.component.ts
View file @
02b292ee
...
@@ -14,10 +14,11 @@ export class IconComponent implements OnInit {
...
@@ -14,10 +14,11 @@ export class IconComponent implements OnInit {
isVisible
=
false
;
isVisible
=
false
;
fileList
:
UploadFile
[]
=
[];
fileList
:
UploadFile
[]
=
[];
validateForm
:
FormGroup
;
title
;
title
=
'添加图标'
;
firstTypeId
;
//分类ID
options
:
any
;
iconId
;
//图标ID
childrenList
=
[];
options
;
//一级分类list;
constructor
(
private
topologySer
:
TopologyService
,
private
message
:
NzMessageService
,
constructor
(
private
topologySer
:
TopologyService
,
private
message
:
NzMessageService
,
private
fb
:
FormBuilder
)
{
private
fb
:
FormBuilder
)
{
...
@@ -31,26 +32,20 @@ export class IconComponent implements OnInit {
...
@@ -31,26 +32,20 @@ export class IconComponent implements OnInit {
}
}
initForm
()
{
initForm
()
{
this
.
validateForm
=
this
.
fb
.
group
({
firstTypeId
:
[
null
,
[
Validators
.
required
]],
secondTypeId
:
[
null
],
iconType
:
[
'0'
],
defaultIcon
:
[
'0'
],
name
:
[
''
],
});
this
.
fileList
=
[];
this
.
fileList
=
[];
}
}
getList
()
{
//一级分类
getList
(){
this
.
topologySer
.
findTreeWithWeb
().
subscribe
(
this
.
topologySer
.
findTreeWithWeb
().
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
if
(
res
.
errCode
==
10000
)
{
this
.
options
=
res
.
data
;
this
.
options
=
res
.
data
;
}
else
{
}
else
{
this
.
message
.
error
(
res
.
errMSg
);
this
.
message
.
error
(
res
.
errMSg
);
}
}
}
}
)
;
)
}
}
beforeUpload
=
(
file
:
UploadFile
):
boolean
=>
{
beforeUpload
=
(
file
:
UploadFile
):
boolean
=>
{
...
@@ -63,7 +58,14 @@ export class IconComponent implements OnInit {
...
@@ -63,7 +58,14 @@ export class IconComponent implements OnInit {
return
false
;
return
false
;
};
};
showModal
()
{
showAddModal
(
title
)
{
this
.
title
=
title
;
this
.
isVisible
=
true
;
}
showEditModal
(
title
,
id
)
{
this
.
iconId
=
id
;
this
.
title
=
title
;
this
.
isVisible
=
true
;
this
.
isVisible
=
true
;
}
}
...
@@ -72,23 +74,27 @@ export class IconComponent implements OnInit {
...
@@ -72,23 +74,27 @@ export class IconComponent implements OnInit {
this
.
message
.
error
(
'请选择图标'
);
this
.
message
.
error
(
'请选择图标'
);
return
false
;
return
false
;
}
}
for
(
let
i
in
this
.
validateForm
.
controls
)
{
this
.
validateForm
.
controls
[
i
].
markAsDirty
();
if
(
this
.
title
==
"添加图标"
){
this
.
validateForm
.
controls
[
i
].
updateValueAndValidity
();
if
(
!
this
.
firstTypeId
)
{
this
.
message
.
error
(
'请选择一级分类'
);
return
false
;
}
else
{
this
.
create
();
}
}
}
if
(
this
.
validateForm
.
invalid
)
{
return
false
;
if
(
this
.
title
==
"更换图标"
){
this
.
update
();
}
}
}
create
(){
const
formData
=
new
FormData
();
const
formData
=
new
FormData
();
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
formData
.
append
(
'file'
,
file
);
formData
.
append
(
'file'
,
file
);
});
});
formData
.
append
(
'iconType'
,
this
.
validateForm
.
value
.
iconType
);
formData
.
append
(
'firstTypeId'
,
this
.
firstTypeId
);
formData
.
append
(
'defaultIcon'
,
this
.
validateForm
.
value
.
defaultIcon
);
formData
.
append
(
'firstTypeId'
,
this
.
validateForm
.
value
.
firstTypeId
);
formData
.
append
(
'secondTypeId'
,
this
.
validateForm
.
value
.
secondTypeId
);
formData
.
append
(
'name'
,
this
.
validateForm
.
value
.
name
);
console
.
log
(
this
.
validateForm
.
value
);
this
.
topologySer
.
iconUpload
(
formData
).
subscribe
(
this
.
topologySer
.
iconUpload
(
formData
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
if
(
res
.
errCode
==
10000
)
{
...
@@ -103,22 +109,25 @@ export class IconComponent implements OnInit {
...
@@ -103,22 +109,25 @@ export class IconComponent implements OnInit {
);
);
}
}
onChanges
(
e
)
{
update
(){
this
.
childrenList
=
[];
const
formData
=
new
FormData
();
console
.
log
(
e
);
this
.
fileList
.
forEach
((
file
:
any
)
=>
{
if
(
!
isNaN
(
e
))
{
formData
.
append
(
'file'
,
file
);
console
.
log
(
'网站监测'
);
this
.
validateForm
.
get
(
'secondTypeId'
).
clearValidators
();
this
.
validateForm
.
value
.
iconType
=
'1'
;
}
else
{
this
.
validateForm
.
get
(
'secondTypeId'
).
setValidators
(
Validators
.
required
);
console
.
log
(
'主机资源'
);
}
this
.
options
.
forEach
(
res
=>
{
if
(
res
.
id
==
e
)
{
this
.
childrenList
=
res
.
childs
;
}
});
});
formData
.
append
(
'id'
,
this
.
iconId
);
this
.
topologySer
.
updateIcon
(
formData
).
subscribe
(
(
res
)
=>
{
if
(
res
.
errCode
==
10000
)
{
this
.
message
.
success
(
'添加成功'
);
this
.
isVisible
=
false
;
this
.
initForm
();
this
.
done
.
emit
();
}
else
{
this
.
message
.
error
(
res
.
errMsg
);
}
}
);
}
}
handleCancel
()
{
handleCancel
()
{
...
...
src/main/webapp/app/netTopology/topology-img/topology-img.component.html
View file @
02b292ee
...
@@ -20,13 +20,6 @@
...
@@ -20,13 +20,6 @@
</div>
</div>
<div
nz-row
class=
"search-form"
>
<div
nz-row
class=
"search-form"
>
<div
nz-col
nzSpan=
"12"
>
<div
nz-col
nzSpan=
"12"
>
<nz-select
style=
"width: 200px;"
nzPlaceHolder=
"选择类型"
(
ngModelChange
)="
getList
()"
>
<!--<ng-container *ngFor="let item of groupList;let i = index;">-->
<!--<nz-option nzLabel="选择类型"></nz-option>-->
<!--</ng-container>-->
</nz-select>
</div>
<div
nz-col
nzSpan=
"12"
class=
"text-right"
>
<button
nz-button
(
click
)="
addIcon
()"
nzType=
"default"
><i
class=
"anticon anticon-plus"
></i>
添加图标
</button>
<button
nz-button
(
click
)="
addIcon
()"
nzType=
"default"
><i
class=
"anticon anticon-plus"
></i>
添加图标
</button>
</div>
</div>
</div>
</div>
...
@@ -47,10 +40,7 @@
...
@@ -47,10 +40,7 @@
<img
style=
"width: 40px;"
[
src
]="
imgUrl
+
data
.
url
"
>
<img
style=
"width: 40px;"
[
src
]="
imgUrl
+
data
.
url
"
>
</td>
</td>
<td
class=
"handle"
>
<td
class=
"handle"
>
<span
(
click
)="
deleteIcon
(
data
)"
>
删除
</span>
<span
(
click
)="
editIcon
(
data
)"
>
更换图标
</span>
<ng-container
*
ngIf=
"data.defaultIcon == 0"
>
<span
(
click
)="
setDefault
(
data
)"
>
设为默认
</span>
</ng-container>
</td>
</td>
</tr>
</tr>
</tbody>
</tbody>
...
...
src/main/webapp/app/netTopology/topology-img/topology-img.component.ts
View file @
02b292ee
...
@@ -23,20 +23,25 @@ export class TopologyImgComponent implements OnInit {
...
@@ -23,20 +23,25 @@ export class TopologyImgComponent implements OnInit {
}
}
getList
()
{
getList
()
{
const
data
=
{};
this
.
topologySer
.
iconFindAll
().
subscribe
(
this
.
topologySer
.
iconFindAll
(
data
).
subscribe
(
(
res
)
=>
{
(
res
)
=>
{
if
(
res
.
errCode
==
10000
){
if
(
res
.
errCode
==
10000
){
this
.
iconList
=
res
.
data
;
this
.
iconList
=
res
.
data
;
}
else
{
}
else
{
this
.
message
.
create
(
'error'
,
`
${
res
.
errMsg
}
`
);
this
.
message
.
error
(
res
.
errMsg
);
}
}
}
}
);
);
}
}
addIcon
(){
//添加图标
this
.
smartIcon
.
showModal
();
addIcon
(
item
){
this
.
smartIcon
.
showAddModal
(
"添加图标"
);
}
//更换图标
editIcon
(
item
){
this
.
smartIcon
.
showEditModal
(
"更换图标"
,
item
.
id
);
}
}
//删除图片
//删除图片
...
...
src/main/webapp/app/netTopology/topology.service.ts
View file @
02b292ee
...
@@ -40,8 +40,8 @@ export class TopologyService {
...
@@ -40,8 +40,8 @@ export class TopologyService {
}
}
//查询所有图标
//查询所有图标
iconFindAll
(
data
):
Observable
<
any
>
{
iconFindAll
():
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/icon/findAll'
,
data
);
return
this
.
http
.
get
(
SERVER_API_URL
+
'/icon/findAll'
);
}
}
//添加图标
//添加图标
...
@@ -49,6 +49,11 @@ export class TopologyService {
...
@@ -49,6 +49,11 @@ export class TopologyService {
return
this
.
http
.
post
(
SERVER_API_URL
+
'/icon/upload'
,
data
);
return
this
.
http
.
post
(
SERVER_API_URL
+
'/icon/upload'
,
data
);
}
}
//更换图标
updateIcon
(
data
):
Observable
<
any
>
{
return
this
.
http
.
post
(
SERVER_API_URL
+
'/icon/updateIcon'
,
data
);
}
//设置默认图标
//设置默认图标
iconDefault
(
params
):
Observable
<
any
>
{
iconDefault
(
params
):
Observable
<
any
>
{
return
this
.
http
.
get
(
SERVER_API_URL
+
'/icon/default/'
+
params
);
return
this
.
http
.
get
(
SERVER_API_URL
+
'/icon/default/'
+
params
);
...
...
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