import request from '@/utils/request'
// 新增字典数据
export const addCsDictData = (data: any) => {
    return request({
        url: '/system-boot/csDictData/add',
        method: 'post',
        data: data
    })
}

// 查询字典数据
export const queryCsDictDataPage = (data: any) => {
    return request({
        url: '/system-boot/csDictData/list',
        method: 'post',
        data: Object.assign(
            {
                orderBy: '',
                pageNum: 0,
                pageSize: 0,
                searchBeginTime: '',
                searchEndTime: '',
                searchState: 0,
                searchValue: '',
                dataType: '',
                sortBy: ''
            },
            data
        )
    })
}

//删除字典数据
export const delCsDictData = (id: string) => {
    let form = new FormData()
    form.append('id', id)
    return request({
        url: '/system-boot/csDictData/delete',
        method: 'post',
        data: form,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        }
    })
}

// 修改字典数据
export const updateCsDictData = (data: any) => {
    return request({
        url: '/system-boot/csDictData/update',
        method: 'post',
        data: data
    })
}

// 执行算法
export const timerRun = (params: any) => {
    return request({
        url: '/system-boot/timer/run',
        method: 'GET',
        params
    })
}
// 任务表达式
export const getActionClasses = () => {
    return request({
        url: '/system-boot/timer/getActionClasses',
        method: 'GET'
    })
}
// 新增任务
export const addTimer = (data: any) => {
    return request({
        url: '/system-boot/timer/add',
        method: 'POST',
        data
    })
}
// 修改任务
export const updateTimer = (data: any) => {
    return request({
        url: '/system-boot/timer/update',
        method: 'POST',
        data
    })
}
// 补招配置
export const runTimer = (data: any) => {
    return request({
        url: '/system-boot/timer/run',
        method: 'GET',
        params: data
    })
}
// 删除任务
export const deleteTimer = (data: any) => {
    return request({
        url: '/system-boot/timer/delete',
        method: 'POST',
        data: data
    })
}
// 关闭任务
export const stop = (params: any) => {
    return request({
        url: '/system-boot/timer/stop',
        method: 'get',
        params
    })
}
// 启动任务
export const start = (params: any) => {
    return request({
        url: '/system-boot/timer/start',
        method: 'get',
        params
    })
}