dashboard.ts 844 B

1234567891011121314151617181920212223242526272829303132
  1. import BaseAPI from './BaseAPI';
  2. /**
  3. * 数据看板 Service
  4. * 后端接口:
  5. * - GET /collect_dashboard/index?date=yyyy-MM-dd 按日看板数据
  6. * - GET /collect_dashboard/trend?start_date=&end_date= 日期范围趋势数据
  7. */
  8. class Dashboard extends BaseAPI {
  9. constructor() {
  10. super(``);
  11. }
  12. // 查询指定日期的看板数据(不传则默认今天)
  13. getByDate(data: { date?: string } = {}) {
  14. return this._get({ path: `/collect_dashboard/index`, data }).then(
  15. (data) => {
  16. return data;
  17. },
  18. );
  19. }
  20. // 查询日期范围内的看板数据(用于趋势图)
  21. getTrend(data: { start_date?: string; end_date?: string }) {
  22. return this._get({ path: `/collect_dashboard/trend`, data }).then(
  23. (data) => {
  24. return data;
  25. },
  26. );
  27. }
  28. }
  29. export default new Dashboard();