region.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. import { resultSuccess } from '../_util';
  2. const regionList = [
  3. {
  4. id: 1,
  5. name: '广东省',
  6. parentId: null,
  7. depth: 1,
  8. },
  9. {
  10. id: 2,
  11. name: '江西省',
  12. parentId: null,
  13. depth: 1,
  14. },
  15. {
  16. id: 3,
  17. name: '浙江省',
  18. parentId: null,
  19. depth: 1,
  20. },
  21. ];
  22. const subRegionList = [
  23. {
  24. id: 11,
  25. name: '深圳市',
  26. parentId: 1,
  27. depth: 2,
  28. },
  29. {
  30. id: 111,
  31. name: '宝安区',
  32. parentId: 11,
  33. depth: 3,
  34. },
  35. {
  36. id: 112,
  37. name: '南山区',
  38. parentId: 11,
  39. depth: 3,
  40. },
  41. {
  42. id: 22,
  43. name: '广州市',
  44. parentId: 1,
  45. depth: 2,
  46. },
  47. {
  48. id: 221,
  49. name: '花都区',
  50. parentId: 22,
  51. depth: 3,
  52. },
  53. {
  54. id: 222,
  55. name: '白云区',
  56. parentId: 22,
  57. depth: 3,
  58. },
  59. {
  60. id: 33,
  61. name: '萍乡市',
  62. parentId: 2,
  63. depth: 2,
  64. },
  65. {
  66. id: 331,
  67. name: '上栗县',
  68. parentId: 33,
  69. depth: 3,
  70. },
  71. {
  72. id: 332,
  73. name: '安源区',
  74. parentId: 33,
  75. depth: 3,
  76. },
  77. {
  78. id: 44,
  79. name: '宜春市',
  80. parentId: 2,
  81. depth: 2,
  82. },
  83. {
  84. id: 441,
  85. name: '袁州区',
  86. parentId: 44,
  87. depth: 3,
  88. },
  89. {
  90. id: 442,
  91. name: '上高县',
  92. parentId: 44,
  93. depth: 3,
  94. },
  95. {
  96. id: 55,
  97. name: '杭州市',
  98. parentId: 3,
  99. depth: 2,
  100. },
  101. {
  102. id: 551,
  103. name: '上城区',
  104. parentId: 55,
  105. depth: 3,
  106. },
  107. {
  108. id: 552,
  109. name: '下城区',
  110. parentId: 55,
  111. depth: 3,
  112. },
  113. {
  114. id: 66,
  115. name: '温州市',
  116. parentId: 3,
  117. depth: 2,
  118. },
  119. {
  120. id: 661,
  121. name: '龙湾区',
  122. parentId: 66,
  123. depth: 3,
  124. },
  125. {
  126. id: 662,
  127. name: '平阳县',
  128. parentId: 66,
  129. depth: 3,
  130. },
  131. ];
  132. export default [
  133. {
  134. url: '/api/area/getParent',
  135. timeout: 1000,
  136. method: 'get',
  137. response: () => {
  138. return resultSuccess(regionList);
  139. },
  140. },
  141. {
  142. url: '/api/area/findByParentId',
  143. timeout: 1000,
  144. method: 'get',
  145. response: ({ query }) => {
  146. const { parentId } = query;
  147. return resultSuccess(subRegionList.filter((item) => item.parentId === parseInt(parentId)));
  148. },
  149. },
  150. ];