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

提交一下

parent d1a354aa
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<app-leftmenu #leftmenu [isCollapsed]="isCollapsed" [selectedItem]="selectedItem"></app-leftmenu> <app-leftmenu #leftmenu [isCollapsed]="isCollapsed" [selectedItem]="selectedItem"></app-leftmenu>
</nz-sider> </nz-sider>
<nz-layout> <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" <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"> <label class="linkToPersonSetting whenHover textStyle1" routerLink="/app/system/person">
......
$headerSlideBackground: rgba(255, 255, 255, 1);
:host ::ng-deep .trigger { :host ::ng-deep .trigger {
font-size: 20px; font-size: 20px;
line-height: 64px; line-height: 64px;
...@@ -14,7 +12,7 @@ $headerSlideBackground: rgba(255, 255, 255, 1); ...@@ -14,7 +12,7 @@ $headerSlideBackground: rgba(255, 255, 255, 1);
} }
.logoBackground { .logoBackground {
background-color: $headerSlideBackground; background-color: #002661;
height: 64px; height: 64px;
line-height: 64px; line-height: 64px;
} }
...@@ -43,11 +41,11 @@ ul { ...@@ -43,11 +41,11 @@ ul {
} }
.width-200{ .width-200{
width: 199px; width: 200px;
} }
.width-60{ .width-80{
width: 79px; width: 80px;
} }
.halfPart{ .halfPart{
......
.menuPart { .menuPart {
margin-top: 64px; border-top: 64px solid #002661;
} }
.menuFirst,.menuSecond { .menuFirst,.menuSecond {
padding: 0; padding: 0;
......
...@@ -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">
......
...@@ -28,7 +28,6 @@ export class GatewayComponent implements OnInit { ...@@ -28,7 +28,6 @@ export class GatewayComponent implements OnInit {
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;
...@@ -41,9 +40,9 @@ export class GatewayComponent implements OnInit { ...@@ -41,9 +40,9 @@ export class GatewayComponent implements OnInit {
addReq = {}; addReq = {};
bindReq = {}; bindReq = {};
divideReq = {}; divideReq = {};
nobind = '';
canbind = false; canbind = false;
canUnbind = false; canUnbind = false;
isCheckedOne = 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) {
...@@ -61,8 +60,6 @@ export class GatewayComponent implements OnInit { ...@@ -61,8 +60,6 @@ export class GatewayComponent implements OnInit {
if (data && data.rows && data.rows.constructor === Array) { 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.data = data.rows.filter(one => { one.isOn = Math.random() > 0.5 ? 1 : 0; return one; });
this.total = data.total; this.total = data.total;
this.initBindArray(data.rows);
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) {
...@@ -78,21 +75,11 @@ export class GatewayComponent implements OnInit { ...@@ -78,21 +75,11 @@ 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]);
} }
initBindArray(obj) { initCheckArray(b) {
obj.map((one, index) => { if (b) {
if (!one.isOn) { this.isCheckedOne = true;
this.nobind += '&' + index;
}
});
}
initCheckArray(n, b) {
const obj = [];
while (n > 0) {
obj.push(b);
n--;
} }
this.checkArray = obj; this.data.map((one) => one.checked = b);
} }
onSearch() { onSearch() {
...@@ -103,37 +90,46 @@ export class GatewayComponent implements OnInit { ...@@ -103,37 +90,46 @@ export class GatewayComponent implements OnInit {
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.isCheckedOne = false;
this.canbind = false; this.canbind = false;
this.canUnbind = false; this.canUnbind = false;
this.isIndeterminate = false;
this.isAllCheck = false;
} else { } else {
this.isIndeterminate = true; this.isIndeterminate = true;
this.isAllCheck = false;
} }
this.checkCanBind();
} }
filter(a, b) { checkCanBind() {
console.log(a, b); 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() { filter(a, b) {
const obj = []; console.log(a, b);
this.data.map((one, index) => {
if (this.checkArray[index]) {
obj.push(index);
}
});
return obj;
} }
deleteConfirm(one) { deleteConfirm(one) {
...@@ -154,10 +150,7 @@ export class GatewayComponent implements OnInit { ...@@ -154,10 +150,7 @@ export class GatewayComponent implements OnInit {
delete(one) {} delete(one) {}
deleteAll() { deleteAll() {}
const obj = this.getAllChecked();
console.log(obj);
}
allDivide() { allDivide() {
this.isMulti = true; 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