123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- 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<DictionaryData[]> {
- return request({
- method: 'GET',
- data: {type, nameOrCode},
- url: `${BASE_URL}/getDictionary`,
- signal,
- });
- }
- /** 获取字典分页列表 */
- export function getDictionaryList(
- data: GetDictionaryListParams,
- signal?: AbortSignal,
- ): BaseListResult<DictionaryData> {
- return request({
- method: 'GET',
- data,
- url: `${BASE_URL}/getDictionaryPage`,
- signal,
- });
- }
- /** 获取字典详情内容 */
- export function getDictionaryInfo(
- type: DictionaryParamsType,
- id?: string,
- code?: string,
- ): BaseListResult<DictionaryData> {
- 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<AllMaterialListData[]> {
- return request({
- url: `${BASE_URL}/getMaterial`,
- data,
- method: 'GET',
- signal,
- });
- }
|