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
48554d2d
Commit
48554d2d
authored
May 05, 2019
by
van.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
传感器的批量操作
parent
8cef0734
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
64 deletions
+158
-64
gateway.component.html
src/app/main/gateway/gateway.component.html
+1
-5
gateway.component.ts
src/app/main/gateway/gateway.component.ts
+39
-18
sensor-mgr.component.html
src/app/main/sensor-mgr/sensor-mgr.component.html
+33
-22
sensor-mgr.component.ts
src/app/main/sensor-mgr/sensor-mgr.component.ts
+83
-17
environment.ts
src/environments/environment.ts
+2
-2
No files found.
src/app/main/gateway/gateway.component.html
View file @
48554d2d
...
@@ -159,18 +159,14 @@
...
@@ -159,18 +159,14 @@
</div>
</div>
<div
class=
"item-input"
>
<div
class=
"item-input"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
ngModelChange
)="
companySelected
()"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
[
nzLabel
]="
one
.
type
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
(
click
)="
companySelected
()"
[
nzLabel
]="
one
.
type
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
{{one.type}} - {{one.sn}}
{{one.type}} - {{one.sn}}
</nz-auto-option>
</nz-auto-option>
</nz-autocomplete>
</nz-autocomplete>
</div>
</div>
</div>
</div>
<app-search-select
inModal=
"true"
*
ngIf=
"req3.device"
[(
value
)]="
req
.
influxdbDatabaseNo
"
[
label
]="'
selectInfluxDB
'
|
translate
"
optL=
"databaseName"
[
data
]="
influxdbs
"
optV=
"influxdbDatabaseNo"
></app-search-select>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="
isMulti
?
('
bindStartTongxinAddr
'
|
translate
)
:
('
bindTongxinAddr
'
|
translate
)"
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="
isMulti
?
('
bindStartTongxinAddr
'
|
translate
)
:
('
bindTongxinAddr
'
|
translate
)"
nz-tooltip
[
nzTitle
]="'
gatewayBindTips
'
|
translate
"
nz-tooltip
[
nzTitle
]="'
gatewayBindTips
'
|
translate
"
[(
value
)]="
req3
.
address
"
></app-search-item>
[(
value
)]="
req3
.
address
"
></app-search-item>
...
...
src/app/main/gateway/gateway.component.ts
View file @
48554d2d
...
@@ -107,19 +107,19 @@ export class GatewayComponent implements OnInit {
...
@@ -107,19 +107,19 @@ export class GatewayComponent implements OnInit {
}
}
companySelected
()
{
companySelected
()
{
if
(
!
this
.
req3
.
device
.
companyNo
)
{
//
if (!this.req3.device.companyNo) {
this
.
message
.
error
(
'该网关并无所属公司'
);
//
this.message.error('该网关并无所属公司');
return
;
//
return;
}
//
}
this
.
isLoading
=
true
;
//
this.isLoading = true;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
this
.
req3
.
device
.
companyNo
},
(
data
)
=>
{
//
this.api.influxdbTables.getByCompanyNo([{companyNo: this.req3.device.companyNo}, (data) => {
if
(
data
&&
data
.
constructor
===
Array
)
{
//
if (data && data.constructor === Array) {
this
.
influxdbs
=
data
;
//
this.influxdbs = data;
}
else
{
//
} else {
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
//
this.message.error(data && data.message ? data.message : '获取数据失败');
}
//
}
this
.
isLoading
=
false
;
//
this.isLoading = false;
}]);
//
}]);
}
}
onSearch
()
{
onSearch
()
{
...
@@ -289,21 +289,33 @@ export class GatewayComponent implements OnInit {
...
@@ -289,21 +289,33 @@ export class GatewayComponent implements OnInit {
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
// 批量新增
}
else
if
(
this
.
isMulti
&&
this
.
isMultiAddConV
)
{
}
else
if
(
this
.
isMulti
&&
this
.
isMultiAddConV
)
{
this
.
api
.
device
.
batchAddGateway
([
this
.
req
,
this
.
next
]);
this
.
api
.
device
.
batchAddGateway
([
this
.
req
,
this
.
next
]);
// 批量绑定
}
else
if
(
this
.
isMulti
&&
this
.
isBindConV
)
{
}
else
if
(
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
bindDeviceAddressVos
=
[];
this
.
req3
.
bindDeviceAddressVos
=
[];
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
req3
.
device
=
null
;
this
.
req3
.
device
=
null
;
this
.
data
.
map
((
one
,
index
)
=>
{
let
i
=
0
;
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
if
(
one
.
checked
)
{
this
.
req3
.
bindDeviceAddressVos
.
push
({
deviceNo
:
one
.
deviceNo
,
address
:
Number
(
this
.
req3
.
address
)
+
index
});
this
.
req3
.
bindDeviceAddressVos
.
push
({
deviceNo
:
one
.
deviceNo
,
address
:
Number
(
this
.
req3
.
address
)
+
i
});
i
++
;
}
}
});
});
this
.
api
.
device
.
batchBindDevice
([
this
.
req3
,
this
.
next
]);
this
.
api
.
device
.
batchBindDevice
([
this
.
req3
,
this
.
next
]);
// 批量分配
}
else
if
(
this
.
isMulti
&&
this
.
isDivideConV
)
{
}
else
if
(
this
.
isMulti
&&
this
.
isDivideConV
)
{
this
.
req4
.
devices
=
[];
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
this
.
req4
.
devices
.
push
(
one
.
deviceNo
);
}
});
this
.
req4
.
influxdbDatabaseNo
=
'ITN78344312655581185'
;
this
.
api
.
device
.
batchUpdateCompany
([
this
.
req4
,
this
.
next
]);
}
}
}
}
...
@@ -346,13 +358,13 @@ export class GatewayComponent implements OnInit {
...
@@ -346,13 +358,13 @@ export class GatewayComponent implements OnInit {
allBind
()
{
allBind
()
{
this
.
isMulti
=
true
;
this
.
isMulti
=
true
;
this
.
isBindConV
=
true
;
this
.
req3
=
{};
this
.
req3
=
{};
this
.
try
=
{
this
.
try
=
{
trans
:
{
address
:
'bindStartTongxinAddr'
},
trans
:
{
address
:
'bindStartTongxinAddr'
},
field
:
[
'address'
],
field
:
[
'address'
],
num
:
[
'address'
]
num
:
[
'address'
]
};
};
this
.
isBindConV
=
true
;
}
}
allDelete
()
{
allDelete
()
{
...
@@ -363,7 +375,16 @@ export class GatewayComponent implements OnInit {
...
@@ -363,7 +375,16 @@ export class GatewayComponent implements OnInit {
});
});
}
}
deleteAll
()
{}
deleteAll
()
{
const
obj
=
[];
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
obj
.
push
(
one
.
deviceNo
);
}
});
this
.
isLoading
=
true
;
this
.
api
.
device
.
batchDelDevice
([
obj
,
this
.
next
]);
}
allUnbind
()
{
allUnbind
()
{
this
.
modalService
.
confirm
({
this
.
modalService
.
confirm
({
...
...
src/app/main/sensor-mgr/sensor-mgr.component.html
View file @
48554d2d
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
</tr>
</tr>
</tbody>
</tbody>
</nz-table>
</nz-table>
<div
class=
"btnLine whenOneLine"
style=
"
text-align: left; margin-top: -48
px;"
>
<div
class=
"btnLine whenOneLine"
style=
"
position: absolute;bottom: 30
px;"
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDelete
()"
>
<button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDelete
()"
>
<span>
{{'delete' | translate}}
</span></button>
<span>
{{'delete' | translate}}
</span></button>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canbind
"
(
click
)="
allBind
()"
><span>
{{'bind' | translate}}
</span>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canbind
"
(
click
)="
allBind
()"
><span>
{{'bind' | translate}}
</span>
...
@@ -81,14 +81,9 @@
...
@@ -81,14 +81,9 @@
<span>
{{'unbind' | translate}}
</span></button>
<span>
{{'unbind' | translate}}
</span></button>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDivide
()"
><span>
{{'divide' | translate}}
</span>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allDivide
()"
><span>
{{'divide' | translate}}
</span>
</button>
</button>
<
button
nz-button
[
nzType
]="'
primary
'"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
isCheckedOne
"
(
click
)="
allUpdate
()"
>
<
!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">--
>
<
span>
{{'update' | translate}}
</span></button
>
<
!--<span>{{'update' | translate}}</span></button>--
>
</div>
</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>
</div>
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzContent
]="
con1
"
nzWidth=
"500"
[
nzTitle
]="
isUpdate
?
('
updateSensor
'
|
translate
)
:
('
addSensor
'
|
translate
)"
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzContent
]="
con1
"
nzWidth=
"500"
[
nzTitle
]="
isUpdate
?
('
updateSensor
'
|
translate
)
:
('
addSensor
'
|
translate
)"
...
@@ -107,33 +102,49 @@
...
@@ -107,33 +102,49 @@
[
data
]="
topicModels
"
inModal=
"true"
optV=
"topicModelNo"
></app-search-select>
[
data
]="
topicModels
"
inModal=
"true"
optV=
"topicModelNo"
></app-search-select>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
<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>
(
valueChange
)="
companySelected
($
event
)"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
<
app-search-select
isMust=
"true"
*
ngIf=
"req.companyNo"
[(
value
)]="
req
.
influxdbDatabaseNo
"
<
!--<app-search-select isMust="true" *ngIf="req.companyNo" [(value)]="req.influxdbDatabaseNo"-->
[
label
]="'
selectInfluxDB
'
|
translate
"
optL=
"databaseName"
<!--[label]="'selectInfluxDB' | translate" optL="databaseName"-->
[
data
]="
influxdbs
"
inModal=
"true"
optV=
"influxdbDatabaseNo"
></app-search-select
>
<!--[data]="influxdbs" inModal="true" optV="influxdbDatabaseNo"></app-search-select>--
>
<app-search-select
[(
value
)]="
req
.
sceneNo
"
[
label
]="'
selectScene
'
|
translate
"
optL=
"sceneName"
<app-search-select
[(
value
)]="
req
.
sceneNo
"
[
label
]="'
selectScene
'
|
translate
"
optL=
"sceneName"
[
data
]="
scenes
"
inModal=
"true"
optV=
"sceneNo"
></app-search-select>
[
data
]="
scenes
"
inModal=
"true"
optV=
"sceneNo"
></app-search-select>
<app-search-item
inModal=
"true"
isMust=
"true"
[
label
]="'
remark
'
|
translate
"
<app-search-item
inModal=
"true"
isMust=
"true"
[
label
]="'
remark
'
|
translate
"
[(
value
)]="
req
.
remark
"
></app-search-item>
[(
value
)]="
req
.
remark
"
></app-search-item>
</ng-template>
</ng-template>
<ng-template
#
foot1
>
<ng-template
#
foot1
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
(
'
isAddConV
'
)"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</ng-template>
</nz-modal>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isMultiAddConV
"
[
nzContent
]="
con2
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isMultiAddConV
"
[
nzContent
]="
con2
"
nzWidth=
"500"
[
nzTitle
]="('
multiAdd
'
|
translate
)
+
('
sensor
'
|
translate
)"
[
nzFooter
]="
foot2
"
(
nzOnCancel
)="
cancel
(
'
isMultiAddConV
'
)"
nzMaskClosable=
"false"
>
[
nzFooter
]="
foot2
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con2
>
<ng-template
#
con2
>
批量新增传感器
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
startSN
'
|
translate
"
[(
value
)]="
req
.
startSN
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
addNum
'
|
translate
"
[(
value
)]="
req
.
num
"
></app-search-item>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
type
'
|
translate
"
[(
value
)]="
req
.
type
"
></app-search-item>
<app-search-select
isMust=
"true"
[(
value
)]="
req
.
topicModelNo
"
[
label
]="'
topicModel
'
|
translate
"
optL=
"topicModelName"
[
data
]="
topicModels
"
inModal=
"true"
optV=
"topicModelNo"
></app-search-select>
<app-search-select
isMust=
"true"
inModal=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
[
data
]="
companys
"
optV=
"companyNo"
></app-search-select>
<!--<app-search-select inModal="true" *ngIf="req.companyNo" [(value)]="req.influxdbDatabaseNo"-->
<!--[label]="'selectInfluxDB' | translate" optL="databaseName"-->
<!--[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>
<ng-template
#
foot2
>
<ng-template
#
foot2
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
(
'
isMultiAddConV
'
)"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
isMultiAddConV
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</ng-template>
</nz-modal>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
[
nzTitle
]="'
bindGateway
'
|
translate
"
<nz-modal
[(
nzVisible
)]="
isBindConV
"
[
nzContent
]="
con3
"
nzWidth=
"500"
[
nzTitle
]="'
bindGateway
'
|
translate
"
[
nzFooter
]="
foot3
"
(
nzOnCancel
)="
cancel
(
'
isBindConV
'
)"
nzMaskClosable=
"false"
>
[
nzFooter
]="
foot3
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con3
>
<ng-template
#
con3
>
<div
class=
"searchItem inModal"
>
<div
class=
"searchItem inModal"
>
<div
class=
"item-label"
>
<div
class=
"item-label"
>
...
@@ -142,7 +153,7 @@
...
@@ -142,7 +153,7 @@
<div
class=
"item-input"
>
<div
class=
"item-input"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
[
nzLabel
]="
one
.
type
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
(
click
)="
companySelected
()"
[
nzLabel
]="
one
.
type
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
{{one.type}} - {{one.sn}}
{{one.type}} - {{one.sn}}
</nz-auto-option>
</nz-auto-option>
</nz-autocomplete>
</nz-autocomplete>
...
@@ -153,7 +164,7 @@
...
@@ -153,7 +164,7 @@
[(
value
)]="
req3
.
address
"
></app-search-item>
[(
value
)]="
req3
.
address
"
></app-search-item>
</ng-template>
</ng-template>
<ng-template
#
foot3
>
<ng-template
#
foot3
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
(
'
isBindConV
'
)"
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
>
<span>
{{'cancel' | translate}}
</span></button>
<span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req3
')"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req3
')"
>
<span>
{{'confirm' | translate}}
</span></button>
<span>
{{'confirm' | translate}}
</span></button>
...
@@ -161,13 +172,13 @@
...
@@ -161,13 +172,13 @@
</nz-modal>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isDivideConV
"
[
nzContent
]="
con5
"
nzWidth=
"500"
[
nzTitle
]="('
divide
'
|
translate
)
+
('
sensor
'
|
translate
)"
<nz-modal
[(
nzVisible
)]="
isDivideConV
"
[
nzContent
]="
con5
"
nzWidth=
"500"
[
nzTitle
]="('
divide
'
|
translate
)
+
('
sensor
'
|
translate
)"
[
nzFooter
]="
foot5
"
(
nzOnCancel
)="
cancel
(
'
isDivideConV
'
)"
nzMaskClosable=
"false"
>
[
nzFooter
]="
foot5
"
(
nzOnCancel
)="
cancel
()"
nzMaskClosable=
"false"
>
<ng-template
#
con5
>
<ng-template
#
con5
>
<app-search-select
isMust=
"true"
[(
value
)]="
req5
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
<app-search-select
isMust=
"true"
[(
value
)]="
req5
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
[
data
]="
companys
"
inModal=
"true"
optV=
"companyNo"
></app-search-select>
</ng-template>
</ng-template>
<ng-template
#
foot5
>
<ng-template
#
foot5
>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
(
'
isDivideConV
'
)"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"default"
[
nzLoading
]="
isLoading
"
(
click
)="
cancel
()"
><span>
{{'cancel' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req5
')"
><span>
{{'confirm' | translate}}
</span></button>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req5
')"
><span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</ng-template>
</nz-modal>
</nz-modal>
src/app/main/sensor-mgr/sensor-mgr.component.ts
View file @
48554d2d
...
@@ -68,12 +68,10 @@ export class SensorMgrComponent implements OnInit {
...
@@ -68,12 +68,10 @@ export class SensorMgrComponent implements OnInit {
if
(
data
&&
data
.
rows
&&
data
.
rows
.
constructor
===
Array
)
{
if
(
data
&&
data
.
rows
&&
data
.
rows
.
constructor
===
Array
)
{
this
.
data
=
data
.
rows
;
this
.
data
=
data
.
rows
;
this
.
total
=
data
.
total
;
this
.
total
=
data
.
total
;
this
.
oneCheck
();
}
else
if
(
data
.
code
===
1
)
{
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
isAddConV
=
false
;
this
.
cancel
();
this
.
isMultiAddConV
=
false
;
this
.
isBindConV
=
false
;
this
.
isDivideConV
=
false
;
this
.
getData
();
this
.
getData
();
}
else
if
(
data
.
code
===
0
)
{
}
else
if
(
data
.
code
===
0
)
{
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'操作失败'
);
...
@@ -208,15 +206,15 @@ export class SensorMgrComponent implements OnInit {
...
@@ -208,15 +206,15 @@ export class SensorMgrComponent implements OnInit {
}
}
companySelected
(
e
)
{
companySelected
(
e
)
{
this
.
isLoading
=
true
;
//
this.isLoading = true;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
e
},
(
data
)
=>
{
//
this.api.influxdbTables.getByCompanyNo([{companyNo: e}, (data) => {
if
(
data
&&
data
.
constructor
===
Array
)
{
//
if (data && data.constructor === Array) {
this
.
influxdbs
=
data
;
//
this.influxdbs = data;
}
else
{
//
} else {
this
.
message
.
error
(
data
&&
data
.
message
?
data
.
message
:
'获取数据失败'
);
//
this.message.error(data && data.message ? data.message : '获取数据失败');
}
//
}
this
.
isLoading
=
false
;
//
this.isLoading = false;
}]);
//
}]);
}
}
// 跳转详情
// 跳转详情
...
@@ -284,8 +282,11 @@ export class SensorMgrComponent implements OnInit {
...
@@ -284,8 +282,11 @@ export class SensorMgrComponent implements OnInit {
field
:
[
'name'
,
'sn'
,
'type'
,
'companyNo'
,
'deviceNo'
]};
field
:
[
'name'
,
'sn'
,
'type'
,
'companyNo'
,
'deviceNo'
]};
}
}
cancel
(
v
)
{
cancel
()
{
this
[
v
]
=
false
;
this
.
isMultiAddConV
=
false
;
this
.
isAddConV
=
false
;
this
.
isBindConV
=
false
;
this
.
isDivideConV
=
false
;
}
}
save
(
v
)
{
save
(
v
)
{
...
@@ -294,22 +295,56 @@ export class SensorMgrComponent implements OnInit {
...
@@ -294,22 +295,56 @@ export class SensorMgrComponent implements OnInit {
this
.
isLoading
=
false
;
this
.
isLoading
=
false
;
return
;
return
;
}
}
// 单个新增
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
!
this
.
isUpdate
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
model
=
1
;
this
.
req
.
model
=
1
;
this
.
api
.
device
.
addSensorOrBlend
([
this
.
req
,
this
.
next
]);
this
.
api
.
device
.
addSensorOrBlend
([
this
.
req
,
this
.
next
]);
// 单个编辑
}
else
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
this
.
isUpdate
)
{
}
else
if
(
!
this
.
isMulti
&&
this
.
isAddConV
&&
this
.
isUpdate
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
model
=
1
;
this
.
req
.
model
=
1
;
this
.
api
.
device
.
updateSensor
([
this
.
req
,
this
.
next
]);
this
.
api
.
device
.
updateSensor
([
this
.
req
,
this
.
next
]);
// 单个绑定
}
else
if
(
!
this
.
isMulti
&&
this
.
isBindConV
)
{
}
else
if
(
!
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
// 单个分配
}
else
if
(
!
this
.
isMulti
&&
this
.
isDivideConV
)
{
}
else
if
(
!
this
.
isMulti
&&
this
.
isDivideConV
)
{
this
.
api
.
device
.
updateCompany
([
this
.
req5
,
this
.
next
]);
this
.
api
.
device
.
updateCompany
([
this
.
req5
,
this
.
next
]);
// 批量新增
}
else
if
(
this
.
isMulti
&&
this
.
isMultiAddConV
)
{
this
.
req
.
alarmMethodNos
=
[];
this
.
req
.
alarmUsers
=
[];
this
.
req
.
model
=
1
;
this
.
api
.
device
.
batchAddSensor
([
this
.
req
,
this
.
next
]);
// 批量绑定
}
else
if
(
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
bindDeviceAddressVos
=
[];
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
?
this
.
req3
.
device
.
influxdbDatabaseNo
:
'ITN78344312655581185'
;
this
.
req3
.
device
=
null
;
let
i
=
0
;
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
this
.
req3
.
bindDeviceAddressVos
.
push
({
deviceNo
:
one
.
deviceNo
,
address
:
Number
(
this
.
req3
.
address
)
+
i
});
i
++
;
}
});
this
.
api
.
device
.
batchBindDevice
([
this
.
req3
,
this
.
next
]);
// 批量分配
}
else
if
(
this
.
isMulti
&&
this
.
isDivideConV
)
{
this
.
req5
.
devices
=
[];
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
this
.
req5
.
devices
.
push
(
one
.
deviceNo
);
}
});
this
.
req5
.
influxdbDatabaseNo
=
'ITN78344312655581185'
;
this
.
api
.
device
.
batchUpdateCompany
([
this
.
req5
,
this
.
next
]);
}
}
}
}
...
@@ -335,16 +370,29 @@ export class SensorMgrComponent implements OnInit {
...
@@ -335,16 +370,29 @@ export class SensorMgrComponent implements OnInit {
multiAdd
()
{
multiAdd
()
{
this
.
isUpdate
=
false
;
this
.
isUpdate
=
false
;
this
.
isMulti
=
true
;
this
.
isMulti
=
true
;
this
.
req
=
{};
this
.
try
=
{
trans
:
{
startSN
:
'startSN'
,
num
:
'addNum'
,
type
:
'type'
,
companyNo
:
'selectCompany'
,
topicModelNo
:
'topicModel'
},
field
:
[
'startSN'
,
'num'
,
'type'
,
'companyNo'
,
'topicModelNo'
]
};
this
.
isMultiAddConV
=
true
;
this
.
isMultiAddConV
=
true
;
}
}
allDivide
()
{
allDivide
()
{
this
.
isMulti
=
true
;
this
.
isMulti
=
true
;
this
.
req5
=
{};
this
.
try
=
{
trans
:
{
companyNo
:
'selectCompany'
},
field
:
[
'companyNo'
]};
this
.
isDivideConV
=
true
;
this
.
isDivideConV
=
true
;
}
}
allBind
()
{
allBind
()
{
this
.
isMulti
=
true
;
this
.
isMulti
=
true
;
this
.
req3
=
{};
this
.
try
=
{
trans
:
{
address
:
'bindStartTongxinAddr'
},
field
:
[
'address'
],
num
:
[
'address'
]
};
this
.
isBindConV
=
true
;
this
.
isBindConV
=
true
;
}
}
...
@@ -356,7 +404,16 @@ export class SensorMgrComponent implements OnInit {
...
@@ -356,7 +404,16 @@ export class SensorMgrComponent implements OnInit {
});
});
}
}
deleteAll
()
{}
deleteAll
()
{
const
obj
=
[];
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
obj
.
push
(
one
.
deviceNo
);
}
});
this
.
isLoading
=
true
;
this
.
api
.
device
.
batchDelDevice
([
obj
,
this
.
next
]);
}
allUnbind
()
{
allUnbind
()
{
this
.
modalService
.
confirm
({
this
.
modalService
.
confirm
({
...
@@ -366,7 +423,16 @@ export class SensorMgrComponent implements OnInit {
...
@@ -366,7 +423,16 @@ export class SensorMgrComponent implements OnInit {
});
});
}
}
unbindAll
()
{}
unbindAll
()
{
const
obj
=
[];
this
.
data
.
map
((
one
)
=>
{
if
(
one
.
checked
)
{
obj
.
push
(
one
.
deviceNo
);
}
});
this
.
isLoading
=
true
;
this
.
api
.
device
.
batchUnBindDevice
([
obj
,
this
.
next
]);
}
toggleOn
(
one
)
{
toggleOn
(
one
)
{
one
.
isLoading
=
true
;
one
.
isLoading
=
true
;
...
...
src/environments/environment.ts
View file @
48554d2d
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
export
const
environment
=
{
export
const
environment
=
{
production
:
false
,
production
:
false
,
//
baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址
baseUrl
:
'http://cloud-test.witium.com/api'
,
// 对外访问测试网地址
// baseUrl: 'http://172.16.1.53:8092', // cy
// baseUrl: 'http://172.16.1.53:8092', // cy
baseUrl
:
'http://172.16.1.52:8094'
,
// zz
//
baseUrl: 'http://172.16.1.52:8094', // zz
// baseUrl: 'http://172.16.1.13:8094', // 测试
// baseUrl: 'http://172.16.1.13:8094', // 测试
};
};
...
...
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