/** * Copyright (c) 2013-Now https://jeesite.com All rights reserved. * No deletion without permission, or be held responsible to law. * @author ThinkGem */ import { defHttp } from '@jeesite/core/utils/http/axios'; import { useGlobSetting } from '@jeesite/core/hooks/setting'; import { downloadByData } from '@jeesite/core/utils/file/download'; import type { Result, UploadFileParams } from '@jeesite/types/axios'; import type { AxiosProgressEvent, AxiosResponse } from 'axios'; const { adminPath, ctxAdminPath, ctxPath } = useGlobSetting(); export interface BaseStationSearchParams { mnc: string | number; lac: string | number; ci: string | number; } export interface BaseStationSearchLocation { latitude?: string | number | null; lat?: string | number | null; y?: string | number | null; longitude?: string | number | null; lng?: string | number | null; lon?: string | number | null; x?: string | number | null; range?: string | number | null; radius?: string | number | null; address?: string | null; addr?: string | null; stationName?: string | null; stationAddr?: string | null; lac?: string | number | null; ci?: string | number | null; cid?: string | number | null; mnc?: string | number | null; operatorName?: string | null; yys?: string | null; } export type BaseStationSearchResponse = | Array | BaseStationSearchLocation | BaseStationSearchLocation[] | { data?: Array | BaseStationSearchLocation | BaseStationSearchLocation[] | null; rows?: BaseStationSearchLocation[] | null; list?: BaseStationSearchLocation[] | null; records?: BaseStationSearchLocation[] | null; result?: Array | BaseStationSearchLocation | BaseStationSearchLocation[] | null; }; export interface BaseStationImportRow { field1?: string; lac?: string; cid?: string; yys?: string; field4?: string; field5?: string; field6?: string; field7?: string; field8?: string; } export interface BaseStationImportPayload { data?: BaseStationImportRow[]; file?: string; path?: string; filePath?: string; result?: string | Recordable | null; } export interface BaseStationImportResponse { code?: number; message?: string; msg?: string; data?: BaseStationImportPayload | string | Recordable | null; path?: string; result?: string | Recordable | null; } export type BaseStationTemplateResponse = | string | { code?: number; message?: string; msg?: string; data?: string | { path?: string; filePath?: string; file?: string } | null; path?: string; filePath?: string; file?: string; }; export interface BaseStationConvertResponse { code?: number; message?: string; msg?: string; data?: string | Recordable | null; path?: string; result?: string | Recordable | null; } export const searchBaseStation = (params: BaseStationSearchParams) => defHttp.get({ url: adminPath + '/tower/qry', params }); export const importBaseStationFile = ( params: UploadFileParams, onUploadProgress: (progressEvent: AxiosProgressEvent) => void, caseId?: string | number, ) => defHttp.uploadFile( { url: ctxPath + adminPath + '/tower/covFile' + (caseId !== undefined && caseId !== null && String(caseId).trim() ? `?caseId=${encodeURIComponent(String(caseId).trim())}` : ''), onUploadProgress, }, params, ); export const fetchBaseStationTemplatePath = () => defHttp.get( { url: adminPath + '/tower/tmpFile' }, { isTransformResponse: false, errorMessageMode: 'message' }, ); export const convertBaseStationData = (file: string) => defHttp.get( { url: adminPath + '/tower/covFile', params: { file } }, { errorMessageMode: 'none', skipSuccessMessage: true }, );