Commit af705aaa authored by van.chen's avatar van.chen

提交一下

parent f30eb7a0
......@@ -4,6 +4,9 @@
</div>
<nz-tabset>
<nz-tab nzTitle="传感器">
<div class="subTitle">
{{'gateway' | translate}} 123456 {{'detail' | translate}}
</div>
<nz-table #nzTable
[nzData]="data"
[nzSize]="'middle'"
......@@ -29,6 +32,9 @@
</nz-table>
</nz-tab>
<nz-tab nzTitle="通道">
<div class="subTitle">
{{'gateway' | translate}} 123456 {{'wayDetail' | translate}}
</div>
<nz-table #nzTable2
[nzData]="data"
[nzSize]="'middle'"
......
......@@ -2,9 +2,14 @@
<app-search-item [label]="'gatewayName' | translate" [(value)]="query.gatewayName"></app-search-item>
<app-search-item [label]="'gatewaySN' | translate" [(value)]="query.gatewaySN"></app-search-item>
<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>-->
<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)="multiAdd()">
<span>{{'multiAdd' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()">
<span>{{'addGateway' | translate}}</span></button>
</div>
</div>
<div class="tableBar" @fade>
......@@ -43,22 +48,69 @@
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.nickName}}</td>
<td nz-td>
<nz-switch [nzControl]="true" (click)="toggleOn(one)" [(ngModel)]="one.isOn"
[nzLoading]="one.isLoading"></nz-switch>
</td>
<td nz-td>{{one.email}}</td>
<td nz-td>{{one.phone}}</td>
<td nz-td>{{one.roleName}}</td>
<td nz-td>{{one.roleName}}</td>
<td nz-td>
<span class="editSpan" (click)="bind(one)">{{'bind' | 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>
</td>
</tr>
</tbody>
</nz-table>
<div class="btnLine whenOneLine" style="text-align: left; margin-top: 10px;">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="delete()"><span>{{'delete' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="bind()"><span>{{'bind' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="divide()"><span>{{'divide' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="unbind()"><span>{{'unbind' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="update()"><span>{{'update' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allDelete()">
<span>{{'delete' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="allBind()"><span>{{'bind' | translate}}</span>
</button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allUnbind()">
<span>{{'unbind' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="allDivide()"><span>{{'divide' | translate}}</span>
</button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (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>
<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"
[nzFooter]="foot1" (nzOnCancel)="cancel(isAddConV)" nzMaskClosable="false">
<ng-template #con1>
11111111
</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>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isMultiAddConV" [nzContent]="con2" nzWidth="500"
[nzFooter]="foot2" (nzOnCancel)="cancel(isMultiAddConV)" nzMaskClosable="false">
<ng-template #con2>
11111111
</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>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isBindCon" [nzContent]="con3" nzWidth="500"
[nzFooter]="foot3" (nzOnCancel)="cancel(isBindCon)" nzMaskClosable="false">
<ng-template #con3>
11111111
</ng-template>
<ng-template #foot3>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel(isBindCon)"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save(isBindCon)"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import {Component, OnInit} from '@angular/core';
import {fadeIn} from '../../animation/fade-in';
import {ApiService} from '../../service/api';
import {NzMessageService} from 'ng-zorro-antd';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {TranslateService} from '@ngx-translate/core';
@Component({
selector: 'app-gateway',
......@@ -32,8 +33,17 @@ export class GatewayComponent implements OnInit {
rows = 10;
total = 125;
listOfBind = [{text: '全部', value: 1}, {text: '已绑定', value: 2}, {text: '未绑定', value: 3}];
constructor(private api: ApiService, private message: NzMessageService, private router: Router) {
selectedOne: any = {};
isAddConV = false;
isMultiAddConV = false;
isBindCon = false;
isMulti = false;
addReq = {};
bindReq = {};
divideReq = {};
constructor(private api: ApiService, private message: NzMessageService, private router: Router,
private modalService: NzModalService, private translate: TranslateService) {
}
ngOnInit() {
......@@ -102,17 +112,90 @@ export class GatewayComponent implements OnInit {
console.log(a, b);
}
delete() {}
getAllChecked() {
const obj = [];
this.data.map((one, index) => {
if (this.checkArray[index]) {
obj.push(index);
}
});
return obj;
}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
allDelete() {
this.modalService.confirm({
nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll()
});
}
delete(one) {}
divide() {}
deleteAll() {
const obj = this.getAllChecked();
console.log(obj);
}
bind() {}
allDivide() {
this.isMulti = true;
}
unbind() {}
allBind() {
this.isMulti = true;
}
update() {}
allUnbind() {
this.isMulti = true;
}
allUpdate() {
this.isMulti = true;
}
multiAdd() {
this.isMulti = true;
}
toSee(e) {
this.router.navigate(['/app/deviceCenter/gatewayMgr/gatewaySee']);
}
add() {
this.isMulti = false;
this.isAddConV = true;
}
bind(one) {
this.isMulti = false;
this.selectedOne = one;
}
update(one) {
this.isMulti = false;
this.selectedOne = one;
}
cancel(v) {
this[v] = false;
}
save(v) {
this[v] = false;
}
toggleOn(one) {
one.isLoading = true;
setTimeout(() => {
one.isOn = !one.isOn;
one.isLoading = false;
}, 2000);
}
}
......@@ -4,6 +4,9 @@
</div>
<nz-tabset>
<nz-tab nzTitle="传感器">
<div class="subTitle">
{{'sensor' | translate}} 123456 {{'detail' | translate}}
</div>
<nz-table #nzTable
[nzData]="data"
[nzSize]="'middle'"
......@@ -12,9 +15,11 @@
[nzLoading]="isLoading">
<thead nz-thead>
<tr>
<th nz-th><span>{{'sensorName' | translate}}</span></th>
<th nz-th><span>{{'wayNum' | translate}}</span></th>
<th nz-th><span>{{'createTime' | translate}}</span></th>
<th nz-th><span>{{'topicName' | translate}}</span></th>
<th nz-th><span>{{'topicType' | translate}}</span></th>
<th nz-th><span>{{'dataType' | translate}}</span></th>
<th nz-th><span>{{'inTime' | translate}}</span></th>
<th nz-th><span>{{'dataSaveInTime' | translate}}</span></th>
<th nz-th><span>{{'oper' | translate}}</span></th>
</tr>
</thead>
......@@ -23,12 +28,17 @@
<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>
</tr>
</tbody>
</nz-table>
</nz-tab>
<nz-tab nzTitle="通道">
<div class="subTitle">
{{'sensor' | translate}} 123456 {{'wayDetail' | translate}}
</div>
<nz-table #nzTable2
[nzData]="data"
[nzSize]="'middle'"
......@@ -38,7 +48,6 @@
<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>
<th nz-th><span>{{'per' | translate}}</span></th>
......@@ -49,14 +58,13 @@
<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>
<th nz-th><span>{{'isbind' | 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>
......
<p>
sensor-mgr works!
</p>
<div class="searchBar" @fade>
<app-search-item [label]="'sensorName' | translate" [(value)]="query.sensorName"></app-search-item>
<app-search-item [label]="'sensorSN' | translate" [(value)]="query.sensorSN"></app-search-item>
<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)="multiAdd()">
<span>{{'multiAdd' | translate}}</span></button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="add()">
<span>{{'addSensor' | translate}}</span></button>
</div>
</div>
<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 nz-th><span>{{'sensorName' | translate}}</span></th>
<th nz-th><span>{{'sensorSN' | translate}}</span></th>
<th nz-th><span>{{'frontName' | translate}}</span></th>
<th nz-th><span>{{'type' | translate}}</span></th>
<th nz-th><span>{{'off/on' | translate}}</span></th>
<th nz-th
nzShowFilter
[nzFilterMultiple]="false"
[nzFilters]="listOfBind"
(nzFilterChange)="filter($event)">
<span>{{'isbind' | translate}}</span></th>
<th nz-th><span>{{'belongCompany' | 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)]="checkArray[i]" (nzCheckedChange)="oneCheck(i)"></td>
<td nz-td class="canClick" (click)="toSee(one)">设备{{i}}</td>
<td nz-td>{{one.realName}}</td>
<td nz-td>{{one.userName}}</td>
<td nz-td>{{one.nickName}}</td>
<td nz-td>
<nz-switch [nzControl]="true" (click)="toggleOn(one)" [(ngModel)]="one.isOn"
[nzLoading]="one.isLoading"></nz-switch>
</td>
<td nz-td>{{one.email}}</td>
<td nz-td>{{one.roleName}}</td>
<td nz-td>
<span class="editSpan" (click)="bind(one)">{{'bind' | 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>
</td>
</tr>
</tbody>
</nz-table>
<div class="btnLine whenOneLine" style="text-align: left; margin-top: 10px;">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allDelete()">
<span>{{'delete' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="allBind()"><span>{{'bind' | translate}}</span>
</button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allUnbind()">
<span>{{'unbind' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (click)="allDivide()"><span>{{'divide' | translate}}</span>
</button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (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"
[nzFooter]="foot1" (nzOnCancel)="cancel(isAddConV)" nzMaskClosable="false">
<ng-template #con1>
11111111
</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>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isMultiAddConV" [nzContent]="con2" nzWidth="500"
[nzFooter]="foot2" (nzOnCancel)="cancel(isMultiAddConV)" nzMaskClosable="false">
<ng-template #con2>
11111111
</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>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isBindCon" [nzContent]="con3" nzWidth="500"
[nzFooter]="foot3" (nzOnCancel)="cancel(isBindCon)" nzMaskClosable="false">
<ng-template #con3>
11111111
</ng-template>
<ng-template #foot3>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel(isBindCon)"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save(isBindCon)"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import { Component, OnInit } from '@angular/core';
import {ApiService} from '../../service/api';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {TranslateService} from '@ngx-translate/core';
import {fadeIn} from '../../animation/fade-in';
@Component({
selector: 'app-sensor-mgr',
templateUrl: './sensor-mgr.component.html',
styles: []
styles: [`
:host ::ng-deep .anticon-filter {
left: 73px;
}
.btnPart {
padding: 10px;
}
`],
animations: [fadeIn]
})
export class SensorMgrComponent implements OnInit {
constructor() { }
data = [];
query = {
sensorName: '',
sensorSN: ''
};
isLoading = false;
isAllCheck = false;
isIndeterminate = false;
checkArray = [];
page = 1;
rows = 10;
total = 125;
listOfBind = [{text: '全部', value: 1}, {text: '已绑定', value: 2}, {text: '未绑定', value: 3}];
selectedOne: any = {};
isAddConV = false;
isMultiAddConV = false;
isBindCon = false;
isMulti = false;
addReq = {};
bindReq = {};
divideReq = {};
constructor(private api: ApiService, private message: NzMessageService, private router: Router,
private modalService: NzModalService, private translate: TranslateService) {
}
ngOnInit() {
this.init();
}
init() {
this.getData();
}
next = (data) => {
if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows;
this.total = data.total;
this.initCheckArray(data.rows.length, false);
} else if (data.code === 1) {
this.message.success(data && data.message ? data.message : '操作成功');
} 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.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
}
initCheckArray(n, b) {
const obj = [];
while (n > 0) {
obj.push(b);
n--;
}
this.checkArray = obj;
}
onSearch() {
}
onGetAll() {
}
checkAll(e) {
this.isIndeterminate = false;
this.initCheckArray(this.checkArray.length, e);
}
oneCheck(i) {
const x = this.checkArray.filter(k => k).length;
if (x === this.checkArray.length) {
this.isIndeterminate = false;
this.isAllCheck = true;
} else if (x === 0) {
this.isIndeterminate = false;
this.isAllCheck = false;
} else {
this.isIndeterminate = true;
this.isAllCheck = false;
}
}
filter(a, b) {
console.log(a, b);
}
getAllChecked() {
const obj = [];
this.data.map((one, index) => {
if (this.checkArray[index]) {
obj.push(index);
}
});
return obj;
}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
allDelete() {
this.modalService.confirm({
nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll()
});
}
delete(one) {}
deleteAll() {
const obj = this.getAllChecked();
console.log(obj);
}
allDivide() {
this.isMulti = true;
}
allBind() {
this.isMulti = true;
}
allUnbind() {
this.isMulti = true;
}
allUpdate() {
this.isMulti = true;
}
multiAdd() {
this.isMulti = true;
}
toSee(e) {
this.router.navigate(['/app/deviceCenter/sensorMgr/sensorDetail']);
}
add() {
this.isMulti = false;
this.isAddConV = true;
}
bind(one) {
this.isMulti = false;
this.selectedOne = one;
}
update(one) {
this.isMulti = false;
this.selectedOne = one;
}
cancel(v) {
this[v] = false;
}
save(v) {
this[v] = false;
}
toggleOn(one) {
one.isLoading = true;
setTimeout(() => {
one.isOn = !one.isOn;
one.isLoading = false;
}, 2000);
}
}
......@@ -66,6 +66,7 @@
"editRole": "编辑角色",
"addRole": "新增角色",
"confirmDeleteThisRecord": "确认删除这条记录吗",
"confirmDeleteSelectedRecord": "确认批量删除选中的这些记录吗",
"loginOutValidityTips": "登录凭证失效,请重新登录",
"noLoginTips": "您尚未登录,请登录",
"wrongServerWithCode": "服务器异常,错误代码: ",
......@@ -94,5 +95,18 @@
"alarmMaxMax": "报警上上限",
"alarmMin": "报警下限",
"alarmMinMin": "报警下下限",
"sensorDetail": "传感器详情"
"sensorDetail": "传感器详情",
"topicName": "主题名",
"topicType": "主题类型",
"dataType": "数据类型",
"inTime": "间隔时间/ms",
"dataSaveInTime": "数据存储间隔时间/ms",
"sensor": "传感器",
"wayDetail": "通道详情",
"detail": "详情",
"gateway": "网关",
"multiAdd": "批量新增",
"addGateway": "新增网关",
"frontName": "前缀名",
"addSensor": "新增传感器"
}
......@@ -118,7 +118,7 @@ ol, ul {
}
.textStyle1 {
color: #000;
color: #ffffff;
font-weight: 400;
font-size: 1rem;
}
......@@ -371,3 +371,11 @@ span.addSpan {
top: 5px;
z-index: 2;
}
.subTitle {
line-height: 30px;
margin-bottom: 15px;
font-size: 18px;
text-indent: 5px;
font-weight: 500;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment