| | |
| | | |
| | | query: any = { |
| | | pageIndex: 1, |
| | | pageSize: 3, |
| | | pageSize: 10, |
| | | isDelete: this.options[1].value |
| | | }; |
| | | data: any[] = []; |
| | | total: 0; |
| | | |
| | | selectedRows: any[] = []; |
| | | curRows: any[] = []; |
| | | allChecked = false; |
| | | indeterminate = false; |
| | | sortMap: any = {}; |
| | |
| | | this.data = res.data.data; |
| | | this.total = res.data.total; |
| | | |
| | | this.dataChange(this.data); |
| | | this.refreshStatus(); |
| | | }); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | checkAll(value: boolean) { |
| | | this.curRows.forEach(i => { |
| | | this.data.forEach(i => { |
| | | i.checked = value; |
| | | }); |
| | | this.refreshStatus(); |
| | | } |
| | | |
| | | dataChange(res: any) { |
| | | this.curRows = res; |
| | | this.refreshStatus(); |
| | | } |
| | | |
| | | refreshStatus() { |
| | | const allChecked = this.curRows.every(value => value.checked); |
| | | const allUnChecked = this.curRows.every(value => !value.checked); |
| | | const allChecked = this.data.every(value => value.checked); |
| | | const allUnChecked = this.data.every(value => !value.checked); |
| | | this.allChecked = allChecked; |
| | | this.indeterminate = (!allChecked) && (!allUnChecked); |
| | | this.selectedRows = this.data.filter(value => value.checked); |
| | |
| | | this.sortMap = {}; |
| | | this.sortMap[field] = value; |
| | | this.query.sorter = value ? `${field} ${value}` : ''; |
| | | this.load(true); |
| | | } |
| | | |
| | | reset(ls: any[]) { |
| | | for (const item of ls) item.value = false; |
| | | this.load(true); |
| | | } |
| | | |