king
2025-02-06 d1cd5af5adb53e91efdd278328e1b6f8ad834fb5
src/menu/components/card/table-card/index.jsx
@@ -18,7 +18,6 @@
const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent'))
const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
const UserComponent = asyncIconComponent(() => import('@/menu/components/share/usercomponent'))
const NormalHeader = asyncComponent(() => import('@/menu/components/share/normalheader'))
const ClockComponent = asyncIconComponent(() => import('@/menu/components/share/clockcomponent'))
const ActionComponent = asyncComponent(() => import('@/menu/components/share/actioncomponent'))
@@ -67,38 +66,6 @@
          elements: []
        }],
        action: [],
      }
      if (card.config) {
        let config = fromJS(card.config).toJS()
        _card.wrap = config.wrap
        _card.wrap.name = card.name
        _card.style = config.style
        _card.headerStyle = config.headerStyle
        _card.setting = config.setting
        _card.columns = config.columns
        _card.scripts = config.scripts
        _card.subcards = config.subcards.map(scard => {
          scard.uuid = Utils.getuuid()
          scard.elements = scard.elements.map(elem => {
            elem.uuid = Utils.getuuid()
            return elem
          })
          return scard
        })
        _card.search = config.search.map(col => {
          col.uuid = Utils.getuuid()
          return col
        })
        if (config.action) {
          _card.action = config.action.map(col => {
            col.uuid = Utils.getuuid()
            return col
          })
        }
      }
      this.updateComponent(_card)
@@ -197,14 +164,14 @@
   */
  deleteCard = (cell) => {
    let card = fromJS(this.state.card).toJS()
    let _this = this
    let that = this
    confirm({
      content: '确定删除卡片吗?',
      onOk() {
        card.subcards = card.subcards.filter(item => item.uuid !== cell.uuid)
        _this.updateComponent(card)
        that.updateComponent(card)
      },
      onCancel() {}
    })
@@ -253,7 +220,7 @@
    this.updateComponent(card)
  }
  addSearch = (copy) => {
  addSearch = (copy, type = '') => {
    const { card } = this.state
    let newcard = {}
@@ -275,7 +242,7 @@
    }
    // 注册事件-添加搜索
    MKEmitter.emit('addSearch', card.uuid, newcard)
    MKEmitter.emit('addSearch', card.uuid, newcard, type)
  }
  move = (item, direction) => {
@@ -304,6 +271,15 @@
  }
  updateWrap = (res) => {
    if (res.interaction) {
      if (res.interaction.includes('parity')) {
        res.parity = 'true'
      }
      if (res.interaction.includes('hover')) {
        res.hover = 'true'
      }
      delete res.interaction
    }
    this.updateComponent({...this.state.card, wrap: res})
  }
@@ -361,13 +337,22 @@
        }
  
        if (res.field && keys.includes(res.field.toLowerCase())) {
          resolve({status: false, message: '搜索字段已存在!'})
          return
          resolve({status: false})
          const that = this
          confirm({
            title: '搜索字段已存在!',
            okText: '知道了',
            cancelText: '替换',
            onOk() {},
            onCancel() {
              that.addSearch(res, 'replace')
            }
          })
        } else {
          resolve({status: true})
          this.addSearch(res)
        }
        resolve({status: true})
        this.addSearch(res)
      }
    }
  }
@@ -456,7 +441,6 @@
            <PasteComponent options={['cardcell', 'search', 'form']} updateConfig={this.pasteComponent} />
            <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/>
            <ClockComponent config={card} updateConfig={this.updateComponent}/>
            <UserComponent config={card}/>
            <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} />
            {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
          </div>