king
2022-09-06 bdfec44c9f3a37dbbe05bf14a252ffec04132a86
src/menu/components/card/balcony/index.jsx
@@ -81,10 +81,6 @@
    }
  }
  componentDidMount () {
    MKEmitter.addListener('submitStyle', this.getStyle)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
  }
@@ -96,7 +92,6 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('submitStyle', this.getStyle)
  }
  /**
@@ -119,19 +114,19 @@
    card.errors = []
    if (card.wrap.datatype === 'static') {
      let supModule = card.wrap.linkType === 'static' ? '' : 'has'
      // let supModule = card.wrap.linkType === 'static' ? '' : 'has'
      card.elements.forEach(cell => {
        if (cell.eleType === 'button') {
          if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
            if (!cell.modal || cell.modal.fields.length === 0) {
              card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`})
            } else if (!supModule) {
              cell.modal.fields.forEach(m => {
                if (m.type === 'linkMain') {
                  card.errors.push({ level: 1, detail: `按钮“${cell.label}”中关联主表表单“${m.label}”无效`})
                }
              })
            // } else if (!supModule) {
            //   cell.modal.fields.forEach(m => {
            //     if (m.type === 'linkMain') {
            //       card.errors.push({ level: 1, detail: `按钮“${cell.label}”中关联主表表单“${m.label}”无效`})
            //     }
            //   })
            }
          }
        } else if (cell.datatype === 'dynamic' && cell.field) {
@@ -139,10 +134,10 @@
        }
      })
    } else {
      let supModule = card.wrap.linkType === 'static' ? '' : 'has'
      // let supModule = card.wrap.linkType === 'static' ? '' : 'has'
      let columns = card.columns.map(c => c.field)
      let lowcols = card.columns.map(c => c.field.toLowerCase())
      // let lowcols = card.columns.map(c => c.field.toLowerCase())
      if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) {
        card.errors.push({ level: 0, detail: '未设置数据源!'})
@@ -159,14 +154,14 @@
          if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
            if (!cell.modal || cell.modal.fields.length === 0) {
              card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单尚未添加`})
            } else {
              cell.modal.fields.forEach(m => {
                if (m.type === 'linkMain' && !supModule) {
                  card.errors.push({ level: 1, detail: `按钮“${cell.label}”中关联主表表单“${m.label}”无效`})
                } else if (m.field && card.wrap.linkType !== 'sync' && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) {
                  card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单“${m.label}”大小写与字段集不一致`})
                }
              })
            // } else {
            //   cell.modal.fields.forEach(m => {
            //     if (m.type === 'linkMain' && !supModule) {
            //       card.errors.push({ level: 1, detail: `按钮“${cell.label}”中关联主表表单“${m.label}”无效`})
            //     } else if (m.field && card.wrap.linkType !== 'sync' && !columns.includes(m.field) && lowcols.includes(m.field.toLowerCase())) {
            //       card.errors.push({ level: 1, detail: `按钮“${cell.label}”中表单“${m.label}”大小写与字段集不一致`})
            //     }
            //   })
            }
          }
        } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) {
@@ -193,15 +188,11 @@
  changeStyle = () => {
    const { card } = this.state
    MKEmitter.emit('changeStyle', [card.uuid], ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style)
    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle)
  }
  getStyle = (comIds, style) => {
    const { card } = this.state
    if (comIds.length !== 1 || comIds[0] !== card.uuid) return
    let _card = {...card, style}
  getStyle = (style) => {
    let _card = {...this.state.card, style}
    this.updateComponent(_card)
  }