king
2023-08-11 4adb8b8868aeed1f5f3b89ae269a7724c6b451ad
src/menu/components/share/usercomponent/index.jsx
@@ -7,20 +7,16 @@
import Api from '@/api'
import Utils from '@/utils/utils.js'
import options from '@/store/options.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import UserForm from './settingform'
import MKEmitter from '@/utils/events.js'
import './index.scss'
class UserComponent extends Component {
  static propTpyes = {
    btnlog: PropTypes.array
    config: PropTypes.object
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    visible: false,
    loading: false,
    name: '',
@@ -85,36 +81,30 @@
      return item
    })
    _config.cols = _config.cols.map(col => {
      if (col.type === 'colspan' && col.subcols) {
        col = this.loopCol(col)
      } else if (col.type === 'custom' && col.elements) {
        col.elements = col.elements.map(cell => this.resetElement(cell))
      } else if (col.type === 'action' && col.elements) {
        col.elements = col.elements.map(cell => {
          cell.verify = null
          return cell
        })
      }
      col.marks = null
      return col
    })
    let loopCol = (cols) => {
      return cols.map(col => {
        col.uuid = Utils.getuuid()
        col.marks = null
        if (col.type === 'colspan' && col.subcols) {
          col.subcols = loopCol(col.subcols)
        } else if (col.type === 'custom' && col.elements) {
          col.elements = col.elements.map(cell => {
            if (cell.eleType === 'button') {
              cell.verify = null
            } else {
              cell = this.resetElement(cell)
            }
            return cell
          })
        }
        return col
      })
    }
    _config.cols = loopCol(_config.cols)
    return _config
  }
  loopCol = (col) => {
    col.subcols = col.subcols.map(c => {
      if (c.type === 'colspan' && c.subcols) {
        c = this.loopCol(c)
      } else if (c.type === 'custom' && c.elements) {
        c.elements = c.elements.map(cell => this.resetElement(cell))
      }
      c.marks = null
      return c
    })
    return col
  }
  resetElement = (item) => {
@@ -153,15 +143,15 @@
            Base64Img: canvas.toDataURL('image/png') // 获取生成的图片
          }
          if (options.cloudServiceApi) {
            param.rduri = options.cloudServiceApi
          if (window.GLOB.cloudServiceApi) {
            param.rduri = window.GLOB.cloudServiceApi
            param.userid = sessionStorage.getItem('CloudUserID') || ''
            param.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
          }
          Api.fileuploadbase64(param).then(result => {
            if (result.status) {
              Api.getSystemConfig({
              Api.getCloudConfig({
                func: 's_custom_components_adduptdel',
                c_id: config.uuid,
                images: Utils.getcloudurl(result.Images),
@@ -208,7 +198,7 @@
  }
  render () {
    const { visible, dict, loading, name } = this.state
    const { visible, loading, name } = this.state
    return (
      <div className="user-component-wrap">
@@ -223,7 +213,7 @@
          onCancel={this.cancel}
          destroyOnClose
        >
          <UserForm dict={dict} name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
          <UserForm name={name} inputSubmit={this.submit} wrappedComponentRef={(inst) => this.verifyRef = inst}/>
        </Modal>
      </div>
    )