king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/templates/comtableconfig/index.jsx
@@ -25,8 +25,11 @@
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 Unattended = asyncComponent(() => import('@/templates/zshare/unattended'))
const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent'))
const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
@@ -89,6 +92,7 @@
    _config.MenuNo = menu.MenuNo || ''
    _config.OpenType = menu.PageParam ? menu.PageParam.OpenType : ''
    _config.easyCode = _config.easyCode || ''
    _config.uuid = menu.MenuID || ''
    // 版本兼容
    _config = updateCommonTable(_config)
@@ -682,7 +686,7 @@
                    })
                  })
                  _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig)))
                } catch {
                } catch (e) {
                  console.warn('Stringify Failure')
                  _subconfig = ''
                }
@@ -1032,14 +1036,10 @@
   * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等
   */
  editConfig = (res) => {
    if (res.type === 'thaw') {
      this.setState({
        thawButtons: res.thawButtons,
        config: res.config
      })
    } else if (res.type === 'paste') {
      this.setState({config: res.config})
    }
  }
  /**
@@ -1083,9 +1083,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')))
@@ -1125,11 +1188,7 @@
                <div className="search-element">
                  {Source.searchItems.map((item, index) => (<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">
@@ -1164,11 +1223,7 @@
                <div className="search-element">
                  {Source.columnItems.map((item, index) => (<SourceElement key={index} content={item}/>))}
                </div>
                <FieldsComponent
                  config={config}
                  type="columns"
                  updatefield={this.updateconfig}
                />
                <FieldsComponent config={config} type="columns"/>
              </Panel>
              {/* 添加标签 */}
              <Panel header={this.state.dict['header.menu.tab']} key="4">
@@ -1206,8 +1261,10 @@
              </div>
            } bordered={false} extra={
              <div>
                <Unattended config={config} updateConfig={this.updateconfig}/>
                <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}/>
                <EditComponent dict={this.state.dict} type="table" options={['search', 'form', '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} />
                <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>
@@ -1215,7 +1272,7 @@
            } style={{ width: '100%' }}>
              <SettingComponent
                config={config}
                MenuID={this.props.menu.MenuID}
                MenuID={menu.MenuID}
                updatesetting={this.updateconfig}
              />
              <SearchComponent