数据可视化大屏
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 1 año
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import { MockRequest } from '@delon/mock';
  2. const list: any[] = [];
  3. const total = 50;
  4. for (let i = 0; i < total; i += 1) {
  5. list.push({
  6. id: i + 1,
  7. disabled: i % 6 === 0,
  8. href: 'https://ant.design',
  9. avatar: [
  10. 'https://gw.alipayobjects.com/zos/rmsportal/eeHMaZBwmTvLdIwMfBpg.png',
  11. 'https://gw.alipayobjects.com/zos/rmsportal/udxAbMEhpwthVVcjLXik.png',
  12. ][i % 2],
  13. no: `TradeCode ${i}`,
  14. title: `一个任务名称 ${i}`,
  15. owner: '曲丽丽',
  16. description: '这是一段描述',
  17. callNo: Math.floor(Math.random() * 1000),
  18. status: Math.floor(Math.random() * 10) % 4,
  19. updatedAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
  20. createdAt: new Date(`2017-07-${Math.floor(i / 2) + 1}`),
  21. progress: Math.ceil(Math.random() * 100),
  22. });
  23. }
  24. function genData(params: any): { total: number; list: any[] } {
  25. let ret = [...list];
  26. const pi = +params.pi;
  27. const ps = +params.ps;
  28. const start = (pi - 1) * ps;
  29. if (params.no) {
  30. ret = ret.filter((data) => data.no.indexOf(params.no) > -1);
  31. }
  32. return { total: ret.length, list: ret.slice(start, ps * pi) };
  33. }
  34. function saveData(id: number, value: any): { msg: string } {
  35. const item = list.find((w) => w.id === id);
  36. if (!item) {
  37. return { msg: '无效用户信息' };
  38. }
  39. Object.assign(item, value);
  40. return { msg: 'ok' };
  41. }
  42. export const USERS = {
  43. '/user': (req: MockRequest) => genData(req.queryString),
  44. '/user/:id': (req: MockRequest) => list.find((w) => w.id === +req.params.id),
  45. 'POST /user/:id': (req: MockRequest) => saveData(+req.params.id, req.body),
  46. '/user/current': {
  47. name: 'Cipchk',
  48. avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png',
  49. userid: '00000001',
  50. email: 'cipchk@qq.com',
  51. signature: '海纳百川,有容乃大',
  52. title: '交互专家',
  53. group: '蚂蚁金服-某某某事业群-某某平台部-某某技术部-UED',
  54. tags: [
  55. {
  56. key: '0',
  57. label: '很有想法的',
  58. },
  59. {
  60. key: '1',
  61. label: '专注撩妹',
  62. },
  63. {
  64. key: '2',
  65. label: '帅~',
  66. },
  67. {
  68. key: '3',
  69. label: '通吃',
  70. },
  71. {
  72. key: '4',
  73. label: '专职后端',
  74. },
  75. {
  76. key: '5',
  77. label: '海纳百川',
  78. },
  79. ],
  80. notifyCount: 12,
  81. country: 'China',
  82. geographic: {
  83. province: {
  84. label: '上海',
  85. key: '330000',
  86. },
  87. city: {
  88. label: '市辖区',
  89. key: '330100',
  90. },
  91. },
  92. address: 'XX区XXX路 XX 号',
  93. phone: '你猜-你猜你猜猜猜',
  94. },
  95. 'POST /user/avatar': 'ok',
  96. 'POST /login/account': (req: MockRequest) => {
  97. const data = req.body;
  98. if (!(data.userName === 'admin' || data.userName === 'user') || data.password !== 'ng-alain.com') {
  99. return { msg: `Invalid username or password(admin/ng-alain.com)` };
  100. }
  101. return {
  102. msg: 'ok',
  103. user: {
  104. token: '123456789',
  105. name: data.userName,
  106. email: `${data.userName}@qq.com`,
  107. id: 10000,
  108. time: +new Date(),
  109. },
  110. };
  111. },
  112. 'POST /register': {
  113. msg: 'ok',
  114. },
  115. };