king
2020-02-22 592ff0aa0f2d45d143872b672a1468e268d3157f
src/templates/modalconfig/index.jsx
@@ -31,6 +31,7 @@
class ComTableConfig extends Component {
  static propTpyes = {
    menu: PropTypes.any,
    optionLibs: PropTypes.any,
    editTab: PropTypes.any,
    editSubTab: PropTypes.any,
    tabConfig: PropTypes.any,
@@ -61,7 +62,8 @@
    selectedTables: [],    // 已选表名
    originConfig: null,    // 原始菜单
    groupVisible: false,   // 全局配置模态框
    curgroup: null         // 当前组,新建或编辑
    curgroup: null,        // 当前组,新建或编辑
    optionLibs: null       // 自定义下拉选项库
  }
  /**
@@ -72,7 +74,7 @@
   * 4、设置按钮基本信息
   */
  UNSAFE_componentWillMount () {
    const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props
    const {menu, editAction, tabConfig, subTabConfig, subConfig, optionLibs} = this.props
    let _config = ''
    let _tab = subTabConfig ? subTabConfig : tabConfig
@@ -87,6 +89,42 @@
    if (subConfig) {
      _config = subConfig
      if (_config.groups.length > 0) {
        _config.groups.forEach(group => {
          group.sublist.forEach(item => {
            if (
              (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
              item.resourceType === '0' &&
              item.options && item.options.length > 0
            ) {
              optionLibs.set(item.uuid, {
                uuid: item.uuid,
                label: item.label,
                parname: editAction.label,
                type: 'Modal',
                options: item.options
              })
            }
          })
        })
      } else {
        _config.fields.forEach(item => {
          if (
            (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
            item.resourceType === '0' &&
            item.options && item.options.length > 0
          ) {
            optionLibs.set(item.uuid, {
              uuid: item.uuid,
              label: item.label,
              parname: editAction.label,
              type: 'Modal',
              options: item.options
            })
          }
        })
      }
    } else {
      _config = JSON.parse(JSON.stringify((Source.baseConfig)))
    }
@@ -100,6 +138,7 @@
    this.setState({
      menu: _menu,
      optionLibs: optionLibs,
      config: _config,
      selectedTables: _config.tables || [],
      originConfig: JSON.parse(JSON.stringify(_config)),
@@ -231,6 +270,7 @@
    
    let param = {
      editMenu: menu,
      optionLibs: this.state.optionLibs,
      editTab: editTab,
      tabConfig: tabConfig,
      editSubTab: editSubTab,
@@ -364,8 +404,23 @@
   * 3、通过loading刷新
   */
  handleSubmit = () => {
    const {editAction, optionLibs} = this.props
    this.formRef.handleConfirm().then(res => {
      let _config = JSON.parse(JSON.stringify(this.state.config))
      if ( // 更新下拉字典
        (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
        res.resourceType === '0' &&
        res.options && res.options.length > 0
      ) {
        optionLibs.set(res.uuid, {
          uuid: res.uuid,
          label: res.label,
          parname: editAction.label,
          type: 'Modal',
          options: res.options
        })
      }
      if (_config.groups.length > 0) {
        _config.groups.forEach(group => {
@@ -391,6 +446,7 @@
      this.setState({
        config: _config,
        optionLibs: optionLibs,
        visible: false
      })
    })
@@ -1050,6 +1106,7 @@
            dict={this.state.dict}
            card={this.state.card}
            formlist={this.state.formlist}
            optionLibs={this.state.optionLibs}
            wrappedComponentRef={(inst) => this.formRef = inst}
          />}
        </Modal>