diff --git a/auto_pt/views.py b/auto_pt/views.py
index 137f474..56b9d9a 100644
--- a/auto_pt/views.py
+++ b/auto_pt/views.py
@@ -97,7 +97,7 @@ def get_downloading(request):
id = request.GET.get('id')
print(id)
downloader = Downloader.objects.filter(id=id).first()
- tracker_filters = Site.objects.all().values('id', 'name', 'tracker')
+ tracker_list = Site.objects.all().values('id', 'name', 'tracker')
qb_client = qbittorrentapi.Client(
host=downloader.host,
port=downloader.port,
@@ -163,7 +163,7 @@ def get_downloading(request):
print(len(torrents))
main_data['torrents'] = torrents
# print(tracker_filters)
- main_data['tracker_filters'] = list(tracker_filters)
+ main_data['tracker_list'] = list(tracker_list)
# return JsonResponse(CommonResponse.success(data=torrents).to_dict(), safe=False)
return JsonResponse(CommonResponse.success(data=main_data).to_dict(), safe=False)
except Exception as e:
diff --git a/templates/auto_pt/downloading.html b/templates/auto_pt/downloading.html
index 80a068e..f401217 100644
--- a/templates/auto_pt/downloading.html
+++ b/templates/auto_pt/downloading.html
@@ -58,7 +58,10 @@
@click="handleButtonClick(downloader.id)">
- 停止刷新
+ 停止刷新
+
+ 停止刷新
+
操作
@@ -153,6 +156,13 @@
:filter-method="filterStateMethod"
:filter-multiple="false"
title="分类">
+
@@ -198,9 +208,6 @@
show-header-overflow show-overflow="tooltip"
show-footer-overflow
title="添加时间">
-
-
@@ -267,6 +274,7 @@
downloaders: [],
loading: false,
mainData: {},
+ tracker_list: [],
dialogFormVisible: false,
timer: {},
deleteForm: false,
@@ -443,6 +451,11 @@
clearInterval(this.timer)
this.timer = null
},
+ startRefresh() {
+ this.timer = setInterval(() => {
+ this.get_downloading(this.downloaders[0].id)
+ }, 1500)
+ },
handleButtonClick(id) {
const loading = this.$loading({
lock: true, //lock的修改符--默认是false
@@ -494,6 +507,13 @@
).then(res => {
if (res.data.code === 0) {
this.mainData = res.data.data
+ this.tracker_list = this.mainData.tracker_list;
+ const trackerFilter = [{label: '无', value: ''}]
+ this.tracker_list.forEach((value, index, array) => {
+ {#console.log(value, index)#}
+ trackerFilter.push({'label': value.name, 'value': value.tracker})
+ })
+ {#console.log(trackerFilter)#}
// 任务状态过滤器数据
this.categoryFilters = [{label: '未分类', value: ''}]
this.categories = []
@@ -506,13 +526,18 @@
const $table = this.$refs.dataTable
{#console.log($table)#}
if ($table) {
- const nameColumn = $table.getColumnByField('category')
+ const categoryColumn = $table.getColumnByField('category')
{#console.log(nameColumn)#}
- if (nameColumn) {
- $table.setFilter(nameColumn, this.categoryFilters)
+ if (categoryColumn) {
+ $table.setFilter(categoryColumn, this.categoryFilters)
+ }
+ const trackerColumn = $table.getColumnByField('tracker')
+ console.log(trackerColumn)
+ if (trackerColumn) {
+ $table.setFilter(trackerColumn, trackerFilter)
}
}
- console.log(res.data.data.tracker_filters)
+ {#console.log(res.data.data.tracker_filters)#}
this.server_state = res.data.data.server_state
// 获取种子
//this.$message({
@@ -557,6 +582,12 @@
handleRatio({row, column, cellValue, index}) {
return cellValue.toFixed(4)
},
+ handleTracker({row, column, cellValue, index}) {
+ // 格式化输出tracker所属的站点
+ let site = this.tracker_list.find(site => cellValue.includes(site.tracker))
+ {#console.log(site)#}
+ return site ? site.name : cellValue
+ },
handleState({row, column, cellValue, index}) {
return download_state[cellValue]
},
@@ -564,6 +595,10 @@
const property = column['property'];
return row[property] === value;
},
+ filterTrackerMethod({value, row, column}) {
+ const property = column['property'];
+ return row[property].includes(value);
+ },
handleSelected(command, category = '', delete_files = false, enable = 'True') {
let ids = []
if (this.selected_rows.length <= 0) {