dictionary.js 913 B

12345678910111213141516171819202122232425262728293031323334
  1. import service from '../../utils/axios'
  2. // 获取字典列表
  3. export function getDictionaryList(param) {
  4. return service.post('/admin/dic/list', param)
  5. }
  6. export const getDictionaryById = async (id) => {
  7. // 模拟 API 调用延迟
  8. await new Promise(resolve => setTimeout(resolve, 500));
  9. return {
  10. id,
  11. label: `Dictionary ${id}`,
  12. value: `Value ${id}`,
  13. typeLabel: 'Type Label',
  14. typeId: 'Type ID',
  15. description: 'Description',
  16. sortNo: 1,
  17. };
  18. };
  19. export const addDictionary = async (data) => {
  20. // 模拟 API 调用延迟
  21. await new Promise(resolve => setTimeout(resolve, 500));
  22. console.log('API: Adding dictionary item', data);
  23. return { ...data, id: Date.now() };
  24. };
  25. export const updateDictionary = async (data) => {
  26. // 模拟 API 调用延迟
  27. await new Promise(resolve => setTimeout(resolve, 500));
  28. console.log('API: Updating dictionary item', data);
  29. return data;
  30. };