king
2021-04-13 e0aff8f4c0e9c8f16d1ba07863cf600638067514
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -4,8 +4,6 @@
import { Icon, Col, Tooltip, notification } from 'antd'
import moment from 'moment'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import asyncComponent from './asyncButtonComponent'
import asyncElementComponent from '@/utils/asyncComponent'
@@ -23,6 +21,11 @@
const BarCode = asyncElementComponent(() => import('@/components/barcode'))
const QrCode = asyncElementComponent(() => import('@/components/qrcode'))
const Video = asyncComponent(() => import('@/components/video'))
const PicRadio = {
  '4:3': '75%', '3:2': '66.67%', '16:9': '56.25%', '2:1': '50%', '3:1': '33.33%', '4:1': '25%',
  '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%',
  '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%'
}
class CardCellComponent extends Component {
  static propTpyes = {
@@ -31,11 +34,9 @@
    cardCell: PropTypes.object,
    data: PropTypes.object,
    elements: PropTypes.array,       // 元素集
    updateStatus: PropTypes.func,    // 状态更新
  }
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    card: null,          // 编辑中元素
    elements: null,      // 按钮组
  }
@@ -279,7 +280,13 @@
      let _style = card.style ? {...card.style} : {}
      if (card.datatype === 'static') {
        val = card.value
        val = card.value || ''
        if (/@username@|@fullName@|@login_city@/ig.test(val)) {
          let userName = sessionStorage.getItem('User_Name') || ''
          let fullName = sessionStorage.getItem('Full_Name') || ''
          let city = sessionStorage.getItem('city') || ''
          val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@login_city@/ig, city)
        }
      } else if (data.hasOwnProperty(card.field)) {
        val = data[card.field]
      }
@@ -305,7 +312,7 @@
      return (
        <Col key={card.uuid} span={card.width}>
          <div style={_style} onClick={(e) => {this.openNewView(e, card)}}>
            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div>
            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 'auto'}}>{val}</div>
          </div>
        </Col>
      )
@@ -357,7 +364,7 @@
      return (
        <Col key={card.uuid} span={card.width}>
          <div style={_style}>
            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div>
            <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 'auto'}}>{val}</div>
          </div>
        </Col>
      )
@@ -441,12 +448,8 @@
        _imagestyle.borderRadius = _style.borderRadius
      }
      if (card.lenWidRadio === '16:9') {
        _imagestyle.paddingTop = '56.25%'
      } else if (card.lenWidRadio === '3:2') {
        _imagestyle.paddingTop = '66.67%'
      } else if (card.lenWidRadio === '4:3') {
        _imagestyle.paddingTop = '75%'
      if (PicRadio[card.lenWidRadio]) {
        _imagestyle.paddingTop = PicRadio[card.lenWidRadio]
      } else {
        _imagestyle.paddingTop = '100%'
      }
@@ -532,6 +535,13 @@
        </Col>
      )
    } else if (card.eleType === 'button') {
      if (card.$type === 'tableButton' && card.controlField) { // 表格中按钮隐藏控制
        if (data[card.controlField] === card.controlVal) {
          return null
        } else if (card.controlVal && card.controlVal.split(',').includes(data[card.controlField])) {
          return null
        }
      }
      if (['exec', 'prompt', 'pop'].includes(card.OpenType)) {
        return (
          <Col key={card.uuid} span={card.width}>
@@ -544,7 +554,6 @@
                setting={cards.setting}
                columns={cards.columns}
                selectedData={[data]}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -560,7 +569,6 @@
                style={card.btnstyle}
                setting={cards.setting}
                selectedData={[data]}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -575,7 +583,6 @@
                show={card.show}
                style={card.btnstyle}
                setting={cards.setting}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -591,7 +598,6 @@
                style={card.btnstyle}
                setting={cards.setting}
                selectedData={[data]}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -606,7 +612,6 @@
                style={card.btnstyle}
                setting={cards.setting}
                selectedData={[data]}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -621,7 +626,6 @@
                style={card.btnstyle}
                setting={cards.setting}
                selectedData={[data]}
                updateStatus={this.props.updateStatus}
              />
            </div>
          </Col>
@@ -638,7 +642,6 @@
                  style={card.btnstyle}
                  setting={cards.setting}
                  selectedData={[data]}
                  updateStatus={this.props.updateStatus}
                />
              </div>
            </Col>
@@ -654,7 +657,6 @@
                  style={card.btnstyle}
                  setting={cards.setting}
                  selectedData={[data]}
                  updateStatus={this.props.updateStatus}
                />
              </div>
            </Col>
@@ -662,6 +664,8 @@
        }
      }
    }
    return null
  }
  render() {