import { api } from 'src/boot/axios'; import { PageDto, PageQueryDto } from './ApiCommon'; const UriBase = '/api/lineInfo'; interface Item { id: number; name: string; lineId: number; config: string; createdAt: string; updateAt: string; } export class PagingQueryParams extends PageQueryDto { name?: string; } /** * 分页查询 * @param params * @returns */ export async function pageQuery( params: PagingQueryParams ): Promise> { const response = await api.get(`${UriBase}/paging`, { params: params, }); return response.data; } /** * 创建线路 * @param params * @returns */ export function createLine(data: { name: string; lineId: number; config: string; }) { 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: Item) { return api.put(`${UriBase}/${id}`, data); } /** * 获取线路数据详情 * @param params * @returns */ export async function getLineInfo(id: number): Promise { const response = await api.get(`${UriBase}/${id}`); return response.data; } /** * 获取线路信息列表 * @param params * @returns */ export async function getLineList(): Promise { const response = await api.get(`${UriBase}/list`); return response.data; }