king
2020-12-01 57da72c823fab94a3ec6fadab2bc75173c8a03b1
src/templates/subtableconfig/index.jsx
@@ -275,49 +275,49 @@
      _config.enabled = false
    }
    _config.funcs = []
    // _config.funcs = []
    _config.funcs.push({
      type: 'view',
      subtype: 'view',
      uuid: _config.uuid,
      intertype: _config.setting.interType || 'system',
      interface: _config.setting.interface || '',
      tableName: _config.setting.tableName || '',
      innerFunc: _config.setting.innerFunc || '',
      outerFunc: _config.setting.outerFunc || ''
    })
    // _config.funcs.push({
    //   type: 'view',
    //   subtype: 'view',
    //   uuid: _config.uuid,
    //   intertype: _config.setting.interType || 'system',
    //   interface: _config.setting.interface || '',
    //   tableName: _config.setting.tableName || '',
    //   innerFunc: _config.setting.innerFunc || '',
    //   outerFunc: _config.setting.outerFunc || ''
    // })
    _config.action.forEach(item => {
      let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '')
    // _config.action.forEach(item => {
    //   let tablename = item.OpenType === 'excelIn' ? (item.sheet || '') : (item.sql || '')
      if (item.OpenType === 'excelOut' && item.intertype === 'system') {
        tablename = _config.setting.tableName || ''
      }
    //   if (item.OpenType === 'excelOut' && item.intertype === 'system') {
    //     tablename = _config.setting.tableName || ''
    //   }
      if (item.OpenType === 'popview') {
        _config.funcs.push({
          type: 'tab',
          subtype: 'btn',
          uuid: item.uuid,
          label: item.label,
          linkTab: item.linkTab
        })
      } else {
        _config.funcs.push({
          type: 'button',
          subtype: 'btn',
          uuid: item.uuid,
          label: item.label,
          tableName: tablename,
          intertype: item.intertype,
          interface: item.interface || '',
          innerFunc: item.innerFunc || '',
          outerFunc: item.outerFunc || '',
          callbackFunc: item.callbackFunc || ''
        })
      }
    })
    //   if (item.OpenType === 'popview') {
    //     _config.funcs.push({
    //       type: 'tab',
    //       subtype: 'btn',
    //       uuid: item.uuid,
    //       label: item.label,
    //       linkTab: item.linkTab
    //     })
    //   } else {
    //     _config.funcs.push({
    //       type: 'button',
    //       subtype: 'btn',
    //       uuid: item.uuid,
    //       label: item.label,
    //       tableName: tablename,
    //       intertype: item.intertype,
    //       interface: item.interface || '',
    //       innerFunc: item.innerFunc || '',
    //       outerFunc: item.outerFunc || '',
    //       callbackFunc: item.callbackFunc || ''
    //     })
    //   }
    // })
    if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态
      this.setState({
@@ -330,48 +330,48 @@
    }
    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
      delete _config.isAdd