king
2020-11-25 42fae277ae5ebe794fc070bf38482a919eb661fc
src/templates/comtableconfig/index.jsx
@@ -59,7 +59,6 @@
    thawButtons: [],         // 已选择要解冻的按钮
    activeKey: '0',          // 默认展开基本信息
    chartview: null,         // 当前视图
    pasteContent: null,      // 粘贴配置信息
    openEdition: ''          // 编辑版本标记,防止多人操作
  }
@@ -902,7 +901,7 @@
        MenuNo: config.MenuNo,
        ParentId: config.ParentId,
        fstMenuId: config.fstMenuId,
        supMenuList: submenu ? submenu.options : []
        supMenuList: submenu ? submenu.children : []
      }
      // 菜单信息验证通过后,跳转子配置页面
@@ -1107,49 +1106,23 @@
   * @description 编辑功能完成更新,包括解冻按钮、粘贴、替换等
   */
  editConfig = (res) => {
    if (res.type === 'thaw') {
      this.setState({
        thawButtons: res.thawButtons,
        config: res.config
      })
    } else if (res.type === 'paste') {
      this.setState({
        pasteContent: res.content
      }, () => {
        this.setState({
          pasteContent: null
        })
      })
    } else if (res.type === 'replace') {
      let config = fromJS(this.state.config).toJS()
      if (res.repType === 'field') {
        let origin = res.origin.toLowerCase()
        let value = res.value
        config.search = config.search.map(item => {
          if (item.field && item.field.toLowerCase() === origin) {
            item.field = value
          } else if (item.datefield && item.datefield.toLowerCase() === origin) {
            item.datefield = value
      if (res.content.copyType === 'search') {
        config.search.push(res.content)
      } else if (res.content.copyType === 'action') {
        config.action.push(res.content)
      } else if (res.content.copyType === 'columns' && res.content.columns && res.content.columns.length > 0) {
        config.columns = config.columns.filter(col => !col.origin)
        config.columns = [...config.columns, ...res.content.columns]
          }
          return item
        })
        config.columns = config.columns.map(item => {
          if (item.field && item.field.toLowerCase() === origin) {
            item.field = value
          } else if (item.nameField && item.nameField.toLowerCase() === origin) {
            item.nameField = value
          }
          return item
        })
      }
      notification.success({
        top: 92,
        message: '替换成功。',
        duration: 2
      })
      this.setState({ config })
    }
  }
@@ -1347,21 +1320,16 @@
              <SettingComponent
                config={config}
                MenuID={this.props.menu.MenuID}
                permFuncField={this.props.permFuncField}
                updatesetting={this.updateconfig}
              />
              <SearchComponent
                menu={{MenuID: this.props.menu.MenuID, MenuName: config.MenuName}}
                config={config}
                pasteContent={this.state.pasteContent}
                sysRoles={this.props.sysRoles}
                updatesearch={this.updatesearch}
              />
              <div className="chart-view" style={{position: 'relative'}}>
                {/* 视图组 权限 会员等级20+ */}
                {this.props.memberLevel >= 20 ? <ChartGroupComponent
                  config={config}
                  sysRoles={this.props.sysRoles}
                  updatechartgroup={this.updatechartgroup}
                /> : null}
                {config.charts.map(item => {
@@ -1376,16 +1344,12 @@
                          menu={{ MenuID: this.props.menu.MenuID, MenuName: config.MenuName, MenuNo: config.MenuNo, fstMenuList: this.props.menu.fstMenuList }}
                          config={config}
                          tabs={this.state.tabviews}
                          pasteContent={this.state.pasteContent}
                          usefulFields={this.props.permFuncField}
                          setSubConfig={(_btn) => this.setSubConfig(_btn, 'button')}
                          updateaction={this.updateaction}
                        />
                        <ColumnComponent
                          config={config}
                          menu={this.props.menu}
                          sysRoles={this.props.sysRoles}
                          pasteContent={this.state.pasteContent}
                          updatecolumn={this.updateconfig}
                        />
                      </Col>
@@ -1447,8 +1411,6 @@
const mapStateToProps = (state) => {
  return {
    sysRoles: state.sysRoles,
    permFuncField: state.permFuncField,
    memberLevel: state.memberLevel
  }
}