api.js 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012
  1. import { getUrlParams } from "./utils";
  2. const titles = [
  3. "Alipay",
  4. "Angular",
  5. "Ant Design",
  6. "Ant Design Pro",
  7. "Bootstrap",
  8. "React",
  9. "Vue",
  10. "Webpack"
  11. ];
  12. const avatars = [
  13. "https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png", // Alipay
  14. "https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png", // Angular
  15. "https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png", // Ant Design
  16. "https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png", // Ant Design Pro
  17. "https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png", // Bootstrap
  18. "https://gw.alipayobjects.com/zos/rmsportal/kZzEzemZyKLKFsojXItE.png", // React
  19. "https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png", // Vue
  20. "https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png" // Webpack
  21. ];
  22. const covers = [
  23. "https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png",
  24. "https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png",
  25. "https://gw.alipayobjects.com/zos/rmsportal/uVZonEtjWwmUZPBQfycs.png",
  26. "https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png"
  27. ];
  28. const desc = [
  29. "那是一种内在的东西, 他们到达不了,也无法触及的",
  30. "希望是一个好东西,也许是最好的,好东西是不会消亡的",
  31. "生命就像一盒巧克力,结果往往出人意料",
  32. "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
  33. "那时候我只会想自己想要什么,从不想自己拥有什么"
  34. ];
  35. const user = [
  36. "付小小",
  37. "曲丽丽",
  38. "林东东",
  39. "周星星",
  40. "吴加好",
  41. "朱偏右",
  42. "鱼酱",
  43. "乐哥",
  44. "谭小仪",
  45. "仲尼"
  46. ];
  47. export function fakeList(count) {
  48. const list = [];
  49. for (let i = 0; i < count; i += 1) {
  50. list.push({
  51. id: `fake-list-${i}`,
  52. owner: user[i % 10],
  53. title: titles[i % 8],
  54. avatar: avatars[i % 8],
  55. cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - i % 4],
  56. status: ["active", "exception", "normal"][i % 3],
  57. percent: Math.ceil(Math.random() * 50) + 50,
  58. logo: avatars[i % 8],
  59. href: "https://ant.design",
  60. updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
  61. createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i),
  62. subDescription: desc[i % 5],
  63. description:
  64. "在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。",
  65. activeUser: Math.ceil(Math.random() * 100000) + 100000,
  66. newUser: Math.ceil(Math.random() * 1000) + 1000,
  67. star: Math.ceil(Math.random() * 100) + 100,
  68. like: Math.ceil(Math.random() * 100) + 100,
  69. message: Math.ceil(Math.random() * 10) + 10,
  70. content:
  71. "段落示意:蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design,用最小的工作量,无缝接入蚂蚁金服生态,提供跨越设计与开发的体验解决方案。",
  72. members: [
  73. {
  74. avatar:
  75. "https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png",
  76. name: "曲丽丽"
  77. },
  78. {
  79. avatar:
  80. "https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png",
  81. name: "王昭君"
  82. },
  83. {
  84. avatar:
  85. "https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png",
  86. name: "董娜娜"
  87. }
  88. ]
  89. });
  90. }
  91. return list;
  92. }
  93. export function getFakeList(req, res, u) {
  94. let url = u;
  95. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  96. url = req.url; // eslint-disable-line
  97. }
  98. const params = getUrlParams(url);
  99. const count = params.count * 1 || 20;
  100. const result = fakeList(count);
  101. if (res && res.json) {
  102. res.json(result);
  103. } else {
  104. return result;
  105. }
  106. }
  107. export const getNotice = [
  108. {
  109. id: "xxx1",
  110. title: titles[0],
  111. logo: avatars[0],
  112. description: "那是一种内在的东西,他们到达不了,也无法触及的",
  113. updatedAt: new Date(),
  114. member: "科学搬砖组",
  115. href: "",
  116. memberLink: ""
  117. },
  118. {
  119. id: "xxx2",
  120. title: titles[1],
  121. logo: avatars[1],
  122. description: "希望是一个好东西,也许是最好的,好东西是不会消亡的",
  123. updatedAt: new Date("2017-07-24"),
  124. member: "全组都是吴彦祖",
  125. href: "",
  126. memberLink: ""
  127. },
  128. {
  129. id: "xxx3",
  130. title: titles[2],
  131. logo: avatars[2],
  132. description: "城镇中有那么多的酒馆,她却偏偏走进了我的酒馆",
  133. updatedAt: new Date(),
  134. member: "中二少女团",
  135. href: "",
  136. memberLink: ""
  137. },
  138. {
  139. id: "xxx4",
  140. title: titles[3],
  141. logo: avatars[3],
  142. description: "那时候我只会想自己想要什么,从不想自己拥有什么",
  143. updatedAt: new Date("2017-07-23"),
  144. member: "程序员日常",
  145. href: "",
  146. memberLink: ""
  147. },
  148. {
  149. id: "xxx5",
  150. title: titles[4],
  151. logo: avatars[4],
  152. description: "凛冬将至",
  153. updatedAt: new Date("2017-07-23"),
  154. member: "高逼格设计天团",
  155. href: "",
  156. memberLink: ""
  157. },
  158. {
  159. id: "xxx6",
  160. title: titles[5],
  161. logo: avatars[5],
  162. description: "生命就像一盒巧克力,结果往往出人意料",
  163. updatedAt: new Date("2017-07-23"),
  164. member: "骗你来学计算机",
  165. href: "",
  166. memberLink: ""
  167. }
  168. ];
  169. export const getActivities = [
  170. {
  171. id: "trend-1",
  172. updatedAt: new Date(),
  173. user: {
  174. name: "林东东",
  175. avatar: avatars[0]
  176. },
  177. group: {
  178. name: "高逼格设计天团",
  179. link: "http://github.com/"
  180. },
  181. project: {
  182. name: "六月迭代",
  183. link: "http://github.com/"
  184. },
  185. template: "在 @{group} 新建项目 @{project}"
  186. },
  187. {
  188. id: "trend-2",
  189. updatedAt: new Date(),
  190. user: {
  191. name: "付小小",
  192. avatar: avatars[1]
  193. },
  194. group: {
  195. name: "高逼格设计天团",
  196. link: "http://github.com/"
  197. },
  198. project: {
  199. name: "六月迭代",
  200. link: "http://github.com/"
  201. },
  202. template: "在 @{group} 新建项目 @{project}"
  203. },
  204. {
  205. id: "trend-3",
  206. updatedAt: new Date(),
  207. user: {
  208. name: "曲丽丽",
  209. avatar: avatars[2]
  210. },
  211. group: {
  212. name: "中二少女团",
  213. link: "http://github.com/"
  214. },
  215. project: {
  216. name: "六月迭代",
  217. link: "http://github.com/"
  218. },
  219. template: "在 @{group} 新建项目 @{project}"
  220. },
  221. {
  222. id: "trend-4",
  223. updatedAt: new Date(),
  224. user: {
  225. name: "周星星",
  226. avatar: avatars[3]
  227. },
  228. project: {
  229. name: "5 月日常迭代",
  230. link: "http://github.com/"
  231. },
  232. template: "将 @{project} 更新至已发布状态"
  233. },
  234. {
  235. id: "trend-5",
  236. updatedAt: new Date(),
  237. user: {
  238. name: "朱偏右",
  239. avatar: avatars[4]
  240. },
  241. project: {
  242. name: "工程效能",
  243. link: "http://github.com/"
  244. },
  245. comment: {
  246. name: "留言",
  247. link: "http://github.com/"
  248. },
  249. template: "在 @{project} 发布了 @{comment}"
  250. },
  251. {
  252. id: "trend-6",
  253. updatedAt: new Date(),
  254. user: {
  255. name: "乐哥",
  256. avatar: avatars[5]
  257. },
  258. group: {
  259. name: "程序员日常",
  260. link: "http://github.com/"
  261. },
  262. project: {
  263. name: "品牌迭代",
  264. link: "http://github.com/"
  265. },
  266. template: "在 @{group} 新建项目 @{project}"
  267. }
  268. ];
  269. const orderData = {
  270. result: 1,
  271. msg: "查询成功",
  272. errorCode: null,
  273. data: [
  274. {
  275. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  276. persistStatus: null,
  277. accountTypeId: null,
  278. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  279. orderCode: "PO1001346180111008",
  280. businessAccountId: null,
  281. businessAccountCode: null,
  282. businessAccountName: null,
  283. poTypeCode: "04",
  284. poTypeName: "资源采购订单",
  285. receiveAddressId: null,
  286. receiveAddressName: null,
  287. demandDeliveryDate: null,
  288. billMakerId: null,
  289. billMakerName: null,
  290. remark: null,
  291. orderDate: "2018-01-11 16:48:23",
  292. billStatusCode: "05",
  293. billStatusName: "已完成",
  294. orderDateStart: null,
  295. orderDateEnd: null,
  296. reqDeliveryDate: null,
  297. defaultDelyDate: null,
  298. totalQuantity: 2,
  299. totalAmount: 5,
  300. totalVolume: 0,
  301. totalWeight: 0,
  302. distributorId: null,
  303. distributorCode: null,
  304. distributorName: null,
  305. transportModeCode: null,
  306. transportModeName: "整车",
  307. purchaseOrderItems: null
  308. },
  309. {
  310. id: "f5a4e11b-c728-4b3f-a449-3fd405ba54a7",
  311. persistStatus: null,
  312. accountTypeId: null,
  313. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  314. orderCode: "PO1001346180111007",
  315. businessAccountId: null,
  316. businessAccountCode: null,
  317. businessAccountName: null,
  318. poTypeCode: "05",
  319. poTypeName: "饰品采购订单",
  320. receiveAddressId: null,
  321. receiveAddressName: null,
  322. demandDeliveryDate: null,
  323. billMakerId: null,
  324. billMakerName: null,
  325. remark: "饰品直送",
  326. orderDate: "2018-01-11 16:15:26",
  327. billStatusCode: "05",
  328. billStatusName: "已完成",
  329. orderDateStart: null,
  330. orderDateEnd: null,
  331. reqDeliveryDate: null,
  332. defaultDelyDate: null,
  333. totalQuantity: 2,
  334. totalAmount: 11,
  335. totalVolume: 0,
  336. totalWeight: 0,
  337. distributorId: null,
  338. distributorCode: null,
  339. distributorName: null,
  340. transportModeCode: null,
  341. transportModeName: "整车",
  342. purchaseOrderItems: null
  343. },
  344. {
  345. id: "59679ed9-f0cb-461c-aad2-b7b5ae8a7e52",
  346. persistStatus: null,
  347. accountTypeId: null,
  348. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  349. orderCode: "PO1001346180111006",
  350. businessAccountId: null,
  351. businessAccountCode: null,
  352. businessAccountName: null,
  353. poTypeCode: "04",
  354. poTypeName: "资源采购订单",
  355. receiveAddressId: null,
  356. receiveAddressName: null,
  357. demandDeliveryDate: null,
  358. billMakerId: null,
  359. billMakerName: null,
  360. remark: null,
  361. orderDate: "2018-01-11 16:03:55",
  362. billStatusCode: "05",
  363. billStatusName: "已完成",
  364. orderDateStart: null,
  365. orderDateEnd: null,
  366. reqDeliveryDate: null,
  367. defaultDelyDate: null,
  368. totalQuantity: 3,
  369. totalAmount: 11,
  370. totalVolume: 0,
  371. totalWeight: 0,
  372. distributorId: null,
  373. distributorCode: null,
  374. distributorName: null,
  375. transportModeCode: null,
  376. transportModeName: "整车",
  377. purchaseOrderItems: null
  378. },
  379. {
  380. id: "2dadc763-5faf-429e-a116-e3b567e98f26",
  381. persistStatus: null,
  382. accountTypeId: null,
  383. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  384. orderCode: "PO1001346180111005",
  385. businessAccountId: null,
  386. businessAccountCode: null,
  387. businessAccountName: null,
  388. poTypeCode: "04",
  389. poTypeName: "资源采购订单",
  390. receiveAddressId: null,
  391. receiveAddressName: null,
  392. demandDeliveryDate: null,
  393. billMakerId: null,
  394. billMakerName: null,
  395. remark: null,
  396. orderDate: "2018-01-11 16:03:07",
  397. billStatusCode: "03",
  398. billStatusName: "已审核",
  399. orderDateStart: null,
  400. orderDateEnd: null,
  401. reqDeliveryDate: null,
  402. defaultDelyDate: null,
  403. totalQuantity: 3,
  404. totalAmount: 11,
  405. totalVolume: 0,
  406. totalWeight: 0,
  407. distributorId: null,
  408. distributorCode: null,
  409. distributorName: null,
  410. transportModeCode: null,
  411. transportModeName: "整车",
  412. purchaseOrderItems: null
  413. },
  414. {
  415. id: "b9f8ad0d-87bc-40f7-b5c5-803057947b71",
  416. persistStatus: null,
  417. accountTypeId: null,
  418. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  419. orderCode: "PO1001346180111004",
  420. businessAccountId: null,
  421. businessAccountCode: null,
  422. businessAccountName: null,
  423. poTypeCode: "04",
  424. poTypeName: "资源采购订单",
  425. receiveAddressId: null,
  426. receiveAddressName: null,
  427. demandDeliveryDate: null,
  428. billMakerId: null,
  429. billMakerName: null,
  430. remark: null,
  431. orderDate: "2018-01-11 16:00:58",
  432. billStatusCode: "03",
  433. billStatusName: "已审核",
  434. orderDateStart: null,
  435. orderDateEnd: null,
  436. reqDeliveryDate: null,
  437. defaultDelyDate: null,
  438. totalQuantity: 3,
  439. totalAmount: 11,
  440. totalVolume: 0,
  441. totalWeight: 0,
  442. distributorId: null,
  443. distributorCode: null,
  444. distributorName: null,
  445. transportModeCode: null,
  446. transportModeName: "整车",
  447. purchaseOrderItems: null
  448. },
  449. {
  450. id: "df0f6e82-5564-4e9b-976d-de22eced0e1e",
  451. persistStatus: null,
  452. accountTypeId: null,
  453. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  454. orderCode: "PO1001346180111002",
  455. businessAccountId: null,
  456. businessAccountCode: null,
  457. businessAccountName: null,
  458. poTypeCode: "05",
  459. poTypeName: "饰品采购订单",
  460. receiveAddressId: null,
  461. receiveAddressName: null,
  462. demandDeliveryDate: null,
  463. billMakerId: null,
  464. billMakerName: null,
  465. remark: null,
  466. orderDate: "2018-01-11 15:52:00",
  467. billStatusCode: "05",
  468. billStatusName: "已完成",
  469. orderDateStart: null,
  470. orderDateEnd: null,
  471. reqDeliveryDate: null,
  472. defaultDelyDate: null,
  473. totalQuantity: 7,
  474. totalAmount: 37,
  475. totalVolume: 0,
  476. totalWeight: 0,
  477. distributorId: null,
  478. distributorCode: null,
  479. distributorName: null,
  480. transportModeCode: null,
  481. transportModeName: "整车",
  482. purchaseOrderItems: null
  483. },
  484. {
  485. id: "dadbe2cc-d0e6-4e98-a5e1-e11b8b4aeeb1",
  486. persistStatus: null,
  487. accountTypeId: null,
  488. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  489. orderCode: "PO1001346180111001",
  490. businessAccountId: null,
  491. businessAccountCode: null,
  492. businessAccountName: null,
  493. poTypeCode: "01",
  494. poTypeName: "常规采购订单",
  495. receiveAddressId: null,
  496. receiveAddressName: null,
  497. demandDeliveryDate: null,
  498. billMakerId: null,
  499. billMakerName: null,
  500. remark: null,
  501. orderDate: "2018-01-11 15:51:25",
  502. billStatusCode: "05",
  503. billStatusName: "已完成",
  504. orderDateStart: null,
  505. orderDateEnd: null,
  506. reqDeliveryDate: null,
  507. defaultDelyDate: null,
  508. totalQuantity: 2,
  509. totalAmount: 1120,
  510. totalVolume: 8.9,
  511. totalWeight: 444,
  512. distributorId: null,
  513. distributorCode: null,
  514. distributorName: null,
  515. transportModeCode: null,
  516. transportModeName: "整车",
  517. purchaseOrderItems: null
  518. },
  519. {
  520. id: "cb10c21c-15c0-44e9-9a6a-082fe23e6a06",
  521. persistStatus: null,
  522. accountTypeId: null,
  523. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  524. orderCode: "PO1001346180110001",
  525. businessAccountId: null,
  526. businessAccountCode: null,
  527. businessAccountName: null,
  528. poTypeCode: "05",
  529. poTypeName: "饰品采购订单",
  530. receiveAddressId: null,
  531. receiveAddressName: null,
  532. demandDeliveryDate: null,
  533. billMakerId: null,
  534. billMakerName: null,
  535. remark: null,
  536. orderDate: "2018-01-10 09:40:04",
  537. billStatusCode: "05",
  538. billStatusName: "已完成",
  539. orderDateStart: null,
  540. orderDateEnd: null,
  541. reqDeliveryDate: null,
  542. defaultDelyDate: null,
  543. totalQuantity: 5,
  544. totalAmount: 27,
  545. totalVolume: 0,
  546. totalWeight: 0,
  547. distributorId: null,
  548. distributorCode: null,
  549. distributorName: null,
  550. transportModeCode: null,
  551. transportModeName: "整车",
  552. purchaseOrderItems: null
  553. },
  554. {
  555. id: "da10e220-99b4-4eab-a1bb-539768082564",
  556. persistStatus: null,
  557. accountTypeId: null,
  558. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  559. orderCode: "PO1001346180109016",
  560. businessAccountId: null,
  561. businessAccountCode: null,
  562. businessAccountName: null,
  563. poTypeCode: "05",
  564. poTypeName: "饰品采购订单",
  565. receiveAddressId: null,
  566. receiveAddressName: null,
  567. demandDeliveryDate: null,
  568. billMakerId: null,
  569. billMakerName: null,
  570. remark: null,
  571. orderDate: "2018-01-09 16:49:06",
  572. billStatusCode: "05",
  573. billStatusName: "已完成",
  574. orderDateStart: null,
  575. orderDateEnd: null,
  576. reqDeliveryDate: null,
  577. defaultDelyDate: null,
  578. totalQuantity: 5,
  579. totalAmount: 27,
  580. totalVolume: 0,
  581. totalWeight: 0,
  582. distributorId: null,
  583. distributorCode: null,
  584. distributorName: null,
  585. transportModeCode: null,
  586. transportModeName: "整车",
  587. purchaseOrderItems: null
  588. },
  589. {
  590. id: "5eca085b-58b4-4c7f-a0ad-e75b5f9cb079",
  591. persistStatus: null,
  592. accountTypeId: null,
  593. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  594. orderCode: "PO1001346180109014",
  595. businessAccountId: null,
  596. businessAccountCode: null,
  597. businessAccountName: null,
  598. poTypeCode: "01",
  599. poTypeName: "常规采购订单",
  600. receiveAddressId: null,
  601. receiveAddressName: null,
  602. demandDeliveryDate: null,
  603. billMakerId: null,
  604. billMakerName: null,
  605. remark: null,
  606. orderDate: "2018-01-09 15:55:44",
  607. billStatusCode: "05",
  608. billStatusName: "已完成",
  609. orderDateStart: null,
  610. orderDateEnd: null,
  611. reqDeliveryDate: null,
  612. defaultDelyDate: null,
  613. totalQuantity: 1,
  614. totalAmount: 560,
  615. totalVolume: 4.45,
  616. totalWeight: 222,
  617. distributorId: null,
  618. distributorCode: null,
  619. distributorName: null,
  620. transportModeCode: null,
  621. transportModeName: "整车",
  622. purchaseOrderItems: null
  623. }
  624. ],
  625. total: 15,
  626. pageIndex: 1,
  627. pageSize: 10
  628. };
  629. export const orderList = (req, res, u) => {
  630. let url = u;
  631. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  632. url = req.url; // eslint-disable-line
  633. }
  634. const params = getUrlParams(url);
  635. let dataSource = [...orderData.data];
  636. if (params.sorter) {
  637. const s = params.sorter.split("_");
  638. dataSource = dataSource.sort((prev, next) => {
  639. if (s[1] === "descend") {
  640. return next[s[0]] - prev[s[0]];
  641. }
  642. return prev[s[0]] - next[s[0]];
  643. });
  644. }
  645. if (params.page) {
  646. dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
  647. }
  648. const result = {
  649. list: dataSource,
  650. pagination: {
  651. total: orderData.total,
  652. pageSize: orderData.pageSize,
  653. pageIndex: parseInt(orderData.pageIndex, 10) || 1
  654. }
  655. };
  656. if (res && res.json) {
  657. res.json(result);
  658. } else {
  659. return result;
  660. }
  661. };
  662. /* 商品 */
  663. const goodsData = {
  664. result: 1,
  665. msg: "查询成功",
  666. errorCode: null,
  667. data: [
  668. {
  669. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  670. persistStatus: null,
  671. accountTypeId: null,
  672. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  673. productCode: "PO1001346180111001",
  674. name: "女装",
  675. specName: "90",
  676. shortName: "女装",
  677. productGroupCode: "008",
  678. productGroupCode: "服装",
  679. remark: "备注"
  680. },
  681. {
  682. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  683. persistStatus: null,
  684. accountTypeId: null,
  685. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  686. productCode: "PO1001346180111002",
  687. name: "女装",
  688. specName: "90",
  689. shortName: "女装",
  690. productGroupCode: "008",
  691. productGroupCode: "服装",
  692. remark: "备注"
  693. },
  694. {
  695. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  696. persistStatus: null,
  697. accountTypeId: null,
  698. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  699. productCode: "PO1001346180111003",
  700. name: "男装",
  701. specName: "90",
  702. shortName: "男装",
  703. productGroupCode: "008",
  704. productGroupCode: "服装",
  705. remark: "备注"
  706. },
  707. {
  708. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  709. persistStatus: null,
  710. accountTypeId: null,
  711. transportModeId: "8b150dff-6143-4e54-aba1-9ce34183cdcf",
  712. productCode: "PO1001346180111004",
  713. name: "女装",
  714. specName: "90",
  715. shortName: "女装",
  716. productGroupCode: "008",
  717. productGroupCode: "服装",
  718. remark: "备注"
  719. }
  720. ],
  721. total: 15,
  722. pageIndex: 1,
  723. pageSize: 10
  724. };
  725. export const goodsList = (req, res, u) => {
  726. let url = u;
  727. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  728. url = req.url; // eslint-disable-line
  729. }
  730. const params = getUrlParams(url);
  731. let dataSource = [...goodsData.data];
  732. if (params.sorter) {
  733. const s = params.sorter.split("_");
  734. dataSource = dataSource.sort((prev, next) => {
  735. if (s[1] === "descend") {
  736. return next[s[0]] - prev[s[0]];
  737. }
  738. return prev[s[0]] - next[s[0]];
  739. });
  740. }
  741. if (params.page) {
  742. dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
  743. }
  744. const result = {
  745. list: dataSource,
  746. pagination: {
  747. total: goodsData.total,
  748. pageSize: goodsData.pageSize,
  749. pageIndex: parseInt(goodsData.pageIndex, 10) || 1
  750. }
  751. };
  752. if (res && res.json) {
  753. res.json(result);
  754. } else {
  755. return result;
  756. }
  757. };
  758. /* 退货入库 */
  759. const returnTreasuryData = {
  760. result: 1,
  761. msg: "查询成功",
  762. errorCode: null,
  763. data: [
  764. {
  765. id: "6a7c905e-c962-4cb4-9436-afe11d27366b",
  766. persistStatus: null,
  767. accountTypeId: null,
  768. billNo: "001",
  769. sourceNo: "0001",
  770. sourceType: "采购订单",
  771. stockinType: "退货入库",
  772. carrier: "甲",
  773. shipmentDate: "1992-11-11",
  774. exDeliveryDate: "1992-11-11",
  775. warehouseId: "仓库id",
  776. distributorId: "经销商ID",
  777. status: "未完成",
  778. comments: "备注",
  779. stockinCargos: "货品清单明细"
  780. }
  781. ],
  782. total: 15,
  783. pageIndex: 1,
  784. pageSize: 10
  785. };
  786. export const returnTreasuryList = (req, res, u) => {
  787. let url = u;
  788. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  789. url = req.url; // eslint-disable-line
  790. }
  791. const params = getUrlParams(url);
  792. let dataSource = [...returnTreasuryData.data];
  793. if (params.sorter) {
  794. const s = params.sorter.split("_");
  795. dataSource = dataSource.sort((prev, next) => {
  796. if (s[1] === "descend") {
  797. return next[s[0]] - prev[s[0]];
  798. }
  799. return prev[s[0]] - next[s[0]];
  800. });
  801. }
  802. if (params.page) {
  803. dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
  804. }
  805. const result = {
  806. list: dataSource,
  807. pagination: {
  808. total: returnTreasuryData.total,
  809. pageSize: returnTreasuryData.pageSize,
  810. pageIndex: parseInt(returnTreasuryData.pageIndex, 10) || 1
  811. }
  812. };
  813. if (res && res.json) {
  814. res.json(result);
  815. } else {
  816. return result;
  817. }
  818. };
  819. // 调拨入库
  820. export const allocatingStorageList = (req, res, u) => {
  821. let url = u;
  822. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  823. url = req.url; // eslint-disable-line
  824. }
  825. const params = getUrlParams(url);
  826. let dataSource = [...returnTreasuryData.data];
  827. if (params.sorter) {
  828. const s = params.sorter.split("_");
  829. dataSource = dataSource.sort((prev, next) => {
  830. if (s[1] === "descend") {
  831. return next[s[0]] - prev[s[0]];
  832. }
  833. return prev[s[0]] - next[s[0]];
  834. });
  835. }
  836. if (params.page) {
  837. dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
  838. }
  839. const result = {
  840. list: dataSource,
  841. pagination: {
  842. total: returnTreasuryData.total,
  843. pageSize: returnTreasuryData.pageSize,
  844. pageIndex: parseInt(returnTreasuryData.pageIndex, 10) || 1
  845. }
  846. };
  847. if (res && res.json) {
  848. res.json(result);
  849. } else {
  850. return result;
  851. }
  852. };
  853. /* 调拨 */
  854. const allocatingData = {
  855. result: 1,
  856. msg: "查询成功",
  857. errorCode: null,
  858. data: [
  859. {
  860. allotDate: null,
  861. allotDetails: [
  862. {
  863. actualQuantity: "5",
  864. allotCode: "33",
  865. allotId: "111",
  866. allotName: "法国",
  867. communityCode: "55",
  868. communityId: "66",
  869. communityName: "刚刚",
  870. creationTime: null,
  871. creator: "zz",
  872. dr: 0,
  873. id: "6hthth",
  874. modifiedTime: null,
  875. modifier: "a",
  876. quantity: "34343",
  877. ts: 0
  878. }
  879. ],
  880. billNo: "1232323",
  881. billStatus: 0,
  882. creationTime: "string",
  883. creator: "string",
  884. dr: 0,
  885. finishDate: "string",
  886. id: "34343",
  887. modifiedTime: "string",
  888. modifier: "string",
  889. ts: 0,
  890. warehouseCode: "string",
  891. warehouseId: "string",
  892. warehouseName: "string"
  893. },
  894. {
  895. allotDate: null,
  896. allotDetails: [
  897. {
  898. actualQuantity: "5",
  899. allotCode: "33",
  900. allotId: "111",
  901. allotName: "法国",
  902. communityCode: "55",
  903. communityId: "66",
  904. communityName: "刚刚",
  905. creationTime: null,
  906. creator: "zz",
  907. dr: 0,
  908. id: "6hthth",
  909. modifiedTime: null,
  910. modifier: "a",
  911. quantity: "34343",
  912. ts: 0
  913. }
  914. ],
  915. billNo: "4444444",
  916. billStatus: 0,
  917. creationTime: "string",
  918. creator: "string",
  919. dr: 0,
  920. finishDate: "string",
  921. id: "ddd",
  922. modifiedTime: "string",
  923. modifier: "string",
  924. ts: 0,
  925. warehouseCode: "string",
  926. warehouseId: "string",
  927. warehouseName: "string"
  928. }
  929. ],
  930. total: 2,
  931. pageIndex: 1,
  932. pageSize: 10
  933. };
  934. // 调拨
  935. export const allocatingList = (req, res, u) => {
  936. let url = u;
  937. if (!url || Object.prototype.toString.call(url) !== "[object String]") {
  938. url = req.url; // eslint-disable-line
  939. }
  940. const params = getUrlParams(url);
  941. let dataSource = [...allocatingData.data];
  942. if (params.sorter) {
  943. const s = params.sorter.split("_");
  944. dataSource = dataSource.sort((prev, next) => {
  945. if (s[1] === "descend") {
  946. return next[s[0]] - prev[s[0]];
  947. }
  948. return prev[s[0]] - next[s[0]];
  949. });
  950. }
  951. if (params.page) {
  952. dataSource = dataSource.filter(data => data.page.indexOf(params.page) > -1);
  953. }
  954. const result = {
  955. list: dataSource,
  956. pagination: {
  957. total: allocatingData.total,
  958. pageSize: allocatingData.pageSize,
  959. pageIndex: parseInt(allocatingData.pageIndex, 10) || 1
  960. }
  961. };
  962. if (res && res.json) {
  963. res.json(result);
  964. } else {
  965. return result;
  966. }
  967. };
  968. export default {
  969. getNotice,
  970. getActivities,
  971. getFakeList,
  972. orderList,
  973. goodsList,
  974. returnTreasuryList,
  975. allocatingStorageList,
  976. allocatingList
  977. };