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
1f638138
Commit
1f638138
authored
Apr 18, 2019
by
van.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交一下
parent
6cce3c71
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1104 additions
and
333 deletions
+1104
-333
package-lock.json
package-lock.json
+3
-3
layout.module.ts
src/app/layout/layout.module.ts
+5
-1
leftmenu.component.ts
src/app/layout/leftmenu/leftmenu.component.ts
+1
-1
gateway-see.component.html
src/app/main/gateway-see/gateway-see.component.html
+24
-26
gateway-see.component.ts
src/app/main/gateway-see/gateway-see.component.ts
+49
-9
gateway.component.html
src/app/main/gateway/gateway.component.html
+98
-64
gateway.component.ts
src/app/main/gateway/gateway.component.ts
+111
-21
influxdb.component.html
src/app/main/influxdb/influxdb.component.html
+64
-0
influxdb.component.ts
src/app/main/influxdb/influxdb.component.ts
+115
-0
module-mgr.component.html
src/app/main/module-mgr/module-mgr.component.html
+1
-1
sensor-detail.component.html
src/app/main/sensor-detail/sensor-detail.component.html
+208
-113
sensor-detail.component.ts
src/app/main/sensor-detail/sensor-detail.component.ts
+167
-16
sensor-mgr.component.html
src/app/main/sensor-mgr/sensor-mgr.component.html
+77
-43
sensor-mgr.component.ts
src/app/main/sensor-mgr/sensor-mgr.component.ts
+131
-25
topic-module-detail.component.html
...in/topic-module-detail/topic-module-detail.component.html
+3
-3
router.module.ts
src/app/router.module.ts
+4
-0
api.ts
src/app/service/api.ts
+17
-2
zh.json
src/assets/i18n/zh.json
+24
-3
environment.ts
src/environments/environment.ts
+1
-2
styles.scss
src/styles.scss
+1
-0
No files found.
package-lock.json
View file @
1f638138
...
...
@@ -130,9 +130,9 @@
}
},
"@angular/cdk"
:
{
"version"
:
"7.3.
6
"
,
"resolved"
:
"http://registry.npm.taobao.org/@angular/cdk/download/@angular/cdk-7.3.
6
.tgz"
,
"integrity"
:
"sha1-
TDMMrNEd9K2t5sHNPtWHdF+ZEv0
="
,
"version"
:
"7.3.
7
"
,
"resolved"
:
"http://registry.npm.taobao.org/@angular/cdk/download/@angular/cdk-7.3.
7
.tgz"
,
"integrity"
:
"sha1-
zhrVO6BL65yOlQrMVpHqAUN1N2Q
="
,
"requires"
:
{
"parse5"
:
"^5.0.0"
,
"tslib"
:
"^1.7.1"
...
...
src/app/layout/layout.module.ts
View file @
1f638138
...
...
@@ -30,6 +30,8 @@ import {SensorDetailComponent} from '../main/sensor-detail/sensor-detail.compone
import
{
ModuleDetailComponent
}
from
'../main/module-detail/module-detail.component'
;
import
{
TopicModuleDetailComponent
}
from
'../main/topic-module-detail/topic-module-detail.component'
;
import
{
TopicModuleWayComponent
}
from
'../main/topic-module-way/topic-module-way.component'
;
import
{
InfluxdbComponent
}
from
'../main/influxdb/influxdb.component'
;
import
{
SensorTopicWayComponent
}
from
'../main/sensor-topic-way/sensor-topic-way.component'
;
// 通用组件
import
{
SearchDateComponent
}
from
'../component/search-date/search-date.component'
;
import
{
SearchItemComponent
}
from
'../component/search-item/search-item.component'
;
...
...
@@ -86,7 +88,9 @@ import {BackComponent} from '../component/back/back.component';
SensorDetailComponent
,
ModuleDetailComponent
,
TopicModuleDetailComponent
,
TopicModuleWayComponent
TopicModuleWayComponent
,
InfluxdbComponent
,
SensorTopicWayComponent
]
})
export
class
LayoutModule
{
...
...
src/app/layout/leftmenu/leftmenu.component.ts
View file @
1f638138
...
...
@@ -38,7 +38,7 @@ export class LeftmenuComponent implements OnInit, OnDestroy {
name
:
'systemMgr'
,
icon
:
'io i-shezhi'
,
type
:
0
,
child
:
[{
name
:
'userCenter'
},
{
name
:
'customCenter'
},
{
name
:
'partMgr'
},
{
name
:
'areaMgr'
},
{
name
:
'logMgr'
}]
child
:
[{
name
:
'
influxdbMgr'
},
{
name
:
'
userCenter'
},
{
name
:
'customCenter'
},
{
name
:
'partMgr'
},
{
name
:
'areaMgr'
},
{
name
:
'logMgr'
}]
},
{
name
:
'dataCenter'
,
icon
:
'io i-ico_data'
,
...
...
src/app/main/gateway-see/gateway-see.component.html
View file @
1f638138
...
...
@@ -5,10 +5,10 @@
<nz-tabset>
<nz-tab
nzTitle=
"传感器"
>
<div
class=
"subTitle"
>
{{'gateway' | translate}}
123456
{{'detail' | translate}}
{{'gateway' | translate}}
{{name}}
{{'detail' | translate}}
</div>
<nz-table
#
nzTable
[
nzData
]="
data
"
[
nzData
]="
d
eviceD
ata
"
[
nzSize
]="'
middle
'"
nzShowSizeChanger
[
nzShowPagination
]="
true
"
...
...
@@ -16,34 +16,37 @@
<thead
nz-thead
>
<tr>
<th
nz-th
><span>
{{'sensorName' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayNum' | translate}}
</span></th>
<th
nz-th
><span>
{{'sensorSN' | translate}}
</span></th>
<th
nz-th
><span>
{{'sensorType' | translate}}
</span></th>
<th
nz-th
><span>
{{'createTime' | translate}}
</span></th>
<th
nz-th
><span>
{{'oper' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable.data, let i = index"
>
<td
nz-td
class=
"canClick"
(
click
)="
toDetail
(
one
)"
>
{{i + 1}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{i}}
</td>
<td
nz-td
class=
"canClick"
(
click
)="
toDetail
(
one
)"
>
{{one.name}}
</td>
<td
nz-td
>
{{one.sn}}
</td>
<td
nz-td
>
{{one.type}}
</td>
<td
nz-td
>
{{one.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}
</td>
<td
nz-td
>
<span
(
click
)="
unbind
(
one
)"
class=
"deleteFontColor"
>
{{'unbind' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
</nz-tab>
<nz-tab
nzTitle=
"通道"
>
<div
class=
"subTitle"
>
{{'gateway' | translate}}
123456
{{'wayDetail' | translate}}
{{'gateway' | translate}}
{{name}}
{{'wayDetail' | translate}}
</div>
<nz-table
#
nzTable2
[
nzData
]="
d
ata
"
[
nzData
]="
wayD
ata
"
[
nzSize
]="'
middle
'"
nzShowSizeChanger
[
nzShowPagination
]="
true
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<th
nz-th
><span>
{{'wayIndex' | translate}}
</span></th>
<th
nz-th
><span>
{{'sensorSN' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayName' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayAlias' | translate}}
</span></th>
...
...
@@ -55,26 +58,21 @@
<th
nz-th
><span>
{{'alarmMaxMax' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMinMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'oper' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable2.data, let i = index"
>
<td
nz-td
>
{{i + 1}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
{{'web'}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
{{'web'}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
<span
class=
"deleteFontColor"
>
{{'delete' | translate}}
</span>
</td>
<td
nz-td
>
{{one.sn}}
</td>
<td
nz-td
>
{{one.name}}
</td>
<td
nz-td
>
{{one.alias}}
</td>
<td
nz-td
>
{{one.unit}}
</td>
<td
nz-td
>
{{one.type}}
</td>
<td
nz-td
>
{{one.rangeMax}}
</td>
<td
nz-td
>
{{one.rangeMin}}
</td>
<td
nz-td
>
{{one.alarmUp}}
</td>
<td
nz-td
>
{{one.alarmDown}}
</td>
<td
nz-td
>
{{one.upperAlarmLimit}}
</td>
<td
nz-td
>
{{one.lowerAlarmLimit}}
</td>
</tr>
</tbody>
</nz-table>
...
...
src/app/main/gateway-see/gateway-see.component.ts
View file @
1f638138
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
ApiService
}
from
'../../service/api'
;
import
{
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
Router
}
from
'@angular/router'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
@
Component
({
selector
:
'app-gateway-see'
,
...
...
@@ -14,33 +15,72 @@ export class GatewaySeeComponent implements OnInit {
isLoading
=
false
;
data
=
[];
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
)
{
}
deviceNo
=
''
;
name
=
''
;
wayData
=
[];
deviceData
=
[];
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
ac
:
ActivatedRoute
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
}
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
getData
();
this
.
ac
.
queryParams
.
subscribe
((
e
)
=>
{
this
.
deviceNo
=
e
.
deviceNo
;
this
.
name
=
e
.
name
;
this
.
getDeviceData
();
this
.
getWayData
();
});
}
next
=
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
data
=
data
;
this
.
d
eviceD
ata
=
data
;
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
getDeviceData
();
this
.
getWayData
();
}
else
if
(
data
.
code
===
0
)
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}
getData
()
{
this
.
api
.
role
.
getAll
([
''
,
this
.
next
]);
getDeviceData
()
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
getSensorByMaxDevice
([{
deviceNo
:
this
.
deviceNo
},
this
.
next
]);
}
toDetail
()
{
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail'
]);
getWayData
()
{
this
.
isLoading
=
true
;
this
.
api
.
probes
.
getProbesByGateway
([{
deviceNo
:
this
.
deviceNo
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
wayData
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
toDetail
(
one
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail'
],
{
queryParams
:
{
deviceNo
:
one
.
deviceNo
,
name
:
one
.
name
}});
}
unbind
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i> </i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirmUnbindThisRecord'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
unbindOne
(
one
)
});
}
unbindOne
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
unBindDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
}
src/app/main/gateway/gateway.component.html
View file @
1f638138
...
...
@@ -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>
...
...
@@ -15,17 +15,16 @@
<div
class=
"tableBar"
@
fade
>
<nz-table
#
nzTable
[
nzData
]="
data
"
[
nzShowPagination
]="
false
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<
th
nzShowCheckbox
[(
nzChecked
)]="
isAllCheck
"
[
nzDisabled
]="
data
.
length=
==0"
[
nzIndeterminate
]="
isIndeterminate
"
(
nzCheckedChange
)="
checkAll
($
event
)"
></th
>
<
!--<th-->
<!--nzShowCheckbox-->
<!--[(nzChecked)]="isAllCheck"-->
<!--[nzDisabled]="data.length===0"-->
<!--[nzIndeterminate]="isIndeterminate"-->
<!--(nzCheckedChange)="checkAll($event)"-->
<!--></th>--
>
<th
nz-th
><span>
{{'gatewayName' | translate}}
</span></th>
<th
nz-th
><span>
{{'gatewaySN' | translate}}
</span></th>
<th
nz-th
><span>
{{'type' | translate}}
</span></th>
...
...
@@ -38,58 +37,83 @@
(
nzFilterChange
)="
filter
($
event
)"
>
<span>
{{'isbind' | translate}}
</span></th>
<th
nz-th
><span>
{{'belongCompany' | translate}}
</span></th>
<th
nz-th
><span>
{{'createTime' | translate}}
</span></th>
<th
nz-th
><span>
{{'oper' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable.data,let i = index"
>
<
td
nzShowCheckbox
[(
nzChecked
)]="
one
.
checked
"
(
nzCheckedChange
)="
oneCheck
()"
></td
>
<td
nz-td
class=
"canClick"
(
click
)="
toSee
(
one
)"
>
设备{{i
}}
</td>
<td
nz-td
>
{{one.
realName
}}
</td>
<td
nz-td
>
{{one.
userNam
e}}
</td>
<td
nz-td
>
{{one.
nickName
}}
</td>
<
!--<td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>--
>
<td
nz-td
class=
"canClick"
(
click
)="
toSee
(
one
)"
>
{{one.name
}}
</td>
<td
nz-td
>
{{one.
sn
}}
</td>
<td
nz-td
>
{{one.
typ
e}}
</td>
<td
nz-td
>
{{one.
simcard
}}
</td>
<td
nz-td
>
<nz-switch
[
nzControl
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
isOn
"
<nz-switch
[
nzControl
]="
true
"
[
disabled
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
state
"
[
nzLoading
]="
one
.
isLoading
"
></nz-switch>
</td>
<td
nz-td
>
{{one.email}}
</td>
<td
nz-td
>
{{one.roleName}}
</td>
<td
nz-td
>
{{one.pDeviceNo ? '是' : '否'}}
</td>
<td
nz-td
>
{{one.companyName}}
</td>
<td
nz-td
>
{{one.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
bind
(
one
)"
>
{{'bind' | translate}}
</span>
<span
*
ngIf=
"!one.pDeviceNo"
class=
"editSpan"
(
click
)="
bind
(
one
)"
>
{{'bind' | translate}}
</span>
<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
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
.
roleNo
)"
>
{{'delete' | translate}}
</span>
<span
*
ngIf=
"!one.pDeviceNo && !one.state"
class=
"editSpan"
(
click
)="
divide
(
one
)"
>
{{'divide' | translate}}
</span>
<nz-divider
*
ngIf=
"!one.pDeviceNo && !one.state"
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
<
div
class=
"btnLine whenOneLine"
style=
"text-align: left; margin-top: 10px;"
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDelete
()"
>
<span>
{{'delete' | translate}}
</span></button
>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canbind
"
(
click
)="
allBind
()"
><span>
{{'bind' | translate}}
</span
>
</button
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canUnbind
"
(
click
)="
allUnbind
()"
>
<span>
{{'unbind' | translate}}
</span></button
>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDivide
()"
><span>
{{'divide' | translate}}
</span
>
</button
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allUpdate
()"
>
<span>
{{'update' | translate}}
</span></button
>
<
/div
>
<
div
class=
"pagePart whenOneLine"
>
<nz-pagination
[
nzPageIndex
]="
page
"
[
nzTotal
]="
total
"
[
nzPageSize
]="
rows
"
[
nzShowTotal
]="
totalTemplate
"
></nz-pagination
>
<ng-template
#
totalTemplate
>
共 {{ total }} 项
</ng-template
>
<
/div
>
<
!--<div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">--
>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">--
>
<!--<span>{{'delete' | translate}}</span></button>--
>
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>--
>
<!--</button>--
>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">--
>
<!--<span>{{'unbind' | translate}}</span></button>--
>
<!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()"><span>{{'divide' | translate}}</span>--
>
<!--</button>--
>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">--
>
<!--<span>{{'update' | translate}}</span></button>--
>
<
!--</div>--
>
<
!--<div class="pagePart whenOneLine">--
>
<!--<nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"-->
<!--[nzShowTotal]="totalTemplate"></nz-pagination>--
>
<!--<ng-template #totalTemplate> 共 {{ total }} 项</ng-template>--
>
<
!--</div>--
>
</div>
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzContent
]="
con1
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nz
Title
]="
isUpdate
?
('
updateGateway
'
|
translate
)
:
('
addGateway
'
|
translate
)"
[
nz
Content
]="
con1
"
nzWidth=
"500"
[
nzFooter
]="
foot1
"
(
nzOnCancel
)="
cancel
('
isAddConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con1
>
新增网关
<app-search-item
inModal=
"true"
isMust=
"true"
[
label
]="'
gatewayName
'
|
translate
"
[(
value
)]="
req
.
name
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
gatewaySN
'
|
translate
"
[(
value
)]="
req
.
sn
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
type
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
simcard
'
|
translate
"
[(
value
)]="
req
.
simcard
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
configJson
'
|
translate
"
[(
value
)]="
req
.
configJson
"
></app-search-item>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
<app-search-select
isMust=
"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
"
[(
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
('
isAddConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<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>
</ng-template>
</nz-modal>
...
...
@@ -99,40 +123,50 @@
批量新增网关
</ng-template>
<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
')"
><span>
{{'confirm' | translate}}
</span></button>
<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
')"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
[
nzTitle
]="'
bindGateway
'
|
translate
"
[
nzFooter
]="
foot3
"
(
nzOnCancel
)="
cancel
('
isBindConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con3
>
绑定/批量绑定网关
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
>
<span
class=
"deleteFontColor"
>
*
</span>
{{'selectGateway' | translate}}
</div>
<div
class=
"item-input"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
[
nzLabel
]="
one
.
name
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
{{one.name}} - {{one.sn}}
</nz-auto-option>
</nz-autocomplete>
</div>
</div>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
belongAddress
'
|
translate
"
[(
value
)]="
req3
.
address
"
></app-search-item>
</ng-template>
<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
('
isBindConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isBindConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
is
UpdateConV
"
[
nzContent
]="
con4
"
nzWidth=
"500"
[
nzFooter
]="
foot4
"
(
nzOnCancel
)="
cancel
('
is
Updat
eConV
')"
nzMaskClosable=
"false"
>
<nz-modal
[(
nzVisible
)]="
is
DivideConV
"
[
nzTitle
]="('
gateway
'
|
translate
)
+
('
divide
'
|
translate
)
"
[
nzContent
]="
con4
"
nzWidth=
"500"
[
nzFooter
]="
foot4
"
(
nzOnCancel
)="
cancel
('
is
Divid
eConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con4
>
编辑网关
</ng-template>
<app-search-select
isMust=
"true"
[(
value
)]="
req4
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
</ng-template>
<ng-template
#
foot4
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isUpdateConV
')"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isUpdateConV
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isDivideConV
"
[
nzContent
]="
con5
"
nzWidth=
"500"
[
nzFooter
]="
foot5
"
(
nzOnCancel
)="
cancel
('
isDivideConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con5
>
分配网关
</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=
"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>
</ng-template>
</nz-modal>
src/app/main/gateway/gateway.component.ts
View file @
1f638138
...
...
@@ -28,20 +28,26 @@ export class GatewayComponent implements OnInit {
isLoading
=
false
;
isAllCheck
=
false
;
isIndeterminate
=
false
;
page
=
1
;
rows
=
10
;
total
=
125
;
listOfBind
=
[{
text
:
'全部'
,
value
:
1
},
{
text
:
'已绑定'
,
value
:
2
},
{
text
:
'未绑定'
,
value
:
3
}];
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
selectedOne
:
any
=
{};
isAddConV
=
false
;
isMultiAddConV
=
false
;
isUpdate
=
false
;
isBindConV
=
false
;
isDivideConV
=
false
;
isMulti
=
false
;
canbind
=
false
;
canUnbind
=
false
;
isCheckedOne
=
false
;
isUpdateConV
=
false
;
isDivideConV
=
false
;
req
:
any
=
{};
companys
=
[];
influxdbs
=
[];
filterFlag
=
null
;
selectedGateways
=
[];
canBindGateways
=
[];
req3
:
any
=
{};
scenes
=
[{
sceneNo
:
'123'
,
sceneName
:
'qq'
}];
req4
:
any
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
...
...
@@ -53,14 +59,22 @@ export class GatewayComponent implements OnInit {
init
()
{
this
.
getData
();
this
.
getCompanys
();
}
next
=
(
data
)
=>
{
if
(
data
&&
data
.
rows
&&
data
.
rows
.
constructor
===
Array
)
{
this
.
data
=
data
.
rows
.
filter
(
one
=>
{
one
.
isOn
=
Math
.
random
()
>
0.5
;
return
one
;
});
this
.
total
=
data
.
total
;
if
(
data
&&
data
.
constructor
===
Array
)
{
const
flag
=
!
(
this
.
filterFlag
===
0
||
this
.
filterFlag
===
1
);
this
.
canBindGateways
=
data
.
filter
(
one
=>
!
one
.
pDeviceNo
);
this
.
data
=
data
.
filter
(
one
=>
(
one
.
pDeviceNo
&&
this
.
filterFlag
||
flag
)
&&
one
.
name
.
indexOf
(
this
.
query
.
gatewayName
)
>
-
1
&&
one
.
sn
.
indexOf
(
this
.
query
.
gatewaySN
)
>
-
1
);
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
isAddConV
=
false
;
this
.
isMultiAddConV
=
false
;
this
.
isBindConV
=
false
;
this
.
isDivideConV
=
false
;
this
.
getData
();
}
else
if
(
data
.
code
===
0
)
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
else
{
...
...
@@ -71,13 +85,51 @@ export class GatewayComponent implements OnInit {
getData
()
{
this
.
isLoading
=
true
;
this
.
api
.
loginlog
.
getAll
(
this
.
page
,
this
.
rows
,
[
''
,
this
.
next
]);
this
.
api
.
device
.
getAll
([{
model
:
0
},
this
.
next
]);
}
getCompanys
()
{
this
.
isLoading
=
true
;
this
.
api
.
company
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
companys
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
companySelected
(
e
)
{
this
.
isLoading
=
true
;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
e
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
influxdbs
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
onSearch
()
{
this
.
filterFlag
=
null
;
this
.
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
this
.
getData
();
}
onGetAll
()
{
this
.
query
=
{
gatewayName
:
''
,
gatewaySN
:
''
};
this
.
filterFlag
=
null
;
this
.
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
this
.
getData
();
}
onInput
(
e
)
{
this
.
selectedGateways
=
this
.
canBindGateways
.
filter
(
one
=>
one
.
name
.
indexOf
(
e
)
>
-
1
||
one
.
sn
.
indexOf
(
e
)
>
-
1
);
}
// 复选框的方法
...
...
@@ -129,41 +181,61 @@ export class GatewayComponent implements OnInit {
}
// 筛选
filter
(
a
,
b
)
{
console
.
log
(
a
,
b
);
filter
(
e
)
{
this
.
filterFlag
=
e
;
this
.
getData
();
}
// 跳转详情
toSee
(
e
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/gatewayMgr/gatewaySee'
]);
this
.
router
.
navigate
([
'/app/deviceCenter/gatewayMgr/gatewaySee'
],
{
queryParams
:
{
deviceNo
:
e
.
deviceNo
,
name
:
e
.
name
}});
}
// 单个的方法
add
()
{
this
.
isMulti
=
false
;
this
.
isUpdate
=
false
;
this
.
isAddConV
=
true
;
}
bind
(
one
)
{
this
.
isMulti
=
false
;
this
.
selectedOne
=
one
;
this
.
selectedGateways
=
[];
this
.
req3
=
{
address
:
''
,
deviceNo
:
one
.
deviceNo
,
influxdbDatabaseNo
:
''
,
pDeviceNo
:
''
};
this
.
isBindConV
=
true
;
}
unbind
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i> </i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirm
DeleteSelected
Record'
)
+
'</b>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirm
UnbindThis
Record'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
unbindOne
(
one
)
});
}
unbindOne
(
one
)
{}
unbindOne
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
unBindDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
update
(
one
)
{
this
.
isMulti
=
false
;
this
.
selectedOne
=
one
;
this
.
isUpdateConV
=
true
;
this
.
req
=
{...
one
};
this
.
companySelected
(
one
.
companyNo
);
this
.
isUpdate
=
true
;
this
.
isAddConV
=
true
;
}
divide
(
one
)
{
this
.
isMulti
=
false
;
this
.
req4
=
{...
one
};
this
.
isDivideConV
=
true
;
}
cancel
(
v
)
{
...
...
@@ -171,7 +243,22 @@ export class GatewayComponent implements OnInit {
}
save
(
v
)
{
this
[
v
]
=
false
;
this
.
isLoading
=
true
;
// 单个新增
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
this
.
api
.
device
.
addGateway
([
this
.
req
,
this
.
next
]);
// 单个编辑
}
else
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
this
.
isUpdate
)
{
this
.
api
.
device
.
updateGateway
([
this
.
req
,
this
.
next
]);
// 单个分配
}
else
if
(
!
this
.
isMulti
&&
this
.
isDivideConV
)
{
this
.
api
.
device
.
updateCompany
([
this
.
req4
,
this
.
next
]);
// 单个绑定
}
else
if
(
!
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
}
}
deleteConfirm
(
one
)
{
...
...
@@ -182,12 +269,15 @@ export class GatewayComponent implements OnInit {
});
}
delete
(
one
)
{}
delete
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
delDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
// 批量的方法
allUpdate
()
{
this
.
isMulti
=
true
;
this
.
isUpdate
ConV
=
true
;
this
.
isUpdate
=
true
;
}
multiAdd
()
{
...
...
src/app/main/influxdb/influxdb.component.html
0 → 100644
View file @
1f638138
<div
class=
"searchBar"
@
fade
>
<app-search-select
[(
value
)]="
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
[
data
]="
companys
"
optV=
"companyNo"
></app-search-select>
<div
class=
"btnLine"
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
(
click
)="
onSearch
()"
><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
)="
add
()"
><span>
{{'add' | translate}}
</span></button>
</div>
</div>
<div
class=
"tableBar"
@
fade
>
<nz-table
#
nzTable
[
nzData
]="
data
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<th
nz-th
><span>
{{'num' | translate}}
</span></th>
<th
nz-th
><span>
{{'databaseName' | translate}}
</span></th>
<th
nz-th
><span>
{{'companyName' | translate}}
</span></th>
<th
nz-th
><span>
{{'field' | translate}}
</span></th>
<th
nz-th
><span>
{{'dbPolicy' | translate}}
</span></th>
<th
nz-th
><span>
{{'dbState' | translate}}
</span></th>
<th
nz-th
><span>
{{'description' | translate}}
</span></th>
<th
nz-th
><span>
{{'remark' | translate}}
</span></th>
<th
nz-th
><span>
{{'oper' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable.data,let i = index"
>
<td
nz-td
>
{{i + 1}}
</td>
<td
nz-td
>
{{one.databaseName}}
</td>
<td
nz-td
>
{{one.companyName}}
</td>
<td
nz-td
>
{{one.field}}
</td>
<td
nz-td
>
{{one.policy}}
</td>
<td
nz-td
>
{{one.state}}
</td>
<td
nz-td
>
{{one.description}}
</td>
<td
nz-td
>
{{one.remark}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
edit
(
one
)"
>
{{'edit' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
</div>
<nz-modal
[(
nzVisible
)]="
isVisible
"
[
nzTitle
]="(
isUpdate
?
'
editUser
'
:
'
addUser
')
|
translate
"
[
nzContent
]="
modalContent
"
nzWidth=
"500"
[
nzFooter
]="
modalFooter
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
modalContent
>
<app-search-item
isMust=
"true"
[(
value
)]="
req
.
databaseName
"
[
label
]="'
databaseName
'
|
translate
"
inModal=
"true"
></app-search-item>
<app-search-item
isMust=
"true"
[(
value
)]="
req
.
field
"
[
label
]="'
field
'
|
translate
"
inModal=
"true"
></app-search-item>
<app-search-item
isMust=
"true"
[(
value
)]="
req
.
description
"
[
label
]="'
description
'
|
translate
"
inModal=
"true"
></app-search-item>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
state
"
[
label
]="'
dbState
'
|
translate
"
optL=
"a"
optV=
"b"
[
data
]="[{
a:
'好',
b:
1
},
{
a:
'坏',
b:
0
}]"
inModal=
"true"
></app-search-select>
<app-search-item
isMust=
"true"
[(
value
)]="
req
.
policy
"
[
label
]="'
dbPolicy
'
|
translate
"
inModal=
"true"
></app-search-item>
<app-search-item
[(
value
)]="
req
.
remark
"
[
label
]="'
remark
'
|
translate
"
inModal=
"true"
></app-search-item>
</ng-template>
<ng-template
#
modalFooter
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
src/app/main/influxdb/influxdb.component.ts
0 → 100644
View file @
1f638138
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ApiService
}
from
'../../service/api'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
import
{
CheckService
}
from
'../../service/check'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
@
Component
({
selector
:
'app-influxdb'
,
templateUrl
:
'./influxdb.component.html'
,
styles
:
[],
animations
:
[
fadeIn
]
})
export
class
InfluxdbComponent
implements
OnInit
{
req
:
any
=
{};
data
:
any
=
[];
isLoading
=
false
;
isVisible
=
false
;
isUpdate
=
false
;
companyNo
=
''
;
companys
=
[];
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
translate
:
TranslateService
,
private
modalService
:
NzModalService
,
private
ck
:
CheckService
)
{
}
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
getData
();
this
.
getCompanys
();
}
getCompanys
()
{
this
.
isLoading
=
true
;
this
.
api
.
company
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
.
constructor
===
Array
)
{
this
.
companys
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
next
=
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
data
=
data
;
}
else
if
(
data
&&
data
.
code
===
1
)
{
this
.
message
.
success
(
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
init
();
this
.
isVisible
=
false
;
}
else
if
(
data
&&
data
.
code
===
0
)
{
this
.
message
.
error
(
data
.
message
?
data
.
message
:
'操作失败'
);
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}
getData
()
{
this
.
isLoading
=
true
;
this
.
api
.
influxdbTables
.
getAll
([
''
,
this
.
next
]);
}
onSearch
()
{
this
.
isLoading
=
true
;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
this
.
companyNo
},
this
.
next
]);
}
onGetAll
()
{
this
.
companyNo
=
''
;
this
.
getData
();
}
add
()
{
this
.
isUpdate
=
false
;
this
.
req
=
{};
this
.
isVisible
=
true
;
}
edit
(
one
)
{
this
.
isUpdate
=
true
;
this
.
req
=
{...
one
};
this
.
isVisible
=
true
;
}
save
()
{
this
.
isLoading
=
true
;
if
(
this
.
isUpdate
)
{
this
.
api
.
influxdbTables
.
updateInfluxdbTables
([
this
.
req
,
this
.
next
]);
}
else
{
this
.
api
.
influxdbTables
.
addInfluxdbTables
([
this
.
req
,
this
.
next
]);
}
}
cancel
()
{
this
.
isVisible
=
false
;
}
deleteConfirm
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i></i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirmDeleteThisRecord'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
delete
(
one
)
});
}
delete
(
one
)
{
this
.
api
.
influxdbTables
.
delInfluxdbTables
([{
influxdbDatabaseNo
:
one
.
influxdbDatabaseNo
},
this
.
next
]);
}
}
src/app/main/module-mgr/module-mgr.component.html
View file @
1f638138
...
...
@@ -25,7 +25,7 @@
<tr
*
ngFor=
"let one of nzTable.data, let i = index"
>
<td
nz-td
>
{{i + 1}}
</td>
<td
nz-td
class=
"canClick"
(
click
)="
toDetail
(
one
)"
>
{{one.probesModelName}}
</td>
<td
nz-td
>
{{one.
probesModelName
}}
</td>
<td
nz-td
>
{{one.
counts
}}
</td>
<td
nz-td
>
{{one.remark}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
update
(
one
)"
>
{{'update' | translate}}
</span>
...
...
src/app/main/sensor-detail/sensor-detail.component.html
View file @
1f638138
...
...
@@ -3,12 +3,18 @@
<app-back
[
isLoading
]="
isLoading
"
></app-back>
</div>
<nz-tabset>
<nz-tab
nzTitle=
"
传感器
"
>
<nz-tab
nzTitle=
"
主题
"
>
<div
class=
"subTitle"
>
{{'sensor' | translate}} 123456 {{'detail' | translate}}
{{'sensor' | translate}} {{name}} {{'topic' | translate}}{{'detail' | translate}}
<div
class=
"backBtnOnTabset"
style=
"top: -2px"
>
<button
nz-button
nzType=
"primary"
style=
"margin-right: 10px"
[
nzLoading
]="
isLoading
"
(
click
)="
add
()"
><span>
{{'addTopic' | translate}}
</span></button>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
(
click
)="
changeModel
()"
><span>
{{'changeModel' | translate}}
</span></button>
</div>
</div>
<nz-table
#
nzTable
[
nzData
]="
data
"
[
nzData
]="
d
eviceD
ata
"
[
nzSize
]="'
middle
'"
nzShowSizeChanger
[
nzShowPagination
]="
true
"
...
...
@@ -25,29 +31,32 @@
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable.data, let i = index"
>
<td
nz-td
class=
"canClick"
(
click
)="
toDetail
(
one
)"
>
{{i + 1}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{i}}
</td>
<td
nz-td
class=
"canClick"
(
click
)="
toDetail
(
one
)"
>
{{one.topicName}}
</td>
<td
nz-td
>
{{one.topicType === 0 ? '推送主题' : one.topicType === 1 ? '订阅主题': '推送订阅主题'}}
</td>
<td
nz-td
>
{{one.dataType === 0 ? 'json' : 'bin'}}
</td>
<td
nz-td
>
{{one.interval}}
</td>
<td
nz-td
>
{{one.dataInterval}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
update
(
one
)"
>
{{'update' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
</nz-tab>
<nz-tab
nzTitle=
"通道"
>
<div
class=
"subTitle"
>
{{'sensor' | translate}}
123456
{{'wayDetail' | translate}}
{{'sensor' | translate}}
{{name}}
{{'wayDetail' | translate}}
</div>
<nz-table
#
nzTable2
[
nzData
]="
d
ata
"
[
nzData
]="
wayD
ata
"
[
nzSize
]="'
middle
'"
nzShowSizeChanger
[
nzShowPagination
]="
true
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<th
nz-th
><span>
{{'wayIndex' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayName' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayAlias' | translate}}
</span></th>
<th
nz-th
><span>
{{'per' | translate}}
</span></th>
...
...
@@ -58,121 +67,207 @@
<th
nz-th
><span>
{{'alarmMaxMax' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMinMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'isbind' | translate}}
</span></th>
<th
nz-th
><span>
{{'isAlarm' | translate}}
</span></th>
<th
nz-th
><span>
{{'oper' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable2.data, let i = index"
>
<td
nz-td
>
{{
i + 1
}}
</td>
<td
nz-td
>
{{one.
userName
}}
</td>
<td
nz-td
>
{{one.
loginTime
}}
</td>
<td
nz-td
>
{{
'web'
}}
</td>
<td
nz-td
>
{{one.
userName
}}
</td>
<td
nz-td
>
{{one.r
ealName
}}
</td>
<td
nz-td
>
{{one.
loginTime
}}
</td>
<td
nz-td
>
{{
'web'
}}
</td>
<td
nz-td
>
{{one.
userName
}}
</td>
<td
nz-td
>
{{one.
realName
}}
</td>
<td
nz-td
>
{{one.
loginTime
}}
</td>
<td
nz-td
>
{{
one.name
}}
</td>
<td
nz-td
>
{{one.
alias
}}
</td>
<td
nz-td
>
{{one.
unit
}}
</td>
<td
nz-td
>
{{
one.type
}}
</td>
<td
nz-td
>
{{one.
rangeMax
}}
</td>
<td
nz-td
>
{{one.r
angeMin
}}
</td>
<td
nz-td
>
{{one.
alarmUp
}}
</td>
<td
nz-td
>
{{
one.upperAlarmLimit
}}
</td>
<td
nz-td
>
{{one.
alarmDown
}}
</td>
<td
nz-td
>
{{one.
lowerAlarmLimit
}}
</td>
<td
nz-td
>
{{one.
isAlarm === 1 ? '是': '否'
}}
</td>
<td
nz-td
>
<span
class=
"deleteFontColor"
>
{{'delete' | translate}}
</span>
<span
class=
"editSpan"
(
click
)="
update2
(
one
)"
>
{{'update' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm2
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
</nz-tab>
<nz-tab
nzTitle=
"运行状态"
>
<div
class=
"cards"
>
<div
class=
"card"
*
ngFor=
"let one of items"
>
<div
class=
"title"
>
{{one.name}}
<div
class=
"rightSpan canClick"
>
查看数据
</div>
</div>
<div
class=
"middle"
>
<div
class=
"left"
>
{{one.data}}{{one.per}}
</div>
<div
class=
"right"
>
{{one.min}}{{one.per}} - {{one.max}}{{one.per}}
<nz-tabset
style=
"margin-top: -20px;"
>
<nz-tab
nzTitle=
"表格"
>
</nz-tab>
<nz-tab
nzTitle=
"图表"
>
<div
class=
"cards"
>
<div
class=
"card"
*
ngFor=
"let one of items"
>
<div
class=
"title"
>
{{one.name}}
<div
class=
"rightSpan canClick"
>
查看数据
</div>
</div>
<div
class=
"middle"
>
<div
class=
"left"
>
{{one.data}}{{one.per}}
</div>
<div
class=
"right"
>
{{one.min}}{{one.per}} - {{one.max}}{{one.per}}
</div>
</div>
<div
class=
"bottom"
>
{{one.time | date: 'yyyy-MM-dd HH:mm:ss'}}
</div>
</div>
</div>
<div
class=
"bottom"
>
{{one.time | date: 'yyyy-MM-dd HH:mm:ss'}}
<div
class=
"charts"
>
<div
style=
"width: calc(100% - 80px);display: inline-block;vertical-align: top;padding-left: 15px;"
>
<app-search-select
inModal=
"true"
[
label
]="'
selectTime
'
|
translate
"
[(
value
)]="
selectTime3
"
optL=
"a"
optV=
"b"
[
data
]="[{
a:
'
1
小时',
b:
1
},
{
a:
'
24
小时',
b:
24
},
{
a:
'
7
天',
b:
144
},
{
a:
'自定义',
b:
0
}]"
></app-search-select>
<app-search-date
*
ngIf=
"selectTime3 === 0"
inModal=
"true"
[
label
]="'
startTime
'
|
translate
"
[(
value
)]="
req3
.
startTime
"
showTime=
"true"
></app-search-date>
<app-search-date
*
ngIf=
"selectTime3 === 0"
inModal=
"true"
[
label
]="'
endTime
'
|
translate
"
[(
value
)]="
req3
.
endTime
"
showTime=
"true"
></app-search-date>
</div>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
(
click
)="
onSearch
()"
>
<span>
{{'search' | translate}}
</span></button>
<nz-tabset
style=
"border-top: 1px solid #cccccc"
>
<nz-tab
nzTitle=
"表格"
>
111
</nz-tab>
<nz-tab
nzTitle=
"图表"
>
222
</nz-tab>
</nz-tabset>
<div
class=
"btnLine"
>
<button
nz-button
[
nzType
]="'
default
'"
[
nzLoading
]="
isLoading
"
(
click
)="
close
()"
>
<span>
{{'close' | translate}}
</span></button>
</div>
</div>
</div>
</div>
<div
class=
"charts"
>
<div
style=
"width: calc(100% - 80px);display: inline-block;vertical-align: top;padding-left: 15px;"
>
<app-search-select
inModal=
"true"
[
label
]="'
selectTime
'
|
translate
"
[(
value
)]="
selectTime
"
optL=
"a"
optV=
"b"
[
data
]="[{
a:
'
1
小时',
b:
1
},
{
a:
'
24
小时',
b:
24
},
{
a:
'
7
天',
b:
144
},
{
a:
'自定义',
b:
0
}]"
></app-search-select>
<app-search-date
*
ngIf=
"selectTime === 0"
inModal=
"true"
[
label
]="'
startTime
'
|
translate
"
[(
value
)]="
req
.
startTime
"
showTime=
"true"
></app-search-date>
<app-search-date
*
ngIf=
"selectTime === 0"
inModal=
"true"
[
label
]="'
endTime
'
|
translate
"
[(
value
)]="
req
.
endTime
"
showTime=
"true"
></app-search-date>
</div>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
(
click
)="
onSearch
()"
>
<span>
{{'search' | translate}}
</span></button>
<nz-tabset
style=
"border-top: 1px solid #cccccc"
>
<nz-tab
nzTitle=
"表格"
>
111
</nz-tab>
<nz-tab
nzTitle=
"图表"
>
222
</nz-tab>
</nz-tabset>
<div
class=
"btnLine"
>
<button
nz-button
[
nzType
]="'
default
'"
[
nzLoading
]="
isLoading
"
(
click
)="
close
()"
>
<span>
{{'close' | translate}}
</span></button>
</div>
</div>
</nz-tab>
<nz-tab
nzTitle=
"日志服务"
>
<div
style=
"width: calc(100% - 80px);display: inline-block;vertical-align: top;"
>
<app-search-select
[
label
]="'
selectTime
'
|
translate
"
[(
value
)]="
selectTime2
"
showTime=
"true"
optL=
"a"
optV=
"b"
[
data
]="[{
a:
'
1
小时',
b:
1
},
{
a:
'
24
小时',
b:
24
},
{
a:
'
7
天',
b:
144
},
{
a:
'自定义',
b:
0
}]"
></app-search-select>
<app-search-date
*
ngIf=
"selectTime === 0"
[
label
]="'
startTime
'
|
translate
"
[(
value
)]="
req2
.
startTime
"
showTime=
"true"
></app-search-date>
<app-search-date
*
ngIf=
"selectTime === 0"
[
label
]="'
endTime
'
|
translate
"
[(
value
)]="
req2
.
endTime
"
showTime=
"true"
></app-search-date>
</div>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
(
click
)="
onSearch2
()"
>
<span>
{{'search' | translate}}
</span></button>
<nz-table
#
nzTable3
[
nzData
]="
data
"
[
nzSize
]="'
middle
'"
nzShowSizeChanger
[
nzShowPagination
]="
true
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<th
nz-th
><span>
{{'wayIndex' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayName' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayAlias' | translate}}
</span></th>
<th
nz-th
><span>
{{'per' | translate}}
</span></th>
<th
nz-th
><span>
{{'wayType' | translate}}
</span></th>
<th
nz-th
><span>
{{'max' | translate}}
</span></th>
<th
nz-th
><span>
{{'min' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMax' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMaxMax' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'alarmMinMin' | translate}}
</span></th>
<th
nz-th
><span>
{{'isbind' | translate}}
</span></th>
</tr>
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable3.data, let i = index"
>
<td
nz-td
>
{{i + 1}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
{{'web'}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
{{'web'}}
</td>
<td
nz-td
>
{{one.userName}}
</td>
<td
nz-td
>
{{one.realName}}
</td>
<td
nz-td
>
{{one.loginTime}}
</td>
<td
nz-td
>
<span
class=
"deleteFontColor"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
</nz-tab>
</nz-tabset>
</nz-tab>
<!--<nz-tab nzTitle="日志服务">-->
<!--<div style="width: calc(100% - 80px);display: inline-block;vertical-align: top;">-->
<!--<app-search-select [label]="'selectTime' | translate" [(value)]="selectTime2"-->
<!--showTime="true" optL="a" optV="b"-->
<!--[data]="[{a: '1小时', b: 1}, {a: '24小时', b: 24}, {a: '7天', b: 144}, {a: '自定义', b: 0}]"></app-search-select>-->
<!--<app-search-date *ngIf="selectTime === 0" [label]="'startTime' | translate" [(value)]="req2.startTime"-->
<!--showTime="true"></app-search-date>-->
<!--<app-search-date *ngIf="selectTime === 0" [label]="'endTime' | translate" [(value)]="req2.endTime"-->
<!--showTime="true"></app-search-date>-->
<!--</div>-->
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="onSearch2()">-->
<!--<span>{{'search' | translate}}</span></button>-->
<!--<nz-table #nzTable3-->
<!--[nzData]="deviceData"-->
<!--[nzSize]="'middle'"-->
<!--nzShowSizeChanger-->
<!--[nzShowPagination]="true"-->
<!--[nzLoading]="isLoading">-->
<!--<thead nz-thead>-->
<!--<tr>-->
<!--<th nz-th><span>{{'wayIndex' | translate}}</span></th>-->
<!--<th nz-th><span>{{'wayName' | translate}}</span></th>-->
<!--<th nz-th><span>{{'wayAlias' | translate}}</span></th>-->
<!--<th nz-th><span>{{'per' | translate}}</span></th>-->
<!--<th nz-th><span>{{'wayType' | translate}}</span></th>-->
<!--<th nz-th><span>{{'max' | translate}}</span></th>-->
<!--<th nz-th><span>{{'min' | translate}}</span></th>-->
<!--<th nz-th><span>{{'alarmMax' | translate}}</span></th>-->
<!--<th nz-th><span>{{'alarmMaxMax' | translate}}</span></th>-->
<!--<th nz-th><span>{{'alarmMin' | translate}}</span></th>-->
<!--<th nz-th><span>{{'alarmMinMin' | translate}}</span></th>-->
<!--<th nz-th><span>{{'isbind' | translate}}</span></th>-->
<!--</tr>-->
<!--</thead>-->
<!--<tbody nz-tbody>-->
<!--<tr *ngFor="let one of nzTable3.data, let i = index">-->
<!--<td nz-td>{{i + 1}}</td>-->
<!--<td nz-td>{{one.userName}}</td>-->
<!--<td nz-td>{{one.loginTime}}</td>-->
<!--<td nz-td>{{'web'}}</td>-->
<!--<td nz-td>{{one.userName}}</td>-->
<!--<td nz-td>{{one.realName}}</td>-->
<!--<td nz-td>{{one.loginTime}}</td>-->
<!--<td nz-td>{{'web'}}</td>-->
<!--<td nz-td>{{one.userName}}</td>-->
<!--<td nz-td>{{one.realName}}</td>-->
<!--<td nz-td>{{one.loginTime}}</td>-->
<!--<td nz-td>-->
<!--<span class="deleteFontColor">{{'delete' | translate}}</span>-->
<!--</td>-->
<!--</tr>-->
<!--</tbody>-->
<!--</nz-table>-->
<!--</nz-tab>-->
</nz-tabset>
</div>
<nz-modal
[(
nzVisible
)]="
isUC
"
[
nzTitle
]="
isUpdate
?
('
updateTopic
'
|
translate
)
:
('
addTopic
'
|
translate
)"
[
nzContent
]="
con1
"
nzWidth=
"500"
[
nzFooter
]="
foot1
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con1
>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
topicName
'
|
translate
"
[(
value
)]="
req
.
topicName
"
></app-search-item>
<app-search-select
isMust=
"true"
inModal=
"true"
[
label
]="'
topicType
'
|
translate
"
[(
value
)]="
req
.
topicType
"
[
data
]="[{
a:
'推送主题',
b:
0
},
{
a:
'订阅主题',
b:
1
},
{
a:
'推送订阅主题',
b:
2
}]"
optL=
"a"
optV=
"b"
></app-search-select>
<app-search-select
isMust=
"true"
inModal=
"true"
[
label
]="'
dataType
'
|
translate
"
[(
value
)]="
req
.
dataType
"
[
data
]="[{
a:
'
json
',
b:
0
},
{
a:
'
bin
',
b:
1
}]"
optL=
"a"
optV=
"b"
></app-search-select>
<app-search-select
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
probesModel
'
|
translate
"
[(
value
)]="
req
.
probesModelNo
"
[
data
]="
probsModels
"
optL=
"probesModelName"
optV=
"probesModelNo"
></app-search-select>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
dataInterval
'
|
translate
"
[(
value
)]="
req
.
dataInterval
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
frequency
'
|
translate
"
[(
value
)]="
req
.
frequency
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
interval
'
|
translate
"
[(
value
)]="
req
.
interval
"
></app-search-item>
</ng-template>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isMC
"
[
nzTitle
]="'
changeModel
'
|
translate
"
[
nzContent
]="
con2
"
nzWidth=
"500"
[
nzFooter
]="
foot2
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con2
>
<app-search-select
isMust=
"true"
inModal=
"true"
[
label
]="'
topicModel
'
|
translate
"
[(
value
)]="
req5
.
topicModelNo
"
[
data
]="
topicModels
"
optL=
"topicModelName"
optV=
"topicModelNo"
></app-search-select>
</ng-template>
<ng-template
#
foot2
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isUC2
"
[
nzContent
]="
con3
"
nzWidth=
"750"
[
nzFooter
]="
foot3
"
[
nzTitle
]="'
updateWay
'
|
translate
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con3
>
<div
class=
"half"
>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayName
'
|
translate
"
[(
value
)]="
req2
.
name
"
></app-search-item>
<app-search-item
inModal=
"true"
[
label
]="'
per
'
|
translate
"
[(
value
)]="
req2
.
unit
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayDescription
'
|
translate
"
[(
value
)]="
req2
.
description
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
max
'
|
translate
"
[(
value
)]="
req2
.
rangeMax
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
alarmMax
'
|
translate
"
[(
value
)]="
req2
.
alarmUp
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
alarmMaxMax
'
|
translate
"
[(
value
)]="
req2
.
upperAlarmLimit
"
></app-search-item>
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
><span
class=
"deleteFontColor"
>
*
</span>
{{'isAlarm' | translate}}
</div>
<div
class=
"item-input"
>
<nz-radio-group
[(
ngModel
)]="
req2
.
isAlarm
"
>
<label
nz-radio
[
nzValue
]="
1
"
>
是
</label>
<label
nz-radio
[
nzValue
]="
0
"
>
否
</label>
</nz-radio-group>
</div>
</div>
</div>
<div
class=
"half"
>
<app-search-item
inModal=
"true"
[
label
]="'
wayAlias
'
|
translate
"
[(
value
)]="
req2
.
alias
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
wayType
'
|
translate
"
[(
value
)]="
req2
.
type
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
min
'
|
translate
"
[(
value
)]="
req2
.
rangeMin
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
alarmMin
'
|
translate
"
[(
value
)]="
req2
.
alarmDown
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
alarmMinMin
'
|
translate
"
[(
value
)]="
req2
.
lowerAlarmLimit
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
alarmInterval
'
|
translate
"
[(
value
)]="
req2
.
alarmInterval
"
></app-search-item>
</div>
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
style=
"width: 149px;"
><span
class=
"deleteFontColor"
>
*
</span>
{{'wayInfo' | translate}}
</div>
<div
class=
"item-input"
style=
"width: calc(100% - 158px);"
>
<textarea
nz-input
[(
ngModel
)]="
req2
.
boxedart
"
></textarea>
</div>
</div>
</ng-template>
<ng-template
#
foot3
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
src/app/main/sensor-detail/sensor-detail.component.ts
View file @
1f638138
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
ApiService
}
from
'../../service/api'
;
import
{
NzMessageService
}
from
'ng-zorro-antd'
;
import
{
Router
}
from
'@angular/router'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
import
{
ActivatedRoute
,
Router
}
from
'@angular/router'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
TranslateService
}
from
'@ngx-translate/core'
;
@
Component
({
selector
:
'app-sensor-detail'
,
...
...
@@ -13,11 +14,22 @@ import {fadeIn} from '../../animation/fade-in';
export
class
SensorDetailComponent
implements
OnInit
{
isLoading
=
false
;
data
=
[];
selectTime
=
24
;
req
=
{};
selectTime2
=
24
;
req2
=
{};
deviceData
=
[];
deviceNo
=
''
;
name
=
''
;
req
:
any
=
{};
req2
:
any
=
{};
req3
=
{};
req5
:
any
=
{};
isUC
=
false
;
isUC2
=
false
;
isMC
=
false
;
isUpdate
=
false
;
isUpdate2
=
false
;
probsModels
=
[];
topicModels
=
[];
wayData
=
[];
selectTime3
=
24
;
items
=
[{
name
:
'液位'
,
data
:
'1'
,
...
...
@@ -40,21 +52,32 @@ export class SensorDetailComponent implements OnInit {
min
:
'0'
,
time
:
new
Date
().
getTime
()
}];
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
)
{
}
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
ac
:
ActivatedRoute
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
}
ngOnInit
()
{
this
.
init
();
}
init
()
{
this
.
getData
();
this
.
ac
.
queryParams
.
subscribe
((
e
)
=>
{
if
(
e
.
deviceNo
)
{
this
.
deviceNo
=
e
.
deviceNo
;
this
.
name
=
e
.
name
;
this
.
getTopicData
();
this
.
getProbsModels
();
this
.
getTopicModels
();
this
.
getProbs
();
}
});
}
next
=
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
data
=
data
;
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
cancel
();
this
.
getTopicData
();
}
else
if
(
data
.
code
===
0
)
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
else
{
...
...
@@ -62,17 +85,145 @@ export class SensorDetailComponent implements OnInit {
}
}
getData
()
{
this
.
api
.
role
.
getAll
([
''
,
this
.
next
]);
getProbsModels
()
{
this
.
isLoading
=
true
;
this
.
api
.
probesModel
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
probsModels
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
toDetail
()
{
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail'
]);
getTopicData
()
{
this
.
isLoading
=
true
;
this
.
api
.
topic
.
getByDeviceNo
([{
deviceNo
:
this
.
deviceNo
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
deviceData
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
onSearch
()
{}
getTopicModels
()
{
this
.
isLoading
=
true
;
this
.
api
.
topicModel
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
topicModels
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
getProbs
()
{
this
.
isLoading
=
true
;
this
.
api
.
probes
.
getProbesByGateway
([{
deviceNo
:
this
.
deviceNo
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
wayData
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
onSearch2
()
{}
toDetail
(
one
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail/sensorTopicWay'
],
{
queryParams
:
{
deviceNo
:
one
.
deviceNo
,
topicName
:
one
.
topicName
}});
}
onSearch
()
{}
close
()
{}
changeModel
()
{
this
.
isMC
=
true
;
this
.
req5
=
{
deviceNo
:
this
.
deviceNo
};
}
add
()
{
this
.
isUpdate
=
false
;
this
.
req
=
{};
this
.
req
.
deviceNo
=
this
.
deviceNo
;
this
.
isUC
=
true
;
}
update
(
one
)
{
this
.
req
=
{...
one
};
this
.
isUpdate
=
true
;
this
.
req
.
oldTopicName
=
one
.
topicName
;
this
.
isUC
=
true
;
}
cancel
()
{
this
.
isUC
=
false
;
this
.
isMC
=
false
;
this
.
isUC2
=
false
;
}
save
()
{
this
.
isLoading
=
true
;
if
(
this
.
isUC
&&
this
.
isUpdate
)
{
this
.
api
.
topic
.
updateTopic
([
this
.
req
,
this
.
next
]);
}
else
if
(
this
.
isUC
&&
!
this
.
isUpdate
)
{
this
.
api
.
topic
.
addTopic
([
this
.
req
,
this
.
next
]);
}
else
if
(
this
.
isMC
)
{
this
.
api
.
device
.
deploySensor
([
this
.
req5
,
this
.
next
]);
}
else
if
(
this
.
isUC2
&&
this
.
isUpdate
)
{
this
.
req2
.
deviceNo
=
this
.
deviceNo
;
this
.
api
.
probes
.
updateProbes
([
this
.
req2
,
this
.
next
]);
}
else
if
(
this
.
isUC2
&&
!
this
.
isUpdate
)
{
this
.
req2
.
deviceNo
=
this
.
deviceNo
;
this
.
api
.
probes
.
addProbes
([
this
.
req2
,
this
.
next
]);
}
}
deleteConfirm
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i> </i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirmDeleteThisRecord'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
delete
(
one
)
});
}
delete
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
topic
.
delTopic
([{
deviceNo
:
one
.
deviceNo
,
topicName
:
one
.
topicName
},
this
.
next
]);
}
add2
()
{
this
.
isUpdate2
=
false
;
this
.
req2
=
{};
this
.
req2
.
deviceNo
=
this
.
deviceNo
;
this
.
isUC2
=
true
;
}
update2
(
one
)
{
this
.
req2
=
{...
one
};
this
.
isUpdate2
=
true
;
this
.
req2
.
oldTopicName
=
one
.
topicName
;
this
.
isUC2
=
true
;
}
deleteConfirm2
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i> </i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirmDeleteThisRecord'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
delete2
(
one
)
});
}
delete2
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
topic
.
delTopic
([{
deviceNo
:
one
.
deviceNo
,
topicName
:
one
.
topicName
},
this
.
next
]);
}
}
src/app/main/sensor-mgr/sensor-mgr.component.html
View file @
1f638138
...
...
@@ -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>
{{'addSensor' | translate}}
</span></button>
</div>
...
...
@@ -15,17 +15,16 @@
<div
class=
"tableBar"
@
fade
>
<nz-table
#
nzTable
[
nzData
]="
data
"
[
nzShowPagination
]="
false
"
[
nzLoading
]="
isLoading
"
>
<thead
nz-thead
>
<tr>
<
th
nzShowCheckbox
[(
nzChecked
)]="
isAllCheck
"
[
nzDisabled
]="
data
.
length=
==0"
[
nzIndeterminate
]="
isIndeterminate
"
(
nzCheckedChange
)="
checkAll
($
event
)"
></th
>
<
!--<th-->
<!--nzShowCheckbox-->
<!--[(nzChecked)]="isAllCheck"-->
<!--[nzDisabled]="data.length===0"-->
<!--[nzIndeterminate]="isIndeterminate"-->
<!--(nzCheckedChange)="checkAll($event)"-->
<!--></th>--
>
<th
nz-th
><span>
{{'sensorName' | translate}}
</span></th>
<th
nz-th
><span>
{{'sensorSN' | translate}}
</span></th>
<th
nz-th
><span>
{{'frontName' | translate}}
</span></th>
...
...
@@ -43,50 +42,70 @@
</thead>
<tbody
nz-tbody
>
<tr
*
ngFor=
"let one of nzTable.data,let i = index"
>
<
td
nzShowCheckbox
[(
nzChecked
)]="
one
.
checked
"
(
nzCheckedChange
)="
oneCheck
()"
></td
>
<td
nz-td
class=
"canClick"
(
click
)="
toSee
(
one
)"
>
设备{{i
}}
</td>
<td
nz-td
>
{{one.
realName
}}
</td>
<td
nz-td
>
{{one.
user
Name}}
</td>
<td
nz-td
>
{{one.
nickNam
e}}
</td>
<
!--<td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>--
>
<td
nz-td
class=
"canClick"
(
click
)="
toSee
(
one
)"
>
{{one.name
}}
</td>
<td
nz-td
>
{{one.
sn
}}
</td>
<td
nz-td
>
{{one.
prefix
Name}}
</td>
<td
nz-td
>
{{one.
typ
e}}
</td>
<td
nz-td
>
<nz-switch
[
nzControl
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
isOn
"
<nz-switch
[
nzControl
]="
true
"
(
click
)="
toggleOn
(
one
)"
[(
ngModel
)]="
one
.
state
"
[
nzLoading
]="
one
.
isLoading
"
></nz-switch>
</td>
<td
nz-td
>
{{one.
email
}}
</td>
<td
nz-td
>
{{one.
role
Name}}
</td>
<td
nz-td
>
{{one.
pDeviceNo ? '是' : '否'
}}
</td>
<td
nz-td
>
{{one.
company
Name}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
bind
(
one
)"
>
{{'bind' | translate}}
</span>
<span
*
ngIf=
"!one.pDeviceNo"
class=
"editSpan"
(
click
)="
bind
(
one
)"
>
{{'bind' | translate}}
</span>
<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
nzType=
"vertical"
></nz-divider>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
.
roleNo
)"
>
{{'delete' | translate}}
</span>
<span
class=
"deleteFontColor"
(
click
)="
deleteConfirm
(
one
)"
>
{{'delete' | translate}}
</span>
</td>
</tr>
</tbody>
</nz-table>
<
div
class=
"btnLine whenOneLine"
style=
"text-align: left; margin-top: 10px;"
>
<
button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDelete
()"
>
<
span>
{{'delete' | translate}}
</span></button
>
<
button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canbind
"
(
click
)="
allBind
()"
><span>
{{'bind' | translate}}
</span
>
<
/button
>
<
button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canUnbind
"
(
click
)="
allUnbind
()"
>
<
span>
{{'unbind' | translate}}
</span></button
>
<
button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDivide
()"
><span>
{{'divide' | translate}}
</span
>
<
/button
>
<
button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allUpdate
()"
>
<
span>
{{'update' | translate}}
</span></button
>
<
/div
>
<
div
class=
"pagePart whenOneLine"
>
<
nz-pagination
[
nzPageIndex
]="
page
"
[
nzTotal
]="
total
"
[
nzPageSize
]="
rows
"
[
nzShowTotal
]="
totalTemplate
"
></nz-pagination
>
<
ng-template
#
totalTemplate
>
共 {{ total }} 项
</ng-template
>
<
/div
>
<
!--<div class="btnLine whenOneLine" style="text-align: left; margin-top: -48px;">--
>
<
!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDelete()">--
>
<
!--<span>{{'delete' | translate}}</span></button>--
>
<
!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>--
>
<
!--</button>--
>
<
!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">--
>
<
!--<span>{{'unbind' | translate}}</span></button>--
>
<
!--<button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allDivide()"><span>{{'divide' | translate}}</span>--
>
<
!--</button>--
>
<
!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">--
>
<
!--<span>{{'update' | translate}}</span></button>--
>
<
!--</div>--
>
<
!--<div class="pagePart whenOneLine">--
>
<
!--<nz-pagination [nzPageIndex]="page" [nzTotal]="total" [nzPageSize]="rows"-->
<!--[nzShowTotal]="totalTemplate"></nz-pagination>--
>
<
!--<ng-template #totalTemplate> 共 {{ total }} 项</ng-template>--
>
<
!--</div>--
>
</div>
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzContent
]="
con1
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzContent
]="
con1
"
nzWidth=
"500"
[
nzTitle
]="
isUpdate
?
('
updateSensor
'
|
translate
)
:
('
addSensor
'
|
translate
)"
[
nzFooter
]="
foot1
"
(
nzOnCancel
)="
cancel
('
isAddConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con1
>
新增传感器
<app-search-item
inModal=
"true"
isMust=
"true"
[
label
]="'
sensorName
'
|
translate
"
[(
value
)]="
req
.
name
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
sensorSN
'
|
translate
"
[(
value
)]="
req
.
sn
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
type
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
configJson
'
|
translate
"
[(
value
)]="
req
.
configJson
"
></app-search-item>
<app-search-item
*
ngIf=
"isUpdate"
inModal=
"true"
[
label
]="'
front
'
|
translate
"
[(
value
)]="
req
.
prefixName
"
></app-search-item>
<app-search-select
*
ngIf=
"!isUpdate"
isMust=
"true"
[(
value
)]="
req
.
topicModelNo
"
[
label
]="'
topicModel
'
|
translate
"
optL=
"topicModelName"
[
data
]="
topicModels
"
inModal=
"true"
optV=
"topicModelNo"
></app-search-select>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
<app-search-select
isMust=
"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
"
[(
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>
...
...
@@ -105,14 +124,29 @@
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
[
nzTitle
]="'
bindGateway
'
|
translate
"
[
nzFooter
]="
foot3
"
(
nzOnCancel
)="
cancel
('
isBindConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con3
>
绑定/批量绑定传感器
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
>
<span
class=
"deleteFontColor"
>
*
</span>
{{'selectGateway' | translate}}
</div>
<div
class=
"item-input"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
[
nzLabel
]="
one
.
name
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
{{one.name}} - {{one.sn}}
</nz-auto-option>
</nz-autocomplete>
</div>
</div>
<app-search-item
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
belongAddress
'
|
translate
"
[(
value
)]="
req3
.
address
"
></app-search-item>
</ng-template>
<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
('
isBindConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
('
isBindConV
')"
>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
()"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
src/app/main/sensor-mgr/sensor-mgr.component.ts
View file @
1f638138
...
...
@@ -22,26 +22,32 @@ export class SensorMgrComponent implements OnInit {
data
=
[];
query
=
{
gateway
Name
:
''
,
gateway
SN
:
''
sensor
Name
:
''
,
sensor
SN
:
''
};
isLoading
=
false
;
isAllCheck
=
false
;
isIndeterminate
=
false
;
page
=
1
;
rows
=
10
;
total
=
125
;
listOfBind
=
[{
text
:
'全部'
,
value
:
1
},
{
text
:
'已绑定'
,
value
:
2
},
{
text
:
'未绑定'
,
value
:
3
}];
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
selectedOne
:
any
=
{};
isAddConV
=
false
;
isMultiAddConV
=
false
;
isBindConV
=
false
;
isMulti
=
false
;
isDivideConV
=
false
;
isUpdate
=
false
;
canbind
=
false
;
canUnbind
=
false
;
isCheckedOne
=
false
;
isDivideConV
=
false
;
isUpdateConV
=
false
;
req
:
any
=
{};
topicModels
=
[];
companys
=
[];
influxdbs
=
[];
scenes
=
[{
sceneNo
:
'123'
,
sceneName
:
'qq'
}];
filterFlag
;
selectedGateways
=
[];
canBindGateways
=
[];
req3
:
any
=
{};
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
)
{
...
...
@@ -53,14 +59,23 @@ export class SensorMgrComponent implements OnInit {
init
()
{
this
.
getData
();
this
.
getTopicModels
();
this
.
getCompanys
();
this
.
getGateways
();
}
next
=
(
data
)
=>
{
if
(
data
&&
data
.
rows
&&
data
.
rows
.
constructor
===
Array
)
{
this
.
data
=
data
.
rows
.
filter
(
one
=>
{
one
.
isOn
=
Math
.
random
()
>
0.5
;
return
one
;
});
this
.
total
=
data
.
total
;
if
(
data
&&
data
.
constructor
===
Array
)
{
const
flag
=
!
(
this
.
filterFlag
===
0
||
this
.
filterFlag
===
1
);
this
.
data
=
data
.
filter
(
one
=>
(
one
.
pDeviceNo
&&
this
.
filterFlag
||
flag
)
&&
one
.
name
.
indexOf
(
this
.
query
.
sensorName
)
>
-
1
&&
one
.
sn
.
indexOf
(
this
.
query
.
sensorSN
)
>
-
1
);
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
isAddConV
=
false
;
this
.
isMultiAddConV
=
false
;
this
.
isBindConV
=
false
;
this
.
isDivideConV
=
false
;
this
.
getData
();
}
else
if
(
data
.
code
===
0
)
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
}
else
{
...
...
@@ -71,13 +86,63 @@ export class SensorMgrComponent implements OnInit {
getData
()
{
this
.
isLoading
=
true
;
this
.
api
.
loginlog
.
getAll
(
this
.
page
,
this
.
rows
,
[
''
,
this
.
next
]);
this
.
api
.
device
.
getAll
([{
model
:
1
},
this
.
next
]);
}
getTopicModels
()
{
this
.
isLoading
=
true
;
this
.
api
.
topicModel
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
topicModels
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
getCompanys
()
{
this
.
isLoading
=
true
;
this
.
api
.
company
.
getAll
([
''
,
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
companys
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
getGateways
()
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
getAll
([{
model
:
0
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
canBindGateways
=
data
.
filter
(
one
=>
!
one
.
pDeviceNo
);
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
onSearch
()
{
this
.
filterFlag
=
null
;
this
.
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
this
.
getData
();
}
onGetAll
()
{
this
.
query
=
{
sensorName
:
''
,
sensorSN
:
''
};
this
.
filterFlag
=
null
;
this
.
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
this
.
getData
();
}
onInput
(
e
)
{
this
.
selectedGateways
=
this
.
canBindGateways
.
filter
(
one
=>
one
.
name
.
indexOf
(
e
)
>
-
1
||
one
.
sn
.
indexOf
(
e
)
>
-
1
);
}
// 复选框的方法
...
...
@@ -129,13 +194,26 @@ export class SensorMgrComponent implements OnInit {
}
// 筛选
filter
(
a
,
b
)
{
console
.
log
(
a
,
b
);
filter
(
e
)
{
this
.
filterFlag
=
e
;
this
.
getData
();
}
companySelected
(
e
)
{
this
.
isLoading
=
true
;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
e
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
influxdbs
=
data
;
}
else
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
}
this
.
isLoading
=
false
;
}]);
}
// 跳转详情
toSee
(
e
)
{
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail'
]);
this
.
router
.
navigate
([
'/app/deviceCenter/sensorMgr/sensorDetail'
]
,
{
queryParams
:
{
deviceNo
:
e
.
deviceNo
,
name
:
e
.
name
}}
);
}
// 单个的方法
...
...
@@ -146,48 +224,76 @@ export class SensorMgrComponent implements OnInit {
bind
(
one
)
{
this
.
isMulti
=
false
;
this
.
selectedOne
=
one
;
this
.
selectedGateways
=
[];
this
.
req3
=
{
address
:
''
,
deviceNo
:
one
.
deviceNo
,
influxdbDatabaseNo
:
''
,
pDeviceNo
:
''
};
this
.
isBindConV
=
true
;
}
unbind
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i></i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirm
DeleteSelected
Record'
)
+
'</b>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirm
UnbindThis
Record'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
unbindOne
(
one
)
});
}
unbindOne
(
one
)
{}
unbindOne
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
unBindDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
update
(
one
)
{
this
.
isMulti
=
false
;
this
.
selectedOne
=
one
;
this
.
isUpdateConV
=
true
;
this
.
req
=
{...
one
};
this
.
companySelected
(
one
.
companyNo
);
this
.
isUpdate
=
true
;
this
.
isAddConV
=
true
;
}
cancel
(
v
)
{
this
[
v
]
=
false
;
}
save
(
v
)
{
this
[
v
]
=
false
;
save
()
{
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
model
=
1
;
this
.
api
.
device
.
addSensorOrBlend
([
this
.
req
,
this
.
next
]);
}
else
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
this
.
isUpdate
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
model
=
1
;
this
.
api
.
device
.
updateSensor
([
this
.
req
,
this
.
next
]);
}
else
if
(
!
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
}
}
deleteConfirm
(
one
)
{
this
.
modalService
.
confirm
({
nzTitle
:
'<i></i>'
,
nzTitle
:
'<i>
</i>'
,
nzContent
:
'<b>'
+
this
.
translate
.
instant
(
'confirmDeleteThisRecord'
)
+
'</b>'
,
nzOnOk
:
()
=>
this
.
delete
(
one
)
});
}
delete
(
one
)
{}
delete
(
one
)
{
this
.
isLoading
=
true
;
this
.
api
.
device
.
delDevice
([{
deviceNo
:
one
.
deviceNo
},
this
.
next
]);
}
// 批量的方法
allUpdate
()
{
this
.
isMulti
=
true
;
this
.
isUpdate
ConV
=
true
;
this
.
isUpdate
=
true
;
}
multiAdd
()
{
...
...
src/app/main/topic-module-detail/topic-module-detail.component.html
View file @
1f638138
...
...
@@ -23,9 +23,9 @@
<tr
*
ngFor=
"let one of nzTable.data, let i = index"
>
<td
nz-td
>
{{i + 1}}
</td>
<td
nz-td
class=
"canClick"
(
click
)="
toConfig
(
one
)"
>
{{one.topicName}}
</td>
<td
nz-td
>
{{one.topicType === 0 ? '
pub' : one.topicType === 1 ? 'sub': 'pub and sub
'}}
</td>
<td
nz-td
>
{{one.topicType === 0 ? '
推送主题' : one.topicType === 1 ? '订阅主题': '推送订阅主题
'}}
</td>
<td
nz-td
>
{{one.dataType === 0 ? 'json' : 'bin'}}
</td>
<td
nz-td
>
{{one.
dataI
nterval}}
</td>
<td
nz-td
>
{{one.
i
nterval}}
</td>
<td
nz-td
>
<span
class=
"editSpan"
(
click
)="
update
(
one
)"
>
{{'update' | translate}}
</span>
<nz-divider
nzType=
"vertical"
></nz-divider>
...
...
@@ -41,7 +41,7 @@
<ng-template
#
con1
>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
topicName
'
|
translate
"
[(
value
)]="
req
.
topicName
"
></app-search-item>
<app-search-select
isMust=
"true"
inModal=
"true"
[
label
]="'
topicType
'
|
translate
"
[(
value
)]="
req
.
topicType
"
[
data
]="[{
a:
'
pub
',
b:
0
},
{
a:
'
sub
',
b:
1
},
{
a:
'
pub
and
sub
',
b:
2
}]"
optL=
"a"
optV=
"b"
></app-search-select>
[
data
]="[{
a:
'
推送主题',
b:
0
},
{
a:
'订阅主题',
b:
1
},
{
a:
'推送订阅主题
',
b:
2
}]"
optL=
"a"
optV=
"b"
></app-search-select>
<app-search-select
isMust=
"true"
inModal=
"true"
[
label
]="'
dataType
'
|
translate
"
[(
value
)]="
req
.
dataType
"
[
data
]="[{
a:
'
json
',
b:
0
},
{
a:
'
bin
',
b:
1
}]"
optL=
"a"
optV=
"b"
></app-search-select>
<app-search-select
*
ngIf=
"!isUpdate"
isMust=
"true"
inModal=
"true"
[
label
]="'
probesModel
'
|
translate
"
[(
value
)]="
req
.
probesModelNo
"
...
...
src/app/router.module.ts
View file @
1f638138
...
...
@@ -21,6 +21,8 @@ import {SensorDetailComponent} from './main/sensor-detail/sensor-detail.componen
import
{
ModuleDetailComponent
}
from
'./main/module-detail/module-detail.component'
;
import
{
TopicModuleDetailComponent
}
from
'./main/topic-module-detail/topic-module-detail.component'
;
import
{
TopicModuleWayComponent
}
from
'./main/topic-module-way/topic-module-way.component'
;
import
{
InfluxdbComponent
}
from
'./main/influxdb/influxdb.component'
;
import
{
SensorTopicWayComponent
}
from
'./main/sensor-topic-way/sensor-topic-way.component'
;
const
AppRoutes
:
Routes
=
[
{
path
:
''
,
redirectTo
:
'/extra/login'
,
pathMatch
:
'full'
},
...
...
@@ -42,6 +44,7 @@ const routes: Routes = [
{
path
:
'deviceCenter/gatewayMgr/gatewaySee'
,
component
:
GatewaySeeComponent
},
{
path
:
'deviceCenter/sensorMgr'
,
component
:
SensorMgrComponent
},
{
path
:
'deviceCenter/sensorMgr/sensorDetail'
,
component
:
SensorDetailComponent
},
{
path
:
'deviceCenter/sensorMgr/sensorDetail/sensorTopicWay'
,
component
:
SensorTopicWayComponent
},
{
path
:
'deviceCenter/moduleMgr'
,
component
:
ModuleMgrComponent
},
{
path
:
'deviceCenter/moduleMgr/moduleDetail'
,
component
:
ModuleDetailComponent
},
{
path
:
'deviceCenter/topicModuleMgr'
,
component
:
TopicModuleMgrComponent
},
...
...
@@ -50,6 +53,7 @@ const routes: Routes = [
{
path
:
'deviceCenter/setModuleMgr'
,
component
:
SetModuleMgrComponent
},
{
path
:
'deviceCenter/mqttSetMgr'
,
component
:
MqttSetMgrComponent
},
{
path
:
'systemMgr/userCenter'
,
component
:
UserComponent
},
{
path
:
'systemMgr/influxdbMgr'
,
component
:
InfluxdbComponent
},
{
path
:
'systemMgr/customCenter'
,
component
:
UserComponent
},
{
path
:
'systemMgr/roleMgr'
,
component
:
RoleComponent
},
{
path
:
'systemMgr/partMgr'
,
component
:
PartMgrComponent
},
...
...
src/app/service/api.ts
View file @
1f638138
...
...
@@ -14,8 +14,6 @@ export class ApiService {
tokenLoseflag
=
0
;
public
url
=
environment
.
baseUrl
;
public
imgUrl
=
environment
.
imgUrl
;
// 前端地址
public
loginlog
=
{
getAll
:
(
page
,
rows
,
data
)
=>
this
.
trans
(
'get'
,
'/system/loginlog/getAll?page='
+
page
+
'&rows='
+
rows
,
data
),
getByTime
:
(
page
,
rows
,
data
)
=>
this
.
trans
(
'post'
,
'/system/loginlog/getByTime?page='
+
page
+
'&rows='
+
rows
,
data
),
...
...
@@ -124,6 +122,7 @@ export class ApiService {
delDevice
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/delDevice'
,
data
),
deploySensor
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/deploySensor'
,
data
),
gatewayBindGateway
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/gatewayBindGateway'
,
data
),
getSensorByMaxDevice
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/getSensorByMaxDevice'
,
data
),
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
),
...
...
@@ -134,6 +133,22 @@ export class ApiService {
updateSensor
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/device/updateSensor'
,
data
),
};
public
influxdbTables
=
{
addInfluxdbTables
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/influxdbTables/addInfluxdbTables'
,
data
),
delInfluxdbTables
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/influxdbTables/delInfluxdbTables'
,
data
),
getAll
:
(
data
)
=>
this
.
trans
(
'get'
,
'/device/influxdbTables/getAll'
,
data
),
getByCompanyNo
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/influxdbTables/getByCompanyNo'
,
data
),
updateInfluxdbTables
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/influxdbTables/updateInfluxdbTables'
,
data
),
};
public
probes
=
{
addProbes
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/probes/addProbes'
,
data
),
delAProbes
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/probes/delAProbes'
,
data
),
getAll
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/probes/getAll'
,
data
),
getProbesByGateway
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/probes/getProbesByGateway'
,
data
),
updateProbes
:
(
data
)
=>
this
.
trans
(
'post'
,
'/device/probes/updateProbes'
,
data
),
};
private
trans
(
type
,
addr
,
data
)
{
this
.
sendHttpReq
(
type
,
addr
,
data
[
0
],
data
[
1
],
data
[
2
],
data
[
3
]);
}
...
...
src/assets/i18n/zh.json
View file @
1f638138
...
...
@@ -101,7 +101,7 @@
"topicType"
:
"主题类型"
,
"dataType"
:
"数据类型"
,
"inTime"
:
"间隔时间/ms"
,
"dataSaveInTime"
:
"数据存储间隔时间/
m
s"
,
"dataSaveInTime"
:
"数据存储间隔时间/
μ
s"
,
"sensor"
:
"传感器"
,
"wayDetail"
:
"通道详情"
,
"detail"
:
"详情"
,
...
...
@@ -126,8 +126,29 @@
"wayDescription"
:
"通道描述"
,
"addTopic"
:
"新增主题"
,
"interval"
:
"间隔时间/ms"
,
"dataInterval"
:
"批量数据存储间隔时间/
m
s"
,
"dataInterval"
:
"批量数据存储间隔时间/
μ
s"
,
"frequency"
:
"发送频率"
,
"probesModel"
:
"通道模板"
,
"topicModuleWay"
:
"主题配置模板通道"
"topicModuleWay"
:
"主题配置模板通道"
,
"influxdbMgr"
:
"influxDB管理"
,
"databaseName"
:
"数据库名称"
,
"field"
:
"域名"
,
"dbState"
:
"数据库状态"
,
"dbPolicy"
:
"存储策略"
,
"simcard"
:
"sim卡号"
,
"selectScene"
:
"选择场景"
,
"configJson"
:
"配置Json"
,
"updateGateway"
:
"编辑网关"
,
"selectInfluxDB"
:
"选择数据库"
,
"topicModel"
:
"主题模板"
,
"updateSensor"
:
"编辑传感器"
,
"confirmUnbindThisRecord"
:
"确认解绑此设备吗"
,
"selectGateway"
:
"选择网关"
,
"bindGateway"
:
"绑定网关"
,
"belongAddress"
:
"所属位置"
,
"sensorType"
:
"传感器类型"
,
"changeModel"
:
"更换模板"
,
"sensorTopicWay"
:
"传感器主题通道"
,
"topic"
:
"主题"
,
"updateWay"
:
"编辑通道"
}
src/environments/environment.ts
View file @
1f638138
...
...
@@ -4,8 +4,7 @@
export
const
environment
=
{
production
:
false
,
baseUrl
:
'http://172.16.1.53:8092'
,
// 对外访问测试网地址
imgUrl
:
'http://172.16.1.53:8092'
// 图片地址
baseUrl
:
'http://172.16.1.52:8094'
,
// 对外访问测试网地址
};
/*
...
...
src/styles.scss
View file @
1f638138
...
...
@@ -378,6 +378,7 @@ span.addSpan {
font-size
:
18px
;
text-indent
:
5px
;
font-weight
:
500
;
position
:
relative
;
}
label
.subTitle
{
...
...
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