@@ -228,7 +244,20 @@
},
tasklist: []
},
- run_log: ""
+ newTask: {
+ taskname: "",
+ shareurl: "",
+ savepath: "",
+ pattern: "",
+ replace: "",
+ enddate: "",
+ emby_id: "",
+ runweek: [1, 2, 3, 4, 5, 6, 7]
+ },
+ run_log: "",
+ taskDirs: [""],
+ taskDirSelected: "",
+ taskNameFilter: ""
},
watch: {
'formData.push_config': {
@@ -263,6 +292,12 @@
}
return task;
});
+ // 存所有任务父目录
+ response.data.tasklist.forEach(item => {
+ parentDir = this.getParentDirectory(item.savepath)
+ if (!this.taskDirs.includes(parentDir))
+ this.taskDirs.push(parentDir);
+ });
this.formData = response.data;
})
.catch(error => {
@@ -296,16 +331,10 @@
this.$delete(this.formData.push_config, key);
},
addTask() {
- this.formData.tasklist.push({
- taskname: "",
- shareurl: "",
- savepath: "",
- pattern: "",
- replace: "",
- enddate: "",
- emby_id: "",
- runweek: [1, 2, 3, 4, 5, 6, 7]
- });
+ newTask = { ...this.newTask }
+ newTask.taskname = this.taskNameFilter
+ newTask.savepath = this.taskDirSelected + "/" + newTask.taskname
+ this.formData.tasklist.push(newTask);
},
removeTask(index) {
if (confirm("确认删除吗?"))
@@ -325,6 +354,12 @@
this.run_log = "错误:\n" + error
console.error('Error:', error);
});
+ },
+ getParentDirectory(path) {
+ parentDir = path.substring(0, path.lastIndexOf('/'))
+ if (parentDir == "")
+ parentDir = "/"
+ return parentDir;
}
}
});