king
2020-12-01 57da72c823fab94a3ec6fadab2bc75173c8a03b1
src/templates/comtableconfig/index.jsx
@@ -205,19 +205,20 @@
  getFuncNames = (data, funcNames, tableNames) => {
    data.forEach(item => {
      if (item.subfuncs) {
        this.getFuncNames(item.subfuncs, funcNames, tableNames)
      } else {
        if (item.tableName) {
          tableNames.push(item.tableName)
        }
        if (item.innerFunc) {
          funcNames.push({func: item.innerFunc, label: item.label || ''})
        }
      // if (item.subfuncs) {
      //   this.getFuncNames(item.subfuncs, funcNames, tableNames)
      //   return
      // }
      if (item.tableName) {
        tableNames.push(item.tableName)
      }
      if (item.innerFunc) {
        funcNames.push({func: item.innerFunc, label: item.label || ''})
      }
        if (item.callbackFunc) {
          funcNames.push({func: item.callbackFunc, label: item.label || ''})
        }
      if (item.callbackFunc) {
        funcNames.push({func: item.callbackFunc, label: item.label || ''})
      }
    })
@@ -355,46 +356,47 @@
    }
    new Promise(resolve => {
      let deffers = []
      _config.funcs.forEach(item => {
        if (item.type === 'tab') {
          let deffer = new Promise(resolve => {
            Api.getSystemConfig({
              func: 'sPC_Get_LongParam',
              MenuID: item.linkTab
            }).then(result => {
              if (result.status && result.LongParam) {
                let _LongParam = ''
      // let deffers = []
      // _config.funcs.forEach(item => {
      //   if (item.type === 'tab') {
      //     let deffer = new Promise(resolve => {
      //       Api.getSystemConfig({
      //         func: 'sPC_Get_LongParam',
      //         MenuID: item.linkTab
      //       }).then(result => {
      //         if (result.status && result.LongParam) {
      //           let _LongParam = ''
      
                if (result.LongParam) {
                  try {
                    _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
                  } catch (e) {
                    console.warn('Parse Failure')
                    _LongParam = ''
                  }
                }
      //           if (result.LongParam) {
      //             try {
      //               _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
      //             } catch (e) {
      //               console.warn('Parse Failure')
      //               _LongParam = ''
      //             }
      //           }
    
                if (_LongParam) {
                  item.menuNo = _LongParam.tabNo || ''
                  item.subfuncs = _LongParam.funcs || []
                }
              }
              resolve()
            })
          })
      //           if (_LongParam) {
      //             item.menuNo = _LongParam.tabNo || ''
      //             item.subfuncs = _LongParam.funcs || []
      //           }
      //         }
      //         resolve()
      //       })
      //     })
          deffers.push(deffer)
        }
      })
      //     deffers.push(deffer)
      //   }
      // })
      if (deffers.length === 0) {
        resolve()
      } else {
        Promise.all(deffers).then(() => {
          resolve()
        })
      }
      // if (deffers.length === 0) {
      //   resolve()
      // } else {
      //   Promise.all(deffers).then(() => {
      //     resolve()
      //   })
      // }
      resolve()
    }).then(() => {
      // 保存时删除配置类型,system 、user
      delete _config.type
@@ -623,10 +625,6 @@
              originMenu: fromJS(_config).toJS()
            })
            this.props.reloadmenu()
            this.submitAction(btnParam, tabParam)
            localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
            delete localParam.LongParam
            delete localParam.PageParam
@@ -635,7 +633,7 @@
            delete localParam.EasyCode
            delete localParam.open_edition
            Api.getLocalConfig(localParam)
            this.submitAction(btnParam, tabParam, localParam)
          } else {
            this.setState({
              menuloading: false,
@@ -655,7 +653,7 @@
  /**
   * @description 保存或修改菜单按钮集
   */
  submitAction = (btnParam, tabParam) => {
  submitAction = (btnParam, tabParam, localParam) => {
    const { config } = this.state
    new Promise(resolve => {
@@ -682,29 +680,25 @@
        deffers.push(defer)
      }
      if (deffers.length === 0) {
        resolve(true)
      } else {
        Promise.all(deffers).then(result => {
          let error = false
          result.forEach(res => {
            if (!res.status) {
              error = res
            }
          })
          if (error) {
            notification.warning({
              top: 92,
              message: error.message,
              duration: 5
            })
            resolve(false)
          } else {
            resolve(true)
      Promise.all(deffers).then(result => {
        let error = false
        result.forEach(res => {
          if (!res.status) {
            error = res
          }
        })
      }
        if (error) {
          notification.warning({
            top: 92,
            message: error.message,
            duration: 5
          })
          resolve(false)
        } else {
          resolve(true)
        }
      })
    }).then(response => {
      if (response === false) return response
@@ -822,6 +816,8 @@
            menucloseloading: false
          })
        }
        this.props.reloadmenu()
        Api.getLocalConfig(localParam)
      } else {
        this.setState({
          menuloading: false,
@@ -1194,7 +1190,7 @@
    const { menu } = this.props
    const { activeKey, config, chartview } = this.state
    const confActions = config.action.filter(_action => !_action.origin && ['pop', 'popview', 'blank', 'tab'].includes(_action.OpenType))
    const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab')))
    let configTabs = []
    config.tabgroups.forEach(group => {