// import Request from '@/utils/request'
import Request from '@/utils/require'
import requestFile from '@/utils/requestFile'
import { business,User,dataDictionary,fileApi } from '@/api'

/* -------粮食财务管理-预算填报页接口开始-------*/
//保存 预算填报项目--迁移后
export function budgetSubmissionSave(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/modify`,
        method: 'post',
        data: VO
    })
}
// //新增 保存 预算填报项目--迁移后
export function budgetSubmissionSaveNew(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/${VO.type}`,
        method: 'post',
        data: VO
    })
}

//新增 保存 预算填报项目--迁移后
// export function budgetSubmissionSaveNew(VO) {
//     return Request({
//         url: `${business}/financial/bizFinancialBudgetFilling/modify`,
//         method: 'post',
//         data: VO
//     })
// }

//删除 --迁移后
export function budgetSubmissionDelete(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/?id=${VO.id}`,
        // url: `${business}/financial/bizFinancialBudgetFilling/deleteById?id=${VO}`,
        method: 'delete'
    })
}

//提交--迁移后 
export function budgetSubmissionSubmission(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/application`,
        method: 'post',
        data: VO
    })
}

//查看详情--迁移后---------0816
export function budgetSubmissionModify(id) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/?id=${id}`,
        method: 'get'
    })
}

//查看详情--迁移后---------0816
export function approveSubmissionModify(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFillingStatus/${VO.id}/${VO.status}/${VO.message}/${VO.findingsAudit}/${VO.departmentsCodes}`,
        method: 'post',
        data: VO
    })
}

//查询--迁移后---------0816
export function budgetSubmissionByPage(VO, data) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/findByPage/${data.page}/${data.size}`,
        method: 'post',
        data: VO
    })
}
//审核-查询--迁移后
export function budgetSubmissionByPageOfAudit(VO, data) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/findByPageOfAudit/${data.page}/${data.size}`,
        method: 'post',
        data: VO
    })
}
//审核-提交--迁移后
export function budgetSubmissionAudit(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/audit`,
        method: 'post',
        data: VO
    })
}
// 附件上传
export function uploadFile(e) {
    // console.log("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
    // console.log(e)
    // console.log("eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
    const fileTxt = e.target.files[0]

    // console.log("fielTextfielTextfielTextfielTextfielTextfielTextfielTextfielTextfielText")
    // console.log(fileTxt)
    // console.log("fielTextfielTextfielTextfielTextfielTextfielTextfielTextfielTextfielText")
    const param = new FormData() // 创建FormData对象
    param.append('file', fileTxt, fileTxt.name) // 通过append向form对象添加数据
    param.append('chunk', '0') // 添加form表单中其他数据
    // console.log(param.get('file')); //FormData私有类对象，访问不到，可以通过get判断值是否传进去
    return requestFile({
        // url: uploadUrl,
        url: `${fileApi}`,
        method: 'post',
        data: param
    })
}
// 附件删除--迁移后
export function deleteFiles(VO) {
    return Request({
        url: `${business}/financial/bizFinancialBudgetFilling/attachId?id=${VO}`,
        method: 'delete',
        // data: VO
    })
}

// 获取本级部门及代码数据的方法 暂时调用此接口
export function getdepartmentsCodesDataOrProjectAttribute(arg) {
    return Request({
        // 1/100暂时先写死
        url: `${dataDictionary}/dataDictionary/findByGroupId/${arg}`,
        method: 'GET',
    })
}

/* -------粮食财务管理-预算填报页接口结束-------*/