Commit 709335f3 authored by van.chen's avatar van.chen

提交一下

parent d1a354aa
......@@ -11,7 +11,7 @@
<app-leftmenu #leftmenu [isCollapsed]="isCollapsed" [selectedItem]="selectedItem"></app-leftmenu>
</nz-sider>
<nz-layout>
<nz-header class="logoBackground bottomLine" style="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"
[class.i-fang]="isCollapsed" (click)="changeCollapsed()"></i>
<label class="linkToPersonSetting whenHover textStyle1" routerLink="/app/system/person">
......
$headerSlideBackground: rgba(255, 255, 255, 1);
:host ::ng-deep .trigger {
font-size: 20px;
line-height: 64px;
......@@ -14,7 +12,7 @@ $headerSlideBackground: rgba(255, 255, 255, 1);
}
.logoBackground {
background-color: $headerSlideBackground;
background-color: #002661;
height: 64px;
line-height: 64px;
}
......@@ -43,11 +41,11 @@ ul {
}
.width-200{
width: 199px;
width: 200px;
}
.width-60{
width: 79px;
.width-80{
width: 80px;
}
.halfPart{
......
.menuPart {
margin-top: 64px;
border-top: 64px solid #002661;
}
.menuFirst,.menuSecond {
padding: 0;
......
......@@ -43,7 +43,7 @@
</thead>
<tbody nz-tbody>
<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>{{one.realName}}</td>
<td nz-td>{{one.userName}}</td>
......@@ -65,15 +65,15 @@
</tbody>
</nz-table>
<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>
<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 nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allUnbind()">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!canUnbind" (click)="allUnbind()">
<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 nz-button [nzType]="'primary'" [nzLoading]="isLoading" (click)="allUpdate()">
<button nz-button [nzType]="'primary'" [nzLoading]="isLoading" [disabled]="!isCheckedOne" (click)="allUpdate()">
<span>{{'update' | translate}}</span></button>
</div>
<div class="pagePart whenOneLine">
......
......@@ -28,7 +28,6 @@ export class GatewayComponent implements OnInit {
isLoading = false;
isAllCheck = false;
isIndeterminate = false;
checkArray = [];
page = 1;
rows = 10;
total = 125;
......@@ -41,9 +40,9 @@ export class GatewayComponent implements OnInit {
addReq = {};
bindReq = {};
divideReq = {};
nobind = '';
canbind = false;
canUnbind = false;
isCheckedOne = false;
constructor(private api: ApiService, private message: NzMessageService, private router: Router,
private modalService: NzModalService, private translate: TranslateService) {
......@@ -61,8 +60,6 @@ export class GatewayComponent implements OnInit {
if (data && data.rows && data.rows.constructor === Array) {
this.data = data.rows.filter(one => { one.isOn = Math.random() > 0.5 ? 1 : 0; return one; });
this.total = data.total;
this.initBindArray(data.rows);
this.initCheckArray(data.rows.length, false);
} else if (data.code === 1) {
this.message.success(data && data.message ? data.message : '操作成功');
} else if (data.code === 0) {
......@@ -78,21 +75,11 @@ export class GatewayComponent implements OnInit {
this.api.loginlog.getAll(this.page, this.rows, ['', this.next]);
}
initBindArray(obj) {
obj.map((one, index) => {
if (!one.isOn) {
this.nobind += '&' + index;
}
});
}
initCheckArray(n, b) {
const obj = [];
while (n > 0) {
obj.push(b);
n--;
initCheckArray(b) {
if (b) {
this.isCheckedOne = true;
}
this.checkArray = obj;
this.data.map((one) => one.checked = b);
}
onSearch() {
......@@ -103,37 +90,46 @@ export class GatewayComponent implements OnInit {
checkAll(e) {
this.isIndeterminate = false;
this.initCheckArray(this.checkArray.length, e);
this.initCheckArray(e);
this.checkCanBind();
}
oneCheck(i) {
const x = this.checkArray.filter(k => k).length;
if (x === this.checkArray.length) {
this.isIndeterminate = false;
oneCheck() {
this.isCheckedOne = true;
this.isIndeterminate = false;
this.isAllCheck = false;
const sum = this.data.filter((one) => one.checked).length;
if (sum === this.data.length) {
this.isAllCheck = true;
} else if (x === 0) {
} else if (sum === 0) {
this.isCheckedOne = false;
this.canbind = false;
this.canUnbind = false;
this.isIndeterminate = false;
this.isAllCheck = false;
} else {
this.isIndeterminate = true;
this.isAllCheck = false;
}
this.checkCanBind();
}
filter(a, b) {
console.log(a, b);
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;
}
}
}
getAllChecked() {
const obj = [];
this.data.map((one, index) => {
if (this.checkArray[index]) {
obj.push(index);
}
});
return obj;
filter(a, b) {
console.log(a, b);
}
deleteConfirm(one) {
......@@ -154,10 +150,7 @@ export class GatewayComponent implements OnInit {
delete(one) {}
deleteAll() {
const obj = this.getAllChecked();
console.log(obj);
}
deleteAll() {}
allDivide() {
this.isMulti = true;
......
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