|
|
@@ -16,7 +16,14 @@ import {
|
|
|
Switch,
|
|
|
} from '@formily/antd';
|
|
|
import type { Field } from '@formily/core';
|
|
|
-import { createForm, FormPath, onFieldInit, onFieldReact, onFieldValueChange } from '@formily/core';
|
|
|
+import {
|
|
|
+ createForm,
|
|
|
+ FormPath,
|
|
|
+ onFieldInit,
|
|
|
+ onFieldReact,
|
|
|
+ onFieldValueChange,
|
|
|
+ registerValidateRules,
|
|
|
+} from '@formily/core';
|
|
|
import { createSchemaField, observer } from '@formily/react';
|
|
|
import type { ISchema } from '@formily/json-schema';
|
|
|
import styles from './index.less';
|
|
|
@@ -119,6 +126,14 @@ const Detail = observer(() => {
|
|
|
form1.setFieldState('configId', async (state1) => {
|
|
|
state1.dataSource = await getConfig(value);
|
|
|
});
|
|
|
+
|
|
|
+ if (value === 'officialMessage') {
|
|
|
+ form1.setFieldState('template.message', (state5) => {
|
|
|
+ state5.decoratorProps = {
|
|
|
+ tooltip: '服务号模版消息内容',
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
onFieldValueChange('configId', (field, form1) => {
|
|
|
const value = field.value;
|
|
|
@@ -210,14 +225,70 @@ const Detail = observer(() => {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
+ onFieldValueChange('template.subject', (field, form1) => {
|
|
|
+ const value = (field as Field).value;
|
|
|
+ const titleList =
|
|
|
+ (typeof value === 'string' &&
|
|
|
+ value
|
|
|
+ ?.match(pattern)
|
|
|
+ ?.filter((i: string) => i)
|
|
|
+ .map((item: string) => ({ id: item, type: 'string', format: '--' }))) ||
|
|
|
+ [];
|
|
|
+ form1.setFieldState('variableDefinitions', (state1) => {
|
|
|
+ state1.visible = !!titleList && titleList.length > 0;
|
|
|
+ });
|
|
|
+ if (form1.modified) {
|
|
|
+ form1.setValuesIn('variableDefinitions', titleList);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ onFieldValueChange('template.markdown.title', (field, form1) => {
|
|
|
+ const value = (field as Field).value;
|
|
|
+ const titleList =
|
|
|
+ (typeof value === 'string' &&
|
|
|
+ value
|
|
|
+ ?.match(pattern)
|
|
|
+ ?.filter((i: string) => i)
|
|
|
+ .map((item: string) => ({ id: item, type: 'string', format: '--' }))) ||
|
|
|
+ [];
|
|
|
+ form1.setFieldState('variableDefinitions', (state1) => {
|
|
|
+ state1.visible = !!titleList && titleList.length > 0;
|
|
|
+ });
|
|
|
+ if (form1.modified) {
|
|
|
+ form1.setValuesIn('variableDefinitions', titleList);
|
|
|
+ }
|
|
|
+ });
|
|
|
onFieldValueChange('template.message', (field, form1) => {
|
|
|
const value = (field as Field).value;
|
|
|
const idList =
|
|
|
- typeof value === 'string' &&
|
|
|
- value
|
|
|
+ (typeof value === 'string' &&
|
|
|
+ value
|
|
|
+ ?.match(pattern)
|
|
|
+ ?.filter((i: string) => i)
|
|
|
+ .map((item: string) => ({ id: item, type: 'string', format: '--' }))) ||
|
|
|
+ [];
|
|
|
+
|
|
|
+ if (id === 'email') {
|
|
|
+ const subject = field.query('template.subject');
|
|
|
+ const title = subject.value();
|
|
|
+ const titleList = title
|
|
|
?.match(pattern)
|
|
|
?.filter((i: string) => i)
|
|
|
.map((item: string) => ({ id: item, type: 'string', format: '--' }));
|
|
|
+ if (idList && titleList?.length > 0) {
|
|
|
+ idList.unshift(...titleList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const _provider = field.query('provider').value();
|
|
|
+ if (_provider === 'dingTalkRobotWebHook') {
|
|
|
+ const title = field.query('template.markdown.title').value();
|
|
|
+ const titleList = title
|
|
|
+ ?.match(pattern)
|
|
|
+ ?.filter((i: string) => i)
|
|
|
+ .map((item: string) => ({ id: item, type: 'string', format: '--' }));
|
|
|
+ if (idList && titleList?.length > 0) {
|
|
|
+ idList.unshift(...titleList);
|
|
|
+ }
|
|
|
+ }
|
|
|
form1.setFieldState('variableDefinitions', (state1) => {
|
|
|
state1.visible = !!idList && idList.length > 0;
|
|
|
});
|
|
|
@@ -244,30 +315,29 @@ const Detail = observer(() => {
|
|
|
{ label: 'yyyy-MM-dd HH:mm:ss EE', value: 'yyyy-MM-dd HH:mm:ss EE' },
|
|
|
{ label: 'yyyy-MM-dd HH:mm:ss zzz', value: 'yyyy-MM-dd HH:mm:ss zzz' },
|
|
|
]);
|
|
|
- format.setValue('string');
|
|
|
+ // format.setValue('string');
|
|
|
break;
|
|
|
case 'string':
|
|
|
- console.log('string');
|
|
|
format.setComponent(PreviewText.Input);
|
|
|
- format.setValue('%s');
|
|
|
+ format.setValue('s%');
|
|
|
break;
|
|
|
case 'number':
|
|
|
format.setComponent(Input);
|
|
|
format.setValue('%.xf');
|
|
|
break;
|
|
|
- case 'file':
|
|
|
- format.setComponent(Select);
|
|
|
- format.setDataSource([
|
|
|
- { label: '视频', value: 'video' },
|
|
|
- { label: '图片', value: 'img' },
|
|
|
- { label: '全部', value: 'any' },
|
|
|
- ]);
|
|
|
- format.setValue('any');
|
|
|
- break;
|
|
|
- case 'other':
|
|
|
- format.setComponent(PreviewText.Input);
|
|
|
- format.setValue('--');
|
|
|
- break;
|
|
|
+ // case 'file':
|
|
|
+ // format.setComponent(Select);
|
|
|
+ // format.setDataSource([
|
|
|
+ // {label: '视频', value: 'video'},
|
|
|
+ // {label: '图片', value: 'img'},
|
|
|
+ // {label: '全部', value: 'any'},
|
|
|
+ // ]);
|
|
|
+ // format.setValue('any');
|
|
|
+ // break;
|
|
|
+ // case 'other':
|
|
|
+ // format.setComponent(PreviewText.Input);
|
|
|
+ // format.setValue('--');
|
|
|
+ // break;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -347,7 +417,20 @@ const Detail = observer(() => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- console.log(typeList[id][0]);
|
|
|
+ registerValidateRules({
|
|
|
+ batchCheckEmail(value) {
|
|
|
+ const regEmail = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
|
|
|
+ let error;
|
|
|
+ value.some((item: string) => {
|
|
|
+ if (!regEmail.test(item)) {
|
|
|
+ error = item;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+ return error ? `${error}邮件格式错误` : '';
|
|
|
+ },
|
|
|
+ });
|
|
|
const schema: ISchema = {
|
|
|
type: 'object',
|
|
|
properties: {
|
|
|
@@ -399,6 +482,10 @@ const Detail = observer(() => {
|
|
|
'x-component-props': {
|
|
|
placeholder: '请选择绑定配置',
|
|
|
},
|
|
|
+ required: true,
|
|
|
+ 'x-decorator-props': {
|
|
|
+ tooltip: '使用固定的通知配置来发送此通知模版',
|
|
|
+ },
|
|
|
'x-visible': id !== 'email',
|
|
|
},
|
|
|
template: {
|
|
|
@@ -416,8 +503,9 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入AgentID',
|
|
|
+ tooltip: '应用唯一标识',
|
|
|
},
|
|
|
+ required: true,
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入AgentID',
|
|
|
},
|
|
|
@@ -435,11 +523,11 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入收信人ID',
|
|
|
+ tooltip: '如果不填写该字段,将在使用此模版发送通知时进行指定。',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
- placeholder: '请输入收信人ID',
|
|
|
+ placeholder: '请选择收信人',
|
|
|
},
|
|
|
},
|
|
|
toParty: {
|
|
|
@@ -447,11 +535,11 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入收信部门ID',
|
|
|
+ tooltip: '如果不填写该字段,将在使用此模版发送通知时进行指定。',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
- placeholder: '请输入收信部门ID',
|
|
|
+ placeholder: '请选择收信部门',
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
@@ -461,7 +549,8 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '标签推送',
|
|
|
+ tooltip:
|
|
|
+ '本企业微信的标签ID列表,最多支持100个,如果不填写该字段,将在使用此模版发送通知时进行指定',
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入标签推送,多个标签用,号分隔',
|
|
|
@@ -488,6 +577,9 @@ const Detail = observer(() => {
|
|
|
'x-component-props': {
|
|
|
placeholder: '请选择用户标签',
|
|
|
},
|
|
|
+ 'x-decorator-props': {
|
|
|
+ tooltip: '如果不填写该字段,将在使用此模板发送通知时进行指定',
|
|
|
+ },
|
|
|
},
|
|
|
layout: {
|
|
|
type: 'void',
|
|
|
@@ -507,6 +599,7 @@ const Detail = observer(() => {
|
|
|
},
|
|
|
'x-decorator-props': {
|
|
|
gridSpan: 1,
|
|
|
+ tooltip: '微信公众号中配置的消息模版',
|
|
|
},
|
|
|
},
|
|
|
url: {
|
|
|
@@ -519,6 +612,7 @@ const Detail = observer(() => {
|
|
|
},
|
|
|
'x-decorator-props': {
|
|
|
gridSpan: 1,
|
|
|
+ tooltip: '用于点击消息后进行页面跳转',
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
@@ -531,6 +625,9 @@ const Detail = observer(() => {
|
|
|
'x-component-props': {
|
|
|
// optionType: 'button'
|
|
|
},
|
|
|
+ 'x-decorator-props': {
|
|
|
+ tooltip: '配置后点击通知消息将跳转到对应小程序',
|
|
|
+ },
|
|
|
default: false,
|
|
|
enum: [
|
|
|
{ label: '是', value: true },
|
|
|
@@ -558,6 +655,7 @@ const Detail = observer(() => {
|
|
|
},
|
|
|
'x-decorator-props': {
|
|
|
gridSpan: 1,
|
|
|
+ tooltip: '小程序唯一性id',
|
|
|
},
|
|
|
},
|
|
|
miniProgramPath: {
|
|
|
@@ -570,6 +668,7 @@ const Detail = observer(() => {
|
|
|
},
|
|
|
'x-decorator-props': {
|
|
|
gridSpan: 1,
|
|
|
+ tooltip: '用于点击消息之后跳转到小程序的具体页面',
|
|
|
},
|
|
|
},
|
|
|
},
|
|
|
@@ -592,6 +691,9 @@ const Detail = observer(() => {
|
|
|
'x-component-props': {
|
|
|
placeholder: '这里是回显内容',
|
|
|
},
|
|
|
+ 'x-decorator-props': {
|
|
|
+ tooltip: '服务号消息模版标题',
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
'x-reactions': {
|
|
|
@@ -618,7 +720,7 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入AgentID',
|
|
|
+ tooltip: '应用唯一标识',
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入AgentID',
|
|
|
@@ -637,11 +739,11 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入收信人ID',
|
|
|
+ tooltip: '如果不填写该字段,将在使用此模板发送通知时进行指定',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
- placeholder: '请输入收信人ID',
|
|
|
+ placeholder: '请选择收信人',
|
|
|
},
|
|
|
'x-reactions': {
|
|
|
dependencies: ['configId'],
|
|
|
@@ -655,7 +757,7 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '收信部门ID',
|
|
|
+ tooltip: '如果不填写该字段,将在使用此模板发送通知时进行指定',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
@@ -794,9 +896,10 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入模版ID',
|
|
|
+ tooltip: '阿里云内部分配的唯一ID标识',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
+ required: true,
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入模版ID',
|
|
|
},
|
|
|
@@ -806,7 +909,7 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入被叫号码',
|
|
|
+ tooltip: '仅支持中国大陆号码',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
@@ -820,7 +923,7 @@ const Detail = observer(() => {
|
|
|
'x-component': 'Input',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入被叫显号',
|
|
|
+ tooltip: '必须是已购买的号码,用于呼叫号码显示',
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入被叫显号',
|
|
|
@@ -828,11 +931,19 @@ const Detail = observer(() => {
|
|
|
},
|
|
|
PlayTimes: {
|
|
|
title: '播放次数',
|
|
|
- 'x-component': 'Input',
|
|
|
+ 'x-component': 'NumberPicker',
|
|
|
'x-decorator': 'FormItem',
|
|
|
'x-decorator-props': {
|
|
|
- tooltip: '请输入播放次数',
|
|
|
+ tooltip: '语音文件的播放次数',
|
|
|
},
|
|
|
+ default: 1,
|
|
|
+ 'x-validator': [
|
|
|
+ {
|
|
|
+ min: 1,
|
|
|
+ max: 3,
|
|
|
+ message: '仅支持1~3次',
|
|
|
+ },
|
|
|
+ ],
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入播放次数',
|
|
|
},
|
|
|
@@ -877,6 +988,7 @@ const Detail = observer(() => {
|
|
|
tooltip: '请输入收信人',
|
|
|
gridSpan: 1,
|
|
|
},
|
|
|
+ 'x-validator': ['phone'],
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入收信人',
|
|
|
},
|
|
|
@@ -913,22 +1025,27 @@ const Detail = observer(() => {
|
|
|
'x-decorator': 'FormItem',
|
|
|
title: '标题',
|
|
|
'x-decorator-props': {
|
|
|
- tip: '邮件标题',
|
|
|
+ tooltip: '邮件标题',
|
|
|
},
|
|
|
+ required: true,
|
|
|
'x-component-props': {
|
|
|
placeholder: '请输入标题',
|
|
|
},
|
|
|
},
|
|
|
sendTo: {
|
|
|
- 'x-component': 'Input.TextArea',
|
|
|
+ 'x-component': 'Select',
|
|
|
'x-decorator': 'FormItem',
|
|
|
title: '收件人',
|
|
|
'x-decorator-props': {
|
|
|
- tip: '多个收件人用换行分隔 \n最大支持1000个号码',
|
|
|
+ tooltip: '多个收件人用换行分隔 \n最大支持1000个号码',
|
|
|
},
|
|
|
'x-component-props': {
|
|
|
+ mode: 'tags',
|
|
|
placeholder: '请输入收件人邮箱,多个收件人用换行分隔',
|
|
|
},
|
|
|
+ 'x-validator': {
|
|
|
+ batchCheckEmail: true,
|
|
|
+ },
|
|
|
},
|
|
|
attachments: {
|
|
|
type: 'array',
|
|
|
@@ -939,6 +1056,7 @@ const Detail = observer(() => {
|
|
|
style: {
|
|
|
width: '100%',
|
|
|
},
|
|
|
+ tooltip: '附件只输入文件名称将在发送邮件时进行文件上传',
|
|
|
},
|
|
|
items: {
|
|
|
type: 'object',
|
|
|
@@ -1061,8 +1179,6 @@ const Detail = observer(() => {
|
|
|
{ label: '字符串', value: 'string' },
|
|
|
{ label: '时间', value: 'date' },
|
|
|
{ label: '数字', value: 'number' },
|
|
|
- { label: '文件', value: 'file' },
|
|
|
- { label: '其他', value: 'other' },
|
|
|
],
|
|
|
},
|
|
|
},
|