king
2020-03-20 bc4ee6130db80f8f2020bb3bb7248b6e55ae90cc
src/templates/formtabconfig/index.jsx
@@ -260,6 +260,12 @@
            }
          })
        })
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
      }
    })
  }
@@ -271,6 +277,46 @@
    this.setState = () => {
      return
    }
  }
  /**
   * @description 加载或刷新标签信息
   */
  reloadTab = () => {
    this.setState({
      loading: true,
      tabviews: []
    })
    Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
      if (res.status) {
        this.setState({
          loading: false,
          tabviews: res.UserTemp.map(temp => {
            return {
              uuid: temp.MenuID,
              value: temp.MenuID,
              text: temp.MenuName,
              type: temp.Template,
              MenuNo: temp.MenuNo
            }
          })
        })
        notification.success({
          top: 92,
          message: '刷新成功。',
          duration: 2
        })
      } else {
        this.setState({
          loading: false
        })
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
      }
    })
  }
  // 页面返回
@@ -755,86 +801,40 @@
        return
      }
      new Promise(resolve => {
        // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。
        // 获取信息后生成删除和创建存储过程的语句
        if (btn.OpenType === 'pop') {
          Api.getSystemConfig({
            func: 'sPC_Get_LongParam',
            MenuID: btn.uuid
          }).then(res => {
            let _LongParam = ''
            if (res.status && res.LongParam) {
              try {
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
      let fields = []
      _config.groups.forEach(group => {
        fields = [...fields, ...group.sublist]
      })
            if (_LongParam) {
              let fields = []
              if (_LongParam.groups.length > 0) {
                _LongParam.groups.forEach(group => {
                  fields = [...fields, ...group.sublist]
                })
              } else {
                fields = _LongParam.fields
              }
      let _param = {
        funcName: btn.innerFunc,
        name: _config.setting.tableName || '',
        fields: fields,
        menuNo: menu.MenuNo
      }
              let _param = {
                funcName: btn.innerFunc,
                name: _config.setting.tableName || '',
                fields: fields,
                menuNo: menu.MenuNo
              }
              newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
              DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
              resolve(true)
            } else {
              notification.warning({
                top: 92,
                message: '弹窗(表单)按钮,请先配置表单信息!',
                duration: 10
              })
              resolve(false)
            }
          })
        } else {
          let _param = {
            funcName: btn.innerFunc,
            name: _config.setting.tableName || '',
            fields: '',
            menuNo: menu.MenuNo
      newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
      DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
      this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
        if (result !== 'success') return
        let isupdate = false
        _config.action = _config.action.map(item => {
          if (item.uuid === btn.uuid) {
            isupdate = true
            return btn
          } else {
            return item
          }
          newLText = Utils.formatOptions(Utils.getfunc(_param, btn, menu, _config))
          DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
          resolve(true)
        })
        if (!isupdate) { // 操作不是修改,添加元素至列表
          _config.action.push(btn)
        }
      }).then(res => {
        if (!res) return
        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
          if (result !== 'success') return
          let isupdate = false
          _config.action = _config.action.map(item => {
            if (item.uuid === btn.uuid) {
              isupdate = true
              return btn
            } else {
              return item
            }
          })
          if (!isupdate) { // 操作不是修改,添加元素至列表
            _config.action.push(btn)
          }
          this.setState({
            config: _config
          })
        this.setState({
          config: _config
        })
      })
    })
@@ -1965,7 +1965,12 @@
            </Collapse>
          </div>
          <div className="setting">
            <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
            <Card title={
              <div>
                {this.state.dict['header.menu.page.configurable']}
                <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={this.reloadTab} />
              </div>
            } bordered={false} extra={
              <div>
                <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>