|
1
|
+import { RouteLocationNormalizedLoaded } from 'vue-router';
|
1
|
2
|
import { RuleChainFieldsEnum, RuleChainFieldsNameEnum } from '../../../enum/formField/flow';
|
2
|
3
|
import { getRuleChains } from '/@/api/ruleDesigner';
|
3
|
4
|
import { FormSchema } from '/@/components/Form';
|
4
|
5
|
|
5
|
|
-const fetch = async (params: Recordable) => {
|
|
6
|
+const fetch = async (params: Recordable, ruleChainId: string) => {
|
6
|
7
|
try {
|
7
|
8
|
const result = await getRuleChains(params);
|
8
|
|
- const data = result.data.map((item) => ({ label: item.name, value: item.id.id }));
|
|
9
|
+ const data = result.data
|
|
10
|
+ .map((item) => ({ label: item.name, value: item.id.id }))
|
|
11
|
+ .filter((item) => item.value !== ruleChainId);
|
9
|
12
|
return data;
|
10
|
13
|
} catch (err) {
|
11
|
14
|
console.error(err);
|
...
|
...
|
@@ -13,24 +16,27 @@ const fetch = async (params: Recordable) => { |
13
|
16
|
}
|
14
|
17
|
};
|
15
|
18
|
|
16
|
|
-export const formSchemas: FormSchema[] = [
|
17
|
|
- {
|
18
|
|
- field: RuleChainFieldsEnum.RULE_CHAIN_ID,
|
19
|
|
- label: RuleChainFieldsNameEnum.RULE_CHAIN_ID,
|
20
|
|
- component: 'ApiSearchSelect',
|
21
|
|
- componentProps: () => {
|
22
|
|
- return {
|
23
|
|
- placeholder: '请选择所属产品',
|
24
|
|
- showSearch: true,
|
25
|
|
- params: {
|
26
|
|
- pageSize: 50,
|
27
|
|
- page: 0,
|
28
|
|
- type: 'CORE',
|
29
|
|
- },
|
30
|
|
- api: fetch,
|
31
|
|
- searchApi: fetch,
|
32
|
|
- getPopupContainer: () => document.body,
|
33
|
|
- };
|
|
19
|
+export const getFormSchemas = (route: RouteLocationNormalizedLoaded): FormSchema[] => {
|
|
20
|
+ const ruleChainId = (route.params as Record<'id', string>).id;
|
|
21
|
+ return [
|
|
22
|
+ {
|
|
23
|
+ field: RuleChainFieldsEnum.RULE_CHAIN_ID,
|
|
24
|
+ label: RuleChainFieldsNameEnum.RULE_CHAIN_ID,
|
|
25
|
+ component: 'ApiSearchSelect',
|
|
26
|
+ componentProps: () => {
|
|
27
|
+ return {
|
|
28
|
+ placeholder: '请选择所属产品',
|
|
29
|
+ showSearch: true,
|
|
30
|
+ params: {
|
|
31
|
+ pageSize: 50,
|
|
32
|
+ page: 0,
|
|
33
|
+ type: 'CORE',
|
|
34
|
+ },
|
|
35
|
+ api: (params: Recordable) => fetch(params, ruleChainId),
|
|
36
|
+ searchApi: (params: Recordable) => fetch(params, ruleChainId),
|
|
37
|
+ getPopupContainer: () => document.body,
|
|
38
|
+ };
|
|
39
|
+ },
|
34
|
40
|
},
|
35
|
|
- },
|
36
|
|
-]; |
|
41
|
+ ];
|
|
42
|
+}; |
...
|
...
|
|