提交代码

This commit is contained in:
2025-06-26 11:41:12 +08:00
commit d75fb55eec
396 changed files with 42172 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
import request from '@/utils/request';
import type { ApiResult } from '@/api/index';
import type { Dictionary, DictionaryParam } from './model';
import {SERVER_API_URL} from "@/utils/server";
/**
* 查询字典列表
*/
export async function listDictionaries(params?: DictionaryParam) {
const res = await request.get<ApiResult<Dictionary[]>>(
SERVER_API_URL + '/system/dictionary',
{
params
}
);
if (res.code === 0) {
return res.data;
}
return Promise.reject(new Error(res.message));
}
/**
* 添加字典
*/
export async function addDictionary(data: Dictionary) {
const res = await request.post<ApiResult<unknown>>(
SERVER_API_URL + '/system/dictionary',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 修改字典
*/
export async function updateDictionary(data: Dictionary) {
const res = await request.put<ApiResult<unknown>>(
SERVER_API_URL + '/system/dictionary',
data
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}
/**
* 删除字典
*/
export async function removeDictionary(id?: number) {
const res = await request.del<ApiResult<unknown>>(
SERVER_API_URL + '/system/dictionary/' + id
);
if (res.code === 0) {
return res.message;
}
return Promise.reject(new Error(res.message));
}