import request from '/@/utils/request';
import { ProjectPlanApplyFormData, ProjectPlanApplyFormItem } from '/@/components/investment/interface/types';
import { investmentProjectsPlanList, InvestmentProjectsPlanPageT, ProjectLibraryDetailT } from '/@/views/invMid/projectLibrary/interface/types';
// 投资项目计划申报
export const investmentProjectsPlanAdd = (data: ProjectPlanApplyFormData) => {
	return request({
		url: '/admin/investmentProjectsPlan/add',
		method: 'post',
		data,
	});
};
// 修改项目投资计划
export const investmentProjectsPlanUpdate = (data: ProjectPlanApplyFormData) => {
	return request({
		url: '/admin/investmentProjectsPlan/update',
		method: 'put',
		data,
	})
}
// 投资项目计划列表
export const investmentProjectsPlanPage = (data: investmentProjectsPlanList) => {
	return request<InvestmentProjectsPlanPageT>({
		url: '/admin/investmentProjectsPlan/page',
		method: 'post',
		data:data
	})
}
// 投资项目计划详情
export const investmentProjectsPlanGetById = (id: number|string) => {
	return request<ProjectPlanApplyFormItem>({
		url: '/admin/investmentProjectsPlan/getById',
		method: 'get',
		params: {
			id: id,
		},
	});
};
// 推送国资 投资项目计划
export const investmentProjectsPlanPush = (id: string) => {
	return request({
		url: '/admin/investmentProjectsPlan/submit',
		method: 'get',
		params:{
            id:id
        }
	})
}
//删除项目投资计划
export const investmentProjectsPlanDelete = (ids: number[]) => {
	return request({
		url: '/admin/investmentProjectsPlan/delete',
		method: 'put',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded',
			'Enc-Flag': true,
		},
		data: new URLSearchParams({
			ids: ids.join(','),
		}),
	})
}
// 删除年度项目投资信息
export const investmentProjectsPlanDeleteInvestment = (ids: number[]) => {
	return request({
		url: '/admin/investmentProjectsPlan/deleteInvestment',
		method: 'delete',
		data: { ids },
	});
}
/**
 * 发起人部门归属
 * /admin/investmentProjectsPlan/userDeptBelong
 * */
export const investmentProjectsPlanUserDeptBelong = () => {
    return request({
        url: '/admin/investmentProjectsPlan/userDeptBelong',
        method: 'get',
    });
}