/* * << * Davinci * == * Copyright (C) 2016 - 2017 EDP * == * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * >> */ import React, { useImperativeHandle, forwardRef } from 'react' import { Form, Row, Col, Input, Select, Icon, InputNumber, Spin } from 'antd' const FormItem = Form.Item const { Option } = Select // validate http/https // const URL_REG = /(https?):\/\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/ import { FormComponentProps } from 'antd/lib/form' import { IScheduleWeChatWorkConfig } from './types' import { FormItemStyle, LongFormItemStyle } from './constants' interface IScheduleWeChatWorkConfigProps extends FormComponentProps { config: IScheduleWeChatWorkConfig } export const ScheduleWeChatWorkConfig: React.FC = ( props, ref ) => { const { form, config } = props const { getFieldDecorator } = form useImperativeHandle(ref, () => ({ form })) return (
{getFieldDecorator('webHookUrl', { rules: [{ required: true, message: 'webhook地址不能为空' }], initialValue: config.webHookUrl })()} {getFieldDecorator('type', { rules: [{ required: true }], initialValue: config.type })( )} {form.getFieldValue('type') !== 'excel' && ( {getFieldDecorator('imageWidth', { rules: [{ required: true }], initialValue: config.imageWidth || 1920 })()}{' '} 像素 )}
) } export default Form.create()( forwardRef(ScheduleWeChatWorkConfig) )