Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
witiumCloud2
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
WitCloud
witiumCloud2
Commits
e644d0bb
Commit
e644d0bb
authored
Apr 19, 2019
by
van.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
四个主页面的表单验证
parent
86fbbd44
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
118 additions
and
55 deletions
+118
-55
gateway.component.html
src/app/main/gateway/gateway.component.html
+19
-19
gateway.component.ts
src/app/main/gateway/gateway.component.ts
+23
-9
module-mgr.component.html
src/app/main/module-mgr/module-mgr.component.html
+1
-1
module-mgr.component.ts
src/app/main/module-mgr/module-mgr.component.ts
+13
-3
sensor-mgr.component.html
src/app/main/sensor-mgr/sensor-mgr.component.html
+9
-5
sensor-mgr.component.ts
src/app/main/sensor-mgr/sensor-mgr.component.ts
+31
-9
topic-module-detail.component.ts
...main/topic-module-detail/topic-module-detail.component.ts
+1
-1
topic-module-mgr.component.html
...app/main/topic-module-mgr/topic-module-mgr.component.html
+1
-1
topic-module-mgr.component.ts
src/app/main/topic-module-mgr/topic-module-mgr.component.ts
+12
-3
api.ts
src/app/service/api.ts
+0
-1
check.ts
src/app/service/check.ts
+1
-1
zh.json
src/assets/i18n/zh.json
+2
-1
environment.prod.ts
src/environments/environment.prod.ts
+1
-1
styles.scss
src/styles.scss
+4
-0
No files found.
src/app/main/gateway/gateway.component.html
View file @
e644d0bb
...
...
@@ -6,8 +6,8 @@
<span>
{{'search' | translate}}
</span></button>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
(
click
)="
onGetAll
()"
><span>
{{'allData' | translate}}
</span>
</button>
<
!--<button nz-button class="btnAdd" [nzLoading]="isLoading" (click)="multiAdd()">--
>
<
!--<span>{{'multiAdd' | translate}}</span></button>--
>
<
button
nz-button
class=
"btnAdd"
[
nzLoading
]="
isLoading
"
(
click
)="
multiAdd
()"
>
<
span>
{{'multiAdd' | translate}}
</span></button
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
(
click
)="
add
()"
>
<span>
{{'addGateway' | translate}}
</span></button>
</div>
...
...
@@ -49,7 +49,7 @@
<td
nz-td
>
{{one.type}}
</td>
<td
nz-td
>
{{one.simcard}}
</td>
<td
nz-td
>
<nz-switch
[
nzControl
]="
true
"
[
disabled
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
state
"
<nz-switch
[
nzControl
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
state
"
[
nzLoading
]="
one
.
isLoading
"
></nz-switch>
</td>
<td
nz-td
>
{{one.pDeviceNo ? '是' : '否'}}
</td>
...
...
@@ -89,30 +89,30 @@
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzTitle
]="
isUpdate
?
('
updateGateway
'
|
translate
)
:
('
addGateway
'
|
translate
)"
[
nzContent
]="
con1
"
nzWidth=
"500"
[
nzFooter
]="
foot1
"
(
nzOnCancel
)="
cancel
('
isAddConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con1
>
<app-search-item
i
nModal=
"true"
isMust
=
"true"
[
label
]="'
gatewayName
'
|
translate
"
<app-search-item
i
sMust=
"true"
inModal
=
"true"
[
label
]="'
gatewayName
'
|
translate
"
[(
value
)]="
req
.
name
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"tru
e"
inModal=
"true"
[
label
]="'
gatewaySN
'
|
translate
"
<app-search-item
isMust=
"true"
*
ngIf=
"!isUpdat
e"
inModal=
"true"
[
label
]="'
gatewaySN
'
|
translate
"
[(
value
)]="
req
.
sn
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"tru
e"
inModal=
"true"
[
label
]="'
type
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-item
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
simcard
'
|
translate
"
<app-search-item
isMust=
"true"
*
ngIf=
"!isUpdat
e"
inModal=
"true"
[
label
]="'
type
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
simcard
'
|
translate
"
[(
value
)]="
req
.
simcard
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
i
sMust=
"true"
i
nModal=
"true"
[
label
]="'
configJson
'
|
translate
"
<app-search-item
*
ngIf=
"!isUpdate"
inModal=
"true"
[
label
]="'
configJson
'
|
translate
"
[(
value
)]="
req
.
configJson
"
></app-search-item>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
<app-search-select
isMust=
"true"
inModal=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
<app-search-select
i
sMust
=
"true"
*
ngIf=
"req.companyNo"
[(
value
)]="
req
.
influxdbDatabaseNo
"
[
data
]="
companys
"
optV=
"companyNo"
></app-search-select>
<app-search-select
i
nModal
=
"true"
*
ngIf=
"req.companyNo"
[(
value
)]="
req
.
influxdbDatabaseNo
"
[
label
]="'
selectInfluxDB
'
|
translate
"
optL=
"databaseName"
[
data
]="
influxdbs
"
inModal=
"true"
optV=
"influxdbDatabaseNo"
></app-search-select>
<app-search-select
[(
value
)]="
req
.
sceneNo
"
[
label
]="'
selectScene
'
|
translate
"
optL=
"sceneName"
[
data
]="
scenes
"
inModal=
"true"
optV=
"sceneNo"
></app-search-select>
<app-search-item
inModal=
"true"
isMust=
"true"
[
label
]="'
remark
'
|
translate
"
[
data
]="
influxdbs
"
optV=
"influxdbDatabaseNo"
></app-search-select>
<app-search-select
inModal=
"true"
[(
value
)]="
req
.
sceneNo
"
[
label
]="'
selectScene
'
|
translate
"
optL=
"sceneName"
[
data
]="
scenes
"
optV=
"sceneNo"
></app-search-select>
<app-search-item
inModal=
"true"
[
label
]="'
remark
'
|
translate
"
[(
value
)]="
req
.
remark
"
></app-search-item>
</ng-template>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isAddConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
(
'
req
'
)"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
@@ -125,7 +125,7 @@
<ng-template
#
foot2
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isMultiAddConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isMultiAddConV
')"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req2
')"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
@@ -151,7 +151,7 @@
<ng-template
#
foot3
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isBindConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
(
'
req3
'
)"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
@@ -166,7 +166,7 @@
<ng-template
#
foot4
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isDivideConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isDivideConV
')"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req4
')"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
src/app/main/gateway/gateway.component.ts
View file @
e644d0bb
...
...
@@ -4,14 +4,12 @@ import {ApiService} from '../../service/api';
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
Router
}
from
'@angular/router'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-gateway'
,
templateUrl
:
'./gateway.component.html'
,
styles
:
[
`
:host ::ng-deep .anticon-filter {
left: 73px;
}
.btnPart {
padding: 10px;
}
...
...
@@ -48,9 +46,11 @@ export class GatewayComponent implements OnInit {
req3
:
any
=
{};
scenes
=
[{
sceneNo
:
'123'
,
sceneName
:
'qq'
}];
req4
:
any
=
{};
try
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -169,8 +169,8 @@ export class GatewayComponent implements OnInit {
this
.
canbind
=
false
;
this
.
canUnbind
=
false
;
}
else
{
const
flag
=
obj
[
0
].
isOn
;
if
(
obj
.
filter
(
one
=>
one
.
isOn
===
flag
).
length
===
obj
.
length
)
{
const
flag
=
obj
[
0
].
pDeviceNo
&&
true
;
if
(
obj
.
filter
(
one
=>
(
obj
[
0
].
pDeviceNo
&&
true
)
===
flag
).
length
===
obj
.
length
)
{
this
.
canbind
=
flag
;
this
.
canUnbind
=
!
flag
;
}
else
{
...
...
@@ -194,9 +194,11 @@ export class GatewayComponent implements OnInit {
// 单个的方法
add
()
{
this
.
req
=
{};
this
.
isMulti
=
false
;
this
.
isUpdate
=
false
;
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'name'
,
'sn'
,
'companyNo'
]};
}
bind
(
one
)
{
...
...
@@ -208,6 +210,7 @@ export class GatewayComponent implements OnInit {
influxdbDatabaseNo
:
''
,
pDeviceNo
:
''
};
this
.
try
=
{
field
:
[
'address'
,
'deviceNo'
,
'pDeviceNo'
]};
this
.
isBindConV
=
true
;
}
...
...
@@ -228,6 +231,7 @@ export class GatewayComponent implements OnInit {
this
.
isMulti
=
false
;
this
.
req
=
{...
one
};
this
.
companySelected
(
one
.
companyNo
);
this
.
try
=
{
field
:
[
'name'
,
'sn'
,
'companyNo'
,
'deviceNo'
]};
this
.
isUpdate
=
true
;
this
.
isAddConV
=
true
;
}
...
...
@@ -235,6 +239,7 @@ export class GatewayComponent implements OnInit {
divide
(
one
)
{
this
.
isMulti
=
false
;
this
.
req4
=
{...
one
};
this
.
try
=
{
field
:
[
'companyNo'
,
'deviceNo'
]};
this
.
isDivideConV
=
true
;
}
...
...
@@ -244,6 +249,10 @@ export class GatewayComponent implements OnInit {
save
(
v
)
{
this
.
isLoading
=
true
;
if
(
!
this
.
ck
.
formCheck
(
this
[
v
],
this
.
try
))
{
this
.
isLoading
=
false
;
return
;
}
// 单个新增
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
this
.
api
.
device
.
addGateway
([
this
.
req
,
this
.
next
]);
...
...
@@ -317,9 +326,14 @@ export class GatewayComponent implements OnInit {
toggleOn
(
one
)
{
one
.
isLoading
=
true
;
setTimeout
(()
=>
{
one
.
isOn
=
!
one
.
isOn
;
this
.
api
.
device
.
mountUninstallDevice
([{
deviceNo
:
one
.
deviceNo
,
state
:
one
.
state
===
0
?
1
:
0
},
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
one
.
state
=
one
.
state
===
0
?
1
:
0
;
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
one
.
isLoading
=
false
;
}
,
2000
);
}
]
);
}
}
src/app/main/module-mgr/module-mgr.component.html
View file @
e644d0bb
...
...
@@ -47,7 +47,7 @@
</ng-template>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isAddConV
')"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
(
'
req
'
)"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
src/app/main/module-mgr/module-mgr.component.ts
View file @
e644d0bb
...
...
@@ -4,6 +4,7 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
Router
}
from
'@angular/router'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-module-mgr'
,
...
...
@@ -20,9 +21,10 @@ export class ModuleMgrComponent implements OnInit {
isSaveOther
=
false
;
isUpdate
=
false
;
moduleName
=
''
;
try
:
any
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
,
private
router
:
Router
)
{
private
translate
:
TranslateService
,
private
router
:
Router
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -64,7 +66,8 @@ export class ModuleMgrComponent implements OnInit {
}
toDetail
(
one
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/moduleMgr/moduleDetail'
],
{
queryParams
:
{
probesModelNo
:
one
.
probesModelNo
,
probesModelName
:
one
.
probesModelName
}});
this
.
router
.
navigate
([
'/app/deviceCenter/moduleMgr/moduleDetail'
],
{
queryParams
:
{
probesModelNo
:
one
.
probesModelNo
,
probesModelName
:
one
.
probesModelName
}});
}
saveOther
(
one
)
{
...
...
@@ -72,22 +75,29 @@ export class ModuleMgrComponent implements OnInit {
}
add
()
{
this
.
req
=
{};
this
.
isUpdate
=
false
;
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'probesModelName'
,
'num'
]};
}
update
(
one
)
{
this
.
isUpdate
=
true
;
this
.
req
=
{...
one
};
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'probesModelNo'
,
'probesModelName'
]};
}
cancel
(
v
)
{
this
[
v
]
=
false
;
}
save
()
{
save
(
v
)
{
this
.
isLoading
=
true
;
if
(
!
this
.
ck
.
formCheck
(
this
[
v
],
this
.
try
))
{
this
.
isLoading
=
false
;
return
;
}
if
(
this
.
isUpdate
)
{
this
.
api
.
probesModel
.
updateProbesModel
([
this
.
req
,
this
.
next
]);
}
else
{
...
...
src/app/main/sensor-mgr/sensor-mgr.component.html
View file @
e644d0bb
...
...
@@ -58,6 +58,8 @@
<span
*
ngIf=
"one.pDeviceNo"
class=
"editSpan"
(
click
)="
unbind
(
one
)"
>
{{'unbind' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
<span
class=
"editSpan"
(
click
)="
update
(
one
)"
>
{{'update' | translate}}
</span>
<nz-divider
*
ngIf=
"!one.pDeviceNo && !one.state"
nzType=
"vertical"
></nz-divider>
<span
*
ngIf=
"!one.pDeviceNo && !one.state"
class=
"editSpan"
(
click
)="
divide
(
one
)"
>
{{'divide' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
...
...
@@ -109,7 +111,7 @@
</ng-template>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isAddConV
')"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isAddConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
@@ -145,18 +147,20 @@
<ng-template
#
foot3
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isBindConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
(
'
req3
'
)"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isDivideConV
"
[
nzContent
]="
con5
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isDivideConV
"
[
nzContent
]="
con5
"
nzWidth=
"500"
[
nzTitle
]="('
divide
'
|
translate
)
+
('
sensor
'
|
translate
)"
[
nzFooter
]="
foot5
"
(
nzOnCancel
)="
cancel
('
isDivideConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con5
>
分配传感器
<app-search-select
isMust=
"true"
[(
value
)]="
req5
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
</ng-template>
<ng-template
#
foot5
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isDivideConV
')"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isDivideConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req5
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
src/app/main/sensor-mgr/sensor-mgr.component.ts
View file @
e644d0bb
...
...
@@ -4,14 +4,12 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import
{
Router
}
from
'@angular/router'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-sensor-mgr'
,
templateUrl
:
'./sensor-mgr.component.html'
,
styles
:
[
`
:host ::ng-deep .anticon-filter {
left: 73px;
}
.btnPart {
padding: 10px;
}
...
...
@@ -29,7 +27,6 @@ export class SensorMgrComponent implements OnInit {
isAllCheck
=
false
;
isIndeterminate
=
false
;
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
selectedOne
:
any
=
{};
isAddConV
=
false
;
isMultiAddConV
=
false
;
isBindConV
=
false
;
...
...
@@ -48,9 +45,11 @@ export class SensorMgrComponent implements OnInit {
selectedGateways
=
[];
canBindGateways
=
[];
req3
:
any
=
{};
req5
:
any
=
{};
try
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -218,8 +217,10 @@ export class SensorMgrComponent implements OnInit {
// 单个的方法
add
()
{
this
.
req
=
{};
this
.
isMulti
=
false
;
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'name'
,
'sn'
,
'type'
,
'companyNo'
]};
}
bind
(
one
)
{
...
...
@@ -232,6 +233,7 @@ export class SensorMgrComponent implements OnInit {
pDeviceNo
:
''
};
this
.
isBindConV
=
true
;
this
.
try
=
{
field
:
[
'address'
,
'deviceNo'
,
'pDeviceNo'
]};
}
unbind
(
one
)
{
...
...
@@ -247,19 +249,32 @@ export class SensorMgrComponent implements OnInit {
this
.
api
.
device
.
unBindDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
divide
(
one
)
{
this
.
isMulti
=
false
;
this
.
req5
=
{...
one
};
this
.
try
=
{
field
:
[
'companyNo'
,
'deviceNo'
]};
this
.
isDivideConV
=
true
;
}
update
(
one
)
{
this
.
isMulti
=
false
;
this
.
req
=
{...
one
};
this
.
companySelected
(
one
.
companyNo
);
this
.
isUpdate
=
true
;
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'name'
,
'sn'
,
'type'
,
'companyNo'
,
'deviceNo'
]};
}
cancel
(
v
)
{
this
[
v
]
=
false
;
}
save
()
{
save
(
v
)
{
this
.
isLoading
=
true
;
if
(
!
this
.
ck
.
formCheck
(
this
[
v
],
this
.
try
))
{
this
.
isLoading
=
false
;
return
;
}
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
...
...
@@ -274,6 +289,8 @@ export class SensorMgrComponent implements OnInit {
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
}
else
if
(
!
this
.
isMulti
&&
this
.
isDivideConV
)
{
this
.
api
.
device
.
updateCompany
([
this
.
req5
,
this
.
next
]);
}
}
...
...
@@ -333,9 +350,14 @@ export class SensorMgrComponent implements OnInit {
toggleOn
(
one
)
{
one
.
isLoading
=
true
;
setTimeout
(()
=>
{
one
.
isOn
=
!
one
.
isOn
;
this
.
api
.
device
.
mountUninstallDevice
([{
deviceNo
:
one
.
deviceNo
,
state
:
one
.
state
===
0
?
1
:
0
},
(
data
)
=>
{
if
(
data
&&
data
.
code
===
1
)
{
one
.
state
=
one
.
state
===
0
?
1
:
0
;
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
one
.
isLoading
=
false
;
}
,
2000
);
}
]
);
}
}
src/app/main/topic-module-detail/topic-module-detail.component.ts
View file @
e644d0bb
...
...
@@ -84,7 +84,7 @@ export class TopicModuleDetailComponent implements OnInit {
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}
;
}
add
()
{
this
.
req
=
{};
...
...
src/app/main/topic-module-mgr/topic-module-mgr.component.html
View file @
e644d0bb
...
...
@@ -51,7 +51,7 @@
</ng-template>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isAddConV
')"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isAddConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
src/app/main/topic-module-mgr/topic-module-mgr.component.ts
View file @
e644d0bb
...
...
@@ -4,6 +4,7 @@ import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
Router
}
from
'@angular/router'
;
import
{
CheckService
}
from
'../../service/check'
;
@
Component
({
selector
:
'app-topic-module-mgr'
,
...
...
@@ -20,9 +21,10 @@ export class TopicModuleMgrComponent implements OnInit {
isSaveOther
=
false
;
isUpdate
=
false
;
topicModuleName
=
''
;
try
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
,
private
router
:
Router
)
{
private
translate
:
TranslateService
,
private
router
:
Router
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
...
...
@@ -64,7 +66,8 @@ export class TopicModuleMgrComponent implements OnInit {
}
toDetail
(
one
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/topicModuleMgr/topicModuleDetail'
],
{
queryParams
:
{
topicModelNo
:
one
.
topicModelNo
,
topicModuleName
:
one
.
topicModuleName
}});
this
.
router
.
navigate
([
'/app/deviceCenter/topicModuleMgr/topicModuleDetail'
],
{
queryParams
:
{
topicModelNo
:
one
.
topicModelNo
,
topicModuleName
:
one
.
topicModuleName
}});
}
saveOther
(
one
)
{
...
...
@@ -75,20 +78,26 @@ export class TopicModuleMgrComponent implements OnInit {
this
.
isUpdate
=
false
;
this
.
req
=
{};
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'topicModelName'
,
'prefixName'
]};
}
update
(
one
)
{
this
.
isUpdate
=
true
;
this
.
req
=
{...
one
};
this
.
isAddConV
=
true
;
this
.
try
=
{
field
:
[
'topicModelNo'
,
'topicModelName'
,
'prefixName'
]};
}
cancel
(
v
)
{
this
[
v
]
=
false
;
}
save
()
{
save
(
v
)
{
this
.
isLoading
=
true
;
if
(
!
this
.
ck
.
formCheck
(
this
[
v
],
this
.
try
))
{
this
.
isLoading
=
false
;
return
;
}
if
(
this
.
isUpdate
)
{
this
.
api
.
topicModel
.
updateTopic
([
this
.
req
,
this
.
next
]);
}
else
{
...
...
src/app/service/api.ts
View file @
e644d0bb
...
...
@@ -126,7 +126,6 @@ export class ApiService {
getAll
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/getAll'
,
data
),
getByTerm
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/getByTerm'
,
data
),
mountUninstallDevice
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/mountUninstallDevice'
,
data
),
mountUninstallGateway
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/mountUninstallGateway'
,
data
),
unBindDevice
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/unBindDevice'
,
data
),
updateCompany
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/updateCompany'
,
data
),
updateGateway
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/updateGateway'
,
data
),
...
...
src/app/service/check.ts
View file @
e644d0bb
...
...
@@ -10,7 +10,7 @@ export class CheckService {
formCheck
(
data
,
req
)
{
const
fNum
=
req
.
field
.
length
;
const
fieldStr
=
'-'
+
req
.
field
.
join
(
'-'
)
+
'-'
;
const
field
=
req
.
field
.
filter
((
item
)
=>
data
[
item
]
!==
null
&&
!
isUndefined
(
data
[
item
])).
length
;
const
field
=
req
.
field
.
filter
((
item
)
=>
data
[
item
]
!==
''
&&
data
[
item
]
!==
null
&&
!
isUndefined
(
data
[
item
])).
length
;
if
(
field
!==
fNum
)
{
this
.
message
.
warning
(
this
.
translate
.
instant
(
'pleaseFillAll'
));
return
false
;
...
...
src/assets/i18n/zh.json
View file @
e644d0bb
...
...
@@ -153,5 +153,6 @@
"updateWay"
:
"编辑通道"
,
"updateTime"
:
"更新时间"
,
"updateData"
:
"最新数据"
,
"see"
:
"查看"
"see"
:
"查看"
,
"pleaseFillAll"
:
"请填完所有必填项"
}
src/environments/environment.prod.ts
View file @
e644d0bb
export
const
environment
=
{
production
:
true
,
baseUrl
:
'http://
47.111.110.50:8094
'
,
// 对外访问测试网地址
baseUrl
:
'http://
cloud-test.witium.com/api
'
,
// 对外访问测试网地址
};
src/styles.scss
View file @
e644d0bb
...
...
@@ -391,3 +391,7 @@ label.subTitle {
display
:
inline-block
;
vertical-align
:
top
;
}
.ant-table-body
table
thead
tr
th
,
table
tbody
tr
{
text-align
:
center
;
}
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