|
@@ -1,5 +1,5 @@
|
|
|
import { Modal } from 'antd';
|
|
import { Modal } from 'antd';
|
|
|
-import { useMemo, useRef } from 'react';
|
|
|
|
|
|
|
+import { useMemo, useRef, useState } from 'react';
|
|
|
import { createForm, Field, onFieldReact, onFieldValueChange } from '@formily/core';
|
|
import { createForm, Field, onFieldReact, onFieldValueChange } from '@formily/core';
|
|
|
import { createSchemaField, observer } from '@formily/react';
|
|
import { createSchemaField, observer } from '@formily/react';
|
|
|
import {
|
|
import {
|
|
@@ -25,6 +25,7 @@ const Debug = observer(() => {
|
|
|
// const location = useLocation<{ id: string }>();
|
|
// const location = useLocation<{ id: string }>();
|
|
|
const id = state.current?.type; // (location as any).query?.id;
|
|
const id = state.current?.type; // (location as any).query?.id;
|
|
|
const variableRef = useRef<any>([]);
|
|
const variableRef = useRef<any>([]);
|
|
|
|
|
+ const [loading, setLoading] = useState(false);
|
|
|
|
|
|
|
|
const form = useMemo(
|
|
const form = useMemo(
|
|
|
() =>
|
|
() =>
|
|
@@ -44,6 +45,12 @@ const Debug = observer(() => {
|
|
|
state1.visible = true;
|
|
state1.visible = true;
|
|
|
state1.value = _template?.variableDefinitions;
|
|
state1.value = _template?.variableDefinitions;
|
|
|
});
|
|
});
|
|
|
|
|
+ } else {
|
|
|
|
|
+ variableRef.current = [];
|
|
|
|
|
+ form1.setFieldState('variableDefinitions', (state1) => {
|
|
|
|
|
+ state1.visible = true;
|
|
|
|
|
+ state1.value = undefined;
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -162,6 +169,7 @@ const Debug = observer(() => {
|
|
|
variableDefinitions: {
|
|
variableDefinitions: {
|
|
|
title: '变量',
|
|
title: '变量',
|
|
|
type: 'string',
|
|
type: 'string',
|
|
|
|
|
+ required: true,
|
|
|
'x-decorator': 'FormItem',
|
|
'x-decorator': 'FormItem',
|
|
|
'x-component': 'ArrayTable',
|
|
'x-component': 'ArrayTable',
|
|
|
'x-component-props': {
|
|
'x-component-props': {
|
|
@@ -230,7 +238,7 @@ const Debug = observer(() => {
|
|
|
const templateId = data.templateId;
|
|
const templateId = data.templateId;
|
|
|
// const list = Store.get('notice-template-list');
|
|
// const list = Store.get('notice-template-list');
|
|
|
// const _template = list.find((item: any) => item.id === templateId);
|
|
// const _template = list.find((item: any) => item.id === templateId);
|
|
|
-
|
|
|
|
|
|
|
+ setLoading(true);
|
|
|
const resp = await service.debug(
|
|
const resp = await service.debug(
|
|
|
state?.current.id,
|
|
state?.current.id,
|
|
|
templateId,
|
|
templateId,
|
|
@@ -248,8 +256,9 @@ const Debug = observer(() => {
|
|
|
);
|
|
);
|
|
|
if (resp.status === 200) {
|
|
if (resp.status === 200) {
|
|
|
onlyMessage('操作成功!');
|
|
onlyMessage('操作成功!');
|
|
|
- state.debug = false;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ state.debug = false;
|
|
|
|
|
+ setLoading(false);
|
|
|
};
|
|
};
|
|
|
return (
|
|
return (
|
|
|
<Modal
|
|
<Modal
|
|
@@ -258,6 +267,7 @@ const Debug = observer(() => {
|
|
|
visible={state.debug}
|
|
visible={state.debug}
|
|
|
onCancel={() => (state.debug = false)}
|
|
onCancel={() => (state.debug = false)}
|
|
|
onOk={start}
|
|
onOk={start}
|
|
|
|
|
+ confirmLoading={loading}
|
|
|
>
|
|
>
|
|
|
<Form form={form} layout={'vertical'}>
|
|
<Form form={form} layout={'vertical'}>
|
|
|
<SchemaField schema={schema} scope={{ getTemplate, useAsyncDataSource }} />
|
|
<SchemaField schema={schema} scope={{ getTemplate, useAsyncDataSource }} />
|