king
2023-02-17 2e3bf38aced62c8ecf4af58ca2685f09d3d47dde
2023-02-17
11个文件已修改
283 ■■■■■ 已修改文件
src/menu/components/card/cardcellcomponent/elementform/index.jsx 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/formconfig.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/index.jsx 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/double-data-card/index.jsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/double-data-card/index.scss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/doublecardcomponent/index.jsx 131 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/doublecardcomponent/options.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/index.jsx 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/datasource/verifycard/settingform/index.jsx 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/modalconfig/index.jsx 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/modalconfig/index.jsx 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -48,7 +48,7 @@
  }
  UNSAFE_componentWillMount () {
    const { card, config } = this.props
    const { card, config, side } = this.props
    let _options = this.getOptions(card.eleType, card.datatype, card.link, (card.showType || 'line'), card.showInfo, card.fixStyle || '', card.posterType || '')
    
    this.setState({
@@ -64,6 +64,23 @@
        if (item.key === 'field' || item.key === 'linkurl' || item.key === 'bgImage' || item.key === 'posterField') {
          item.options = []
          if (side === 'sub') {
            config.subColumns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          } else {
          config.columns.forEach(col => {
            let label = `${col.field}(${col.label})`
            if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
@@ -78,6 +95,7 @@
              })
            }
          })
          }
        } else if (item.key === 'value' && card.eleType === 'slider') {
          item.type = 'number'
          item.label = '值'
@@ -159,7 +177,7 @@
   * 3、切换标签类型,重置可选标签
   */
  selectChange = (key, value, option) => {
    const { card, config } = this.props
    const { card, config, side } = this.props
    const { datatype, eleType, showType, showInfo, fixStyle, posterType } = this.state
    if (key === 'eleType') {
@@ -170,6 +188,22 @@
        if (item.key === 'field') {
          item.options = []
          if (side === 'sub') {
            config.subColumns.forEach(col => {
              let label = `${col.field}(${col.label})`
              if (/^(Int|Decimal)/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) {
                item.options.push({
                  value: col.field,
                  text: label
                })
              } else if (/^(Nvarchar|date)/ig.test(col.datatype) && card.eleType !== 'number' && card.eleType !== 'slider') {
                item.options.push({
                  value: col.field,
                  text: label
                })
              }
            })
          } else {
          config.columns.forEach(col => {
            let label = `${col.field}(${col.label})`
@@ -185,6 +219,7 @@
              })
            }
          })
          }
        } else if (item.key === 'value') {
          if (value === 'slider') {
            item.type = 'number'
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -28,7 +28,7 @@
    anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || []
  }
  if (cards.type === 'table' || (cards.type === 'card' && cards.subtype === 'datacard')) {
  if (cards.type === 'table' || (cards.type === 'card' && cards.subtype !== 'propcard')) {
    _options.push({value: 'sequence', text: '序号'})
  } else if (card.eleType === 'sequence') { // 拖拽添加类型转换
    card.eleType = 'text'
src/menu/components/card/cardcellcomponent/index.jsx
@@ -122,11 +122,12 @@
    this.setState({elements: this.state.elements.filter(item => item.uuid !== eleId)})
  }
  cardAddElement = (id, element) => {
    const { cardCell } = this.props
  cardAddElement = (id, element, type) => {
    const { cardCell, side } = this.props
    if (id !== cardCell.uuid) return
    if (window.GLOB.$lock) return
    if (type && side !== type) return
    window.GLOB.$lock = true
    setTimeout(() => {
@@ -535,9 +536,13 @@
  }
  handleSubConfig = (item) => {
    const { cards } = this.props
    const { cards, side } = this.props
    const { appType } = this.state
    let btn = fromJS(item).toJS()
    if (side === 'sub') {
      btn.$sub = true
    }
    if ((sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') === 'true')) return
@@ -693,7 +698,7 @@
  }
  getVerify = (card) => {
    const { cards } = this.props
    const { cards, side } = this.props
    if (!card) return null
@@ -701,13 +706,13 @@
      return <VerifyCard
        card={card}
        config={cards}
        columns={cards.columns}
        columns={side === 'sub' ? cards.subColumns : cards.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'excelIn') {
      return <VerifyExcelIn
        card={card}
        columns={cards.columns}
        columns={side === 'sub' ? cards.subColumns : cards.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    } else if (card.OpenType === 'excelOut') {
@@ -719,14 +724,14 @@
    } else if (card.OpenType === 'funcbutton' && card.funcType === 'print') {
      return <VerifyPrint
        card={card}
        columns={cards.columns}
        columns={side === 'sub' ? cards.subColumns : cards.columns}
        wrappedComponentRef={(inst) => this.verifyRef = inst}
      />
    }
  }
  render() {
    const { cards, cardCell } = this.props
    const { cards, cardCell, side } = this.props
    const { elements, visible, actvisible, profVisible, card, record } = this.state
    return (
@@ -734,7 +739,7 @@
        <DragElement
          list={elements}
          parent={cardCell}
          fields={cards.columns}
          fields={side === 'sub' ? cards.subColumns : cards.columns}
          updateMarks={this.updateMarks}
          handleList={this.handleList}
          handleMenu={this.handleElement}
@@ -757,6 +762,7 @@
          >
            <ElementForm
              card={card}
              side={side}
              formlist={this.state.formlist}
              inputSubmit={this.handleSubmit}
              config={cards}
@@ -771,7 +777,7 @@
            maskClosable={false}
            onCancel={this.editModalCancel}
            footer={[
              record && record.intertype === 'inner' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
              record && record.intertype === 'inner' && cards.subtype === 'dualdatacard' ? <CreateFunc key="create" ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
              <Button key="cancel" onClick={this.editModalCancel}>取消</Button>,
              <Button key="confirm" type="primary" onClick={this.handleActionSubmit}>确定</Button>
            ]}
src/menu/components/card/double-data-card/index.jsx
@@ -73,6 +73,7 @@
            uuid: Utils.getuuid(),
            eleType: 'text',
            datatype: 'static',
            width: 12,
            value: '循环区域'
          }],
          backSetting: {},
@@ -86,6 +87,7 @@
            uuid: Utils.getuuid(),
            eleType: 'text',
            datatype: 'static',
            width: 12,
            value: '子表区域'
          }]
        }]
src/menu/components/card/double-data-card/index.scss
@@ -19,7 +19,7 @@
    background: rgba(255, 255, 255, 0.55);
  }
  .card-item {
  .card-item, .card-item-wrap {
    overflow: hidden;
    position: relative;
    background-color: #ffffff;
src/menu/components/card/doublecardcomponent/index.jsx
@@ -27,7 +27,8 @@
  state = {
    card: null,            // 卡片信息,包括正反面
    appType: sessionStorage.getItem('appType'),
    visible: false
    visible: false,
    side: ''
  }
  /**
@@ -60,7 +61,7 @@
    const { card, side } = this.state
    let _card = fromJS(card).toJS()
    if (side === 'back') {
    if (side === 'sub') {
      _card.backStyle = style
    } else {
      _card.style = style
@@ -73,12 +74,12 @@
    this.props.updateElement(_card)
  }
  updateCard = (elements, btn) => {
    const { card, side } = this.state
  updateCard = (elements, btn, type) => {
    const { card } = this.state
    let _card = {}
    if (side === 'back') {
    if (type === 'sub') {
      _card = {...card, backElements: elements}
    } else {
      _card = {...card, elements: elements}
@@ -91,28 +92,7 @@
    this.props.updateElement(_card, btn)
  }
  changeSide = () => {
    const { card } = this.props
    const { side } = this.state
    let _side = ''
    let _elements = null
    if (side === 'front') {
      _side = 'back'
    } else {
      _side = 'front'
    }
    if (_side === 'front') {
      _elements = fromJS(card.elements).toJS()
    } else {
      _elements = fromJS(card.backElements).toJS()
    }
    this.setState({side: _side, elements: _elements})
  }
  addElement = () => {
  addElement = (type) => {
    const { card } = this.state
    let newcard = {}
@@ -124,10 +104,10 @@
    newcard.height = 1
    // 注册事件-添加元素
    MKEmitter.emit('cardAddElement', card.uuid, newcard)
    MKEmitter.emit('cardAddElement', card.uuid, newcard, type)
  }
  addButton = () => {
  addButton = (type) => {
    const { card } = this.state
    let newcard = {eleType: 'button', label: 'button', verify: null, show: 'link', sqlType: '', Ot: 'requiredSgl', OpenType: 'prompt', icon: '', class: 'primary', intertype: 'system', execSuccess: 'grid', execError: 'never', popClose: 'never'}
@@ -135,30 +115,31 @@
    newcard.focus = true
    // 注册事件-添加元素
    MKEmitter.emit('cardAddElement', card.uuid, newcard)
    MKEmitter.emit('cardAddElement', card.uuid, newcard, type)
  }
  changeStyle = () => {
    const { card, side } = this.state
  changeStyle = (type) => {
    const { card } = this.state
    let _style = null
    let options = ['height', 'background', 'border', 'padding', 'margin', 'shadow']
    if (side === 'front') {
      _style = card.style ? fromJS(card.style).toJS() : {}
    } else if (side === 'back') {
      _style = card.backStyle ? fromJS(card.backStyle).toJS() : {}
      options = ['background', 'padding']
    if (type === 'sub') {
      _style = fromJS(card.backStyle).toJS()
    } else {
      _style = fromJS(card.style).toJS()
    }
    this.setState({side: type})
    MKEmitter.emit('changeStyle', options, _style, this.getStyle)
  }
  getSettingForms = () => {
    const { cards } = this.props
    const { card, appType } = this.state
    const { card } = this.state
    let buttons = []
    card.elements && card.elements.forEach(item => {
    card.elements.forEach(item => {
      if (item.eleType === 'button') {
        buttons.push({
          value: item.uuid,
@@ -166,7 +147,14 @@
        })
      }
    })
    if (appType !== 'mob' && card.backElements) {
    return getSettingForm(card.setting, buttons)
  }
  getBackSettingForms = () => {
    const { card } = this.state
    let buttons = []
      card.backElements.forEach(item => {
        if (item.eleType === 'button') {
          buttons.push({
@@ -175,12 +163,12 @@
          })
        }
      })
    }
    return getSettingForm(card.setting, cards.subtype, buttons, card.$cardType, cards.columns)
    return getSettingForm(card.backSetting, buttons)
  }
  updateSetting = (res) => {
    const { card, side, appType } = this.state
  updateSetting = (res, type) => {
    const { card, appType } = this.state
    if (appType === '' && res.menu) {
      let list = null
@@ -202,23 +190,22 @@
      })
    }
    let _card = {...card, setting: res}
    let _card = {...card}
    if (type === 'sub') {
      _card.backSetting = res
    } else {
      _card.setting = res
    }
    this.setState({
      card: _card
    })
    if (side === 'back' && res.type === 'simple') {
      this.setState({
        side: 'front',
        elements: fromJS(_card.elements).toJS()
      })
    }
    this.props.updateElement(_card)
  }
  paste = (element, resolve) => {
  paste = (element, resolve, type) => {
    const { card } = this.state
    let _uuid = Utils.getuuid()
@@ -233,14 +220,16 @@
    resolve({status: true})
    // 注册事件-添加元素
    MKEmitter.emit('cardAddElement', card.uuid, element)
    MKEmitter.emit('cardAddElement', card.uuid, element, type)
  }
  doubleClickCard = () => {
  doubleClickCard = (type) => {
    const { card } = this.state
    if (card.setting.click === 'menu' && card.setting.menu) {
    if (type !== 'sub' && card.setting.click === 'menu' && card.setting.menu) {
      MKEmitter.emit('changeEditMenu', {MenuID: card.setting.menu})
    } else if (type === 'sub' && card.backSetting.click === 'menu' && card.backSetting.menu) {
      MKEmitter.emit('changeEditMenu', {MenuID: card.backSetting.menu})
    }
  }
@@ -262,43 +251,45 @@
    return (
      <Col span={card.setting.width || 24}>
        <div className="card-item-wrap">
        <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}>
          <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}>
            <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
              <div className="mk-popover-control">
                <PlusOutlined className="plus" title="添加元素" onClick={this.addElement} />
                <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton} />
                <NormalForm title={'循环卡片设置'} width={950} update={this.updateSetting} getForms={this.getSettingForms}>
                  <PlusOutlined className="plus" title="添加元素" onClick={() => this.addElement('main')} />
                  <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.addButton('main')} />
                  <NormalForm title={'循环卡片设置'} width={950} update={(res) => this.updateSetting(res)} getForms={this.getSettingForms}>
                  <EditOutlined className="edit" title="编辑"/>
                </NormalForm>
                <CopyComponent type="cardcell" card={card}/>
                <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} />
                <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} />
                  <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'main')} />
                  <FontColorsOutlined className="style" title="调整样式" onClick={() => this.changeStyle()} />
              </div>
            } trigger="hover">
              <ToolOutlined />
            </Popover>
          </div>
          <CardCellComponent cards={cards} cardCell={card} side="" elements={card.elements} updateElement={this.updateCard}/>
            <CardCellComponent cards={cards} cardCell={card} side="main" elements={card.elements} updateElement={(elements, btn) => this.updateCard(elements, btn)}/>
        </div>
        <div className={'card-item ' + (card.setting.btnControl || '')} style={_backStyle} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}>
          <div className={'card-item ' + (card.backSetting.btnControl || '')} style={_backStyle} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard('sub')}} id={card.uuid}>
          <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}>
            <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
              <div className="mk-popover-control">
                <PlusOutlined className="plus" title="添加元素" onClick={this.addElement} />
                <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton} />
                <NormalForm title={'循环子卡片设置'} width={950} update={this.updateSetting} getForms={this.getSettingForms}>
                  <PlusOutlined className="plus" title="添加元素" onClick={() => this.addElement('sub')} />
                  <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.addButton('sub')} />
                  <NormalForm title={'循环子卡片设置'} width={950} update={(res) => this.updateSetting(res, 'sub')} getForms={this.getBackSettingForms}>
                  <EditOutlined className="edit" title="编辑"/>
                </NormalForm>
                <CopyComponent type="cardcell" card={card}/>
                <PasteController options={['action', 'customCardElement']} updateConfig={this.paste} />
                <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle} />
                  <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'sub')} />
                  <FontColorsOutlined className="style" title="调整样式" onClick={() => this.changeStyle('sub')} />
              </div>
            } trigger="hover">
              <ToolOutlined />
            </Popover>
          </div>
          <CardCellComponent cards={cards} cardCell={card} side="" elements={card.backElements} updateElement={this.updateCard}/>
            <CardCellComponent cards={cards} cardCell={card} side="sub" elements={card.backElements} updateElement={(elements, btn) => this.updateCard(elements, btn, 'sub')}/>
          </div>
        </div>
      </Col>
    )
src/menu/components/card/doublecardcomponent/options.jsx
@@ -1,7 +1,7 @@
/**
 * @description Setting表单配置信息
 */
export default function (setting, subtype, buttons = [], cardType, columns) {
export default function (setting, buttons = []) {
  let appType = sessionStorage.getItem('appType')
  let menulist = []
src/menu/datasource/verifycard/index.jsx
@@ -759,16 +759,7 @@
  copyDatasource = () => {
    const { config } = this.props
    const { columns, scripts } = this.state
    if (columns.length === 0) {
      notification.warning({
        top: 92,
        message: '请添加字段集!',
        duration: 5
      })
      return
    }
    const { columns, subColumns, scripts } = this.state
    this.settingForm.handleConfirm().then(res => {
      delete res.supModule
@@ -777,7 +768,7 @@
      let source = {
        key: 'interface',
        type: 'line',
        data: {setting: res, columns, scripts, pageable: false, format: 'array', name: res.name, status: 'false', type: 'interface', uuid: '' }
        data: {setting: res, columns, subColumns, scripts, pageable: false, format: 'array', name: res.name, status: 'false', type: 'interface', uuid: '' }
      }
      try {
@@ -825,6 +816,15 @@
      }
      if (config.subtype !== 'basetable') {
        let subColumns = []
        if (config.subtype === 'dualdatacard' && res.data.subColumns) {
          subColumns = res.data.subColumns.map(col => {
            col.uuid = Utils.getuuid()
            return col
          })
        }
        this.setState({
          scripts: res.data.scripts.map(col => {
            col.uuid = Utils.getuuid()
@@ -834,6 +834,7 @@
            col.uuid = Utils.getuuid()
            return col
          }),
          subColumns: subColumns,
          setting: res.data.setting,
          median: res.data.setting,
          reload: true,
@@ -926,6 +927,7 @@
            {!reload ? <SettingForm
              config={config}
              columns={columns}
              subColumns={subColumns}
              setting={setting}
              scripts={scripts}
              updateStatus={(res) => this.setState({median: {...res}})}
src/menu/datasource/verifycard/settingform/index.jsx
@@ -556,6 +556,39 @@
                })(<InputNumber min={0} max={500} precision={0} />)}
              </Form.Item>
            </Col> : null}
            {config.subtype === 'dualdatacard' ? <Col span={8}>
              <Form.Item label={
                <Tooltip placement="topLeft" title="子表在主表中的数据集名称。">
                  <QuestionCircleOutlined className="mk-form-tip" />
                  子表字段
                </Tooltip>
              }>
                {getFieldDecorator('subdata', {
                  initialValue: setting.subdata || 'sub_data',
                  rules: [
                    {
                      required: true,
                      message: '请输入默认排序!'
                    }
                  ]
                })(<Input placeholder={''} autoComplete="off" />)}
              </Form.Item>
            </Col> : null}
            {config.subtype === 'dualdatacard' ? <Col span={8}>
              <Form.Item label="子表主键">
                {getFieldDecorator('subKey', {
                  initialValue: setting.subKey || ''
                })(
                  <Select>
                    {this.props.subColumns.map((option, i) =>
                      <Select.Option key={i} value={option.field}>
                        {option.label}
                      </Select.Option>
                    )}
                  </Select>
                )}
              </Form.Item>
            </Col> : null}
          </Row>
        </Form>
      </div>
src/menu/modalconfig/index.jsx
@@ -106,7 +106,7 @@
   * 3、设置编辑参数项-formlist
   */
  handleForm = (_card) => {
    const { componentConfig } = this.props
    const { componentConfig, btn } = this.props
    const { config } = this.state
    let card = fromJS(_card).toJS()
    let _inputfields = []
@@ -177,7 +177,12 @@
    _tabfields.unshift({field: '', label: '原表单'})
    componentConfig.columns.forEach(col => {
    let columns = componentConfig.columns
    if (btn.$sub) {
      columns = componentConfig.subColumns || []
    }
    columns.forEach(col => {
      if (col.field && !uniq.has(col.field)) {
        uniq.set(col.field, true)
@@ -206,7 +211,7 @@
      standardform,
      visible: true,
      card: card,
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, componentConfig.columns)
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns)
    })
  }
src/mob/modalconfig/index.jsx
@@ -127,7 +127,7 @@
   * 3、设置编辑参数项-formlist
   */
  handleForm = (_card) => {
    const { componentConfig } = this.props
    const { componentConfig, btn } = this.props
    const { config } = this.state
    let card = fromJS(_card).toJS()
    let _inputfields = []
@@ -199,7 +199,12 @@
      }
    }
    componentConfig.columns.forEach(col => {
    let columns = componentConfig.columns
    if (btn.$sub) {
      columns = componentConfig.subColumns || []
    }
    columns.forEach(col => {
      if (col.field && !uniq.has(col.field)) {
        uniq.set(col.field, true)
@@ -220,7 +225,7 @@
      standardform,
      visible: true,
      card: card,
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, componentConfig.columns)
      formlist: getModalForm(card, _inputfields, _tabfields, _linkableFields, _linksupFields, columns)
    })
  }