48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { ChartDto, ChartEditDto, ChartJsonItemRowDto } from '../proxy/charts/models'
|
|
import apiService from './api.service'
|
|
|
|
export const getChartByCode = (chartCode: string) =>
|
|
apiService.fetchData<ChartEditDto>({
|
|
method: 'GET',
|
|
url: `/api/app/charts/by-chart-code`,
|
|
params: { chartCode },
|
|
})
|
|
|
|
export const getChartOptions = (chartCode: string) =>
|
|
apiService.fetchData<ChartDto>({
|
|
method: 'GET',
|
|
url: `/api/app/charts/chart-options`,
|
|
params: { chartCode },
|
|
})
|
|
|
|
export const getChartSelect = (chartCode: string, filter?: string) =>
|
|
apiService.fetchData({
|
|
method: 'GET',
|
|
url: `/api/app/chart-select/select`,
|
|
params: { chartCode, filter },
|
|
})
|
|
|
|
export const putCharts = (input: ChartEditDto) =>
|
|
apiService.fetchData({
|
|
method: 'PUT',
|
|
url: `/api/app/charts/${input.id}`,
|
|
data: input,
|
|
})
|
|
|
|
export const deleteChartJsonItem = (
|
|
id: string,
|
|
chartCode: string,
|
|
index: number,
|
|
fieldName: string,
|
|
) =>
|
|
apiService.fetchData({
|
|
method: 'DELETE',
|
|
url: `/api/app/charts/chart-json-item?id=${id}&chartCode=${chartCode}&index=${index}&fieldName=${fieldName}`,
|
|
})
|
|
|
|
export const putChartJsonItem = (input: ChartJsonItemRowDto) =>
|
|
apiService.fetchData({
|
|
method: 'PUT',
|
|
url: `/api/app/charts/chart-json-item`,
|
|
data: input,
|
|
})
|