add store
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { axios, type PageResult } from "timi-web";
|
||||
import type { CustomerEventRankView, EventRecord, EventRecordPage, EventRecordRankPage } from "@/types/EventRecord";
|
||||
import type { Customer } from "@/types/Customer.ts";
|
||||
import { withCurrentStoreId } from "@/utils/store";
|
||||
|
||||
const BASE_URI = "/gao/event/record";
|
||||
|
||||
async function list(page: EventRecordPage): Promise<PageResult<EventRecord>> {
|
||||
return await axios.post(`${BASE_URI}/list`, page);
|
||||
return await axios.post(`${BASE_URI}/list`, withCurrentStoreId(page));
|
||||
}
|
||||
|
||||
async function detail(id: string): Promise<EventRecord> {
|
||||
@@ -15,19 +16,19 @@ async function detail(id: string): Promise<EventRecord> {
|
||||
}
|
||||
|
||||
async function create(record: EventRecord): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/create`, record);
|
||||
await axios.post(`${BASE_URI}/create`, withCurrentStoreId(record));
|
||||
}
|
||||
|
||||
async function createBatch(recordList: EventRecord[]): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/create/batch`, recordList);
|
||||
await axios.post(`${BASE_URI}/create/batch`, recordList.map(record => withCurrentStoreId(record)));
|
||||
}
|
||||
|
||||
async function createWithCustomer(customer: Customer): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/create/customer`, customer);
|
||||
await axios.post(`${BASE_URI}/create/customer`, withCurrentStoreId(customer));
|
||||
}
|
||||
|
||||
async function update(record: EventRecord): Promise<void> {
|
||||
await axios.post(`${BASE_URI}/update`, record);
|
||||
await axios.post(`${BASE_URI}/update`, withCurrentStoreId(record));
|
||||
}
|
||||
|
||||
async function remove(id: string): Promise<void> {
|
||||
@@ -37,11 +38,11 @@ async function remove(id: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function eventRank(page: EventRecordRankPage): Promise<CustomerEventRankView> {
|
||||
return await axios.post(`${BASE_URI}/rank`, page);
|
||||
return await axios.post(`${BASE_URI}/rank`, withCurrentStoreId(page));
|
||||
}
|
||||
|
||||
async function exportXSSF(page: EventRecordPage): Promise<Blob> {
|
||||
return await axios.post(`${BASE_URI}/export`, page, {
|
||||
return await axios.post(`${BASE_URI}/export`, withCurrentStoreId(page), {
|
||||
responseType: "blob"
|
||||
});
|
||||
}
|
||||
@@ -57,4 +58,3 @@ export default {
|
||||
remove,
|
||||
eventRank
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user