king
2022-04-15 21d92eff0e23974d76e3e5a79ba50e3fc1c0b879
src/components/normalform/modalform/mkTable/index.jsx
@@ -3,9 +3,10 @@
import { fromJS } from 'immutable'
import { DndProvider, DragSource, DropTarget } from 'react-dnd'
import { Table, Input, InputNumber, Popconfirm, Form, Select, Radio, Cascader, notification, Typography, Button } from 'antd'
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons'
import { PlusOutlined, EditOutlined, DeleteOutlined, ArrowRightOutlined } from '@ant-design/icons'
import Utils from '@/utils/utils.js'
import MKEmitter from '@/utils/events.js'
import ColorSketch from '@/mob/colorsketch'
import asyncComponent from '@/utils/asyncComponent'
import './index.scss'
@@ -86,8 +87,8 @@
      return <MkEditIcon allowClear/>
    } else if (inputType === 'select') {
      return (
        <Select>
          {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}> {item.label || item.text} </Select.Option>))}
        <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
          {options.map((item, i) => (<Select.Option key={i} value={item.field || item.value}>{item.label || item.text}</Select.Option>))}
        </Select>
      )
    } else if (inputType === 'multiStr') {
@@ -165,6 +166,7 @@
  }
  UNSAFE_componentWillMount () {
    let actions = this.props.actions || []
    let columns = fromJS(this.props.columns).toJS()
    let operation = {
@@ -196,6 +198,7 @@
              <span className="danger"><DeleteOutlined /></span>
            </Popconfirm> : null}
            {editingKey !== '' ? <span className="danger"><DeleteOutlined /></span> : null}
            {actions.includes('view') ? <span className="copy" onClick={() => {editingKey === '' && this.changeMenu(record.menu)}}><ArrowRightOutlined /></span> : null}
          </div>
        )
      }
@@ -213,6 +216,24 @@
  // shouldComponentUpdate (nextProps, nextState) {
  //   return !is(fromJS(this.state), fromJS(nextState))
  // }
  changeMenu = (MenuId) => {
    if (MenuId === 'IM') {
      if (!sessionStorage.getItem('instantMessage')) return
      let param = {
        MenuID: sessionStorage.getItem('instantMessage'),
        copyMenuId: '',
        type: 'view'
      }
      param = window.btoa(window.encodeURIComponent(JSON.stringify(param)))
      MKEmitter.emit('changeEditMenu', {routerUrl: '/imdesign/' + param})
    } else {
      MKEmitter.emit('changeEditMenu', {MenuID: MenuId})
    }
  }
  isEditing = record => record.uuid === this.state.editingKey
@@ -297,6 +318,29 @@
            })
          })
        })
      } else if (col.inputType === 'cascader') {
        let keys = record[col.dataIndex]
        let _options = []
        let rematch = (options, level) => {
          options.some(m => {
            if (!m.value || m.value !== keys[level]) return false
            _options.push(m)
            if (m.children && keys[level + 1]) {
              rematch(m.children, level + 1)
            }
            return true
          })
        }
        rematch(col.options, 0)
        if (_options.length) {
          col.extends.forEach(n => {
            record[n.value] = _options.map(o => o[n.key]).join(' / ')
          })
        }
      } else {
        let key = record[col.dataIndex]
        let option = col.options.filter(m => m.value === key)[0]