import request from '@/utils/request'

// 往来单位-下拉
export function getUnitList(query) {
    return request({
        url: '/material/agreementInfo/getUnitList',
        method: 'get',
        params: query,
    })
}

// 工程名称-下拉
export function getProjectList(query) {
    return request({
        url: '/material/agreementInfo/getProjectList',
        method: 'get',
        params: query,
    })
}

// 协议管理-列表
export function getAgreementList(query) {
    return request({
        url: '/material/agreementInfo/getAgreementInfoAll',
        method: 'get',
        params: query,
    })
}
// 协议管理-详情
export function getAgreementInfoId(query) {
    return request({
        url: '/material/agreementInfo/getAgreementInfoId',
        method: 'get',
        params: query,
    })
}

//协议管理--新增
export function addAgreement(data) {
    return request({
        url: '/material/agreementInfo/add',
        method: 'post',
        data: data,
    })
}

// 协议管理--修改
export function updateAgreement(data) {
    return request({
        url: '/material/agreementInfo/update',
        method: 'post',
        data: data,
    })
}
// //协议管理--删除
export function removeAgreement(data) {
    return request({
        url: '/material/agreementInfo/remove',
        method: 'post',
        data: data,
    })
}

// 机具领料-申请列表
export function getLeaseManageListAll(query) {
    return request({
        url: '/material/base/tm_task/getLeaseManageListAll',
        method: 'get',
        params: query,
    })
}
// 机具领料-申请列表
export function getLeaseManageListAllCq(query) {
    return request({
        url: '/material/base/tm_task/getLeaseManageListAllCq',
        method: 'get',
        params: query,
    })
}
// 机具领料-管理列表
export function getLeaseAuditListAll(query) {
    return request({
        url: '/material/base/tm_task/getLeaseAuditListAll',
        method: 'get',
        params: query,
    })
}

// 获取 来往单位 列表
export function getUnitData(params = {}) {
    return request({
        url: '/material/select/getUnitCbx',
        method: 'post',
        data: params,
    })
}

// 获取 工程 列表
export function getProData(params = {}) {
    return request({
        url: '/material/select/getSectionEngineeringCbx',
        method: 'post',
        data: params,
    })
}

//  获取 设备树
export function getDeviceTypeTree(params = {}) {
    return request({
        url: '/material/select/getDeviceTypeTree',
        method: 'post',
        data: params,
    })
}

// 根据单位id和工程id  获取 协议id
export function getAgreementInfoById(params = {}) {
    return request({
        url: '/material/select/getAgreementInfoById',
        method: 'post',
        data: params,
    })
}

//提交 领料申请
export function submitLeaseApply(params = {}) {
    return request({
        url: '/material/base/tm_task/submitLeaseApply',
        method: 'post',
        data: params,
    })
}

//编辑 领料申请
export function editLeaseApply(params = {}) {
    return request({
        url: '/material/base/tm_task/edit',
        method: 'post',
        data: params,
    })
}

// 参数 领料任务
export function deleteTask(taskId) {
    return request({
        url: `/material/base/tm_task/${taskId}`,
        method: 'delete',
    })
}

// 根据 领料任务id  获取详情数据
export function getLeaseListAll(params = {}) {
    return request({
        url: '/material/base/tm_task/getLeaseListAll',
        method: 'get',
        params: params,
    })
}
// 根据 领料任务id  获取详情数据
export function getLeaseListAllCq(params = {}) {
    return request({
        url: '/material/base/tm_task/getLeaseListAllCq',
        method: 'get',
        params: params,
    })
}

// 领料审核  同意
export function auditLeaseByCompany(params = {}) {
    return request({
        url: '/material/base/tm_task/auditLeaseByCompany',
        method: 'post',
        data: params,
    })
}
// 领料审核  同意
export function auditLeaseByCompanyCq(params = {}) {
    return request({
        url: '/material/base/tm_task/auditLeaseByCompanyCq',
        method: 'post',
        data: params,
    })
}

// 领料审核  拒绝
export function rejectLeaseByCompany(params = {}) {
    return request({
        url: '/material/base/tm_task/rejectLeaseByCompany',
        method: 'post',
        data: params,
    })
}
// 领料审核  拒绝
export function rejectLeaseByCompanyCq(params = {}) {
    return request({
        url: '/material/base/tm_task/rejectLeaseByCompanyCq',
        method: 'post',
        data: params,
    })
}

//  获取 物品类型
export function getUseTypeTreee(params = {}) {
    return request({
        url: '/material/backApply/getUseTypeTree',
        method: 'post',
        data: params,
    })
}

// 机具领料申请-详情
export function getLeaseApplyListAll(query) {
    return request({
        url: '/material/base/tm_task/getLeaseApplyListAll',
        method: 'get',
        params: query,
    })
}

export function getLeaseApplyAuditListAll(query) {
    return request({
        url: '/material/base/tm_task/getLeaseApplyAuditListAll',
        method: 'get',
        params: query,
    })
}

//领料出库 列表
export function getLeaseAuditList(query) {
    return request({
        url: '/material/base/tm_task/getLeaseAuditList',
        method: 'get',
        params: query,
    })
}

//领料出库 详情
export function getLeaseAuditListDetail(query) {
    return request({
        url: '/material/base/tm_task/getLeaseAuditListDetail',
        method: 'get',
        params: query,
    })
}

//领料出库 编码出库获取编码
export function getDetailsByTypeId(query) {
    return request({
        url: '/material/base/leaseOutDetails/getDetailsByTypeId',
        method: 'get',
        params: query,
    })
}

// 领料出库  编码出库 保存
export function submitOut(params) {
    return request({
        url: '/material/base/leaseOutDetails/submitOutRfid',
        method: 'post',
        data: params,
    })
}

// 领料出库  数量出库 保存
export function submitNumOut(params) {
    return request({
        url: '/material/base/leaseOutDetails/submitOutRfid',
        method: 'post',
        data: params,
    })
}

// 领料确认
export function updateLeaseTaskStatusConfirmByCq(params) {
    return request({
        url: '/material/base/tm_task/updateLeaseTaskStatusConfirmByCq',
        method: 'post',
        data: params,
    })
}

// 当前在用量
export function getUseNumByTypeId(params) {
    return request({
        url: '/material/backApply/getUseNumByTypeId',
        method: 'get',
        params,
    })
}

// 批量审核
export function auditAll(params) {
    return request({
        url: '/material/backApply/auditAll',
        method: 'post',
        data: params,
    })
}

// 获取费用承担方
export function getCostBearingApi() {
    return request({
        url: '/material/base/dic/pid',
        method: 'get',
    })
}
// 推送智慧工程
export function pushSmartEngineeringApi(data) {
    return request({
        url: '/material/base/tm_task/pushToIntelligentProject',
        method: 'post',
        data,
    })
}
// 推送智慧工程
export function getLeaseOutDetailRecordApi(data) {
    return request({
        url: '/material/base/tm_task/getLeaseOutDetailRecord',
        method: 'get',
        params: data,
    })
}
