80 lines
1.5 KiB
TypeScript
80 lines
1.5 KiB
TypeScript
import { api } from 'src/boot/axios';
|
|
import { PageDto, PageQueryDto } from './ApiCommon';
|
|
|
|
const UriBase = '/api/lineInfo';
|
|
|
|
export interface createParams {
|
|
name: string;
|
|
lineId: number;
|
|
config?: string;
|
|
}
|
|
|
|
interface Item extends createParams {
|
|
id: number;
|
|
createdAt: string;
|
|
updateAt: string;
|
|
}
|
|
|
|
export class PagingQueryParams extends PageQueryDto {
|
|
name?: string;
|
|
}
|
|
|
|
/**
|
|
* 分页查询
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export async function pageQuery(
|
|
params: PagingQueryParams
|
|
): Promise<PageDto<Item>> {
|
|
const response = await api.get(`${UriBase}/paging`, {
|
|
params: params,
|
|
});
|
|
return response.data;
|
|
}
|
|
|
|
/**
|
|
* 创建线路
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export function createLine(data: createParams) {
|
|
return api.post(`${UriBase}`, data);
|
|
}
|
|
|
|
/**
|
|
* 删除线路
|
|
* @param id 线路id
|
|
*/
|
|
export function deleteLine(id: number) {
|
|
return api.delete(`${UriBase}/${id}`);
|
|
}
|
|
|
|
/**
|
|
* 保存线路数据
|
|
* @param id 草稿id
|
|
*/
|
|
export function saveLineData(id: number, data: createParams) {
|
|
return api.put(`${UriBase}/${id}`, data);
|
|
}
|
|
|
|
/**
|
|
* 获取线路数据详情
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export async function getLineInfo(id: number): Promise<Item> {
|
|
const response = await api.get(`${UriBase}/${id}`);
|
|
return response.data;
|
|
}
|
|
|
|
/**
|
|
* 获取线路信息列表
|
|
* @param params
|
|
* @returns
|
|
*/
|
|
export async function getLineList(): Promise<Array<Item>> {
|
|
const response = await api.get(`${UriBase}/list`);
|
|
return response.data;
|
|
}
|