| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import { cacheFor } from '@/request/api/index';
- import { type Flow, fromFlowData } from '@/request/model';
- import Router from '@/router';
- import HTTP from '../alova';
- export function copyrightMethod() {
- return HTTP.Post(`/fdhb-tablet/warrantManage/getPageSets`, void 0, {
- cacheFor, name: `variate:copyright`,
- params: { k: 'copyright' },
- meta: { ignoreException: true },
- transform(data: any, headers) {
- if ( !data ) { throw { message: `无效的证书` }; }
- return [ data?.partner, data?.technicalSupporter ].filter(Boolean).join('<br>');
- },
- });
- }
- export function processMethod() {
- const path = unref(Router.currentRoute).path;
- return HTTP.Post<string, { tabletProcessModules?: string[]; }>(`/fdhb-tablet/warrantManage/getPageSets`, {}, {
- cacheFor, name: `variate:process`,
- params: { k: 'process', p: path },
- transform(data) {
- const options = data.tabletProcessModules ?? [];
- const ref = fromFlowData(options);
- const flow = ref.get(path);
- if ( !flow ) throw { message: `[路由] 配置异常无法解析正确路径,请联系管理员 (${ data?.tabletProcessModules?.join(' -> ') }})` };
- return flow.route;
- },
- });
- }
- export function processMethod2() {
- const path = unref(Router.currentRoute).path;
- return HTTP.Post<Flow, { tabletProcessModules?: string[]; }>(`/fdhb-tablet/warrantManage/getPageSets`, {}, {
- cacheFor, name: `variate:process`,
- params: { k: 'process', p: path },
- transform(data) {
- const options = data.tabletProcessModules ?? [];
- const ref = fromFlowData(options);
- const flow = ref.get(path);
- if ( !flow ) throw { message: `[路由] 配置异常无法解析正确路径,请联系管理员 (${ data?.tabletProcessModules?.join(' -> ') }})` };
- return flow;
- },
- });
- }
- export function processMethod3() {
- const path = unref(Router.currentRoute).path;
- return HTTP.Post<{ current: Flow; prev: Flow; next: Flow }, { tabletProcessModules?: string[]; }>(`/fdhb-tablet/warrantManage/getPageSets`, {}, {
- cacheFor, name: `variate:process`,
- params: { k: 'process', p: path },
- transform(data) {
- const options = data.tabletProcessModules ?? [];
- const ref = fromFlowData(options);
- const [key, current] = [...ref.entries()].find(([,flow]) => flow.route === path) || [];
- const prev = [...ref.values()].find(flow => flow.route === key);
- const next = ref.get(path);
- if ( !next ) throw { message: `[路由] 配置异常无法解析正确路径,请联系管理员 (${ data?.tabletProcessModules?.join(' -> ') }})` };
- return { current, prev, next } as any;
- }
- })
- }
|