充电枪编辑功能

This commit is contained in:
三丙
2025-09-09 18:25:55 +08:00
parent 74fec1e044
commit 7a78c8a62a
11 changed files with 239 additions and 79 deletions

View File

@@ -5,7 +5,7 @@
* 付费课程知识星球https://t.zsxq.com/aKtXo
*/
import {api} from './api';
import type {Gun, GunCreateRequest, PageResponse, QueryParams} from '../types';
import type {Gun, GunCreateRequest, GunUpdateRequest, PageResponse, QueryParams} from '../types';
export const getGuns = async (params: QueryParams): Promise<PageResponse<Gun>> => {
const response = await api.get('/api/guns', { params });
@@ -17,7 +17,7 @@ export const createGun = async (data: GunCreateRequest): Promise<Gun> => {
return response.data.data;
};
export const updateGun = async (id: string, data: Partial<Gun>): Promise<Gun> => {
export const updateGun = async (id: string, data: GunUpdateRequest): Promise<Gun> => {
const response = await api.put(`/api/guns/${id}`, data);
return response.data.data;
};

View File

@@ -39,4 +39,11 @@ export const searchStationOptions = async (params: StationSearchRequest): Promis
export const getStationOptions = async (): Promise<StationOption[]> => {
const response = await api.get('/api/stations/options');
return response.data.data;
};
// 获取充电站-充电桩级联选择器数据
export const getStationPileCascaderOptions = async (keyword?: string): Promise<any[]> => {
const params = keyword ? { keyword } : {};
const response = await api.get('/api/stations/pile-cascader', { params });
return response.data.data;
};