|
@@ -2,11 +2,12 @@ import React from 'react'
|
|
import { Form, Input, Row, Col, Switch, Button, Modal, message, Select, Icon } from 'antd'
|
|
import { Form, Input, Row, Col, Switch, Button, Modal, message, Select, Icon } from 'antd'
|
|
import { connect } from 'dva'
|
|
import { connect } from 'dva'
|
|
import AceEditor from 'react-ace'
|
|
import AceEditor from 'react-ace'
|
|
-import { detail, test, update, groupList } from '../service'
|
|
|
|
|
|
+import {detail, test, update, groupList, createNote } from '../service'
|
|
import { isJSON } from '@/utils/utils'
|
|
import { isJSON } from '@/utils/utils'
|
|
|
|
|
|
import 'ace-builds/src-noconflict/mode-java'
|
|
import 'ace-builds/src-noconflict/mode-java'
|
|
import 'ace-builds/src-noconflict/theme-monokai'
|
|
import 'ace-builds/src-noconflict/theme-monokai'
|
|
|
|
+import Nt from '@/pages/fengkong/strategies/note/note'
|
|
|
|
|
|
const formItemLayout = {
|
|
const formItemLayout = {
|
|
layout: 'vertical'
|
|
layout: 'vertical'
|
|
@@ -52,6 +53,38 @@ class Add extends React.PureComponent {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ onNoteOk = () => {
|
|
|
|
+ const { content } = this.state.params
|
|
|
|
+ if (!content) {
|
|
|
|
+ message.warn('内容不能为空!')
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ createNote({ name: this.props.match.params.name, content: content, operator: this.props.currentUser.name }).then(res => {
|
|
|
|
+ console.log('数据: ' + JSON.stringify(res))
|
|
|
|
+ if (res.data != null && res.code === 0) {
|
|
|
|
+ message.success('处理成功')
|
|
|
|
+ this.onNoteCancel()// 关闭弹窗
|
|
|
|
+ this.create()
|
|
|
|
+ } else {
|
|
|
|
+ message.error('处理失败: ' + res.msg)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onNoteCancel = () => {
|
|
|
|
+ this.setState({ showNote: false })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ noteAndCreate = () => {
|
|
|
|
+ this.setState({ showNote: true, params: {} })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onParamsChange = (key, value) => {
|
|
|
|
+ const params = { ...this.state.params }
|
|
|
|
+ params[key] = value
|
|
|
|
+ this.setState({ params })
|
|
|
|
+ }
|
|
|
|
+
|
|
create = () => {
|
|
create = () => {
|
|
this.props.form.validateFields((err, values) => {
|
|
this.props.form.validateFields((err, values) => {
|
|
if (!err) {
|
|
if (!err) {
|
|
@@ -129,7 +162,7 @@ class Add extends React.PureComponent {
|
|
|
|
|
|
render () {
|
|
render () {
|
|
const { getFieldDecorator } = this.props.form
|
|
const { getFieldDecorator } = this.props.form
|
|
- const { name, description, enabled, content } = this.state
|
|
|
|
|
|
+ const { name, description, enabled, content, params, showNote } = this.state
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<h1>编辑决策</h1>
|
|
<h1>编辑决策</h1>
|
|
@@ -255,7 +288,7 @@ class Add extends React.PureComponent {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
<Form.Item>
|
|
<Form.Item>
|
|
- <Button type="primary" onClick={this.create}>提交</Button> 
|
|
|
|
|
|
+ <Button type="primary" onClick={this.noteAndCreate}>提交</Button> 
|
|
<Button onClick={() => this.setState({ showTest: true })}>测试</Button>
|
|
<Button onClick={() => this.setState({ showTest: true })}>测试</Button>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</Form>
|
|
</Form>
|
|
@@ -306,7 +339,7 @@ class Add extends React.PureComponent {
|
|
|
|
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
-
|
|
|
|
|
|
+ <Nt showModal={showNote} params={params} onChange={this.onParamsChange} onOk={this.onNoteOk} onCancel={this.onNoteCancel} />
|
|
</div>
|
|
</div>
|
|
)
|
|
)
|
|
}
|
|
}
|