king
2021-09-06 d4c2669215ef211e52496e69a89010a9b545e04a
src/templates/comtableconfig/index.jsx
@@ -25,6 +25,8 @@
const { Panel } = Collapse
const { confirm } = Modal
const Versions = asyncComponent(() => import('@/menu/versions'))
const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
@@ -871,7 +873,7 @@
          } else if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') {
            param.subConfig = _LongParam
          }
          if (param.editTab) {
            param.editTab.open_edition = res.open_edition || ''
          } else if (param.editAction) {
@@ -1083,9 +1085,72 @@
    })
  }
  refreshConfig = () => {
    const { menu } = this.props
    let param = {
      func: 'sPC_Get_LongParam',
      MenuID: menu.MenuID
    }
    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.ParentId = menu.ParentId
        _config.fstMenuId = menu.fstMenuId
        _config.MenuName = menu.MenuName || ''
        _config.MenuNo = menu.MenuNo || ''
        _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : ''
        _config.easyCode = _config.easyCode || ''
        // 版本兼容
        _config = updateCommonTable(_config)
        this.setState({
          config: null
        }, () => {
          this.setState({
            chartview: _config.charts[0].uuid,
            config: _config,
            openEdition: res.open_edition || '',
            activeKey: menu.activeKey || '0',
            originActions: [],
            originMenu: fromJS(_config).toJS()
          })
        })
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
      }
    })
  }
  render () {
    const { menu } = this.props
    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 === 'tab' && _action.tabTemplate === 'FormTab') || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop')))
@@ -1206,6 +1271,7 @@
              </div>
            } bordered={false} extra={
              <div>
                <Versions MenuId={menu.MenuID} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/>
                <EditComponent dict={this.state.dict} options={['search', 'action', 'columns']} config={this.state.config} MenuID={this.props.menu.MenuID} thawButtons={this.state.thawButtons} refresh={this.editConfig}/>
                <Switch className="big" checkedChildren={this.state.dict['model.enable']} unCheckedChildren={this.state.dict['model.disable']} checked={this.state.config.enabled} onChange={this.onEnabledChange} />
@@ -1215,7 +1281,7 @@
            } style={{ width: '100%' }}>
              <SettingComponent
                config={config}
                MenuID={this.props.menu.MenuID}
                MenuID={menu.MenuID}
                updatesetting={this.updateconfig}
              />
              <SearchComponent