leaser_front/src/api/common.ts
2026-01-10 11:39:33 +08:00

86 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from 'axios';
import {
CommonProvinceRes,
CommonCityRes,
CommonDistrictRes,
AllProjectIdNameListRes,
AllBuildingIdNameListRes,
AllFloorIdNameListRes,
AllInvoiceTypeIdNameListRes,
AllFilingTypeIdNameListRes,
UploadParam,
BankListRes,
} from '@/types/comm';
import { HttpResponse } from './interceptor';
export interface ProjectRecord {
id: string;
name: string;
type: string;
}
// 省份列表
export function getProvinceList(): Promise<CommonProvinceRes> {
return axios.get(`common/getProvinceList`);
}
// 城市列表
export function getCityListByProvinceId(id: number): Promise<CommonCityRes> {
return axios.get(`common/getCityList?province_id=${id}`);
}
// 区域列表
export function getDistrictListByCityId(
id: number
): Promise<CommonDistrictRes> {
return axios.get(`common/getDistrictList?city_id=${id}`);
}
// 全部项目(id,名称)列表
export function getAllProjectIdNameList(): Promise<AllProjectIdNameListRes> {
return axios.get(`common/getAllProjectList`);
}
// 全部楼栋(id,名称)列表(根据项目id查询)
export function getAllBuildingIdNameList(
id: number
): Promise<AllBuildingIdNameListRes> {
return axios.get(`common/getAllBuildingList?project_id=${id}`);
}
// 全部楼层(id,名称)列表(根据楼栋id查询)
export function getAllFloorIdNameList(
id: number
): Promise<AllFloorIdNameListRes> {
return axios.get(`common/getAllFloorList?building_id=${id}`);
}
// 发票类型列表
export function getInvoiceTypeList(): Promise<AllInvoiceTypeIdNameListRes> {
return axios.get(`common/getInvoiceTypeList`);
}
// 租客归档类型列表
export function getFilingTypeList(): Promise<AllFilingTypeIdNameListRes> {
return axios.get(`common/getFilingTypeList`);
}
// 上传文档
export function ossUpload(
params: UploadParam | FormData
): Promise<HttpResponse> {
return axios.post('common/ossUpload', params);
}
// 下载文档
export function ossDownload(key: string): Promise<HttpResponse> {
return axios.get(`common/ossDownload?key=${key}`);
}
// 银行列表
export function getBanksList(keyword: string): Promise<BankListRes> {
return axios.post('common/getBanksList', { keyword });
}
// 获取勾选部门的项目列表
export function getDeptProjectListFromDeptId(id: number): Promise<any> {
return axios.get(`common/getDeptProjectList?departmentId=${id}`);
}
// 审批流类型列表
export function getWorkflowsTypeList(): Promise<any> {
return axios.get(`common/getWorkflowsTypeList`);
}
// 公共接口-用户列表
export function getCommonUserList(): Promise<any> {
return axios.get(`common/getUserList`);
}