import { AddDictionaryListParams, AllMaterialListData, BaseListResult, BaseResult, DictionaryData, DictionaryParamsType, EditDictionaryListParams, EditDictionaryParams, GetAllMaterialListParams, GetDictionaryListParams, } from '@models'; import {request} from './request'; const BASE_URL = '/dictionary'; /** 获取字典列表 */ // eslint-disable-next-line max-params export function getDictionaryOptions( type: DictionaryParamsType, nameOrCode?: string, signal?: AbortSignal, ): BaseResult { return request({ method: 'GET', data: {type, nameOrCode}, url: `${BASE_URL}/getDictionary`, signal, }); } /** 获取字典分页列表 */ export function getDictionaryList( data: GetDictionaryListParams, signal?: AbortSignal, ): BaseListResult { return request({ method: 'GET', data, url: `${BASE_URL}/getDictionaryPage`, signal, }); } /** 获取字典详情内容 */ export function getDictionaryInfo( type: DictionaryParamsType, id?: string, code?: string, ): BaseListResult { return request({ method: 'GET', data: {page: '1', limit: '1', type, tldId: id, code}, url: `${BASE_URL}/getDictionaryPage`, }); } /** 修改物料字典内容 */ export function editDictionary(data: EditDictionaryParams): BaseResult { return request({ method: 'PUT', data, url: '/materialClass/updateMaterial', }); } /** 修改物料字典 */ export function editDictionaryData(data: EditDictionaryListParams): BaseResult { return request({ method: 'POST', data, url: `${BASE_URL}/updateDictionary`, }); } /** 新增物料字典 */ export function addDictionaryData(data: AddDictionaryListParams): BaseResult { return request({ method: 'POST', data, url: `${BASE_URL}/addDictionary`, }); } /** 删除物料字典 */ export function deleteDictionaryData(data: { id: string; type: DictionaryParamsType; }): BaseResult { return request({ method: 'DELETE', data, url: `${BASE_URL}/deleteDictionary`, }); } /** 修改仓库类型 */ export function editStorageType(data: { warehouseType: string; id: string; }): BaseResult { return request({ method: 'PUT', data, url: '/maintenance/updateWarehouse', }); } /** 导出物料信息 */ export function exportMaterial(data: GetDictionaryListParams): any { return request({ method: 'GET', data, url: `${BASE_URL}/export`, skipError: true, }); } /** 导出字典表信息 */ export function exportDictionary(data: GetDictionaryListParams): any { return request({ method: 'GET', data, url: `${BASE_URL}/dictionariesExport`, skipError: true, }); } /** 获取所有字典信息 */ export function getAllMaterialList( data: GetAllMaterialListParams, signal?: AbortSignal, ): BaseResult { return request({ url: `${BASE_URL}/getMaterial`, data, method: 'GET', signal, }); }