king
2020-06-28 48a18736c461ad730bd264b0ac7b40b68a0e33a1
src/templates/sharecomponent/columncomponent/index.jsx
@@ -28,9 +28,9 @@
  }
  state = {
    dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    columnlist: null,    // 显示列
    loading: false,      // 查询显示列关联菜单
    loading: false,      // 查询显示列联动菜单
    showField: false,    // 显示列字段
    modaltype: '',       // 模态框控制
    card: null           // 编辑中元素
@@ -49,17 +49,21 @@
   * @description 监听到显示列复制时,触发显示列编辑
   */
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { config } = this.props
    const { columnlist } = this.state
    if (
      nextProps.pasteContent &&
      columnlist.length === 0 &&
      nextProps.pasteContent.columns &&
      nextProps.pasteContent.copyType === 'columns' &&
      nextProps.pasteContent.columns.length > 0
    ) {
      this.setState({columnlist: nextProps.pasteContent.columns})
    } else if (!is(fromJS(nextProps.config.columns), fromJS(this.props.config.columns)) && !is(fromJS(nextProps.config.columns), fromJS(columnlist))) {
      if (columnlist.filter(col => !col.origin).length === 0) {
        this.setState({columnlist: nextProps.pasteContent.columns}, () => {
          this.props.updatecolumn({...config, columns: nextProps.pasteContent.columns})
        })
      }
    } else if (!is(fromJS(nextProps.config.columns), fromJS(config.columns)) && !is(fromJS(nextProps.config.columns), fromJS(columnlist))) {
      this.setState({columnlist: fromJS(nextProps.config.columns).toJS()})
    }
  }
@@ -99,7 +103,7 @@
        let _param = {
          func: 'sPC_Get_FunMenu',
          ParentID: card.linkmenu[0],
          systemType: options.systemType,
          systemType: options.sysType,
          debug: 'Y'
        }
@@ -307,7 +311,7 @@
    confirm({
      content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`,
      okText: dict['model.confirm'],
      cancelText: this.state.dict['header.cancel'],
      cancelText: this.state.dict['model.cancel'],
      onOk() {
        let _columnlist = fromJS(_this.state.columnlist).toJS()
@@ -425,6 +429,10 @@
    })
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
  /**
   * @description 组件销毁,清除state更新
   */
@@ -446,7 +454,7 @@
        {columnlist && columnlist.length > 0 ?
          <Icon className="column-copy" title="copy" type="copy" onClick={this.copycolumn} /> : null
        }
        <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showField} onChange={this.onFieldChange} />
        <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={this.onFieldChange} />
        <DragElement
          list={columnlist}
          setting={config.setting}
@@ -463,7 +471,7 @@
        <Modal
          title={dict['header.modal.column.edit']}
          visible={modaltype === 'columns'}
          width={750}
          width={800}
          maskClosable={false}
          onOk={this.handleSubmit}
          onCancel={this.editModalCancel}
@@ -480,9 +488,9 @@
        </Modal>
        {/* 合并列编辑 */}
        <Modal
          title={dict['header.modal.colspan.edit']}
          title={dict['model.modal.colspan'] + '-' + dict['model.edit']}
          visible={modaltype === 'colspan'}
          width={750}
          width={800}
          maskClosable={false}
          onOk={this.handleSubmit}
          onCancel={this.editModalCancel}
@@ -500,7 +508,7 @@
        <Modal
          title={dict['header.modal.gridbtn.edit']}
          visible={modaltype === 'gridbtn'}
          width={700}
          width={800}
          maskClosable={false}
          onOk={this.handleSubmit}
          onCancel={this.editModalCancel}
@@ -521,7 +529,7 @@
          width={'75vw'}
          maskClosable={false}
          style={{minWidth: '900px', maxWidth: '1200px'}}
          okText={dict['header.submit']}
          okText={dict['model.submit']}
          onOk={this.markSubmit}
          onCancel={() => { this.setState({ modaltype: '' }) }}
          destroyOnClose