| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, InputNumber } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio, InputNumber, Modal } from 'antd' |
| | | import { FormOutlined } from '@ant-design/icons' |
| | | |
| | | import ColorSketch from '@/mob/colorsketch' |
| | | |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | |
| | | } |
| | | |
| | | state = { |
| | | formlist: null |
| | | formlist: null, |
| | | mknode: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.setState({ |
| | | mknode: null, |
| | | formlist: this.getFormList(this.props.node) |
| | | }) |
| | | } |
| | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (!is(fromJS(this.props.node), fromJS(nextProps.node))) { |
| | | this.setState({ |
| | | mknode: null, |
| | | formlist: null |
| | | }, () => { |
| | | this.setState({ |
| | |
| | | field: 'fontFill', |
| | | label: '颜色', |
| | | initval: font.fill || '#000000' |
| | | }, |
| | | { |
| | | type: 'other', |
| | | label: '自定义信息', |
| | | initval: node |
| | | } |
| | | ] |
| | | } else if (node.shape === 'lane') { |
| | |
| | | initval: fontFill |
| | | }, |
| | | { |
| | | type: 'title', |
| | | label: '自定义信息' |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'mksign', |
| | | label: '标记', |
| | | initval: node.mksign || '' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'mkroleid', |
| | | label: '角色', |
| | | initval: node.mkroleid || '', |
| | | options: this.props.rolelist.map(item => ({value: item.RoleID, text: item.RoleName})) |
| | | }, |
| | | type: 'other', |
| | | label: '自定义信息', |
| | | initval: node |
| | | } |
| | | ] |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | this.props.onChange(value, key) |
| | | } |
| | | |
| | | confirm = () => { |
| | | this.setState({visible: false}) |
| | | } |
| | | |
| | | getFields() { |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'other') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <span className="split-line">{item.label}:<FormOutlined onClick={() => {this.setState({visible: true})}}/></span> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | return fields |
| | | } |
| | | |
| | | render() { |
| | | const { visible } = this.state |
| | | |
| | | return ( |
| | | <div className="node-edit-form-wrap"> |
| | | <Form className="node-edit-form"> |
| | | <Row>{this.getFields()}</Row> |
| | | </Form> |
| | | <Modal |
| | | title="节点编辑" |
| | | visible={visible} |
| | | closable={false} |
| | | maskClosable={false} |
| | | width={700} |
| | | onOk={this.confirm} |
| | | onCancel={() => this.setState({visible: false})} |
| | | destroyOnClose |
| | | > |
| | | |
| | | </Modal> |
| | | </div> |
| | | ) |
| | | } |