|
|
@@ -1,6 +1,11 @@
|
|
|
import { Col, Form, Row } from 'antd';
|
|
|
import type { FormInstance } from 'antd';
|
|
|
-import { BuiltIn, OrgList, UserList } from '@/pages/rule-engine/Scene/Save/action/VariableItems';
|
|
|
+import {
|
|
|
+ BuiltIn,
|
|
|
+ OrgList,
|
|
|
+ UserList,
|
|
|
+ TagSelect,
|
|
|
+} from '@/pages/rule-engine/Scene/Save/action/VariableItems';
|
|
|
import { InputFile } from '@/pages/rule-engine/Scene/Save/components';
|
|
|
|
|
|
interface MessageContentProps {
|
|
|
@@ -24,43 +29,37 @@ export default (props: MessageContentProps) => {
|
|
|
{props.template.variableDefinitions.map((item: any, index: number) => {
|
|
|
const type = item.expands?.businessType || item.type;
|
|
|
const _name = [props.name, 'notify', 'variables', item.id];
|
|
|
+ let initialValue = undefined;
|
|
|
+ if (type === 'user') {
|
|
|
+ initialValue = {
|
|
|
+ source: 'relation',
|
|
|
+ value: undefined,
|
|
|
+ };
|
|
|
+ } else if (['date', 'number', 'string'].includes(type)) {
|
|
|
+ initialValue = {
|
|
|
+ source: 'fixed',
|
|
|
+ value: undefined,
|
|
|
+ };
|
|
|
+ }
|
|
|
return (
|
|
|
<Col span={12} key={`${item.id}_${index}`}>
|
|
|
- {type === 'user' ? (
|
|
|
- <Form.Item
|
|
|
- name={_name}
|
|
|
- label={item.name}
|
|
|
- initialValue={{
|
|
|
- source: 'relation',
|
|
|
- value: undefined,
|
|
|
- }}
|
|
|
- >
|
|
|
+ <Form.Item name={_name} label={item.name} initialValue={initialValue}>
|
|
|
+ {type === 'user' ? (
|
|
|
<UserList
|
|
|
notifyType={props.notifyType}
|
|
|
configId={props.configId}
|
|
|
type={props.triggerType}
|
|
|
/>
|
|
|
- </Form.Item>
|
|
|
- ) : type === 'org' ? (
|
|
|
- <Form.Item name={_name} label={item.name}>
|
|
|
+ ) : type === 'org' ? (
|
|
|
<OrgList notifyType={props.notifyType} configId={props.configId} />
|
|
|
- </Form.Item>
|
|
|
- ) : type === 'file' ? (
|
|
|
- <Form.Item name={_name} label={item.name}>
|
|
|
+ ) : type === 'file' ? (
|
|
|
<InputFile />
|
|
|
- </Form.Item>
|
|
|
- ) : (
|
|
|
- <Form.Item
|
|
|
- name={_name}
|
|
|
- label={item.name}
|
|
|
- initialValue={{
|
|
|
- source: 'fixed',
|
|
|
- value: undefined,
|
|
|
- }}
|
|
|
- >
|
|
|
+ ) : type === 'tag' ? (
|
|
|
+ <TagSelect configId={props.configId} />
|
|
|
+ ) : (
|
|
|
<BuiltIn type={props.triggerType} data={item} />
|
|
|
- </Form.Item>
|
|
|
- )}
|
|
|
+ )}
|
|
|
+ </Form.Item>
|
|
|
</Col>
|
|
|
);
|
|
|
})}
|