import request from '@/utils/request'
import store from '@/store'

const BASE_URL = store.getters.request_config_baseUrl;

/**
 * @Author: NanKeYang
 * @Description: 作业票相关API
 * @Data: 2019/12/30 9:53
 */

/**
 * @Author: NanKeYang
 * @Description: 获取类型表单列表
 * @Data: 2019/12/30 9:52
 */
export function getTypeFormList(data) {
    return request({
        url: BASE_URL + '/3rd/flow/formList',
        method: 'get',
        params: data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 获取我的申请和待申请列表
 * @Data: 2019/12/30 9:52
 */
export function getApplyList(data) {
    return request({
        url: BASE_URL + '/3rd/flow/query',
        method: 'get',
        params: data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 获取已审批
 * @Data: 2019/12/30 9:52
 */
export function getApprovedList(data) {
    return request({
        url: BASE_URL + '/3rd/flow/queryLog',
        method: 'get',
        params: data
    })
}


/**
 * @Author: NanKeYang
 * @Description: 获取类型表单详情
 * @Data: 2019/12/30 9:52
 */
export function getTypeFormItem(data) {
    return request({
        url: BASE_URL + '/3rd/flow/getById',
        method: 'get',
        params: data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 获取我的申请和待申请列表 - 详情
 * @Data: 2019/12/30 9:52
 */
export function getApplyDetail(data) {
    return request({
        url: BASE_URL + '/3rd/flow/queryById',
        method: 'get',
        params: data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 申请表单
 * @Data: 2019/12/30 9:52
 */
export function applyForm(data) {
    return request({
        url: BASE_URL + '/3rd/flow/add',
        method: 'post',
        data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 更新申请表单
 * @Data: 2019/12/30 9:52
 */
export function updateApplyForm(data) {
    return request({
        url: BASE_URL + '/3rd/flow/update',
        method: 'post',
        data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 提交审批
 * @Data: 2019/12/30 9:52
 */
export function submitApproval(data) {
    return request({
        url: BASE_URL + '/3rd/flow/holiday',
        method: 'post',
        data
    })
}

/**
 * @Author: NanKeYang
 * @Description: 处理任务
 * @Data: 2019/12/30 9:52
 */
export function processingTask(data) {
    return request({
        url: BASE_URL + '/3rd/flow/approve',
        method: 'post',
        data
    })
}


/**
 * @Author: NanKeYang
 * @Description: 获取全部企业用户列表
 * @Data: 2020/1/2 11:49
 */
export function getCompanyUserList(data) {
    return request({
        url: BASE_URL + '/3rd/flow/getUsers',
        method: 'get',
        params: data
    })
}
