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
64873932
Commit
64873932
authored
Apr 26, 2019
by
van.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网管的一些批量操作
parent
95ab2f6f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
40 deletions
+99
-40
gateway.component.html
src/app/main/gateway/gateway.component.html
+29
-18
gateway.component.ts
src/app/main/gateway/gateway.component.ts
+54
-11
sensor-mgr.component.html
src/app/main/sensor-mgr/sensor-mgr.component.html
+5
-5
sensor-mgr.component.ts
src/app/main/sensor-mgr/sensor-mgr.component.ts
+4
-4
zh.json
src/assets/i18n/zh.json
+5
-1
environment.ts
src/environments/environment.ts
+2
-1
No files found.
src/app/main/gateway/gateway.component.html
View file @
64873932
...
...
@@ -75,7 +75,7 @@
</tr>
</tbody>
</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
()"
>
<span>
{{'delete' | translate}}
</span></button>
<button
nz-button
class=
"btnAll"
[
nzLoading
]="
isLoading
"
[
disabled
]="!
canbind
"
(
click
)="
allBind
()"
>
...
...
@@ -86,13 +86,8 @@
<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>
<!--<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">-->
<!--<span>{{'update' | translate}}</span></button>-->
</div>
</div>
<nz-modal
[(
nzVisible
)]="
isAddConV
"
[
nzTitle
]="
isUpdate
?
('
updateGateway
'
|
translate
)
:
('
addGateway
'
|
translate
)"
...
...
@@ -111,11 +106,10 @@
[(
value
)]="
req
.
configJson
"
></app-search-item>
<app-search-select
isMust=
"true"
inModal=
"true"
[(
value
)]="
req
.
companyNo
"
[
label
]="'
selectCompany
'
|
translate
"
optL=
"companyName"
(
valueChange
)="
companySelected
($
event
)"
[
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" *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
"
...
...
@@ -129,15 +123,29 @@
</ng-template>
</nz-modal>
<nz-modal
[(
nzVisible
)]="
isMultiAddConV
"
[
nzContent
]="
con2
"
nzWidth=
"500"
<nz-modal
[(
nzVisible
)]="
isMultiAddConV
"
[
nzContent
]="
con2
"
nzWidth=
"500"
[
nzTitle
]="('
multiAdd
'
|
translate
)
+
('
gateway
'
|
translate
)"
[
nzFooter
]="
foot2
"
(
nzOnCancel
)="
cancel
('
isMultiAddConV
')"
nzMaskClosable=
"false"
>
<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"
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
#
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
('
req
2
')"
>
<button
nz-button
nzType=
"primary"
[
nzLoading
]="
isLoading
"
(
click
)="
save
('
req
')"
>
<span>
{{'confirm' | translate}}
</span></button>
</ng-template>
</nz-modal>
...
...
@@ -151,6 +159,7 @@
</div>
<div
class=
"item-input"
>
<input
nz-input
placeholder=
""
[
nzAutocomplete
]="
auto
"
[(
ngModel
)]="
req3
.
device
"
(
ngModelChange
)="
companySelected
()"
(
input
)="
onInput
($
event
.
target
?.
value
)"
>
<nz-autocomplete
nzBackfill
#
auto
>
<nz-auto-option
*
ngFor=
"let one of selectedGateways"
[
nzLabel
]="
one
.
type
+
'
-
'
+
one
.
sn
"
[
nzValue
]="
one
"
>
...
...
@@ -159,8 +168,11 @@
</nz-autocomplete>
</div>
</div>
<app-search-item
isMust=
"true"
inModal=
"true"
[
label
]="'
bindTongxinAddr
'
|
translate
"
nz-tooltip
[
nzTitle
]="'
gatewayBindTips
'
|
translate
"
<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
)"
nz-tooltip
[
nzTitle
]="'
gatewayBindTips
'
|
translate
"
[(
value
)]="
req3
.
address
"
></app-search-item>
</ng-template>
<ng-template
#
foot3
>
...
...
@@ -176,7 +188,6 @@
[
nzFooter
]="
foot4
"
(
nzOnCancel
)="
cancel
('
isDivideConV
')"
nzMaskClosable=
"false"
>
<ng-template
#
con4
>
<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
>
...
...
src/app/main/gateway/gateway.component.ts
View file @
64873932
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
OnInit
,
ViewChild
}
from
'@angular/core'
;
import
{
fadeIn
}
from
'../../animation/fade-in'
;
import
{
ApiService
}
from
'../../service/api'
;
import
{
NzMessageService
,
NzModalService
}
from
'ng-zorro-antd'
;
...
...
@@ -26,7 +26,6 @@ export class GatewayComponent implements OnInit {
isAllCheck
=
false
;
isIndeterminate
=
false
;
listOfBind
=
[{
text
:
'已绑定'
,
value
:
1
},
{
text
:
'未绑定'
,
value
:
0
}];
selectedOne
:
any
=
{};
isAddConV
=
false
;
isMultiAddConV
=
false
;
isUpdate
=
false
;
...
...
@@ -48,6 +47,7 @@ export class GatewayComponent implements OnInit {
page
=
1
;
rows
=
10
;
total
=
0
;
@
ViewChild
(
'influxdb'
)
influx
;
constructor
(
private
api
:
ApiService
,
private
message
:
NzMessageService
,
private
router
:
Router
,
private
modalService
:
NzModalService
,
private
translate
:
TranslateService
,
...
...
@@ -68,6 +68,7 @@ export class GatewayComponent implements OnInit {
this
.
canBindGateways
=
data
.
rows
.
filter
(
one
=>
!
one
.
pDeviceNo
);
this
.
data
=
data
.
rows
;
this
.
total
=
data
.
total
;
this
.
oneCheck
();
}
else
if
(
data
.
code
===
1
)
{
this
.
message
.
success
(
data
&&
data
.
message
?
data
.
message
:
'操作成功'
);
this
.
isAddConV
=
false
;
...
...
@@ -105,9 +106,13 @@ export class GatewayComponent implements OnInit {
}]);
}
companySelected
(
e
)
{
companySelected
()
{
if
(
!
this
.
req3
.
device
.
companyNo
)
{
this
.
message
.
error
(
'该网关并无所属公司'
);
return
;
}
this
.
isLoading
=
true
;
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
e
},
(
data
)
=>
{
this
.
api
.
influxdbTables
.
getByCompanyNo
([{
companyNo
:
this
.
req3
.
device
.
companyNo
},
(
data
)
=>
{
if
(
data
&&
data
.
constructor
===
Array
)
{
this
.
influxdbs
=
data
;
}
else
{
...
...
@@ -176,10 +181,10 @@ export class GatewayComponent implements OnInit {
this
.
canbind
=
false
;
this
.
canUnbind
=
false
;
}
else
{
const
flag
=
obj
[
0
].
pDeviceNo
&&
true
;
if
(
obj
.
filter
(
one
=>
(
obj
[
0
].
pDeviceNo
&&
true
)
===
flag
).
length
===
obj
.
length
)
{
this
.
canbind
=
flag
;
this
.
canUnbind
=
!
flag
;
const
flag
:
boolean
=
!!
obj
[
0
].
pDeviceNo
;
if
(
obj
.
filter
(
one
=>
(
!!
one
.
pDeviceNo
)
===
flag
).
length
===
obj
.
length
)
{
this
.
canbind
=
!
flag
;
this
.
canUnbind
=
flag
;
}
else
{
this
.
canbind
=
false
;
this
.
canUnbind
=
false
;
...
...
@@ -222,7 +227,8 @@ export class GatewayComponent implements OnInit {
};
this
.
try
=
{
trans
:
{
address
:
'bindTongxinAddr'
},
field
:
[
'address'
,
'deviceNo'
]
field
:
[
'address'
,
'deviceNo'
],
num
:
[
'address'
]
};
this
.
isBindConV
=
true
;
}
...
...
@@ -243,7 +249,6 @@ export class GatewayComponent implements OnInit {
update
(
one
)
{
this
.
isMulti
=
false
;
this
.
req
=
{...
one
};
this
.
companySelected
(
one
.
companyNo
);
this
.
try
=
{
trans
:
{
name
:
'gatewayName'
,
sn
:
'gatewaySN'
,
companyNo
:
'selectCompany'
},
field
:
[
'name'
,
'sn'
,
'companyNo'
,
'deviceNo'
]
...
...
@@ -280,9 +285,25 @@ export class GatewayComponent implements OnInit {
this
.
api
.
device
.
updateCompany
([
this
.
req4
,
this
.
next
]);
// 单个绑定
}
else
if
(
!
this
.
isMulti
&&
this
.
isBindConV
)
{
this
.
req3
.
device
=
null
;
this
.
req3
.
pDeviceNo
=
this
.
req3
.
device
.
deviceNo
;
this
.
req3
.
influxdbDatabaseNo
=
this
.
req3
.
device
.
influxdbDatabaseNo
;
this
.
api
.
device
.
gatewayBindGateway
([
this
.
req3
,
this
.
next
]);
}
else
if
(
this
.
isMulti
&&
this
.
isMultiAddConV
)
{
this
.
api
.
device
.
batchAddGateway
([
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
=
null
;
this
.
data
.
map
((
one
,
index
)
=>
{
if
(
one
.
checked
)
{
this
.
req3
.
bindDeviceAddressVos
.
push
({
deviceNo
:
one
.
deviceNo
,
address
:
Number
(
this
.
req3
.
address
)
+
index
});
}
});
this
.
api
.
device
.
batchBindDevice
([
this
.
req3
,
this
.
next
]);
}
else
if
(
this
.
isMulti
&&
this
.
isDivideConV
)
{
}
}
...
...
@@ -307,18 +328,31 @@ export class GatewayComponent implements OnInit {
multiAdd
()
{
this
.
isUpdate
=
false
;
this
.
req
=
{};
this
.
try
=
{
trans
:
{
startSN
:
'startSN'
,
num
:
'addNum'
,
type
:
'type'
,
companyNo
:
'selectCompany'
},
field
:
[
'startSN'
,
'num'
,
'type'
,
'companyNo'
]
};
this
.
isMulti
=
true
;
this
.
isMultiAddConV
=
true
;
}
allDivide
()
{
this
.
req4
=
{};
this
.
isMulti
=
true
;
this
.
isDivideConV
=
true
;
this
.
try
=
{
trans
:
{
companyNo
:
'selectCompany'
},
field
:
[
'companyNo'
]};
}
allBind
()
{
this
.
isMulti
=
true
;
this
.
isBindConV
=
true
;
this
.
req3
=
{};
this
.
try
=
{
trans
:
{
address
:
'bindStartTongxinAddr'
},
field
:
[
'address'
],
num
:
[
'address'
]
};
}
allDelete
()
{
...
...
@@ -339,7 +373,16 @@ export class GatewayComponent implements OnInit {
});
}
unbindAll
()
{}
unbindAll
()
{
this
.
isLoading
=
true
;
const
obj
=
[];
this
.
data
.
map
(
one
=>
{
if
(
one
.
checked
)
{
obj
.
push
(
one
.
deviceNo
);
}
});
this
.
api
.
device
.
batchUnBindDevice
([
obj
,
this
.
next
]);
}
toggleOn
(
one
)
{
one
.
isLoading
=
true
;
...
...
src/app/main/sensor-mgr/sensor-mgr.component.html
View file @
64873932
...
...
@@ -84,11 +84,11 @@
<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="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"
[
nzTitle
]="
isUpdate
?
('
updateSensor
'
|
translate
)
:
('
addSensor
'
|
translate
)"
...
...
src/app/main/sensor-mgr/sensor-mgr.component.ts
View file @
64873932
...
...
@@ -190,10 +190,10 @@ export class SensorMgrComponent implements OnInit {
this
.
canbind
=
false
;
this
.
canUnbind
=
false
;
}
else
{
const
flag
=
obj
[
0
].
isOn
;
if
(
obj
.
filter
(
one
=>
one
.
isOn
===
flag
).
length
===
obj
.
length
)
{
this
.
canbind
=
flag
;
this
.
canUnbind
=
!
flag
;
const
flag
:
boolean
=
!!
obj
[
0
].
pDeviceNo
;
if
(
obj
.
filter
(
one
=>
(
!!
one
.
pDeviceNo
)
===
flag
).
length
===
obj
.
length
)
{
this
.
canbind
=
!
flag
;
this
.
canUnbind
=
flag
;
}
else
{
this
.
canbind
=
false
;
this
.
canUnbind
=
false
;
...
...
src/assets/i18n/zh.json
View file @
64873932
...
...
@@ -158,9 +158,13 @@
"isSaveOtherProbesModel"
:
"另存为通道模板"
,
"isSaveOtherTopicModel"
:
"另存为主题模板"
,
"bindTongxinAddr"
:
"绑定通信地址"
,
"bindStartTongxinAddr"
:
"绑定通信起始地址"
,
"bindUpGateway"
:
"绑定上级网关"
,
"gatewayBindTips"
:
"Modbus, Sub1G, LoRa等通信协议地址"
,
"wrongNum"
:
"数值填写错误"
,
"updateTopic"
:
"编辑主题"
,
"wrongEng"
:
"部分字段要求为英文格式"
"wrongEng"
:
"部分字段要求为英文格式"
,
"addNum"
:
"新增数量"
,
"startSN"
:
"起始序列号"
,
"confirmUnbindSelectedRecord"
:
"确认解绑选中的这些设备吗"
}
src/environments/environment.ts
View file @
64873932
...
...
@@ -6,7 +6,8 @@ export const environment = {
production
:
false
,
// baseUrl: 'http://cloud-test.witium.com/api', // 对外访问测试网地址
// 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'
,
// 测试
};
/*
...
...
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