add StoreDiary
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { axios, type Page, type PageResult } from "timi-web-api";
|
||||
import type { StoreDiary } from "@/types/StoreDiary";
|
||||
|
||||
const BASE_URI = "/gao/store/diary";
|
||||
|
||||
export interface StoreDiaryListOptions {
|
||||
storeId?: string;
|
||||
beginCreatedAt: number;
|
||||
endCreatedAt: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 门店日记接口。
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param options 门店和月份筛选条件
|
||||
*/
|
||||
async function list(page: Page<StoreDiary>, options: StoreDiaryListOptions): Promise<PageResult<StoreDiary>> {
|
||||
return await axios.post(`${BASE_URI}/list`, {
|
||||
index: page.index,
|
||||
size: page.size,
|
||||
beginCreatedAt: options.beginCreatedAt,
|
||||
endCreatedAt: options.endCreatedAt,
|
||||
...(options.storeId ? { storeId: options.storeId } : {})
|
||||
});
|
||||
}
|
||||
|
||||
async function detail(id: string): Promise<StoreDiary> {
|
||||
return await axios.post(`${BASE_URI}/detail`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
async function create(article: StoreDiary): Promise<string> {
|
||||
return await axios.post(`${BASE_URI}/create`, article);
|
||||
}
|
||||
|
||||
async function update(article: StoreDiary): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/update`, article);
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/delete`, undefined, {
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
list,
|
||||
detail,
|
||||
create,
|
||||
update,
|
||||
remove
|
||||
};
|
||||
Reference in New Issue
Block a user