king
2022-03-03 2b45840e53d250f517874bea495bffaeda172807
src/menu/components/table/normal-table/columns/editColumn/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Icon, Cascader, Modal } from 'antd'
import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Cascader, Modal } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { getColumnForm } from './formconfig'
import { formRule } from '@/utils/option.js'
@@ -17,10 +18,11 @@
  colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'],
  custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'],
  action: ['label', 'type', 'Align', 'Width'],
  formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'],
  index: ['label', 'type', 'Align', 'Width']
}
class MainSearch extends Component {
class NormalTableColumn extends Component {
  static propTpyes = {
    dict: PropTypes.object,     // 字典项
    visible: PropTypes.bool,
@@ -60,16 +62,17 @@
        return item
      })
    }, () => {
      if (column.focus) {
    })
    if (column.focus) {
      setTimeout(() => {
        try {
          let _form = document.getElementById('label')
          _form && _form.select()
        } catch {
        } catch (e) {
          console.warn('表单focus失败!')
        }
      }
    })
      }, 200)
    }
  }
  typeChange = (key, value, option) => {
@@ -101,7 +104,7 @@
        }
        values.type = 'number'
        values.decimal = decimal
      } else if (/nvarchar/ig.test(option.props.datatype)) {
      } else {
        values.type = 'text'
      }
@@ -157,7 +160,7 @@
    formlist.forEach((item, index) => {
      if (item.hidden || item.forbidden) return
      if (item.type === 'text') { // 文本搜索
      if (item.type === 'text') {
        let rules = []
        if (item.key !== 'linkurl') {
          rules = [{
@@ -168,8 +171,8 @@
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
              <Tooltip placement="topLeft" title={item.tooltip}>
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -190,8 +193,8 @@
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
              <Tooltip placement="topLeft" title={item.tooltip}>
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -241,8 +244,8 @@
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" overlayClassName={item.tooltipClass} title={item.tooltip}>
                <Icon type="question-circle" />
              <Tooltip placement="topLeft" title={item.tooltip}>
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -310,12 +313,12 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'textarea') { // 文本搜索
      } else if (item.type === 'textarea') {
        fields.push(
          <Col span={24} key={index} className="textarea">
            <Form.Item label={item.tooltip ?
              <Tooltip placement="topLeft" title={item.tooltip}>
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                {item.label}
              </Tooltip> : item.label
            }>
@@ -327,7 +330,7 @@
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
              })(<TextArea rows={2} disabled={item.readonly} placeholder={item.placeholder || ''}/>)}
            </Form.Item>
          </Col>
        )
@@ -385,4 +388,4 @@
  }
}
export default Form.create()(MainSearch)
export default Form.create()(NormalTableColumn)