king
2020-03-07 31499a3e864ca1229493fd7ec901659c0cb54159
2020-03-07
4个文件已修改
308 ■■■■ 已修改文件
src/components/sidemenu/editthdmenu/index.jsx 211 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/index.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/tableshare/menuform/index.jsx 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editthdmenu/index.jsx
@@ -69,7 +69,9 @@
    btnTabConfig: null,     // 打开新标签按钮配置
    handleMVisible: false,  // 添加或修改菜单模态框(角色权限分配等)
    sysMenu: false,         // 添加或编辑菜单(角色权限分配等)
    optionLibs: []          // 自定义下拉选项库
    optionLibs: [],         // 自定义下拉选项库
    fstMenuId: null,        // 一级菜单Id
    fstMenuList: null       // 一级菜单列表
  }
  /**
@@ -121,7 +123,11 @@
        onCancel() {}
      })
    } else if (menu.type === 'edit') {
      let _menu = menu.card
      let _menu = JSON.parse(JSON.stringify(menu.card))
      delete _menu.id
      delete _menu.src
      delete _menu.text
      if (_menu.PageParam && _menu.PageParam.Template === 'RolePermission') { // 单页面修改
        let _menu_ = {
@@ -162,19 +168,10 @@
          _menu.LongParam = _LongParam
          _menu.ParentID = this.props.supMenu.MenuID
          _menu.supMenuList = this.props.supMenuList
          // 检测模板是否存在
          let _Template = this.state.sysTemplates.filter(temp => temp.type === _menu.PageParam.Template)
          this.setState({
            type: 'edit',
            editMenu: _menu,
            loading: false,
            optionLibs: new Map(), // 编辑时,初始化为空
            tabview: _Template.length > 0 ? _menu.PageParam.Template : 'template'
          }, () => {
            document.getElementById('root').style.overflowY = 'hidden'
          })
          // 模板不存在时错误提示
          if (_Template.length === 0) {
@@ -183,6 +180,75 @@
              message: this.state.dict['header.menu.template.empty'],
              duration: 10
            })
            this.setState({
              type: 'edit',
              editMenu: _menu,
              loading: false,
              tabview: 'template'
            }, () => {
              document.getElementById('root').style.overflowY = 'hidden'
            })
          } else {
            if (this.state.fstMenuId) {
              _menu.fstMenuId = this.state.fstMenuId
              _menu.fstMenuList = this.state.fstMenuList
              this.setState({
                type: 'edit',
                editMenu: _menu,
                loading: false,
                optionLibs: new Map(), // 编辑时,初始化为空
                tabview: _menu.PageParam.Template
              }, () => {
                document.getElementById('root').style.overflowY = 'hidden'
              })
            } else {
              let _param = {
                func: 's_Get_FSMenusForOpen',
                SndMenuID: this.props.supMenu.MenuID,
                TYPE: 20,
                TypeCharOne: 'PC'
              }
              Api.getSystemConfig(_param).then(result => {
                if (result.status) {
                  _menu.fstMenuId = result.FstIDSeleted
                  _menu.fstMenuList = result.data.map(smenu => {
                    let _smenu = {
                      MenuID: smenu.FstID,
                      text: smenu.FstName,
                      options: smenu.SndData.map(menu => {
                        return {
                          MenuID: menu.SndID,
                          text: menu.SndName,
                        }
                      })
                    }
                    return _smenu
                  })
                  this.setState({
                    type: 'edit',
                    editMenu: _menu,
                    loading: false,
                    optionLibs: new Map(), // 编辑时,初始化为空
                    tabview: _menu.PageParam.Template
                  }, () => {
                    document.getElementById('root').style.overflowY = 'hidden'
                  })
                } else {
                  this.setState({
                    loading: false
                  })
                  notification.warning({
                    top: 92,
                    message: result.message,
                    duration: 10
                  })
                }
              })
            }
          }
        } else {
          this.setState({
@@ -209,20 +275,76 @@
        })
        return
      }
      this.setState({
        tabview: 'template',
        editMenu: {
          MenuID: Utils.getuuid(),
          MenuName: '',
          MenuNo: '',
          type: '',
          PageParam: '',
          LongParam: '',
          isSubtable: '', // 是否为主子表
          ParentID: this.props.supMenu.MenuID
      if (this.state.fstMenuId) {
        this.setState({
          tabview: 'template',
          editMenu: {
            MenuID: Utils.getuuid(),
            MenuName: '',
            MenuNo: '',
            type: '',
            PageParam: '',
            LongParam: '',
            isSubtable: '', // 是否为主子表
            ParentID: this.props.supMenu.MenuID,
            supMenuList: this.props.supMenuList,
            fstMenuId: this.state.fstMenuId,
            fstMenuList: this.state.fstMenuList
          }
        }, () => {
          document.getElementById('root').style.overflowY = 'hidden'
        })
      } else {
        let _param = {
          func: 's_Get_FSMenusForOpen',
          SndMenuID: this.props.supMenu.MenuID,
          TYPE: 20,
          TypeCharOne: 'PC'
        }
      })
      document.getElementById('root').style.overflowY = 'hidden'
        Api.getSystemConfig(_param).then(result => {
          if (result.status) {
            this.setState({
              tabview: 'template',
              editMenu: {
                MenuID: Utils.getuuid(),
                MenuName: '',
                MenuNo: '',
                type: '',
                PageParam: '',
                LongParam: '',
                isSubtable: '', // 是否为主子表
                ParentID: this.props.supMenu.MenuID,
                supMenuList: this.props.supMenuList,
                fstMenuId: result.FstIDSeleted,
                fstMenuList: result.data.map(smenu => {
                  let _smenu = {
                    MenuID: smenu.FstID,
                    text: smenu.FstName,
                    options: smenu.SndData.map(menu => {
                      return {
                        MenuID: menu.SndID,
                        text: menu.SndName,
                      }
                    })
                  }
                  return _smenu
                })
              }
            }, () => {
              document.getElementById('root').style.overflowY = 'hidden'
            })
          } else {
            notification.warning({
              top: 92,
              message: result.message,
              duration: 10
            })
          }
        })
      }
    } else if (type === 'thaw') {
      if (!is(fromJS(this.props.menulist), fromJS(this.state.menulist))) {
        notification.warning({
@@ -551,7 +673,6 @@
        MenuNo: res.MenuNo,
        Template: sysMenu.Template,
        MenuName: res.MenuName,
        Sort: (this.props.supMenuList.length + 1) * 10,
        PageParam: JSON.stringify({Template: sysMenu.Template, OpenType: 'newtab'}),
        LongParam: ''
      }
@@ -591,6 +712,43 @@
    this.setState({
      menulist: this.props.menulist
    })
  }
  componentDidMount () {
    let _param = {
      func: 's_Get_FSMenusForOpen',
      SndMenuID: this.props.supMenu.MenuID,
      TYPE: 20,
      TypeCharOne: 'PC'
    }
    Api.getSystemConfig(_param).then(result => {
      if (result.status) {
        this.setState({
          fstMenuId: result.FstIDSeleted,
          fstMenuList: result.data.map(smenu => {
            let _smenu = {
              MenuID: smenu.FstID,
              text: smenu.FstName,
              options: smenu.SndData.map(menu => {
                return {
                  MenuID: menu.SndID,
                  text: menu.SndName,
                }
              })
            }
            return _smenu
          })
        })
      } else {
        notification.warning({
          top: 92,
          message: result.message,
          duration: 10
        })
      }
    })
  }
@@ -703,7 +861,6 @@
          <ComTableConfig
            menu={this.state.editMenu}
            optionLibs={this.state.optionLibs}
            supMenuList={this.props.supMenuList}
            reloadmenu={() => {this.props.reload()}}
            handleView={this.handleView}
          />
src/tabviews/commontable/index.jsx
@@ -837,13 +837,13 @@
  }
  componentDidMount () {
    document.onkeydown = (event) => {
      let e = event || window.event
    // document.onkeydown = (event) => {
    //   let e = event || window.event
      if(e && e.keyCode === 27) {
        console.log(this.props.MenuID)
      }
    }
    //   if(e && e.keyCode === 27) {
    //     console.log(this.props.MenuID)
    //   }
    // }
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
src/templates/comtableconfig/index.jsx
@@ -44,7 +44,6 @@
  static propTpyes = {
    menu: PropTypes.any,
    optionLibs: PropTypes.any,
    supMenuList: PropTypes.array,
    reloadmenu: PropTypes.func,
    handleView: PropTypes.func
  }
@@ -171,15 +170,15 @@
      originMenu: JSON.parse(JSON.stringify(menu)),
      selectedTables: _config.tables || [],
      menuformlist: [
        // {
        //   type: 'select',
        //   key: 'firparentId',
        //   label: '一级菜单',
        //   initVal: menu.ParentID,
        //   required: true,
        //   readonly: false,
        //   options: this.props.supMenuList
        // },
        {
          type: 'select',
          key: 'fstMenuId',
          label: '一级菜单',
          initVal: menu.fstMenuId,
          required: true,
          readonly: false,
          options: menu.fstMenuList
        },
        {
          type: 'select',
          key: 'parentId',
@@ -187,7 +186,7 @@
          initVal: menu.ParentID,
          required: true,
          readonly: false,
          options: this.props.supMenuList
          options: menu.supMenuList
        },
        {
          type: 'text',
@@ -1540,7 +1539,6 @@
  getFuncNames = (data, funcNames, tableNames) => {
    data.forEach(item => {
      console.log(item)
      if (item.subfuncs) {
        this.getFuncNames(item.subfuncs, funcNames, tableNames)
      } else {
@@ -1548,12 +1546,11 @@
          tableNames.push(item.tableName)
        }
        if (item.innerFunc) {
          // funcNames.push({func: item.innerFunc, label: item})
          funcNames.push(item.innerFunc)
          funcNames.push({func: item.innerFunc, label: item.label || ''})
        }
        if (item.callbackFunc) {
          funcNames.push(item.callbackFunc)
          funcNames.push({func: item.callbackFunc, label: item.label || ''})
        }
      }
    })
@@ -1574,7 +1571,6 @@
    let config = JSON.parse(JSON.stringify(this.state.config))
    this.menuformRef.handleConfirm().then(res => {
      if (config.isAdd) {
        if (config.search[0] && config.search[0].origin) {
          config.search = config.search.filter(item => !item.origin)
@@ -1784,20 +1780,22 @@
        tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
  
        let _vals = this.getFuncNames(_config.funcs, [], [])
        let _funcs = Array.from(new Set(_vals.func))
        // let _funcs = Array.from(new Set(_vals.func))
        let _tables = Array.from(new Set(_vals.table))
        let param = {
          func: 'sPC_TrdMenu_AddUpt',
          FstID: res.fstMenuId,
          SndID: res.parentId,
          ParentID: res.parentId,
          MenuID: menu.MenuID,
          MenuNo: res.menuNo,
          Template: menu.PageParam.Template || '',
          MenuName: res.menuName,
          Sort: (this.props.supMenuList.length + 1) * 10,
          // Sort: (this.props.supMenuList.length + 1) * 10,
          PageParam: JSON.stringify(_pageParam),
          LongParam: _LongParam,
          LText: _funcs.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as ProcName,'${item}' as MenuName`),
          LText: _vals.func.map(item => `select '${menu.MenuID}' as MenuID,'${item.func}' as ProcName,'${item.label}' as MenuName`),
          LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
        }
@@ -1914,6 +1912,12 @@
          Api.getSystemConfig(param).then(response => {
            if (response.status) {
              let _FMenu = originMenu.fstMenuList.filter(fstM => fstM.MenuID === res.fstMenuId)[0]
              let _supMenuList = []
              if (_FMenu) {
                _supMenuList = _FMenu.options
              }
              this.setState({
                config: _config,
                originMenu: {
@@ -1922,7 +1926,9 @@
                  PageParam: _pageParam,
                  MenuName: res.menuName,
                  MenuNo: res.menuNo,
                  ParentID: res.parentId
                  ParentID: res.parentId,
                  fstMenuId: res.fstMenuId,
                  supMenuList: _supMenuList
                }
              })
    
@@ -2156,7 +2162,8 @@
          PageParam: _pageParam,
          MenuName: res.menuName,
          MenuNo: res.menuNo,
          ParentID: res.parentId
          ParentID: res.parentId,
          fstMenuId: res.fstMenuId
        }
        if (!is(fromJS(originMenu), fromJS(_originMenu))) {
@@ -2515,7 +2522,8 @@
          PageParam: _pageParam,
          MenuName: res.menuName,
          MenuNo: res.menuNo,
          ParentID: res.parentId
          ParentID: res.parentId,
          fstMenuId: res.fstMenuId
        }
        if (!is(fromJS(originMenu), fromJS(_originMenu))) { // 菜单信息变化时,提示保存
src/templates/tableshare/menuform/index.jsx
@@ -10,10 +10,40 @@
    formlist: PropTypes.array
  }
  state = {
    formlist: null
  }
  UNSAFE_componentWillMount () {
    this.setState({
      formlist: this.props.formlist
    })
  }
  selectChange = (item, value) => {
    const { formlist } = this.state
    if (item.key === 'fstMenuId') {
      let option = item.options.filter(cell => cell.MenuID === value)[0]
      this.setState({
        formlist: formlist.map(cell => {
          if (cell.key === 'parentId') {
            cell.options = option.options
          }
          return cell
        })
      }, () => {
        let _id = option.options[0] ? option.options[0].MenuID : ''
        this.props.form.setFieldsValue({parentId: _id})
      })
    }
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.props.formlist.forEach((item, index) => {
    this.state.formlist.forEach((item, index) => {
      if (item.type === 'text') { // 文本搜索
        fields.push(
          <Col span={24} key={index}>
@@ -50,6 +80,7 @@
                <Select
                  showSearch
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.selectChange(item, value)}}
                  getPopupContainer={() => document.getElementById('subqazxcvbn')}
                >
                  {item.options.map(option =>