|
@@ -44,81 +44,80 @@ const AddMessage = props => {
|
|
|
return newValues
|
|
return newValues
|
|
|
}
|
|
}
|
|
|
return (
|
|
return (
|
|
|
- <div>
|
|
|
|
|
- <ModalForm
|
|
|
|
|
- isKeyPressSubmit={false}
|
|
|
|
|
- key="modalForm"
|
|
|
|
|
- formRef={formRef}
|
|
|
|
|
- trigger={
|
|
|
|
|
- <Button type="primary">
|
|
|
|
|
- <Plus className="mr-1" />
|
|
|
|
|
- 新建通知
|
|
|
|
|
- </Button>
|
|
|
|
|
|
|
+ <ModalForm
|
|
|
|
|
+ isKeyPressSubmit={false}
|
|
|
|
|
+ formRef={formRef}
|
|
|
|
|
+ trigger={
|
|
|
|
|
+ <Button type="primary">
|
|
|
|
|
+ <Plus className="mr-1" />
|
|
|
|
|
+ 新建通知
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ }
|
|
|
|
|
+ initialValues={{ msgType: 'notification', refresh: 0 }}
|
|
|
|
|
+ onFinish={async values => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const nValues = handleFormValues(values)
|
|
|
|
|
+ await onConfirm(nValues)
|
|
|
|
|
+ formRef.current?.resetFields()
|
|
|
|
|
+ message.success('添加成功')
|
|
|
|
|
+ return true
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ return false
|
|
|
}
|
|
}
|
|
|
- initialValues={{ msgType: 'notification', refresh: 0 }}
|
|
|
|
|
- onFinish={async values => {
|
|
|
|
|
- try {
|
|
|
|
|
- const nValues = handleFormValues(values)
|
|
|
|
|
- await onConfirm(nValues)
|
|
|
|
|
- formRef.current?.resetFields()
|
|
|
|
|
- message.success('添加成功')
|
|
|
|
|
- return true
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- }}>
|
|
|
|
|
- <ProFormText
|
|
|
|
|
- name="title"
|
|
|
|
|
- label="标题"
|
|
|
|
|
- placeholder="请输入标题"
|
|
|
|
|
- rules={[{ required: true, message: '请输入标题' }]}
|
|
|
|
|
- />
|
|
|
|
|
- <Form.Item
|
|
|
|
|
- label="内容"
|
|
|
|
|
- name="content"
|
|
|
|
|
- rules={[{ required: true, message: '请输入通知内容' }]}>
|
|
|
|
|
- <RighEditor />
|
|
|
|
|
- </Form.Item>
|
|
|
|
|
- <ProFormRadio.Group
|
|
|
|
|
- label="类型"
|
|
|
|
|
- name="msgType"
|
|
|
|
|
- required
|
|
|
|
|
- options={[
|
|
|
|
|
- { label: '通知', value: msgTypeEnum.NotificationOne }
|
|
|
|
|
- // { label: '消息', value: msgTypeEnum.Message }
|
|
|
|
|
- ]}
|
|
|
|
|
- />
|
|
|
|
|
- <ProFormDependency name={['msgType']}>
|
|
|
|
|
- {({ msgType }) =>
|
|
|
|
|
- msgType === msgTypeEnum.NotificationOne ? (
|
|
|
|
|
- <ProFormSelect
|
|
|
|
|
- name="media"
|
|
|
|
|
- label="通知类型"
|
|
|
|
|
- rules={[{ required: true, message: '请选择类型' }]}
|
|
|
|
|
- options={[
|
|
|
|
|
- { label: '版本更新', value: mediaType.VersionUpdate },
|
|
|
|
|
- { label: '节假通知', value: mediaType.HolidayNotice }
|
|
|
|
|
- ]}
|
|
|
|
|
- />
|
|
|
|
|
- ) : null
|
|
|
|
|
- }
|
|
|
|
|
- </ProFormDependency>
|
|
|
|
|
- <ProFormDependency name={['msgType', 'media']}>
|
|
|
|
|
- {({ msgType, media }) =>
|
|
|
|
|
- msgType === msgTypeEnum.NotificationOne && media === mediaType.VersionUpdate ? (
|
|
|
|
|
- <ProFormRadio.Group
|
|
|
|
|
- name="refresh"
|
|
|
|
|
- rules={[{ required: true, message: '请选择刷新机制' }]}
|
|
|
|
|
- options={[
|
|
|
|
|
- { label: '手动刷新', value: 0 },
|
|
|
|
|
- { label: '强制刷新', value: 1 }
|
|
|
|
|
- ]}
|
|
|
|
|
- />
|
|
|
|
|
- ) : null
|
|
|
|
|
- }
|
|
|
|
|
- </ProFormDependency>
|
|
|
|
|
- </ModalForm>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ <ProFormText
|
|
|
|
|
+ name="title"
|
|
|
|
|
+ label="标题"
|
|
|
|
|
+ placeholder="请输入标题"
|
|
|
|
|
+ rules={[{ required: true, message: '请输入标题' }]}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Form.Item
|
|
|
|
|
+ label="内容"
|
|
|
|
|
+ name="content"
|
|
|
|
|
+ rules={[{ required: true, message: '请输入通知内容' }]}
|
|
|
|
|
+ >
|
|
|
|
|
+ <RighEditor />
|
|
|
|
|
+ </Form.Item>
|
|
|
|
|
+ <ProFormRadio.Group
|
|
|
|
|
+ label="类型"
|
|
|
|
|
+ name="msgType"
|
|
|
|
|
+ required
|
|
|
|
|
+ options={[
|
|
|
|
|
+ { label: '通知', value: msgTypeEnum.NotificationOne }
|
|
|
|
|
+ // { label: '消息', value: msgTypeEnum.Message }
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ <ProFormDependency name={['msgType']}>
|
|
|
|
|
+ {({ msgType }) =>
|
|
|
|
|
+ msgType === msgTypeEnum.NotificationOne ? (
|
|
|
|
|
+ <ProFormSelect
|
|
|
|
|
+ name="media"
|
|
|
|
|
+ label="通知类型"
|
|
|
|
|
+ rules={[{ required: true, message: '请选择类型' }]}
|
|
|
|
|
+ options={[
|
|
|
|
|
+ { label: '版本更新', value: mediaType.VersionUpdate },
|
|
|
|
|
+ { label: '节假通知', value: mediaType.HolidayNotice }
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ ) : null
|
|
|
|
|
+ }
|
|
|
|
|
+ </ProFormDependency>
|
|
|
|
|
+ <ProFormDependency name={['msgType', 'media']}>
|
|
|
|
|
+ {({ msgType, media }) =>
|
|
|
|
|
+ msgType === msgTypeEnum.NotificationOne && media === mediaType.VersionUpdate ? (
|
|
|
|
|
+ <ProFormRadio.Group
|
|
|
|
|
+ name="refresh"
|
|
|
|
|
+ rules={[{ required: true, message: '请选择刷新机制' }]}
|
|
|
|
|
+ options={[
|
|
|
|
|
+ { label: '手动刷新', value: 0 },
|
|
|
|
|
+ { label: '强制刷新', value: 1 }
|
|
|
|
|
+ ]}
|
|
|
|
|
+ />
|
|
|
|
|
+ ) : null
|
|
|
|
|
+ }
|
|
|
|
|
+ </ProFormDependency>
|
|
|
|
|
+ </ModalForm>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|