|
@@ -2,16 +2,16 @@ 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, createNote } from '../service'
|
|
|
|
|
|
+import {detail, test, update, groupList} 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'
|
|
}
|
|
}
|
|
|
|
+const { TextArea } = Input
|
|
|
|
|
|
@connect(({ user }) => ({
|
|
@connect(({ user }) => ({
|
|
currentUser: user.currentUser
|
|
currentUser: user.currentUser
|
|
@@ -27,7 +27,9 @@ class Add extends React.PureComponent {
|
|
dos: [],
|
|
dos: [],
|
|
groupList: [],
|
|
groupList: [],
|
|
group: '',
|
|
group: '',
|
|
- features: ''
|
|
|
|
|
|
+ features: '',
|
|
|
|
+ bzEnabled:false,
|
|
|
|
+ note:''
|
|
}
|
|
}
|
|
|
|
|
|
async componentDidMount () {
|
|
async componentDidMount () {
|
|
@@ -49,36 +51,11 @@ class Add extends React.PureComponent {
|
|
} else {
|
|
} else {
|
|
this.setState({ ...res.data })
|
|
this.setState({ ...res.data })
|
|
}
|
|
}
|
|
|
|
+ console.log('dc状态数据:' + JSON.stringify(this.state))
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- 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) => {
|
|
onParamsChange = (key, value) => {
|
|
const params = { ...this.state.params }
|
|
const params = { ...this.state.params }
|
|
params[key] = value
|
|
params[key] = value
|
|
@@ -95,6 +72,7 @@ class Add extends React.PureComponent {
|
|
}
|
|
}
|
|
update({
|
|
update({
|
|
...values,
|
|
...values,
|
|
|
|
+ state: this.state.state,
|
|
createUser: this.state.createUser || this.props.currentUser.name, // 创建人
|
|
createUser: this.state.createUser || this.props.currentUser.name, // 创建人
|
|
updateUser: this.props.currentUser.name // 最后修改人
|
|
updateUser: this.props.currentUser.name // 最后修改人
|
|
}).then(res => {
|
|
}).then(res => {
|
|
@@ -102,7 +80,7 @@ class Add extends React.PureComponent {
|
|
this.setState({ ...values })
|
|
this.setState({ ...values })
|
|
Modal.success({
|
|
Modal.success({
|
|
title: '提交成功',
|
|
title: '提交成功',
|
|
- content: '决策代码编译正常,点击“测试按钮”可以继续测试决策逻辑'
|
|
|
|
|
|
+ content: '提交自核成功,请在自核列表中查看!'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
@@ -162,7 +140,7 @@ class Add extends React.PureComponent {
|
|
|
|
|
|
render () {
|
|
render () {
|
|
const { getFieldDecorator } = this.props.form
|
|
const { getFieldDecorator } = this.props.form
|
|
- const { name, description, enabled, content, params, showNote } = this.state
|
|
|
|
|
|
+ const { name, description, enabled, content, note} = this.state
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
<h1>编辑决策</h1>
|
|
<h1>编辑决策</h1>
|
|
@@ -172,7 +150,7 @@ class Add extends React.PureComponent {
|
|
<Form.Item label="决策名称">
|
|
<Form.Item label="决策名称">
|
|
{getFieldDecorator('name', {
|
|
{getFieldDecorator('name', {
|
|
initialValue: name
|
|
initialValue: name
|
|
- })(<Input placeholder="全英文或英文带下划线" />)}
|
|
|
|
|
|
+ })(<Input placeholder="全英文或英文带下划线" disabled={true}/>)}
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item label="决策描述">
|
|
<Form.Item label="决策描述">
|
|
{getFieldDecorator('description', {
|
|
{getFieldDecorator('description', {
|
|
@@ -181,7 +159,7 @@ class Add extends React.PureComponent {
|
|
</Form.Item>
|
|
</Form.Item>
|
|
<Form.Item label="决策类型">
|
|
<Form.Item label="决策类型">
|
|
{getFieldDecorator('type', { initialValue: this.state.type })(
|
|
{getFieldDecorator('type', { initialValue: this.state.type })(
|
|
- <Select placeholder={'请选择类型'} onChange={value => this.setState({ type: value })}>
|
|
|
|
|
|
+ <Select placeholder={'请选择类型'} onChange={value => this.setState({ type: value })} disabled={true}>
|
|
<Select.Option value= {0}>策略</Select.Option>
|
|
<Select.Option value= {0}>策略</Select.Option>
|
|
<Select.Option value= {1}>流程</Select.Option>
|
|
<Select.Option value= {1}>流程</Select.Option>
|
|
<Select.Option value= {2}>模型</Select.Option>
|
|
<Select.Option value= {2}>模型</Select.Option>
|
|
@@ -210,6 +188,18 @@ class Add extends React.PureComponent {
|
|
initialValue: enabled
|
|
initialValue: enabled
|
|
})(<Switch checked={enabled} onChange={checked => this.setState({ enabled: checked })} />)}
|
|
})(<Switch checked={enabled} onChange={checked => this.setState({ enabled: checked })} />)}
|
|
</Form.Item>
|
|
</Form.Item>
|
|
|
|
+ <Form.Item label="是否备注">
|
|
|
|
+ {getFieldDecorator('bzEnabled', {
|
|
|
|
+ initialValue: this.state.bzEnabled
|
|
|
|
+ })(<Switch checked={this.state.bzEnabled} onChange={checked => this.setState({ bzEnabled: checked })} />)}
|
|
|
|
+ </Form.Item>
|
|
|
|
+ {this.state.bzEnabled === true && (
|
|
|
|
+ <Form.Item>
|
|
|
|
+ {getFieldDecorator('note', {
|
|
|
|
+ initialValue: note
|
|
|
|
+ })(<Input.TextArea placeholder="多行输入" />)}
|
|
|
|
+ </Form.Item>
|
|
|
|
+ )}
|
|
{
|
|
{
|
|
// (this.state.type !== 3 && this.setState({ timeTaskEnabled: false })) ||
|
|
// (this.state.type !== 3 && this.setState({ timeTaskEnabled: false })) ||
|
|
(this.state.type === 3 && (
|
|
(this.state.type === 3 && (
|
|
@@ -288,7 +278,7 @@ class Add extends React.PureComponent {
|
|
)
|
|
)
|
|
}
|
|
}
|
|
<Form.Item>
|
|
<Form.Item>
|
|
- <Button type="primary" onClick={this.noteAndCreate}>提交</Button> 
|
|
|
|
|
|
+ <Button type="primary" onClick={this.create}>提交</Button> 
|
|
<Button onClick={() => this.setState({ showTest: true })}>测试</Button>
|
|
<Button onClick={() => this.setState({ showTest: true })}>测试</Button>
|
|
</Form.Item>
|
|
</Form.Item>
|
|
</Form>
|
|
</Form>
|
|
@@ -339,7 +329,6 @@ 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>
|
|
)
|
|
)
|
|
}
|
|
}
|