flow.api.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { cacheFor } from '@/request/api/index';
  2. import { fromFlowData } from '@/request/model';
  3. import Router from '@/router';
  4. import HTTP from '../alova';
  5. export function copyrightMethod() {
  6. return HTTP.Post(`/fdhb-tablet/warrantManage/getPageSets`, void 0, {
  7. cacheFor, name: `variate:copyright`,
  8. params: { k: 'copyright' },
  9. meta: { ignoreException: true },
  10. transform(data: any, headers) {
  11. if ( !data ) { throw { message: `无效的证书` }; }
  12. return [ data?.partner, data?.technicalSupporter ].filter(Boolean).join('<br>');
  13. },
  14. });
  15. }
  16. export function processMethod() {
  17. const path = unref(Router.currentRoute).path;
  18. return HTTP.Post<string, { tabletProcessModules?: string[]; }>(`/fdhb-tablet/warrantManage/getPageSets`, {}, {
  19. cacheFor, name: `variate:process`,
  20. params: { k: 'process', p: path },
  21. transform(data) {
  22. const options = data.tabletProcessModules ?? [];
  23. const ref = fromFlowData(options);
  24. const route = ref.get(path);
  25. if ( !route ) throw { message: `[路由] 配置异常无法解析正确路径,请联系管理员 (${ data?.tabletProcessModules?.join(' -> ') }})` };
  26. return route;
  27. },
  28. });
  29. }