king
2020-12-01 57da72c823fab94a3ec6fadab2bc75173c8a03b1
src/templates/treepageconfig/index.jsx
@@ -166,19 +166,19 @@
  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 || ''})
      }
    })
@@ -267,46 +267,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
@@ -437,6 +438,13 @@
      }).then(resp => {
        if (resp === false) return
        let localParam = fromJS(param).toJS()
        localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
        delete localParam.LongParam
        delete localParam.PageParam
        delete localParam.Template
        delete localParam.Sort
        delete localParam.EasyCode
        delete localParam.open_edition
        Api.getSystemConfig(param).then(response => {
          if (response.status) {
@@ -446,8 +454,6 @@
              originMenu: fromJS(_config).toJS()
            })
            this.props.reloadmenu()
            // 存在标签页时
            if (tabParam.LText) {
              Api.getSystemConfig(tabParam).then(result => {
@@ -457,6 +463,10 @@
                    message: '保存成功',
                    duration: 2
                  })
                  this.props.reloadmenu()
                  Api.getLocalConfig(localParam)
                  if (this.state.closeVisible) {
                    this.props.handleView()
                  } else {
@@ -483,6 +493,10 @@
                message: '保存成功',
                duration: 2
              })
              this.props.reloadmenu()
              Api.getLocalConfig(localParam)
              if (this.state.closeVisible) {
                this.props.handleView()
              } else {
@@ -492,16 +506,6 @@
                })
              }
            }
            localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
            delete localParam.LongParam
            delete localParam.PageParam
            delete localParam.Template
            delete localParam.Sort
            delete localParam.EasyCode
            delete localParam.open_edition
            Api.getLocalConfig(localParam)
          } else {
            this.setState({
              menuloading: false,