diff --git a/spug_web/src/pages/alarm/group/Form.js b/spug_web/src/pages/alarm/group/Form.js index 6ba5a3b..57b75bd 100644 --- a/spug_web/src/pages/alarm/group/Form.js +++ b/spug_web/src/pages/alarm/group/Form.js @@ -56,10 +56,11 @@ class ComForm extends React.Component { {getFieldDecorator('contacts', {valuePropName: 'targetKeys', initialValue: info['contacts']})( ({key: x.id, title: x.name}))} - render={item => item.title}/> + rowKey={item => item.id} + titles={['已有联系人', '已选联系人']} + listStyle={{width: 199}} + dataSource={contactStore.records} + render={item => item.name}/> )} diff --git a/spug_web/src/pages/monitor/Form.js b/spug_web/src/pages/monitor/Form.js index a897140..1a096d9 100644 --- a/spug_web/src/pages/monitor/Form.js +++ b/spug_web/src/pages/monitor/Form.js @@ -1,11 +1,13 @@ import React from 'react'; import { observer } from 'mobx-react'; -import { Modal, Form, Input, Select, Radio, message } from 'antd'; +import { Modal, Form, Input, Select, Radio, message, Steps, Button, Transfer, Checkbox } from 'antd'; import TemplateSelector from '../exec/task/TemplateSelector'; import { LinkButton, SHEditor } from 'components'; import http from 'libs/http'; import store from './store'; import hostStore from '../host/store'; +import groupStore from '../alarm/group/store'; +import styles from './index.module.css'; @observer class ComForm extends React.Component { @@ -17,6 +19,12 @@ class ComForm extends React.Component { extra: {[store.record.type]: store.record.extra}, addr: {}, showTmp: false, + page: 0, + modeOptions: [ + {label: '微信', 'value': '1'}, + {label: '短信', 'value': '2'}, + {label: '钉钉', 'value': '3'}, + {label: '邮件', 'value': '4'}] } } @@ -57,6 +65,11 @@ class ComForm extends React.Component { wrapperCol: {span: 14} }; + itemTailLayout = { + labelCol: {span: 6}, + wrapperCol: {span: 14, offset: 6} + }; + getStyle = (t) => { const type = this.props.form.getFieldValue('type'); return t.indexOf(type) !== -1 ? {display: 'block'} : {display: 'none'} @@ -82,10 +95,22 @@ class ComForm extends React.Component { ); + verifyButtonStatus = () => { + const data = this.props.form.getFieldsValue(); + const {notify_grp, notify_mode, type, name} = data; + let b1 = this.state.addr[type] && name; + if (type !== '1') { + b1 = b1 && this.state.extra[type] + } + const b2 = notify_grp && notify_grp.length && notify_mode && notify_mode.length; + return [b1, b2]; + }; + render() { const info = store.record; - const {loading, extra, addr, showTmp} = this.state; + const {loading, extra, addr, showTmp, page, modeOptions} = this.state; const {getFieldDecorator} = this.props.form; + const [b1, b2] = this.verifyButtonStatus(); return ( store.formVisible = false} - confirmLoading={loading} - onOk={this.handleSubmit}> + footer={null}> + + + +
- - {getFieldDecorator('type', {initialValue: info['type'] || '1'})( - + 站点检测 + 端口检测 + 进程检测 + 自定义脚本 + + )} + + + {getFieldDecorator('name', {initialValue: info['name']})( + + )} + + + this.handleAddr('1', e)}/> + + + this.handleAddr('2', e)}/> + + + - )} - - - {getFieldDecorator('name', {initialValue: info['name']})( - - )} - - - this.handleAddr('1', e)}/> - - - this.handleAddr('2', e)}/> - - - - - - this.handleExtra('2', e)}/> - - - this.handleExtra('3', e)}/> - - this.setState({showTmp: true})}>从模板添加}> - this.handleExtra('4', e)}/> - - - {getFieldDecorator('rate', {initialValue: info['rate'] || 5})( - - 1分钟 - 5分钟 - 15分钟 - 30分钟 - 60分钟 - - )} - - - {getFieldDecorator('threshold', {initialValue: info['threshold'] || 3})( - - 1次 - 2次 - 3次 - 4次 - 5次 - - )} - - - {getFieldDecorator('quiet', {initialValue: info['quiet'] || 24 * 60})( - - )} - - - {getFieldDecorator('desc', {initialValue: info['desc']})( - - )} + + + this.handleExtra('2', e)}/> + + + this.handleExtra('3', e)}/> + + this.setState({showTmp: true})}>从模板添加}> + this.handleExtra('4', e)}/> + + + {getFieldDecorator('desc', {initialValue: info['desc']})( + + )} + + +
+ + {getFieldDecorator('rate', {initialValue: info['rate'] || 5})( + + 1分钟 + 5分钟 + 15分钟 + 30分钟 + 60分钟 + + )} + + + {getFieldDecorator('threshold', {initialValue: info['threshold'] || 3})( + + 1次 + 2次 + 3次 + 4次 + 5次 + + )} + + + {getFieldDecorator('notify_grp', {valuePropName: 'targetKeys', initialValue: info['notify_grp']})( + item.id} + titles={['已有联系组', '已选联系组']} + listStyle={{width: 199}} + dataSource={groupStore.records} + render={item => item.name}/> + )} + + + {getFieldDecorator('notify_mode', {initialValue: info['notify_mode']})( + + )} + + + {getFieldDecorator('quiet', {initialValue: info['quiet'] || 24 * 60})( + + )} + +
+ + {page === 1 && + } + {page === 0 && + } + {page !== 0 && + }
{showTmp &&