<script>
import axios from "axios";
export default {
name: 'task_management',
data() {
return {
aa: '',
sites: [],
isShowPutong: true,
isShowGaoji: false,
id_search: '',
id_input: '',
id_picker: '',
visible: false,
taskList: [],
loading_task: [
{
icon: 'snippets',
start_icon: 'pause-circle',
del_icon: 'delete',
detail_icon: 'container',
task_name: 'loading_task',
plan_start_time: '2020/12/23 14:10:55',
aff_ip: '机器人甲'
},
],
success_task: [
{
icon: 'snippets',
icon1: 'container',
name: 'success_task',
time: '2020/12/23 14:10:55',
affiliation: '机器人甲'
},
],
abort_task: [
{
icon: 'snippets',
icon1: 'container',
name: 'abort_task',
time: '2020/12/23 14:10:55',
affiliation: '机器人甲'
},
],
error_task: [
{
icon: 'snippets',
icon1: 'container',
name: 'error_task',
time: '2020/12/23 14:10:55',
affiliation: '机器人甲'
},
],
labelCol: {span: 4},
wrapperCol: {span: 14},
form: {
// taskname: '',
// execute_path: '',
// loop_model: '',
// start_time: '',
// robot: '',
// definetime: '',
// aff_ip: '',
}
}
},
created() {
let that = this;
const url = 'http://192.168.0.196:8001/task/';
axios.get(url).then(function (res) {
that.taskList = res.data.tasks_list;
}
).catch(
function (error){
alert('hdsjdshgd')
}
)
},
methods: {
// 搜索框
onSearch(value) {
console.log(value);
console.log(this.taskList, '1111');
},
// 高级搜索按钮
advanced() {
console.log("高级搜索");
this.isShowPutong = !this.isShowPutong;
this.isShowGaoji = !this.isShowGaoji;
var self = this;
$.ajax({
url: 'http://192.168.0.196:8001/task/',
type: 'get',
data: {},
dataType: 'json'
}).then(function (res) {
console.log(res);
//把从json获取的数据赋值给数组
self.sites = res;
}).fail(function () {
console.log('失败');
})
},
// 日历
onChange(date, dateString) {
console.log(date, dateString);
},
// 普通搜索按钮
gj_advanced() {
console.log('普通搜索');
this.isShowGaoji = !this.isShowGaoji;
this.isShowPutong = !this.isShowPutong;
},
// 清空按钮
empty() {
console.log('清空');
this.id_search = '';
this.id_input = '';
this.id_picker = '';
},
// 新建任务按钮
showModal() {
this.visible = true;
},
// 新建任务
handleOk(e) {
console.log(e);
// let s = JSON.toString(this.form)
var self = this;
const url = 'http://192.168.0.196:8001/task/';
let addTask = {
"starttime": this.form.start_time.format('YYYY-MM-DD HH:mm:ss'),
"runtime": 30,
"endtime": '',
"loop_model": this.form.loop_model,
"execute_path": this.form.execute_path,
"remark": '111',
"task_name": this.form.taskname,
"aff_ip": this.form.aff_ip,
};
axios.post(url, addTask).then(function (res){
self.sites = res
}
)
this.visible = false;
},
// 开始任务
start_task(task_id, execute_path, task_name) {
const url = 'http://192.168.0.196:8001/data/';
let startTask = {
"task_id": task_id,
"execute_path": execute_path,
"task_name": task_name,
};
axios.post(url, startTask).then(
function (res){
}
)
},
// 删除任务
del_task(task_id) {
const url = 'http://192.168.0.196:8001/task/';
let datas = {
"task_id": task_id,
};
axios.delete(url, {data: datas}).then(
function (res){
}
)
},
}
}
</script>
vue js 写法
最新推荐文章于 2023-12-07 21:21:30 发布
本文深入探讨Vue.js的编程技巧,包括组件化开发、响应式原理、Vuex状态管理和API使用等,旨在帮助开发者提升Vue.js应用的构建效率和质量。
摘要由CSDN通过智能技术生成