king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/templates/subtableconfig/index.jsx
@@ -26,6 +26,7 @@
const { Panel } = Collapse
const { confirm } = Modal
const Versions = asyncComponent(() => import('@/menu/versions'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent'))
@@ -862,17 +863,13 @@
  }
  /**
   * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等
   * @description 编辑功能完成更新,包括解冻按钮等
   */
  updateConfig = (res) => {
    if (res.type === 'thaw') {
      this.setState({
        thawButtons: res.thawButtons,
        config: res.config
      })
    } else if (res.type === 'paste') {
      this.setState({config: res.config})
    }
    this.setState({
      thawButtons: res.thawButtons,
      config: res.config
    })
  }
  /**
@@ -917,8 +914,65 @@
    })
  }
  refreshConfig = () => {
    const { config } = this.props
    let param = {
      func: 'sPC_Get_LongParam',
      MenuID: config.uuid
    }
    Api.getSystemConfig(param).then(res => {
      if (res.status) {
        let _config = ''
        if (res.LongParam) {
          try {
            _config = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
          } catch (e) {
            console.warn('Parse Failure')
            _config = ''
          }
        }
        if (!_config) {
          notification.warning({
            top: 92,
            message: '未获取到配置信息!',
            duration: 5
          })
          return
        }
        // 版本兼容
        _config = updateSubTable(_config)
        this.setState({
          config: null
        }, () => {
          this.setState({
            chartview: _config.charts[0].uuid,
            config: _config,
            openEdition: res.open_edition || '',
            activeKey: '0',
            originActions: [],
            originConfig: fromJS(_config).toJS()
          })
        })
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
      }
    })
  }
  render () {
    const { activeKey, config, chartview } = this.state
    const { activeKey, config, chartview, openEdition } = this.state
    if (!config) return null
    const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview'].includes(_action.OpenType) || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop')))
@@ -950,11 +1004,7 @@
                    return (<SourceElement key={index} content={item}/>)
                  })}
                </div>
                <FieldsComponent
                  config={config}
                  type="search"
                  updatefield={this.updateconfig}
                />
                <FieldsComponent config={config} type="search" />
              </Panel>
              {/* 按钮添加 */}
              <Panel header={this.state.dict['header.menu.action']} key="2">
@@ -993,11 +1043,7 @@
                    return (<SourceElement key={index} content={item}/>)
                  })}
                </div>
                <FieldsComponent
                  config={config}
                  type="columns"
                  updatefield={this.updateconfig}
                />
                <FieldsComponent config={config} type="columns" />
              </Panel>
            </Collapse>
          </div>
@@ -1009,8 +1055,9 @@
              </div>
            } bordered={false} extra={
              <div>
                <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/>
                <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/>
                <EditComponent dict={this.state.dict} type="table" options={['search', 'form', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/>
                <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} />
                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button>
                <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button>