king
2021-05-08 6afdec0062dacbded57e166230eb22cc55ced0c1
src/templates/sharecomponent/columncomponent/columnform/index.jsx
@@ -5,12 +5,14 @@
import { formRule } from '@/utils/option.js'
import './index.scss'
const { TextArea } = Input
const columnTypeOptions = {
  text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'fieldlength', 'blacklist', 'perspective', 'rowspan'],
  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'],
  link: ['label', 'field', 'type', 'nameField', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'fieldlength', 'blacklist'],
  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'fieldlength', 'blacklist'],
  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight']
  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'maxHeight'],
  index: ['label', 'type', 'Align', 'Width']
}
class MainSearch extends Component {
@@ -34,10 +36,10 @@
    let _options = JSON.parse(JSON.stringify(columnTypeOptions[card.type]))
    if (card.type === 'text' || card.type === 'number') {
      if (card.perspective !== 'linkurl') {
        _options.push('linkmenu')
      } else {
        _options.push('linkurl')
      if (card.perspective === 'linkmenu') {
        _options.push('linkmenu', 'linkfields')
      } else if (card.perspective === 'linkurl') {
        _options.push('linkurl', 'linkfields')
      }
    }
@@ -74,10 +76,10 @@
      let _options = JSON.parse(JSON.stringify(columnTypeOptions[value]))
      if (card.type === 'text' || card.type === 'number') {
        if (card.perspective !== 'linkurl') {
          _options.push('linkmenu')
        } else {
          _options.push('linkurl')
        if (card.perspective === 'linkmenu') {
          _options.push('linkmenu', 'linkfields')
        } else if (card.perspective === 'linkurl') {
          _options.push('linkurl', 'linkfields')
        }
      }
@@ -107,11 +109,10 @@
  changeRadio = (key, value) => {
    if (key === 'perspective') {
      let _options = JSON.parse(JSON.stringify(columnTypeOptions[this.state.type]))
      if (value !== 'linkurl') {
        _options.push('linkmenu')
      } else {
        _options.push('linkurl')
      if (value === 'linkmenu') {
        _options.push('linkmenu', 'linkfields')
      } else if (value === 'linkurl') {
        _options.push('linkurl', 'linkfields')
      }
      this.setState({
@@ -173,6 +174,27 @@
                  ...rules
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
        )
      } 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" />
                {item.label}
              </Tooltip> : item.label
            }>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<TextArea rows={2} disabled={item.readonly} onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
        )
@@ -283,7 +305,13 @@
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || []
                initialValue: item.initVal || [],
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Cascader
                  options={this.state.menulist}