import { Button, Form, Input, Modal, Select, DatePicker,Checkbox } from 'antd'; import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; import { createPatrolTemplate, delPatrolTemplate, updatePatrolTemplate, getPatrolTemplate } from '../actions/template'; import moment from 'moment'; const { RangePicker } = DatePicker; const { TextArea } = Input; const PlanModal = ({ visible, onCancel, dispatch, type, curRecord, tableRef, checkItemsGroup }) => { const [form] = Form.useForm(); const shigutypes = [{value:1,label: '邮件告警'}, {value:2,label:'短信告警'}] return ( { form.resetFields(); onCancel(); }} onOk={() => { form .validateFields() .then((values) => { const params = { ...values, } if (type === 'create') { dispatch(createPatrolTemplate(params)).then(res => { if (res.success) { tableRef.current.reload(); form.resetFields(); onCancel(); } }) } else { dispatch(updatePatrolTemplate({ ...params, id: curRecord.id })).then(res => { if (res.success) { tableRef.current.reload(); form.resetFields(); onCancel(); } }) } }) .catch((info) => { console.log('Validate Failed:', info); }); }} >
c.id) }} labelCol={{ span: 5 }} wrapperCol={{ span: 19 }} offe >
); }; function mapStateToProps (state) { const { auth, checkItemsGroup } = state return { user: auth.user, checkItemsGroup: checkItemsGroup.data || [] } } export default connect(mapStateToProps)(PlanModal);