import httpRequest from '@/utils/request.js'

// 保存脚本
export function save(param, data) {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: 'script/save',
        method: 'post',
        params: param,
        data: data
    })
}
// 读取脚本
export function read() {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: 'script/read',
        method: 'get'
    })
}
// 运行脚本
export function run(data) {
    return httpRequest({
        baseURL: 'http://127.0.0.1:9001',
        url: 'script/run',
        method: 'post',
        data: data
    })
}

// 修改已有脚本
export function updateScript(params) {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: 'script/update',
        method: 'post',
        data: params
    })
}
// 删除脚本
export function deleteScript(parmas) {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: `script/delete?id=${parmas.id}`,
        method: 'get'
    })
}

// 每天运行一次脚本
//列表
export function scriptTimedrunlist() {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: `script/timedrun/list`,
        method: 'get'
    })
}
//删除
export function deleteTimedrunScript(parmas) {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: `script/timedrun/delete?scriptid=${parmas.id}`,
        method: 'get'
    })
}
//运行
export function dayRunScript(data) {
    return httpRequest({
        baseURL: process.env.VUE_APP_REPORT_URL,
        url: `script/timedrun`,
        method: 'post',
        data: data
    })
}