73 lines
1.6 KiB
TypeScript
73 lines
1.6 KiB
TypeScript
import type { CommunityForm, CommunityQuery, CommunityVO } from './model';
|
|
|
|
import type { ID, IDS, PageResult } from '#/api/common';
|
|
|
|
import { commonExport } from '#/api/helper';
|
|
import { requestClient } from '#/api/request';
|
|
|
|
/**
|
|
* 查询小区列表
|
|
* @param params
|
|
* @returns 小区列表
|
|
*/
|
|
export function communityList(params?: CommunityQuery) {
|
|
return requestClient.get<PageResult<CommunityVO>>(
|
|
'/property/community/list',
|
|
{ params },
|
|
);
|
|
}
|
|
|
|
/**
|
|
* 查询小区树结构
|
|
* @param params
|
|
* @returns 小区列表
|
|
*/
|
|
export function communityTree(level: number) {
|
|
return requestClient.get<CommunityVO[]>(`/property/community/tree/${level}`);
|
|
}
|
|
|
|
/**
|
|
* 导出小区列表
|
|
* @param params
|
|
* @returns 小区列表
|
|
*/
|
|
export function communityExport(params?: CommunityQuery) {
|
|
return commonExport('/property/community/export', params ?? {});
|
|
}
|
|
|
|
/**
|
|
* 查询小区详情
|
|
* @param id id
|
|
* @returns 小区详情
|
|
*/
|
|
export function communityInfo(id: ID) {
|
|
return requestClient.get<CommunityVO>(`/property/community/${id}`);
|
|
}
|
|
|
|
/**
|
|
* 新增小区
|
|
* @param data
|
|
* @returns void
|
|
*/
|
|
export function communityAdd(data: CommunityForm) {
|
|
return requestClient.postWithMsg<void>('/property/community', data);
|
|
}
|
|
|
|
/**
|
|
* 更新小区
|
|
* @param data
|
|
* @returns void
|
|
*/
|
|
export function communityUpdate(data: CommunityForm) {
|
|
return requestClient.putWithMsg<void>('/property/community', data);
|
|
}
|
|
|
|
/**
|
|
* 删除小区
|
|
* @param id id
|
|
* @returns void
|
|
*/
|
|
export function communityRemove(id: ID | IDS) {
|
|
return requestClient.deleteWithMsg<void>(`/property/community/${id}`);
|
|
}
|