import request from '@/utils/request'
//登录板块api
export const loginApi = {
    // 登录
    login: data => request('/login', 'json', data),
    // 退出登录
    loginOut: () => request('/logout', 'get'),
    //修改密码
    editPassword: data => request('/auth/user/updatePwd', 'post', data),
    // 获取验证码
    getCode: () => request('/captchaImage', 'captchaImage', {}, {
        SHOW_LOADING: false, headers: {
            'Content-Type': 'application/json'
        }
    }),
    getUserInfo: () => request('/getInfo', 'get'),
}

// 项目板块
export const projectApi = {
    // 查询项目列表
    listProject: query => request('/business/project/list', 'get', query),
    deleteProject: id => request(`/business/project/${id}`, 'delete'),
    addProject: data => request('/business/project/add', 'json', data),
    updateProject: data => request('/business/project/update', 'json', data),
    getProjectCode: () => request('/business/project/getCode', 'get'),
    getProjectDetail: id => request(`/business/project/info/${id}`, 'get'),
    // 项目成员
    getProjectUser: id => request(`/business/project/${id}`, 'get'),
    updateProjectUser: data => request('/business/project/team', 'json', data),
    deleteProjectUser: id => request(`/business/project/team/${id}`, 'delete'),
}
// 工作日志
export const workLogApi = {
    userProject: id => request(`/business/work/hour/project/${id}`, 'get'),
    getLogData: data => request('/business/work/hour/calendar', 'json', data, { SHOW_LOADING: false }),
    getLogDataDetail: data => request('/business/work/hour/getInfo', 'json', data, { SHOW_LOADING: false }),
    addLog: data => request('/business/work/hour/add', 'json', data),
}
// 用户板块
export const useUserApi = () => {


}
// 系统板块
export const systemApi = {
    getUserList: data => request('/system/user/list', 'get', data),
    getDictData: dictCode => request('/system/dict/data/type/' + dictCode, 'get'),
    getDeptTree: () => request('/system/user/deptTree', 'get'),
}
// 系统定时任务
export const systemJobApi = {
    // 查询定时任务调度列表
    listJob: query => request('/monitor/job/list', 'get', query),

    // 查询定时任务调度详细
    getJob: jobId => request(`/monitor/job/${jobId}`, 'get'),

    // 新增定时任务调度
    addJob: data => request('/monitor/job', 'post', data),

    // 修改定时任务调度
    updateJob: data => request('/monitor/job', 'put', data),

    // 删除定时任务调度
    delJob: jobId => request(`/monitor/job/${jobId}`, 'delete'),

    // 任务状态修改
    changeJobStatus: (jobId, status) => request('/monitor/job/changeStatus', 'put', { jobId, status }),

    // 定时任务立即执行一次
    runJob: (jobId, jobGroup) => request('/monitor/job/run', 'put', { jobId, jobGroup }),
}