api-cascader.ts 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. import { MockMethod } from 'vite-plugin-mock';
  2. import { resultSuccess } from '../_util';
  3. const areaList: any[] = [
  4. {
  5. id: '530825900854620160',
  6. code: '430000',
  7. parentCode: '100000',
  8. levelType: 1,
  9. name: '湖南省',
  10. province: '湖南省',
  11. city: null,
  12. district: null,
  13. town: null,
  14. village: null,
  15. parentPath: '430000',
  16. createTime: '2020-11-30 15:47:31',
  17. updateTime: '2020-11-30 16:33:42',
  18. customized: false,
  19. usable: true,
  20. },
  21. {
  22. id: '530825900883980288',
  23. code: '430100',
  24. parentCode: '430000',
  25. levelType: 2,
  26. name: '长沙市',
  27. province: '湖南省',
  28. city: '长沙市',
  29. district: null,
  30. town: null,
  31. village: null,
  32. parentPath: '430000,430100',
  33. createTime: '2020-11-30 15:47:31',
  34. updateTime: '2020-11-30 16:33:42',
  35. customized: false,
  36. usable: true,
  37. },
  38. {
  39. id: '530825900951089152',
  40. code: '430102',
  41. parentCode: '430100',
  42. levelType: 3,
  43. name: '芙蓉区',
  44. province: '湖南省',
  45. city: '长沙市',
  46. district: '芙蓉区',
  47. town: null,
  48. village: null,
  49. parentPath: '430000,430100,430102',
  50. createTime: '2020-11-30 15:47:31',
  51. updateTime: '2020-11-30 16:33:42',
  52. customized: false,
  53. usable: true,
  54. },
  55. {
  56. id: '530825901014003712',
  57. code: '430104',
  58. parentCode: '430100',
  59. levelType: 3,
  60. name: '岳麓区',
  61. province: '湖南省',
  62. city: '长沙市',
  63. district: '岳麓区',
  64. town: null,
  65. village: null,
  66. parentPath: '430000,430100,430104',
  67. createTime: '2020-11-30 15:47:31',
  68. updateTime: '2020-11-30 16:33:42',
  69. customized: false,
  70. usable: true,
  71. },
  72. {
  73. id: '530825900988837888',
  74. code: '430103',
  75. parentCode: '430100',
  76. levelType: 3,
  77. name: '天心区',
  78. province: '湖南省',
  79. city: '长沙市',
  80. district: '天心区',
  81. town: null,
  82. village: null,
  83. parentPath: '430000,430100,430103',
  84. createTime: '2020-11-30 15:47:31',
  85. updateTime: '2020-11-30 16:33:42',
  86. customized: false,
  87. usable: true,
  88. },
  89. {
  90. id: '530826672489115648',
  91. code: '430103002',
  92. parentCode: '430103',
  93. levelType: 4,
  94. name: '坡子街街道',
  95. province: '湖南省',
  96. city: '长沙市',
  97. district: '天心区',
  98. town: '坡子街街道',
  99. village: null,
  100. parentPath: '430000,430100,430103,430103002',
  101. createTime: '2020-11-30 15:47:31',
  102. updateTime: '2020-12-14 15:26:43',
  103. customized: false,
  104. usable: true,
  105. },
  106. {
  107. id: '530840241171607552',
  108. code: '430103002001',
  109. parentCode: '430103002',
  110. levelType: 5,
  111. name: '八角亭社区',
  112. province: '湖南省',
  113. city: '长沙市',
  114. district: '天心区',
  115. town: '坡子街街道',
  116. village: '八角亭社区',
  117. parentPath: '430000,430100,430103,430103002,430103002001',
  118. createTime: '2020-11-30 15:47:31',
  119. updateTime: '2021-01-20 14:07:23',
  120. customized: false,
  121. usable: true,
  122. },
  123. {
  124. id: '530840241200967680',
  125. code: '430103002002',
  126. parentCode: '430103002',
  127. levelType: 5,
  128. name: '西牌楼社区',
  129. province: '湖南省',
  130. city: '长沙市',
  131. district: '天心区',
  132. town: '坡子街街道',
  133. village: '西牌楼社区',
  134. parentPath: '430000,430100,430103,430103002,430103002002',
  135. createTime: '2020-11-30 15:47:31',
  136. updateTime: '2020-11-30 17:30:41',
  137. customized: false,
  138. usable: true,
  139. },
  140. {
  141. id: '530840241230327808',
  142. code: '430103002003',
  143. parentCode: '430103002',
  144. levelType: 5,
  145. name: '太平街社区',
  146. province: '湖南省',
  147. city: '长沙市',
  148. district: '天心区',
  149. town: '坡子街街道',
  150. village: '太平街社区',
  151. parentPath: '430000,430100,430103,430103002,430103002003',
  152. createTime: '2020-11-30 15:47:31',
  153. updateTime: '2020-11-30 17:30:41',
  154. customized: false,
  155. usable: true,
  156. },
  157. {
  158. id: '530840241259687936',
  159. code: '430103002005',
  160. parentCode: '430103002',
  161. levelType: 5,
  162. name: '坡子街社区',
  163. province: '湖南省',
  164. city: '长沙市',
  165. district: '天心区',
  166. town: '坡子街街道',
  167. village: '坡子街社区',
  168. parentPath: '430000,430100,430103,430103002,430103002005',
  169. createTime: '2020-11-30 15:47:31',
  170. updateTime: '2020-11-30 17:30:41',
  171. customized: false,
  172. usable: true,
  173. },
  174. {
  175. id: '530840241284853760',
  176. code: '430103002006',
  177. parentCode: '430103002',
  178. levelType: 5,
  179. name: '青山祠社区',
  180. province: '湖南省',
  181. city: '长沙市',
  182. district: '天心区',
  183. town: '坡子街街道',
  184. village: '青山祠社区',
  185. parentPath: '430000,430100,430103,430103002,430103002006',
  186. createTime: '2020-11-30 15:47:31',
  187. updateTime: '2020-11-30 17:30:41',
  188. customized: false,
  189. usable: true,
  190. },
  191. {
  192. id: '530840241310019584',
  193. code: '430103002007',
  194. parentCode: '430103002',
  195. levelType: 5,
  196. name: '沙河社区',
  197. province: '湖南省',
  198. city: '长沙市',
  199. district: '天心区',
  200. town: '坡子街街道',
  201. village: '沙河社区',
  202. parentPath: '430000,430100,430103,430103002,430103002007',
  203. createTime: '2020-11-30 15:47:31',
  204. updateTime: '2020-11-30 17:30:41',
  205. customized: false,
  206. usable: true,
  207. },
  208. {
  209. id: '530840241381322752',
  210. code: '430103002008',
  211. parentCode: '430103002',
  212. levelType: 5,
  213. name: '碧湘社区',
  214. province: '湖南省',
  215. city: '长沙市',
  216. district: '天心区',
  217. town: '坡子街街道',
  218. village: '碧湘社区',
  219. parentPath: '430000,430100,430103,430103002,430103002008',
  220. createTime: '2020-11-30 15:47:31',
  221. updateTime: '2020-11-30 17:30:41',
  222. customized: false,
  223. usable: true,
  224. },
  225. {
  226. id: '530840241410682880',
  227. code: '430103002009',
  228. parentCode: '430103002',
  229. levelType: 5,
  230. name: '创远社区',
  231. province: '湖南省',
  232. city: '长沙市',
  233. district: '天心区',
  234. town: '坡子街街道',
  235. village: '创远社区',
  236. parentPath: '430000,430100,430103,430103002,430103002009',
  237. createTime: '2020-11-30 15:47:31',
  238. updateTime: '2020-11-30 17:30:41',
  239. customized: false,
  240. usable: true,
  241. },
  242. {
  243. id: '530840241431654400',
  244. code: '430103002010',
  245. parentCode: '430103002',
  246. levelType: 5,
  247. name: '楚湘社区',
  248. province: '湖南省',
  249. city: '长沙市',
  250. district: '天心区',
  251. town: '坡子街街道',
  252. village: '楚湘社区',
  253. parentPath: '430000,430100,430103,430103002,430103002010',
  254. createTime: '2020-11-30 15:47:31',
  255. updateTime: '2020-11-30 17:30:41',
  256. customized: false,
  257. usable: true,
  258. },
  259. {
  260. id: '530840241465208832',
  261. code: '430103002011',
  262. parentCode: '430103002',
  263. levelType: 5,
  264. name: '西湖社区',
  265. province: '湖南省',
  266. city: '长沙市',
  267. district: '天心区',
  268. town: '坡子街街道',
  269. village: '西湖社区',
  270. parentPath: '430000,430100,430103,430103002,430103002011',
  271. createTime: '2020-11-30 15:47:31',
  272. updateTime: '2020-11-30 17:30:41',
  273. customized: false,
  274. usable: true,
  275. },
  276. {
  277. id: '530840241502957568',
  278. code: '430103002012',
  279. parentCode: '430103002',
  280. levelType: 5,
  281. name: '登仁桥社区',
  282. province: '湖南省',
  283. city: '长沙市',
  284. district: '天心区',
  285. town: '坡子街街道',
  286. village: '登仁桥社区',
  287. parentPath: '430000,430100,430103,430103002,430103002012',
  288. createTime: '2020-11-30 15:47:31',
  289. updateTime: '2020-11-30 17:30:41',
  290. customized: false,
  291. usable: true,
  292. },
  293. {
  294. id: '530840241553289216',
  295. code: '430103002013',
  296. parentCode: '430103002',
  297. levelType: 5,
  298. name: '文庙坪社区',
  299. province: '湖南省',
  300. city: '长沙市',
  301. district: '天心区',
  302. town: '坡子街街道',
  303. village: '文庙坪社区',
  304. parentPath: '430000,430100,430103,430103002,430103002013',
  305. createTime: '2020-11-30 15:47:31',
  306. updateTime: '2020-11-30 17:30:41',
  307. customized: false,
  308. usable: true,
  309. },
  310. ];
  311. export default [
  312. {
  313. url: '/basic-api/cascader/getAreaRecord',
  314. timeout: 1000,
  315. method: 'post',
  316. response: ({ body }) => {
  317. const { parentCode } = body || {};
  318. if (!parentCode) {
  319. return resultSuccess(areaList.filter((it) => it.code === '430000'));
  320. }
  321. return resultSuccess(areaList.filter((it) => it.parentCode === parentCode));
  322. },
  323. },
  324. ] as MockMethod[];