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

提交一下

parent e5b63ff3
...@@ -14,12 +14,8 @@ ...@@ -14,12 +14,8 @@
<nz-header class="logoBackground bottomLine" style="background-color: #002661;padding:0;position:fixed; width:100%;z-index: 99;border-bottom: 1px solid rgb(230, 230, 230);"> <nz-header class="logoBackground bottomLine" style="background-color: #002661;padding:0;position:fixed; width:100%;z-index: 99;border-bottom: 1px solid rgb(230, 230, 230);">
<i class="io trigger textStyle1 whenHover" [class.i-shou]="!isCollapsed" <i class="io trigger textStyle1 whenHover" [class.i-shou]="!isCollapsed"
[class.i-fang]="isCollapsed" (click)="changeCollapsed()"></i> [class.i-fang]="isCollapsed" (click)="changeCollapsed()"></i>
<label class="linkToPersonSetting whenHover textStyle1" routerLink="/app/system/person">
<i class="io i-person"></i>
{{'person' | translate}}
</label>
<label class="loginOut whenHover textStyle1" (click)="loginOut()"> <label class="loginOut whenHover textStyle1" (click)="loginOut()">
{{'signOut' | translate}} <i class="io i-out"></i>
</label> </label>
</nz-header> </nz-header>
<nz-content id="layoutCon" style="margin-top:64px;overflow: auto;"> <nz-content id="layoutCon" style="margin-top:64px;overflow: auto;">
......
...@@ -31,13 +31,13 @@ ...@@ -31,13 +31,13 @@
<th nz-th><span>{{'type' | translate}}</span></th> <th nz-th><span>{{'type' | translate}}</span></th>
<th nz-th><span>{{'simCardNum' | translate}}</span></th> <th nz-th><span>{{'simCardNum' | translate}}</span></th>
<th nz-th><span>{{'off/on' | translate}}</span></th> <th nz-th><span>{{'off/on' | translate}}</span></th>
<th nz-th><span>{{'belongCompany' | translate}}</span></th>
<th nz-th <th nz-th
nzShowFilter nzShowFilter
[nzFilterMultiple]="false" [nzFilterMultiple]="false"
[nzFilters]="listOfBind" [nzFilters]="listOfBind"
(nzFilterChange)="filter($event)"> (nzFilterChange)="filter($event)">
<span>{{'isbind' | translate}}</span></th> <span>{{'isbind' | translate}}</span></th>
<th nz-th><span>{{'belongCompany' | translate}}</span></th>
<th nz-th><span>{{'oper' | translate}}</span></th> <th nz-th><span>{{'oper' | translate}}</span></th>
</tr> </tr>
</thead> </thead>
...@@ -83,34 +83,56 @@ ...@@ -83,34 +83,56 @@
</div> </div>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500" <nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" (nzOnCancel)="cancel(isAddConV)" nzMaskClosable="false"> [nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1> <ng-template #con1>
11111111 新增网关
</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('isAddConV')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save(isAddConV)"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isAddConV')"><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"
[nzFooter]="foot2" (nzOnCancel)="cancel(isMultiAddConV)" nzMaskClosable="false"> [nzFooter]="foot2" (nzOnCancel)="cancel('isMultiAddConV')" nzMaskClosable="false">
<ng-template #con2> <ng-template #con2>
11111111 批量新增网关
</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('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="primary" [nzLoading]="isLoading" (click)="save('isMultiAddConV')"><span>{{'confirm' | translate}}</span></button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isBindCon" [nzContent]="con3" nzWidth="500" <nz-modal [(nzVisible)]="isBindConV" [nzContent]="con3" nzWidth="500"
[nzFooter]="foot3" (nzOnCancel)="cancel(isBindCon)" nzMaskClosable="false"> [nzFooter]="foot3" (nzOnCancel)="cancel('isBindConV')" nzMaskClosable="false">
<ng-template #con3> <ng-template #con3>
11111111 绑定/批量绑定网关
</ng-template> </ng-template>
<ng-template #foot3> <ng-template #foot3>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel(isBindCon)"><span>{{'cancel' | 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(isBindCon)"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isBindConV')"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isUpdateConV" [nzContent]="con4" nzWidth="500"
[nzFooter]="foot4" (nzOnCancel)="cancel('isUpdateConV')" nzMaskClosable="false">
<ng-template #con4>
编辑网关
</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>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -35,14 +35,13 @@ export class GatewayComponent implements OnInit { ...@@ -35,14 +35,13 @@ export class GatewayComponent implements OnInit {
selectedOne: any = {}; selectedOne: any = {};
isAddConV = false; isAddConV = false;
isMultiAddConV = false; isMultiAddConV = false;
isBindCon = false; isBindConV = false;
isMulti = false; isMulti = false;
addReq = {};
bindReq = {};
divideReq = {};
canbind = false; canbind = false;
canUnbind = false; canUnbind = false;
isCheckedOne = false; isCheckedOne = false;
isUpdateConV = false;
isDivideConV = false;
constructor(private api: ApiService, private message: NzMessageService, private router: Router, constructor(private api: ApiService, private message: NzMessageService, private router: Router,
private modalService: NzModalService, private translate: TranslateService) { private modalService: NzModalService, private translate: TranslateService) {
...@@ -75,6 +74,13 @@ export class GatewayComponent implements OnInit { ...@@ -75,6 +74,13 @@ export class GatewayComponent implements OnInit {
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]); this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
} }
onSearch() {
}
onGetAll() {
}
// 复选框的方法
initCheckArray(b) { initCheckArray(b) {
if (b) { if (b) {
this.isCheckedOne = true; this.isCheckedOne = true;
...@@ -82,12 +88,6 @@ export class GatewayComponent implements OnInit { ...@@ -82,12 +88,6 @@ export class GatewayComponent implements OnInit {
this.data.map((one) => one.checked = b); this.data.map((one) => one.checked = b);
} }
onSearch() {
}
onGetAll() {
}
checkAll(e) { checkAll(e) {
this.isIndeterminate = false; this.isIndeterminate = false;
this.initCheckArray(e); this.initCheckArray(e);
...@@ -128,76 +128,103 @@ export class GatewayComponent implements OnInit { ...@@ -128,76 +128,103 @@ export class GatewayComponent implements OnInit {
} }
} }
// 筛选
filter(a, b) { filter(a, b) {
console.log(a, b); console.log(a, b);
} }
deleteConfirm(one) { // 跳转详情
this.modalService.confirm({ toSee(e) {
nzTitle : '<i></i>', this.router.navigate(['/app/deviceCenter/gatewayMgr/gatewaySee']);
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
} }
allDelete() { // 单个的方法
add() {
this.isMulti = false;
this.isAddConV = true;
}
bind(one) {
this.isMulti = false;
this.selectedOne = one;
this.isBindConV = true;
}
unbind(one) {
this.modalService.confirm({ this.modalService.confirm({
nzTitle : '<i></i>', nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>', nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll() nzOnOk : () => this.unbindOne(one)
}); });
} }
delete(one) {} unbindOne(one) {}
deleteAll() {} update(one) {
this.isMulti = false;
this.selectedOne = one;
this.isUpdateConV = true;
}
allDivide() { cancel(v) {
this.isMulti = true; this[v] = false;
} }
allBind() { save(v) {
this.isMulti = true; this[v] = false;
} }
allUnbind() { deleteConfirm(one) {
this.isMulti = true; this.modalService.confirm({
nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
} }
delete(one) {}
// 批量的方法
allUpdate() { allUpdate() {
this.isMulti = true; this.isMulti = true;
this.isUpdateConV = true;
} }
multiAdd() { multiAdd() {
this.isMulti = true; this.isMulti = true;
this.isMultiAddConV = true;
} }
toSee(e) { allDivide() {
this.router.navigate(['/app/deviceCenter/gatewayMgr/gatewaySee']); this.isMulti = true;
this.isDivideConV = true;
} }
add() { allBind() {
this.isMulti = false; this.isMulti = true;
this.isAddConV = true; this.isBindConV = true;
} }
bind(one) { allDelete() {
this.isMulti = false; this.modalService.confirm({
this.selectedOne = one; nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll()
});
} }
update(one) { deleteAll() {}
this.isMulti = false;
this.selectedOne = one;
}
cancel(v) { allUnbind() {
this[v] = false; this.modalService.confirm({
} nzTitle : '<i> </i>',
save(v) { nzContent: '<b>' + this.translate.instant('confirmUnbindSelectedRecord') + '</b>',
this[v] = false; nzOnOk : () => this.unbindAll()
});
} }
unbindAll() {}
toggleOn(one) { toggleOn(one) {
one.isLoading = true; one.isLoading = true;
setTimeout(() => { setTimeout(() => {
......
...@@ -45,3 +45,24 @@ ...@@ -45,3 +45,24 @@
</tbody> </tbody>
</nz-table> </nz-table>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1>
新增/编辑通道模板
</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)]="isSaveOther" [nzContent]="con2" nzWidth="500"
[nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false">
<ng-template #con2>
另存为通道模板
</ng-template>
<ng-template #foot2>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isSaveOther')"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ApiService} from '../../service/api'; import {ApiService} from '../../service/api';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {fadeIn} from '../../animation/fade-in'; import {fadeIn} from '../../animation/fade-in';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
...@@ -19,8 +19,11 @@ export class ModuleMgrComponent implements OnInit { ...@@ -19,8 +19,11 @@ export class ModuleMgrComponent implements OnInit {
page: any = 1; page: any = 1;
rows: any = 10; rows: any = 10;
total: any; total: any;
isAddConV = false;
isSaveOther = false;
isUpdate = false;
constructor(private api: ApiService, private message: NzMessageService, constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService,
private translate: TranslateService, private router: Router) { private translate: TranslateService, private router: Router) {
} }
...@@ -75,11 +78,35 @@ export class ModuleMgrComponent implements OnInit { ...@@ -75,11 +78,35 @@ export class ModuleMgrComponent implements OnInit {
this.router.navigate(['/app/deviceCenter/moduleMgr/moduleDetail']); this.router.navigate(['/app/deviceCenter/moduleMgr/moduleDetail']);
} }
saveOther(one) {} saveOther(one) {
this.isSaveOther = true;
}
update(one) {} add() {
this.isUpdate = false;
this.isAddConV = true;
}
deleteConfirm(one) {} update(one) {
this.isUpdate = true;
this.isAddConV = true;
}
cancel(v) {
this[v] = false;
}
save(v) {
this[v] = false;
}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
add() {} delete(one) {}
} }
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</thead> </thead>
<tbody nz-tbody> <tbody nz-tbody>
<tr *ngFor="let one of nzTable.data,let i = index"> <tr *ngFor="let one of nzTable.data,let i = index">
<td nzShowCheckbox [(nzChecked)]="checkArray[i]" (nzCheckedChange)="oneCheck(i)"></td> <td nzShowCheckbox [(nzChecked)]="one.checked" (nzCheckedChange)="oneCheck()"></td>
<td nz-td class="canClick" (click)="toSee(one)">设备{{i}}</td> <td nz-td class="canClick" (click)="toSee(one)">设备{{i}}</td>
<td nz-td>{{one.realName}}</td> <td nz-td>{{one.realName}}</td>
<td nz-td>{{one.userName}}</td> <td nz-td>{{one.userName}}</td>
...@@ -65,15 +65,15 @@ ...@@ -65,15 +65,15 @@
</tbody> </tbody>
</nz-table> </nz-table>
<div class="btnLine whenOneLine" style="text-align: left; margin-top: 10px;"> <div class="btnLine whenOneLine" style="text-align: left; margin-top: 10px;">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (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" (click)="allBind()"><span>{{'bind' | translate}}</span> <button nz-button class="btnAll" [nzLoading]="isLoading" [disabled]="!canbind" (click)="allBind()"><span>{{'bind' | translate}}</span>
</button> </button>
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allUnbind()"> <button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">
<span>{{'unbind' | translate}}</span></button> <span>{{'unbind' | translate}}</span></button>
<button nz-button class="btnAll" [nzLoading]="isLoading" (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" (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"> <div class="pagePart whenOneLine">
...@@ -82,35 +82,58 @@ ...@@ -82,35 +82,58 @@
<ng-template #totalTemplate> 共 {{ total }} 项</ng-template> <ng-template #totalTemplate> 共 {{ total }} 项</ng-template>
</div> </div>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500" <nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" (nzOnCancel)="cancel(isAddConV)" nzMaskClosable="false"> [nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1> <ng-template #con1>
11111111 新增传感器
</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('isAddConV')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save(isAddConV)"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isAddConV')"><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"
[nzFooter]="foot2" (nzOnCancel)="cancel(isMultiAddConV)" nzMaskClosable="false"> [nzFooter]="foot2" (nzOnCancel)="cancel('isMultiAddConV')" nzMaskClosable="false">
<ng-template #con2> <ng-template #con2>
11111111 批量新增传感器
</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('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="primary" [nzLoading]="isLoading" (click)="save('isMultiAddConV')"><span>{{'confirm' | translate}}</span></button>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="isBindCon" [nzContent]="con3" nzWidth="500" <nz-modal [(nzVisible)]="isBindConV" [nzContent]="con3" nzWidth="500"
[nzFooter]="foot3" (nzOnCancel)="cancel(isBindCon)" nzMaskClosable="false"> [nzFooter]="foot3" (nzOnCancel)="cancel('isBindConV')" nzMaskClosable="false">
<ng-template #con3> <ng-template #con3>
11111111 绑定/批量绑定传感器
</ng-template> </ng-template>
<ng-template #foot3> <ng-template #foot3>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel(isBindCon)"><span>{{'cancel' | 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(isBindCon)"><span>{{'confirm' | translate}}</span></button> <button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isBindConV')"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
<nz-modal [(nzVisible)]="isUpdateConV" [nzContent]="con4" nzWidth="500"
[nzFooter]="foot4" (nzOnCancel)="cancel('isUpdateConV')" nzMaskClosable="false">
<ng-template #con4>
编辑传感器
</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>
</ng-template> </ng-template>
</nz-modal> </nz-modal>
...@@ -22,13 +22,12 @@ export class SensorMgrComponent implements OnInit { ...@@ -22,13 +22,12 @@ export class SensorMgrComponent implements OnInit {
data = []; data = [];
query = { query = {
sensorName: '', gatewayName: '',
sensorSN: '' gatewaySN: ''
}; };
isLoading = false; isLoading = false;
isAllCheck = false; isAllCheck = false;
isIndeterminate = false; isIndeterminate = false;
checkArray = [];
page = 1; page = 1;
rows = 10; rows = 10;
total = 125; total = 125;
...@@ -36,11 +35,13 @@ export class SensorMgrComponent implements OnInit { ...@@ -36,11 +35,13 @@ export class SensorMgrComponent implements OnInit {
selectedOne: any = {}; selectedOne: any = {};
isAddConV = false; isAddConV = false;
isMultiAddConV = false; isMultiAddConV = false;
isBindCon = false; isBindConV = false;
isMulti = false; isMulti = false;
addReq = {}; canbind = false;
bindReq = {}; canUnbind = false;
divideReq = {}; isCheckedOne = false;
isDivideConV = false;
isUpdateConV = false;
constructor(private api: ApiService, private message: NzMessageService, private router: Router, constructor(private api: ApiService, private message: NzMessageService, private router: Router,
private modalService: NzModalService, private translate: TranslateService) { private modalService: NzModalService, private translate: TranslateService) {
...@@ -56,9 +57,8 @@ export class SensorMgrComponent implements OnInit { ...@@ -56,9 +57,8 @@ export class SensorMgrComponent implements OnInit {
next = (data) => { next = (data) => {
if (data && data.rows && data.rows.constructor === Array) { if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows; this.data = data.rows.filter(one => { one.isOn = Math.random() > 0.5; return one; });
this.total = data.total; this.total = data.total;
this.initCheckArray(data.rows.length, false);
} 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 : '操作成功');
} else if (data.code === 0) { } else if (data.code === 0) {
...@@ -67,130 +67,164 @@ export class SensorMgrComponent implements OnInit { ...@@ -67,130 +67,164 @@ export class SensorMgrComponent implements OnInit {
this.message.error(data && data.message ? data.message : '获取数据失败'); this.message.error(data && data.message ? data.message : '获取数据失败');
} }
this.isLoading = false; this.isLoading = false;
}; }
getData() { getData() {
this.isLoading = true; this.isLoading = true;
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]); 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() { onSearch() {
} }
onGetAll() { onGetAll() {
} }
// 复选框的方法
initCheckArray(b) {
if (b) {
this.isCheckedOne = true;
}
this.data.map((one) => one.checked = b);
}
checkAll(e) { checkAll(e) {
this.isIndeterminate = false; this.isIndeterminate = false;
this.initCheckArray(this.checkArray.length, e); this.initCheckArray(e);
this.checkCanBind();
} }
oneCheck(i) { oneCheck() {
const x = this.checkArray.filter(k => k).length; this.isCheckedOne = true;
if (x === this.checkArray.length) { this.isIndeterminate = false;
this.isIndeterminate = false; this.isAllCheck = false;
const sum = this.data.filter((one) => one.checked).length;
if (sum === this.data.length) {
this.isAllCheck = true; this.isAllCheck = true;
} else if (x === 0) { } else if (sum === 0) {
this.isIndeterminate = false; this.isCheckedOne = false;
this.isAllCheck = false; this.canbind = false;
this.canUnbind = false;
} else { } else {
this.isIndeterminate = true; this.isIndeterminate = true;
this.isAllCheck = false; }
this.checkCanBind();
}
checkCanBind() {
const obj = this.data.filter(one => one.checked);
if (obj.length === 0) {
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;
} else {
this.canbind = false;
this.canUnbind = false;
}
} }
} }
// 筛选
filter(a, b) { filter(a, b) {
console.log(a, b); console.log(a, b);
} }
getAllChecked() { // 跳转详情
const obj = []; toSee(e) {
this.data.map((one, index) => { this.router.navigate(['/app/deviceCenter/gatewayMgr/gatewaySee']);
if (this.checkArray[index]) {
obj.push(index);
}
});
return obj;
} }
deleteConfirm(one) { // 单个的方法
this.modalService.confirm({ add() {
nzTitle : '<i></i>', this.isMulti = false;
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>', this.isAddConV = true;
nzOnOk : () => this.delete(one)
});
} }
allDelete() { bind(one) {
this.isMulti = false;
this.selectedOne = one;
this.isBindConV = true;
}
unbind(one) {
this.modalService.confirm({ this.modalService.confirm({
nzTitle : '<i></i>', nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>', nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll() nzOnOk : () => this.unbindOne(one)
}); });
} }
delete(one) {} unbindOne(one) {}
deleteAll() { update(one) {
const obj = this.getAllChecked(); this.isMulti = false;
console.log(obj); this.selectedOne = one;
this.isUpdateConV = true;
} }
allDivide() { cancel(v) {
this.isMulti = true; this[v] = false;
} }
allBind() { save(v) {
this.isMulti = true; this[v] = false;
} }
allUnbind() { deleteConfirm(one) {
this.isMulti = true; this.modalService.confirm({
nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
} }
delete(one) {}
// 批量的方法
allUpdate() { allUpdate() {
this.isMulti = true; this.isMulti = true;
this.isUpdateConV = true;
} }
multiAdd() { multiAdd() {
this.isMulti = true; this.isMulti = true;
this.isMultiAddConV = true;
} }
toSee(e) { allDivide() {
this.router.navigate(['/app/deviceCenter/sensorMgr/sensorDetail']); this.isMulti = true;
this.isDivideConV = true;
} }
add() { allBind() {
this.isMulti = false; this.isMulti = true;
this.isAddConV = true; this.isBindConV = true;
} }
bind(one) { allDelete() {
this.isMulti = false; this.modalService.confirm({
this.selectedOne = one; nzTitle : '<i></i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteSelectedRecord') + '</b>',
nzOnOk : () => this.deleteAll()
});
} }
update(one) { deleteAll() {}
this.isMulti = false;
this.selectedOne = one;
}
cancel(v) { allUnbind() {
this[v] = false; this.modalService.confirm({
} nzTitle : '<i></i>',
save(v) { nzContent: '<b>' + this.translate.instant('confirmUnbindSelectedRecord') + '</b>',
this[v] = false; nzOnOk : () => this.unbindAll()
});
} }
unbindAll() {}
toggleOn(one) { toggleOn(one) {
one.isLoading = true; one.isLoading = true;
setTimeout(() => { setTimeout(() => {
......
...@@ -49,3 +49,24 @@ ...@@ -49,3 +49,24 @@
</tbody> </tbody>
</nz-table> </nz-table>
</div> </div>
<nz-modal [(nzVisible)]="isAddConV" [nzContent]="con1" nzWidth="500"
[nzFooter]="foot1" (nzOnCancel)="cancel('isAddConV')" nzMaskClosable="false">
<ng-template #con1>
新增/编辑主题模板
</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)]="isSaveOther" [nzContent]="con2" nzWidth="500"
[nzFooter]="foot2" (nzOnCancel)="cancel('isSaveOther')" nzMaskClosable="false">
<ng-template #con2>
另存为主题模板
</ng-template>
<ng-template #foot2>
<button nz-button nzType="default" [nzLoading]="isLoading" (click)="cancel('isSaveOther')"><span>{{'cancel' | translate}}</span></button>
<button nz-button nzType="primary" [nzLoading]="isLoading" (click)="save('isSaveOther')"><span>{{'confirm' | translate}}</span></button>
</ng-template>
</nz-modal>
import {Component, OnInit} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {ApiService} from '../../service/api'; import {ApiService} from '../../service/api';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {TranslateService} from '@ngx-translate/core'; import {TranslateService} from '@ngx-translate/core';
import {fadeIn} from '../../animation/fade-in'; import {fadeIn} from '../../animation/fade-in';
import {Router} from '@angular/router'; import {Router} from '@angular/router';
...@@ -19,8 +19,11 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -19,8 +19,11 @@ export class TopicModuleMgrComponent implements OnInit {
page: any = 1; page: any = 1;
rows: any = 10; rows: any = 10;
total: any; total: any;
isAddConV = false;
isUpdate = false;
isSaveOther = false;
constructor(private api: ApiService, private message: NzMessageService, constructor(private api: ApiService, private message: NzMessageService, private modalService: NzModalService,
private translate: TranslateService, private router: Router) { private translate: TranslateService, private router: Router) {
} }
...@@ -61,7 +64,7 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -61,7 +64,7 @@ export class TopicModuleMgrComponent implements OnInit {
this.message.error(data.message || this.translate.instant('wrongToGetData')); this.message.error(data.message || this.translate.instant('wrongToGetData'));
} }
this.isLoading = false; this.isLoading = false;
}; }
searchData() { searchData() {
if (this.req.startTime || this.req.endTime) { if (this.req.startTime || this.req.endTime) {
...@@ -75,11 +78,35 @@ export class TopicModuleMgrComponent implements OnInit { ...@@ -75,11 +78,35 @@ export class TopicModuleMgrComponent implements OnInit {
this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail']); this.router.navigate(['/app/deviceCenter/topicModuleMgr/topicModuleDetail']);
} }
saveOther(one) {} saveOther(one) {
this.isSaveOther = true;
}
add() {
this.isUpdate = false;
this.isAddConV = true;
}
update(one) {
this.isUpdate = true;
this.isAddConV = true;
}
update(one) {} cancel(v) {
this[v] = false;
}
deleteConfirm(one) {} save(v) {
this[v] = false;
}
deleteConfirm(one) {
this.modalService.confirm({
nzTitle : '<i> </i>',
nzContent: '<b>' + this.translate.instant('confirmDeleteThisRecord') + '</b>',
nzOnOk : () => this.delete(one)
});
}
add() {} delete(one) {}
} }
...@@ -133,7 +133,7 @@ ol, ul { ...@@ -133,7 +133,7 @@ ol, ul {
cursor: pointer; cursor: pointer;
} }
.whenHover:hover, .whenHover:focus { .textStyle2:hover, .textStyle2:focus {
color: #005691 !important; color: #005691 !important;
} }
......
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