king
2019-12-06 2cb65d99c9aebf8293cb2838fcfe3e09fb2739ce
src/templates/comtableconfig/index.jsx
@@ -877,8 +877,7 @@
        })
        _this.setState({
          config: _config,
          [element.type + 'loading']: true,
          visible: false
          [element.type + 'loading']: true
        }, () => {
          _this.setState({
            [element.type + 'loading']: false
@@ -944,6 +943,25 @@
        return
      }
      let sql = []
      config.action.forEach((item, index) => {
        sql.push(`'${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`)
      })
      sql = sql.join(' union all select ')
      sql = 'select ' + sql
      sql = Utils.formatOptions(sql)
      let btnParam = {
        func: 'sPC_Button_AddUpt',
        ParentID: menu.MenuID,
        MenuNo: res.menuNo,
        Template: menu.PageParam.Template || '',
        PageParam: '',
        LongParam: '',
        LongButton: sql
      }
      if (this.state.operaType === 'add') { // 新建菜单
        let param = {
          func: 'sPC_TrdMenu_Add',
@@ -955,6 +973,7 @@
          PageParam: JSON.stringify(_pageParam),
          LongParam: _LongParam
        }
        this.setState({
          menuloading: true
        })
@@ -962,7 +981,6 @@
        Api.getSystemConfig(param).then(response => {
          if (response.status) {
            this.setState({
              menuloading: false,
              operaType: 'edit',
              originMenu: {
                ...originMenu,
@@ -973,11 +991,7 @@
                ParentID: res.parentId
              }
            })
            notification.success({
              top: 92,
              message: '保存成功',
              duration: 10
            })
            this.submitAction(btnParam)
          } else {
            this.setState({
              menuloading: false
@@ -1006,26 +1020,17 @@
        Api.getSystemConfig(param).then(response => {
          if (response.status) {
            notification.success({
              top: 92,
              message: '保存成功',
              duration: 10
            this.setState({
              originMenu: {
                ...originMenu,
                LongParam: _config,
                PageParam: _pageParam,
                MenuName: res.menuName,
                MenuNo: res.menuNo,
                ParentID: res.parentId
              }
            })
            if (this.state.closeVisible) {
              this.props.handleConfig('')
            } else {
              this.setState({
                menuloading: false,
                originMenu: {
                  ...originMenu,
                  LongParam: _config,
                  PageParam: _pageParam,
                  MenuName: res.menuName,
                  MenuNo: res.menuNo,
                  ParentID: res.parentId
                }
              })
            }
            this.submitAction(btnParam)
          } else {
            this.setState({
              menuloading: false
@@ -1050,10 +1055,32 @@
  /**
   * @description 保存或修改菜单按钮
   */
  submitAction = () => {
    if (!is(fromJS(this.state.originActions), fromJS())) {
    }
  submitAction = (param) => {
    Api.getSystemConfig(param).then(response => {
      if (response.status) {
        notification.success({
          top: 92,
          message: '保存成功',
          duration: 10
        })
        if (this.state.closeVisible) {
          this.props.handleConfig('')
        } else {
          this.setState({
            menuloading: false
          })
        }
      } else {
        this.setState({
          menuloading: false
        })
        notification.warning({
          top: 92,
          message: response.message,
          duration: 10
        })
      }
    })
  }
  cancelConfig = () => {
@@ -1388,6 +1415,9 @@
    })
  }
  /**
   * @description 设置可配置按钮
   */
  setSubConfig = (btn) => {
    const { menu } = this.props
    const { config, originMenu } = this.state
@@ -1422,16 +1452,24 @@
            loading: true
          })
          Api.getSystemConfig({
            func: 'sPC_Get_FrozenMenu',
            ParentID: btn.uuid,
            TYPE: 30
            func: 'sPC_Get_LongParam',
            MenuID: btn.uuid
          }).then(res => {
            if (res.status) {
              let btnconfig = ''
              this.setState({
                loading: false
              })
              this.props.handleSubConfig(btn, originMenu, btnconfig)
              let _LongParam = ''
              if (res.LongParam) {
                _LongParam = window.decodeURIComponent(window.atob(res.LongParam))
                try {
                  _LongParam = JSON.parse(_LongParam)
                } catch (e) {
                  _LongParam = ''
                }
              }
              this.props.handleSubConfig(btn, originMenu, _LongParam)
            } else {
              this.setState({
                loading: false