|
|
@@ -1,8 +1,8 @@
|
|
|
import { request } from '@@/plugin-request/request';
|
|
|
import BaseService from '@/utils/BaseService';
|
|
|
import type { SceneItem } from '@/pages/rule-engine/Scene/typings';
|
|
|
-import { defer, from, lastValueFrom, shareReplay } from 'rxjs';
|
|
|
-import { filter, map } from 'rxjs/operators';
|
|
|
+// import { defer, from, lastValueFrom, shareReplay } from 'rxjs';
|
|
|
+// import { filter, map } from 'rxjs/operators';
|
|
|
|
|
|
class Service extends BaseService<SceneItem> {
|
|
|
startScene = (id: string) => request(`${this.uri}/${id}/_enable`, { method: 'PUT' });
|
|
|
@@ -11,11 +11,11 @@ class Service extends BaseService<SceneItem> {
|
|
|
|
|
|
updateScene = (data: any) => request(`${this.uri}/${data.id}`, { method: 'PUT', data });
|
|
|
|
|
|
- // getParseTerm = (data: Record<string, any>) =>
|
|
|
- // request(`${this.uri}/parse-term-column`, {
|
|
|
- // method: 'POST',
|
|
|
- // data,
|
|
|
- // }).then((resp) => resp.result);
|
|
|
+ getParseTerm = (data: Record<string, any>) =>
|
|
|
+ request(`${this.uri}/parse-term-column`, {
|
|
|
+ method: 'POST',
|
|
|
+ data,
|
|
|
+ }).then((resp) => resp.result);
|
|
|
// getParseTerm = (data: Record<string, any>) => {
|
|
|
// const oldParams = Store.get('request-params-parse-term');
|
|
|
// const list = Store.get('parse-term');
|
|
|
@@ -35,29 +35,29 @@ class Service extends BaseService<SceneItem> {
|
|
|
// });
|
|
|
// };
|
|
|
|
|
|
- private cacheTerm$: Promise<any> | undefined;
|
|
|
+ // private cacheTerm$: Promise<any> | undefined;
|
|
|
|
|
|
- getParseTerm = (data: Record<string, any>) => {
|
|
|
- if (!this.cacheTerm$) {
|
|
|
- this.cacheTerm$ = lastValueFrom(
|
|
|
- defer(() =>
|
|
|
- from(
|
|
|
- request(`${this.uri}/parse-term-column`, {
|
|
|
- method: 'POST',
|
|
|
- data,
|
|
|
- }),
|
|
|
- ),
|
|
|
- ).pipe(
|
|
|
- filter((item) => item.status === 200),
|
|
|
- map((item) => {
|
|
|
- return item.result;
|
|
|
- }),
|
|
|
- shareReplay(1, 100),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
- return this.cacheTerm$;
|
|
|
- };
|
|
|
+ // getParseTerm = (data: Record<string, any>) => {
|
|
|
+ // if (!this.cacheTerm$) {
|
|
|
+ // this.cacheTerm$ = lastValueFrom(
|
|
|
+ // defer(() =>
|
|
|
+ // from(
|
|
|
+ // request(`${this.uri}/parse-term-column`, {
|
|
|
+ // method: 'POST',
|
|
|
+ // data,
|
|
|
+ // }),
|
|
|
+ // ),
|
|
|
+ // ).pipe(
|
|
|
+ // filter((item) => item.status === 200),
|
|
|
+ // map((item) => {
|
|
|
+ // return item.result;
|
|
|
+ // }),
|
|
|
+ // // shareReplay(1, 100),
|
|
|
+ // ),
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // return this.cacheTerm$;
|
|
|
+ // };
|
|
|
}
|
|
|
|
|
|
export default Service;
|