import request from "@/utils/httpRequest";
import { ASSESS_PATH as prefix } from "../../AppPath";

export default class FinanceInvoiceService {
	list(params) {
		return request({
			url: prefix + "/finance/invoice/list",
			method: "get",
			params: params,
		});
	}
	queryById(id) {
		return request({
			url: prefix + "/finance/invoice/queryById",
			method: "get",
			params: { id: id },
		});
	}
	queryByNumber(number, id) {
		return request({
			url: prefix + "/finance/invoice/queryByNumber",
			method: "get",
			params: { number: number, id: id },
		});
	}
	save(inputForm) {
		return request({
			url: prefix + `/finance/invoice/save`,
			method: "post",
			data: inputForm,
		});
	}
	delete(ids) {
		return request({
			url: prefix + "/finance/invoice/delete",
			method: "delete",
			params: { ids: ids },
		});
	}
	updateStatusById(data) {
		return request({
			url: prefix + "/finance/invoice/updateStatusById",
			method: "post",
			data: data,
		});
	}
	isReceivables(data) {
		return request({
			url: prefix + "/finance/invoice/isReceivables",
			method: "post",
			data: data,
		});
	}
	saveForm(inputForm) {
		return request({
			url: prefix + `/finance/invoice/saveForm`,
			method: "post",
			data: inputForm,
		});
	}
	saveFormOnly(inputForm) {
		return request({
			url: prefix + `/finance/invoice/saveFormOnly`,
			method: "post",
			data: inputForm,
		});
	}

	saveFormInvalid(inputForm) {
		return request({
			url: prefix + `/finance/invoice/saveFormInvalid`,
			method: "post",
			data: inputForm,
		});
	}
	queryIdByInvalidId(id) {
		return request({
			url: prefix + "/finance/invoice/queryIdByInvalidId",
			method: "get",
			params: { id: id },
		});
	}
	importDetail(data) {
		return request({
			url: prefix + "/finance/invoice/importDetail",
			method: "post",
			data: data,
		});
	}
	exportTemplate() {
		return request({
			url: prefix + "/finance/invoice/importDetail/template",
			method: "get",
			responseType: "blob",
		});
	}
	exportFile(params) {
		return request({
			url: prefix + "/finance/invoice/export",
			method: "get",
			params: params,
			responseType: "blob",
		});
	}
	redList(params) {
		return request({
			url: prefix + "/finance/invoice/redList",
			method: "get",
			params: params,
		});
	}
	findInvoiceByProjectName(params) {
		return request({
			url: prefix + "/finance/invoice/findInvoiceByProjectName",
			method: "get",
			params: params,
		});
	}
	downLoadOMSInvoiceAttachzip(params) {
		return request({
			url: prefix + "/finance/invoice/downLoadOMSInvoiceAttachzip",
			method: "get",
			params: params,
			responseType: "blob",
		});
	}

	invoiceOMSView(invoiceId) {
		return request({
			url: prefix + "/finance/invoice/invoiceOMSView",
			method: "get",
			params: { invoiceId: invoiceId },
		});
	}

	invoiceAllScenarioRedOMSView(params) {
		return request({
			url: prefix + "/finance/invoice/invoiceAllScenarioRedOMSView",
			method: "get",
			params: params,
		});
	}

	exportInvoiceTemplate() {
		return request({
			url: prefix + "/finance/invoice/importFinance/template",
			method: "get",
			responseType: "blob",
		});
	}

	importProjectRecords(data) {
		return request({
			url: prefix + "/finance/invoice/importProjectRecords",
			method: "post",
			data: data,
		});
	}

	// 下载导入结果Excel
	downloadImportResult(fileName) {
		return request({
			url: prefix + "/finance/invoice/downloadImportResult",
			method: "get",
			params: { fileName: fileName },
			responseType: "blob",
		});
	}
}
