king
2019-11-22 67e7787f24a1ca3dc45f77fb7bbcb76edc33fe55
src/components/sidemenu/editthdmenu/index.jsx
@@ -8,16 +8,15 @@
import TransferForm from '@/components/transferform'
import Utils from '@/utils/utils.js'
import DragElement from '../menuelement'
// import MenuForm from '../menuform'
// import ComTableConfig from '../comtableconfig'
import asyncComponent from '@/utils/asyncComponent'
import asyncLoadComponent from '@/utils/asyncLoadComponent'
import Api from '@/api'
import zhCN from '@/locales/zh-CN/header.js'
import enUS from '@/locales/en-US/header.js'
import nortable from '@/assets/img/normaltable.jpg'
import './index.scss'
const ComTableConfig = asyncComponent(() => import('../comtableconfig'))
const ComTableConfig = asyncLoadComponent(() => import('@/templates/comtableconfig'))
const ModalConfig = asyncLoadComponent(() => import('@/templates/modalconfig'))
const { confirm } = Modal
const { TabPane } = Tabs
const illust = {
@@ -43,7 +42,6 @@
    tabview: '', // 选择模板窗口(template)、基础表格配置(CommonTable)
    formlist: null,
    editMenu: null, // 编辑菜单
    editMvisible: false, // 编辑菜单模态框
    thawMvisible: false, // 解除冻结模态框
    confirmLoading: false, // 提交中。。。
    dict: (!localStorage.getItem('lang') || localStorage.getItem('lang') === 'zh-CN') ? zhCN : enUS,
@@ -118,6 +116,7 @@
            }
          }
          _menu.LongParam = _LongParam
          _menu.ParentID = this.props.supMenu.MenuID
          // console.log(_menu)
          // 检测模板是否存在
          let _Template = this.state.baseTemplates.filter(temp => temp.type === _menu.PageParam.Template)
@@ -212,14 +211,6 @@
    }
  }
  // memuHandleCancel = () => {
  //   this.setState({
  //     editMvisible: false,
  //     visible: false
  //   })
  //   this.resetFormlist()
  // }
  thawMemuSubmit = () => {
    // 三级菜单解除冻结
    if (this.refs.trawmenu.state.targetKeys.length === 0) {
@@ -303,7 +294,8 @@
          text: '',
          type: template.type,
          PageParam: {OpenType: "newtab", Template: template.type},
          LongParam: ''
          LongParam: '',
          ParentID: this.props.supMenu.MenuID
        }
      })
    } else {
@@ -316,107 +308,6 @@
    }
    document.getElementById('root').style.overflowY = 'hidden'
  }
  // submitMenuConfig = () => {
  //   if (this.state.type !== 'edit') {
  //     this.setState({
  //       visible: true,
  //       title: this.state.dict['header.menu.addtitle'],
  //       formlist: [
  //         {
  //           type: 'text',
  //           key: 'parentId',
  //           label: this.state.dict['header.menu.supMenu'],
  //           initVal: this.props.supMenu.text,
  //           required: true,
  //           readonly: true
  //         },
  //         {
  //           type: 'text',
  //           key: 'menuName',
  //           label: this.state.dict['header.menu.menuName'],
  //           initVal: '',
  //           required: true,
  //           readonly: false
  //         },
  //         {
  //           type: 'text',
  //           key: 'menuNo',
  //           label: this.state.dict['header.menu.menuNo'],
  //           initVal: '',
  //           required: true,
  //           readonly: false
  //         },
  //         {
  //           type: 'select',
  //           key: 'opentype',
  //           label: '打开方式',
  //           initVal: 'newtab',
  //           required: true,
  //           options: [{
  //             MenuID: 'newtab',
  //             text: '新标签页'
  //           }, {
  //             MenuID: 'newpage',
  //             text: '新页面'
  //           }]
  //         }
  //       ]
  //     })
  //   } else {
  //     console.log(this.state.editMenu)
  //     // confirm({
  //     //   title: this.state.dict['header.menu.update'].replace('@M', menu.card.text),
  //     //   content: '',
  //     //   okText: this.state.dict['header.confirm'],
  //     //   cancelText: this.state.dict['header.cancel'],
  //     //   onOk() {
  //     //     let param = {
  //     //       func: 'sPC_MainMenu_Del',
  //     //       MenuID: menu.card.MenuID
  //     //     }
  //     //     return Api.getSystemConfig(param).then(res => {
  //     //       if (res.status) {
  //     //         _this.props.reload()
  //     //       } else {
  //     //         notification.warning({
  //     //           top: 92,
  //     //           message: res.message,
  //     //           duration: 10
  //     //         })
  //     //       }
  //     //     })
  //     //   },
  //     //   onCancel() {}
  //     // })
  //     this.setState({
  //       tabview: this.state.selectTemp.type
  //     })
  //   }
  // }
  // changeTemp = () => {
  //   this.setState({
  //     editMvisible: false,
  //     tabview: 'template'
  //   })
  //   this.resetFormlist()
  // }
  // changeConfig = () => {
  //   this.setState({
  //     editMvisible: false,
  //     tabview: this.state.editMenu.PageParam.Template,
  //     menuConfig: window.atob(this.state.editMenu.LongParam)
  //   })
  //   this.resetFormlist()
  // }
  // resetFormlist = () => {
  //   setTimeout(() => {
  //     this.setState({formlist: null})
  //   }, 300)
  // }
  getUsedTemplate = () => {
    Api.getSystemConfig({func: 'sPC_Get_UserTemp'}).then(res => {
@@ -449,6 +340,17 @@
  handleConfig = (type) => {
    this.setState({tabview: type})
    document.getElementById('root').style.overflowY = 'unset'
  }
  handleSubConfig = (item, originMenu, config) => {
    if (item.OpenType === 'pop') {
      // this.setState({
      //   editMenu: originMenu,
      //   tabview: 'Modal'
      // })
    }
    console.log(item)
    console.log(originMenu)
  }
  UNSAFE_componentWillMount () {
@@ -536,6 +438,14 @@
          <ComTableConfig
            type={this.state.type}
            menu={this.state.editMenu}
            supMenuList={this.props.supMenuList}
            handleConfig={this.handleConfig}
            handleSubConfig={this.handleSubConfig}
          />
        }
        {this.state.tabview === 'Modal' &&
          <ModalConfig
            menu={this.state.editMenu}
            supMenu={this.props.supMenu}
            supMenuList={this.props.supMenuList}
            handleConfig={this.handleConfig}