king
2022-09-06 b8e1395f02c929eaa96b949cf6027ee2a43856a6
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'
@@ -13,7 +14,7 @@
  number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'blacklist', 'perspective', 'sum', 'rowspan'],
  link: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'joint', 'Width', 'blacklist', 'nameField'],
  textarea: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'blacklist'],
  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'picSort'],
  picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'span'],
  colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'],
  custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'],
  action: ['label', 'type', 'Align', 'Width'],
@@ -43,7 +44,14 @@
  }
  editColumn = (column) => {
    let formlist = getColumnForm(column, this.props.fields)
    let fields = fromJS(this.props.fields).toJS().map(item => {
      if (item.label.toLowerCase() !== item.field.toLowerCase()) {
        item.text = item.label + '(' + item.field + ')'
      }
      return item
    })
    let formlist = getColumnForm(column, fields)
    let _options = fromJS(columnTypeOptions[column.type]).toJS()
    if (column.type === 'text' || column.type === 'number') {
      if (column.perspective === 'linkmenu') {
@@ -61,16 +69,17 @@
        return item
      })
    }, () => {
      if (column.focus) {
    })
    if (column.focus) {
      setTimeout(() => {
        try {
          let _form = document.getElementById('label')
          _form && _form.select()
        } catch (e) {
          console.warn('表单focus失败!')
        }
      }
    })
      }, 200)
    }
  }
  typeChange = (key, value, option) => {
@@ -94,7 +103,7 @@
        }
      })
    } else if (key === 'field') {
      let values = {label: option.props.children}
      let values = {label: option.props.label || option.props.children}
      if (/Decimal|int/ig.test(option.props.datatype)) {
        let decimal = 0
        if (/Decimal/ig.test(option.props.datatype)) {
@@ -158,7 +167,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 = [{
@@ -170,7 +179,7 @@
          <Col span={12} key={index}>
            <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
            }>
@@ -192,7 +201,7 @@
          <Col span={12} key={index}>
            <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
            }>
@@ -229,7 +238,7 @@
                  getPopupContainer={() => document.getElementById('columnwinter')}
                >
                  {item.options.map((option, index) =>
                    <Select.Option key={index} datatype={option.datatype || ''} value={(option.value || option.field || option.MenuID)}>
                    <Select.Option key={index} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}>
                      {(option.text || option.label || option.MenuName)}
                    </Select.Option>
                  )}
@@ -243,7 +252,7 @@
          <Col span={12} key={index}>
            <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
            }>
@@ -311,12 +320,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
            }>
@@ -371,7 +380,7 @@
        <Modal
          title="显示列编辑"
          visible={visible}
          width={800}
          width={850}
          maskClosable={false}
          onOk={this.handleSubmit}
          onCancel={this.editModalCancel}