|
|
@@ -154,7 +154,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
: treeValue[0];
|
|
|
|
|
|
const source = (field as Field).value;
|
|
|
- const value = field.query(source === 'manual' ? '.value' : '.metric');
|
|
|
+ const value = field.query(source === 'manual' ? '.value.0' : '.metric');
|
|
|
if (target) {
|
|
|
if (source === 'manual') {
|
|
|
// 手动输入
|
|
|
@@ -178,7 +178,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
};
|
|
|
}
|
|
|
});
|
|
|
- form1.setFieldState(field.query('.value2'), (state) => {
|
|
|
+ form1.setFieldState(field.query('.value.1'), (state) => {
|
|
|
state.componentType = valueTypeMap[valueType];
|
|
|
if (valueType === 'date') {
|
|
|
state.componentProps = {
|
|
|
@@ -187,13 +187,18 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
}
|
|
|
});
|
|
|
} else if (source === 'metrics') {
|
|
|
+ const termType = field.query('..termType').value();
|
|
|
+ const tag = ['nbtw', 'btw'].includes(termType);
|
|
|
// 指标
|
|
|
form1.setFieldState(value, (state) => {
|
|
|
state.componentType = Select;
|
|
|
- state.dataSource = target?.metrics.map((item: any) => ({
|
|
|
- label: item.name,
|
|
|
- value: item.id,
|
|
|
- }));
|
|
|
+ state.dataSource = target?.metrics
|
|
|
+ ?.filter((i: { range: boolean }) => i.range === tag)
|
|
|
+ .map((item: any) => ({
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ }));
|
|
|
+ state.value = undefined;
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -324,7 +329,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
- value: {
|
|
|
+ 'value[0]': {
|
|
|
type: 'string',
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
@@ -336,7 +341,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
required: true,
|
|
|
'x-reactions': [
|
|
|
{
|
|
|
- dependencies: ['.source'],
|
|
|
+ dependencies: ['..source'],
|
|
|
fulfill: {
|
|
|
state: {
|
|
|
visible: '{{$deps[0]==="manual"}}',
|
|
|
@@ -344,7 +349,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
- dependencies: ['..termType'],
|
|
|
+ dependencies: ['...termType'],
|
|
|
when: '{{["nbtw","btw"].includes($deps[0])}}',
|
|
|
fulfill: {
|
|
|
state: {
|
|
|
@@ -367,7 +372,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
- value2: {
|
|
|
+ 'value[1]': {
|
|
|
type: 'string',
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
@@ -378,7 +383,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
},
|
|
|
required: true,
|
|
|
'x-reactions': {
|
|
|
- dependencies: ['.source', '..termType'],
|
|
|
+ dependencies: ['..source', '...termType'],
|
|
|
fulfill: {
|
|
|
state: {
|
|
|
visible:
|
|
|
@@ -387,6 +392,7 @@ const TriggerTerm = (props: Props, ref: any) => {
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
+
|
|
|
metric: {
|
|
|
type: 'string',
|
|
|
'x-component': 'Select',
|