_geo.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { MockRequest } from '@delon/mock';
  2. const DATA = [
  3. {
  4. name: '上海',
  5. id: '310000',
  6. },
  7. {
  8. name: '市辖区',
  9. id: '310100',
  10. },
  11. {
  12. name: '北京',
  13. id: '110000',
  14. },
  15. {
  16. name: '市辖区',
  17. id: '110100',
  18. },
  19. {
  20. name: '浙江省',
  21. id: '330000',
  22. },
  23. {
  24. name: '杭州市',
  25. id: '330100',
  26. },
  27. {
  28. name: '宁波市',
  29. id: '330200',
  30. },
  31. {
  32. name: '温州市',
  33. id: '330300',
  34. },
  35. {
  36. name: '嘉兴市',
  37. id: '330400',
  38. },
  39. {
  40. name: '湖州市',
  41. id: '330500',
  42. },
  43. {
  44. name: '绍兴市',
  45. id: '330600',
  46. },
  47. {
  48. name: '金华市',
  49. id: '330700',
  50. },
  51. {
  52. name: '衢州市',
  53. id: '330800',
  54. },
  55. {
  56. name: '舟山市',
  57. id: '330900',
  58. },
  59. {
  60. name: '台州市',
  61. id: '331000',
  62. },
  63. {
  64. name: '丽水市',
  65. id: '331100',
  66. },
  67. ];
  68. export const GEOS = {
  69. '/geo/province': () => DATA.filter(w => w.id.endsWith('0000')),
  70. '/geo/:id': (req: MockRequest) => {
  71. const pid = (req.params.id || '310000').slice(0, 2);
  72. return DATA.filter(w => w.id.slice(0, 2) === pid && !w.id.endsWith('0000'));
  73. },
  74. };