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

提交一下

parent af705aaa
...@@ -41,6 +41,9 @@ export class GatewayComponent implements OnInit { ...@@ -41,6 +41,9 @@ export class GatewayComponent implements OnInit {
addReq = {}; addReq = {};
bindReq = {}; bindReq = {};
divideReq = {}; divideReq = {};
nobind = '';
canbind = false;
canUnbind = 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,8 +59,9 @@ export class GatewayComponent implements OnInit { ...@@ -56,8 +59,9 @@ export class GatewayComponent 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 ? 1 : 0; return one; });
this.total = data.total; this.total = data.total;
this.initBindArray(data.rows);
this.initCheckArray(data.rows.length, false); 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 : '操作成功');
...@@ -67,13 +71,21 @@ export class GatewayComponent implements OnInit { ...@@ -67,13 +71,21 @@ export class GatewayComponent 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]);
} }
initBindArray(obj) {
obj.map((one, index) => {
if (!one.isOn) {
this.nobind += '&' + index;
}
});
}
initCheckArray(n, b) { initCheckArray(n, b) {
const obj = []; const obj = [];
while (n > 0) { while (n > 0) {
...@@ -100,6 +112,8 @@ export class GatewayComponent implements OnInit { ...@@ -100,6 +112,8 @@ export class GatewayComponent implements OnInit {
this.isIndeterminate = false; this.isIndeterminate = false;
this.isAllCheck = true; this.isAllCheck = true;
} else if (x === 0) { } else if (x === 0) {
this.canbind = false;
this.canUnbind = false;
this.isIndeterminate = false; this.isIndeterminate = false;
this.isAllCheck = false; this.isAllCheck = false;
} else { } else {
......
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