king
2023-06-14 08cce3334a2dc81d690b518136b0aaea64e48b0b
src/menu/components/share/markcomponent/markform/index.jsx
@@ -1,13 +1,14 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Select, Button, Input, Icon, Cascader, Tooltip } from 'antd'
import { Form, Row, Col, Select, Button, Input, Cascader, Tooltip } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import ColorSketch from '@/mob/colorsketch'
import './index.scss'
class UniqueForm extends Component {
  static propTpyes = {
    dict: PropTypes.object,         // 字典项
    field: PropTypes.any,
    columns: PropTypes.array,       // 列名集合
    signs: PropTypes.array,         // 标记类型
    markChange: PropTypes.func      // 修改函数
@@ -23,7 +24,7 @@
  }
  render() {
    const { columns, signs } = this.props
    const { columns, signs, field } = this.props
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
@@ -36,21 +37,35 @@
      }
    }
    let initVal = []
    if (field) {
      initVal = [field, 'static']
    }
    return (
      <Form {...formItemLayout} className="normal-table-mark-form">
        <Row gutter={24}>
          <Col span={6}>
            <Form.Item label={'对比字段'}>
              {getFieldDecorator('field', {
                initialValue: [],
                initialValue: initVal,
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.select'] + '对比字段!'
                    message: '请选择对比字段!'
                  },
                  {
                    validator: (rule, value, callback) => {
                      if (value[1] === 'dynamic' && value[0] === value[2]) {
                        callback('对比字段不可相同!')
                      } else {
                        callback()
                      }
                    }
                  }
                ]
              })(
                <Cascader options={columns} placeholder=""/>
                <Cascader className="mark-type" options={columns} placeholder=""/>
              )}
            </Form.Item>
          </Col>
@@ -61,7 +76,7 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.select'] + '对比方式!'
                    message: '请选择对比方式!'
                  }
                ]
              })(
@@ -77,7 +92,7 @@
          </Col>
          <Col span={6}>
            <Form.Item label={<Tooltip placement="topLeft" title="对比静态值时,需要填写对比值,默认为空。">
                <Icon type="question-circle" />
              <QuestionCircleOutlined className="mk-form-tip" />
                {'对比值'}
              </Tooltip>
            }>
@@ -93,7 +108,7 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.select'] + '颜色!'
                    message: '请选择颜色!'
                  }
                ]
              })(
@@ -108,11 +123,11 @@
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.select'] + '标记方式!'
                    message: '请选择标记方式!'
                  }
                ]
              })(
                <Cascader options={signs} placeholder=""/>
                <Cascader popupClassName="mark-type" options={signs} placeholder=""/>
              )}
            </Form.Item>
          </Col> : null}