king
2023-08-03 4b013affeb7afe534bf70204c743c5764db45484
src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
@@ -1,10 +1,10 @@
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
@@ -16,11 +16,13 @@
  }
  state = {
    formlist: null
    formlist: null,
    mknode: null
  }
  UNSAFE_componentWillMount () {
    this.setState({
      mknode: null,
      formlist: this.getFormList(this.props.node)
    })
  }
@@ -28,6 +30,7 @@
  UNSAFE_componentWillReceiveProps(nextProps) {
    if (!is(fromJS(this.props.node), fromJS(nextProps.node))) {
      this.setState({
        mknode: null,
        formlist: null
      }, () => {
        this.setState({
@@ -127,6 +130,11 @@
          field: 'fontFill',
          label: '颜色',
          initval: font.fill || '#000000'
        },
        {
          type: 'other',
          label: '自定义信息',
          initval: node
        }
      ]
    } else if (node.shape === 'lane') {
@@ -350,22 +358,10 @@
          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
        }
      ]
    }
  }
@@ -384,6 +380,10 @@
    }
    this.props.onChange(value, key)
  }
  confirm = () => {
    this.setState({visible: false})
  }
  getFields() {
@@ -462,17 +462,37 @@
            </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>
    )
  }