| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- import { http } from "@/utils/http";
- import { baseUrlApi } from "../utils";
- export interface DictList<T = any> {
- code: number;
- msg: string;
- rows: T;
- total?: number;
- }
- export interface BasicResponseModel<T = any> {
- code: number;
- msg: string;
- data: T;
- }
- /**
- * 获取字典类型列表
- * @param query
- */
- export const getSystemDictList = (query?: object) => {
- return http.request<DictList>("get", baseUrlApi("system/dict/type/list"), {
- params: query
- });
- };
- /**
- * 添加字典类型
- * @param data
- */
- export const addSystemDictType = (data: object) => {
- return http.request<BasicResponseModel>(
- "post",
- baseUrlApi("system/dict/type"),
- { data }
- );
- };
- /**
- * 修改字典类型
- * @param data
- */
- export const updateSystemDictType = (data: object) => {
- return http.request<BasicResponseModel>(
- "put",
- baseUrlApi("system/dict/type"),
- { data }
- );
- };
- /**
- * 删除字典类型
- * @param id
- */
- export const deleteSystemDictType = (id: string) => {
- return http.request<BasicResponseModel>(
- "delete",
- baseUrlApi(`system/dict/type/${id}`)
- );
- };
- /**
- * 根据ID获取字典类型详细信息
- * @param id
- */
- export const getSystemDictById = (id: string) => {
- return http.request<BasicResponseModel>(
- "get",
- baseUrlApi(`system/dict/type/${id}`)
- );
- };
- /**
- * 获取字典名称下拉框
- */
- export const getDictTypeOptionSelect = () => {
- return http.request<BasicResponseModel>(
- "get",
- baseUrlApi("system/dict/type/optionselect")
- );
- };
- /**
- * 获取字典数据列表
- * @param query
- */
- export const getSystemDictDataList = (query?: object) => {
- return http.request<DictList>("get", baseUrlApi("system/dict/data/list"), {
- params: query
- });
- };
- /**
- * 添加字典数据
- * @param data
- */
- export const addSystemDictData = (data: object) => {
- return http.request<BasicResponseModel>(
- "post",
- baseUrlApi("system/dict/data"),
- { data }
- );
- };
- /**
- * 修改字典数据
- * @param data
- */
- export const updateSystemDictData = (data: object) => {
- return http.request<BasicResponseModel>(
- "put",
- baseUrlApi("system/dict/data"),
- { data }
- );
- };
- /**
- * 删除字典数据
- * @param id
- */
- export const deleteSystemDictData = (id: string) => {
- return http.request<BasicResponseModel>(
- "delete",
- baseUrlApi(`system/dict/data/${id}`)
- );
- };
- /**
- * 根据ID获取字典数据详细信息
- * @param id
- */
- export const getSystemDictDataById = (id: string) => {
- return http.request<BasicResponseModel>(
- "get",
- baseUrlApi(`system/dict/data/${id}`)
- );
- };
- /**
- * 获取字典数据根据字典类型
- * @param dictType
- */
- export const getDictDataByType = (dictType: string) => {
- return http.request<BasicResponseModel>(
- "get",
- baseUrlApi(`system/dict/data/type/${dictType}`)
- );
- };
- /**
- * 刷新字典缓存
- */
- export const refreshDictCache = () => {
- return http.request<BasicResponseModel>(
- "delete",
- baseUrlApi("system/dict/type/refreshCache")
- );
- };
|