diff --git a/templates/auto_pt/downloading.html b/templates/auto_pt/downloading.html index 6046976..191eaca 100644 --- a/templates/auto_pt/downloading.html +++ b/templates/auto_pt/downloading.html @@ -163,12 +163,9 @@ { // 将表格和工具栏进行关联 - const $table = this.$refs.dataTable + this.table = this.$refs.dataTable {#console.log(this.$refs)#} - {#console.log($table)#} - $table.connect(this.$refs.xToolbar) + this.table.connect(this.$refs.xToolbar) }) this.get_downloaders() }, @@ -520,11 +518,11 @@ }, clearFilters() { //清除筛选 - this.$refs.dataTable.clearFilter() + this.table.clearFilter() }, clearSelection() { //清除选中 - this.$refs.dataTable.clearCheckboxRow() + this.table.clearCheckboxRow() }, stopRefresh() { this.refresh = true @@ -535,7 +533,7 @@ this.refresh = false this.timer = setInterval(() => { this.get_downloading(this.downloader_id) - }, 1500) + }, 5000) }, handleButtonClick(id) { console.log(id.name) @@ -548,7 +546,7 @@ this.get_downloader_categories(this.downloader_id) this.timer = setInterval(() => { this.get_downloading(this.downloader_id) - }, 1500) + }, 5000) this.refresh = false }, get_downloaders() { @@ -563,7 +561,7 @@ this.get_downloader_categories(this.downloader_id) this.timer = setInterval(() => { this.get_downloading(this.downloader_id) - }, 1500) + }, 5000) } else { this.$message({ type: 'warning', message: '获取下载器列表失败!' @@ -599,18 +597,17 @@ this.categories.push({'title': value, 'value': value}) }) // 异步加载筛选数据 - const $table = this.$refs.dataTable - {#console.log($table)#} - if ($table) { - const categoryColumn = $table.getColumnByField('category') + {#this.table = this.$refs.dataTable#} + if (this.table) { + const categoryColumn = this.table.getColumnByField('category') {#console.log(nameColumn)#} if (categoryColumn) { - $table.setFilter(categoryColumn, categoryFilters) + this.table.setFilter(categoryColumn, categoryFilters) } - const trackerColumn = $table.getColumnByField('tracker') + const trackerColumn = this.table.getColumnByField('tracker') {#console.log(trackerColumn)#} if (trackerColumn) { - $table.setFilter(trackerColumn, trackerFilter) + this.table.setFilter(trackerColumn, trackerFilter) } } } else { @@ -708,12 +705,14 @@ }, handleSelected(command, category = '', delete_files = false, enable = 'True') { let ids = [] - if (this.selected_rows.length <= 0) { + const selectedRows = this.table.getCheckboxRecords() + if (selectedRows.length <= 0) { this.$message({type: 'warning', message: '未选中任何种子!!'}) return } - this.selected_rows.forEach((item, index) => { - {#console.log(item['hash'], index)#} + + selectedRows.forEach((item, index) => { + console.log(item['hash'], index) ids.push(item['hash']) }) let data = new FormData() @@ -723,21 +722,21 @@ data.append('category', category) data.append('downloader_id', this.downloader_id) axios.post( - // "{% url "control_torrent" %}", + "{% url "control_torrent" %}", data ).then(res => { console.log(res.data) this.get_downloading(this.downloader_id) this.$message({type: 'success', message: '指令发送成功!!'}) this.selected_rows = [] - this.$refs.dataTable.clearSelection() + {#this.$refs.dataTable.clearSelection()#} + this.table.clearCheckboxRow() }).catch(() => { this.$message({type: 'warning', message: '指令发送失败!!'}) }) }, - tableSelected(rows) { - this.selected_rows = rows - console.log(this.selected_rows.length) + tableSelected({checked, row, rowIndex, $rowIndex, column, columnIndex, $columnIndex, $event}) { + this.selected_rows = this.table.getCheckboxRecords() }, rowKey(row) { console.log(row.hash)