king
2020-11-23 f8c3c53f9e29541f8c0e3fcbf682c301fd17e06a
src/views/menudesign/menuform/index.jsx
@@ -4,6 +4,7 @@
import { Form, Row, Col, Input, Select, notification, Radio, Icon, Tooltip, InputNumber } from 'antd'
import Api from '@/api'
import options from '@/store/options.js'
import './index.scss'
class CustomMenuForm extends Component {
@@ -25,48 +26,72 @@
  }
  UNSAFE_componentWillMount () {
    const { parentId } = this.props
    let param = {
      func: 's_Get_FSMenusForOpen',
      SndMenuID: parentId,
      TYPE: 20,
      TypeCharOne: 'PC'
    const { MenuId } = this.props
    let _param = {func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}
    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
      _param.linkurl = window.GLOB.linkurl
    }
    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
    Api.getSystemConfig(_param).then(result => {
      if (result.status) {
        let thdMenu = null
        let menulist = result.fst_menu.map(fst => {
          let fstItem = {
            MenuID: fst.MenuID,
            MenuName: fst.MenuName,
            children: []
    }
    Api.getSystemConfig(param).then(result => {
      if (result.status) {
        let menulist = result.data.map(smenu => {
          let _smenu = {
            value: smenu.FstID,
            text: smenu.FstName,
            options: smenu.SndData.map(menu => {
              return {
                value: menu.SndID,
                text: menu.SndName,
          if (fst.snd_menu) {
            fstItem.children = fst.snd_menu.map(snd => {
              let sndItem = {
                ParentId: fst.MenuID,
                MenuID: snd.MenuID,
                MenuName: snd.MenuName,
                children: []
              }
              if (snd.trd_menu) {
                sndItem.children = snd.trd_menu.map(trd => {
                  let trdItem = {
                    FstId: fst.MenuID,
                    ParentId: snd.MenuID,
                    MenuID: trd.MenuID,
                    MenuName: trd.MenuName,
                    MenuNo: trd.MenuNo,
                    EasyCode: trd.EasyCode
                  }
                  if (MenuId === trd.MenuID) {
                    thdMenu = trdItem
                  }
                  return trdItem
            })
          }
          return _smenu
              return sndItem
            })
          }
          return fstItem
        })
        let smenulist = []
        menulist.forEach(item => {
          if (item.value === result.FstIDSeleted) {
            smenulist = item.options
          if (thdMenu && (item.MenuID === thdMenu.FstId)) {
            smenulist = item.children
          }
        })
        this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: result.FstIDSeleted})
        this.props.initMenuList({fstMenuList: fromJS(menulist).toJS(), fstMenuId: thdMenu ? thdMenu.FstId : ''})
        this.setState({
          fstMenuId: result.FstIDSeleted,
          fstMenuId: thdMenu ? thdMenu.FstId : '',
          menulist,
          smenulist
        }, () => {
          this.props.form.setFieldsValue({
            fstMenuId: result.FstIDSeleted,
            parentId: parentId
            fstMenuId: thdMenu ? thdMenu.FstId : '',
            parentId: thdMenu ? thdMenu.ParentId : ''
          })
        })
      } else {
@@ -94,15 +119,15 @@
    if (key === 'fstMenuId') {
      let smenulist = []
      menulist.forEach(item => {
        if (item.value === value) {
          smenulist = item.options
        if (item.MenuID === value) {
          smenulist = item.children
        }
      })
      this.setState({
        smenulist
      }, () => {
        let _id = smenulist[0] ? smenulist[0].value : ''
        let _id = smenulist[0] ? smenulist[0].MenuID : ''
        this.props.form.setFieldsValue({parentId: _id})
        this.props.updateConfig({...config, fstMenuId: value, parentId: _id})
      })
@@ -110,8 +135,6 @@
      this.props.updateConfig({...config, parentId: value})
    } else if (key === 'cacheUseful') {
      this.props.updateConfig({...config, cacheUseful: value})
    } else if (key === 'diffUser') {
      this.props.updateConfig({...config, diffUser: value})
    } else if (key === 'timeUnit') {
      this.props.updateConfig({...config, timeUnit: value})
    }
@@ -170,8 +193,8 @@
              })(
                <Select onChange={(value) => {this.selectChange('fstMenuId', value)}}>
                  {menulist.map(option =>
                    <Select.Option key={option.value} value={option.value}>
                      {option.text}
                    <Select.Option key={option.MenuID} value={option.MenuID}>
                      {option.MenuName}
                    </Select.Option>
                  )}
                </Select>
@@ -191,8 +214,8 @@
              })(
                <Select onChange={(value) => {this.selectChange('parentId', value)}}>
                  {smenulist.map(option =>
                    <Select.Option key={option.value} value={option.value}>
                      {option.text}
                    <Select.Option key={option.MenuID} value={option.MenuID}>
                      {option.MenuName}
                    </Select.Option>
                  )}
                </Select>
@@ -242,23 +265,6 @@
              )}
            </Form.Item>
          </Col>
          {config.cacheUseful === 'true' ? <Col span={24}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="对于不同用户,查询信息是否存在差异。">
                <Icon type="question-circle" />
                区分用户
              </Tooltip>
            }>
              {getFieldDecorator('diffUser', {
                initialValue: config.diffUser || 'true'
              })(
                <Radio.Group onChange={(e) => {this.selectChange('diffUser', e.target.value)}}>
                  <Radio value="true">是</Radio>
                  <Radio value="false">否</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col> : null}
          {config.cacheUseful === 'true' ? <Col span={24}>
            <Form.Item label="单位">
              {getFieldDecorator('timeUnit', {