import request from '@/utils/request'

// 登录板块api

// 项目板块
export const projectApi = {
    // 查询项目列表
    listProject: (query) => request({
        url: '/business/project/list',
        method: 'get',
        params: query,
    }),
    deleteProject: (id) => request({
        url: `/business/project/${id}`,
        method: 'delete',
    }),
    addProject: (data) => request({
        url: '/business/project/add',
        method: 'post',
        data: data,
    }),
    updateProject: (data) => request({
        url: '/business/project/update',
        method: 'put',
        data: data,
    }),
    getProjectCode: () => request({
        url: '/business/project/getCode',
        method: 'get',
    }),
    getProjectDetail: (id) => request({
        url: `/business/project/info/${id}`,
        method: 'get',
    }),
    // 项目成员
    getProjectUser: (id) => request({
        url: `/business/project/${id}`,
        method: 'get',
    }),
    updateProjectUser: (data) => request({
        url: '/business/project/team',
        method: 'POST',
        data: data,
    }),
    deleteProjectUser: (id) => request({
        url: `/business/project/team/${id}`,
        method: 'delete',
    }),
    projectHasLogData: (data) => request({
        url: `/business/project/updateCheck`,
        method: 'POST',
        data: data,

    }),
}

// 工作日志
export const workLogApi = {
    userProject: (id) => request({
        url: `/business/work/hour/project/${id}`,
        method: 'get',
    }),
    getLogData: (data) => request({
        url: '/business/work/hour/calendar',
        method: 'post',
        data: data,
        SHOW_LOADING: false,
    }),
    getLogDataDetail: (data) => request({
        url: '/business/work/hour/getInfo',
        method: 'post',
        data: data,
        SHOW_LOADING: false,
    }),
    addLog: (data) => request({
        url: '/business/work/hour/add',
        method: 'post',
        data: data,
    }),
    getDayTime: (data) => request({
        url: '/business/work/hour/remaining',
        method: 'post',
        data: data,
    }),
    editLog: (data) => request({
        url: '/business/work/hour/update',
        method: 'put',
        data: data,
    }),

}

// 项目看板
export const projectBank = {
    porjectProgress: (data) => request({
        url: '/business/project/executionInfo',
        method: 'post',
        data: data,
    }),
    userProject: (data) => request({
        url: '/business/project/executionInfo',
        method: 'post',
        data: data,
    }),
    projectUser: (data) => request({
        url: '/business/project/workInfo',
        method: 'post',
        data: data,
    }),
}

// 用户板块
export const useUserApi = () => {
    // 这里可以添加用户相关的 API 方法
}

// 系统板块
export const systemApi = {
    getUserList: (data) => request({
        url: '/system/user/list',
        method: 'get',
        params: data,
    }),
    getDictData: (dictCode) => request({
        url: '/system/dict/data/type/' + dictCode,
        method: 'get',
    }),
    getDeptTree: () => request({
        url: '/system/user/deptTree',
        method: 'get',
    }),
}
