king
2024-08-20 58826d6f4eab9f8c9acf9fa8696f60039c645cfe
src/views/menudesign/index.jsx
@@ -4,16 +4,16 @@
import { is, fromJS } from 'immutable'
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
import { ConfigProvider, notification, Modal, Collapse, Card, Switch, Button, Typography, Spin } from 'antd'
import { notification, Modal, Collapse, Card, Switch, Button, Typography, Spin } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons'
import html2canvas from 'html2canvas'
import md5 from 'md5'
import Api from '@/api'
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import antdZhCN from 'antd/es/locale/zh_CN'
import Utils from '@/utils/utils.js'
import { langs } from '@/store/options'
import MKEmitter from '@/utils/events.js'
import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
import { getTables, getFuncsAndInters, getLangTrans } from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
import '@/assets/css/design.scss'
@@ -22,7 +22,6 @@
const { Panel } = Collapse
const { confirm } = Modal
const { Paragraph } = Typography
const _locale = antdZhCN
const MenuForm = asyncComponent(() => import('./menuform'))
const HomeForm = asyncComponent(() => import('./homeform'))
@@ -67,6 +66,7 @@
    eyeopen: false,
    view: '',
    popConfig: null,
    langName: '',
    needUpdate: false
  }
@@ -98,12 +98,17 @@
      sessionStorage.setItem('MenuType', param.MenuType || 'custom')
      if (param.lang) {
        sessionStorage.setItem('lang', param.lang)
      }
      this.setState({
        MenuType: param.MenuType,
        MenuId: param.MenuId || param.MenuID,
        ParentId: param.ParentId || '',
        MenuName: param.MenuName || '',
        MenuNo: param.MenuNo || '',
        langName: sessionStorage.getItem('lang') !== 'zh-CN' && langs[sessionStorage.getItem('lang')] ? `(${langs[sessionStorage.getItem('lang')]})` : ''
      }, () => {
        this.getMenuParam()
      })
@@ -128,7 +133,7 @@
    MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
    setTimeout(() => {
      this.getRoleFields()
      setGLOBFuncs()
      // setGLOBFuncs()
    }, 1000)
    document.onkeydown = (event) => {
@@ -772,6 +777,18 @@
        duration: 5
      })
      return
    } else if (this.checklog()) {
      if (sessionStorage.getItem('langList') && !config.trans) {
      } else {
        notification.success({
          top: 92,
          message: '当前配置未修改,无需保存。',
          duration: 5
        })
        MKEmitter.emit('completeSave')
        return
      }
    }
    this.setState({
@@ -828,12 +845,15 @@
      } else {
        let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
        urlparam.type = 'admin'
        urlparam.lang = sessionStorage.getItem('lang')
        url = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
        config.tbkey = key
      }
      let interfaces = getFuncsAndInters(config)
      let urlFields = config.urlFields ? config.urlFields.join(',') : ''
      let langSql = getLangTrans(config)
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
@@ -847,12 +867,16 @@
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}),
        open_edition: config.open_edition,
        LText: '',
        LTexttb: '',
        // LText: '',
        // LTexttb: '',
        debug_md5: key,
        debug_url: url,
        debug_list: window.btoa(tbs),
        LongParam: window.btoa(window.encodeURIComponent(JSON.stringify(config)))
      }
      if (langSql) {
        param.lang_translation = window.btoa(window.encodeURIComponent(langSql))
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
@@ -1185,11 +1209,11 @@
  }
  render () {
    const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, eyeopen, needUpdate } = this.state
    const { view, comloading, MenuType, MenuId, config, settingshow, ParentId, menuloading, eyeopen, needUpdate, langName } = this.state
    return (
      <ConfigProvider locale={_locale}>
        <Header menuName={config ? config.MenuName : ''}/>
      <>
        <Header menuName={config ? config.MenuName + langName : ''}/>
        <DndProvider backend={HTML5Backend}>
          {view !== 'popview' ? <div className={'pc-menu-view ' + (MenuType || '')}>
            <div className="menu-body">
@@ -1253,7 +1277,7 @@
                    <PasteController insert={this.insert} />
                    {config ? <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                    <Button type="primary" id="save-config" className={needUpdate ? 'update-tip' : ''} onClick={this.submitConfig} loading={menuloading}>保存</Button>
                    <Button type="default" onClick={this.closeView}>关闭</Button>
                    <Button type="default" disabled={menuloading} onClick={this.closeView}>关闭</Button>
                  </div>
                } style={{ width: '100%' }}>
                  {config && !comloading ? <MenuShell menu={config} handleList={this.updateConfig} /> : <Spin className="loading-config" size="large" />}
@@ -1265,7 +1289,7 @@
        <ModalController />
        <StyleController />
        <StyleCombController />
      </ConfigProvider>
      </>
    )
  }
}