king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
src/views/pcdesign/index.jsx
@@ -6,7 +6,7 @@
import moment from 'moment'
import HTML5Backend from 'react-dnd-html5-backend'
import { ConfigProvider, notification, Modal, Collapse, Switch, Button, message, Spin, Typography } from 'antd'
import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined } from '@ant-design/icons'
import { DoubleLeftOutlined, DoubleRightOutlined, HomeOutlined, LoginOutlined, RedoOutlined, ArrowLeftOutlined } from '@ant-design/icons'
import Api from '@/api'
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
@@ -17,7 +17,6 @@
import MKEmitter from '@/utils/events.js'
import MenuUtils from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
import backurl from '@/assets/img/back.jpg'
import './index.scss'
@@ -216,6 +215,7 @@
    let param = {
      MenuID: menu.MenuID,
      copyMenuId: menu.copyMenuId || '',
      clearMenu: menu.clearMenu !== 'false',
      type: 'view'
    }
@@ -246,9 +246,9 @@
        return
      }
      let homeId = MenuID || ''
      let homeId = ''
      let appViewList = []
      if (!homeId && res.data && res.data.length > 0) {
      if (res.data && res.data.length > 0) {
        appViewList = res.data
        appViewList.forEach(item => {
          if (item.keys_type === 'index') {
@@ -258,7 +258,7 @@
      }
      if (!homeId) {
        homeId = Utils.getuuid()
        homeId = MenuID || Utils.getuuid()
        let param = {
          func: 's_kei_link_keyids_addupt',
@@ -297,7 +297,7 @@
        })
      } else {
        sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
        this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'}))))
        this.props.history.replace('/pcdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: MenuID || homeId, type: 'view'}))))
      }
    })
  }
@@ -748,7 +748,7 @@
          }
        }
      } else {
        config.components = MenuUtils.resetConfig(config.components)
        config.components = MenuUtils.resetConfig(config.components, {}, urlParam.clearMenu)
        config.enabled = false
        message.success('复制成功,保存后生效。')
      }
@@ -854,11 +854,12 @@
  getMenuMessage = () => {
    const { config } = this.state
    let nodes = {type: 'view', key: config.uuid, title: config.MenuName, children: []}
    let nodes = {type: 'view', version: '1.0', key: config.uuid, title: config.MenuName, children: []}
    let popviews = []
    let traversal = (components) => {
      let list = components.map(item => {
      let list = []
      components.forEach(item => {
        let m = {
          key: item.uuid,
          title: item.name,
@@ -868,6 +869,7 @@
          return null
        } else if (item.type === 'tabs') {
          let tabs = []
          let mm = []
          item.subtabs.forEach(tab => {
            let s = traversal(tab.components)
@@ -878,13 +880,35 @@
              title: tab.label,
              children: s
            })
            mm.push(...s)
          })
          if (tabs.length > 0) {
            m.children = tabs
          }
          if (item.setting.permission === 'true') {
            list.push(m)
          } else if (mm.length) {
            list.push(...mm)
          }
          return null
        } else if (item.type === 'group') {
          m.children = traversal(item.components)
          if (item.setting.permission === 'true') {
            list.push(m)
          } else if (m.children.length) {
            list.push(...m.children)
          }
          return null
        } if (item.plot && item.plot.permission !== 'true') {
          return null
        } if (item.wrap && item.wrap.permission !== 'true') {
          return null
        } else if (item.type === 'card' || (item.type === 'table' && item.subtype === 'tablecard')) {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
@@ -990,10 +1014,8 @@
          })
        }
        return m
        list.push(m)
      })
      list = list.filter(Boolean)
      return list
    }
@@ -1005,6 +1027,11 @@
    if (config.components.findIndex(item => item.type === 'login') > -1) {
      nodes.login = true
      nodes.children = []
    }
    if (config.permission !== 'true') {
      nodes.pass = true
      nodes.children = []
    }
    return nodes
@@ -1112,34 +1139,39 @@
              let roles = {
                type: 'navbar',
                version: '1.0',
                key: item.uuid,
                title: item.name,
                children: []
              }
              roles.children = item.menus.map(fst => {
                if (fst.property === 'classify' && fst.sublist.length > 0) {
                  return {
                    key: fst.MenuID,
                    title: fst.name,
                    children: fst.sublist.map(scd => {
                      if (scd.property === 'classify' && scd.sublist.length > 0) {
                        return {
                          key: scd.MenuID,
                          title: scd.name,
                          children: scd.sublist.map(thd => {
                            return { key: thd.MenuID, title: thd.name }
                          })
              if (item.wrap.permission === 'true') {
                roles.children = item.menus.map(fst => {
                  if (fst.property === 'classify' && fst.sublist.length > 0) {
                    return {
                      key: fst.MenuID,
                      title: fst.name,
                      children: fst.sublist.map(scd => {
                        if (scd.property === 'classify' && scd.sublist.length > 0) {
                          return {
                            key: scd.MenuID,
                            title: scd.name,
                            children: scd.sublist.map(thd => {
                              return { key: thd.MenuID, title: thd.name }
                            })
                          }
                        } else {
                          return { key: scd.MenuID, title: scd.name }
                        }
                      } else {
                        return { key: scd.MenuID, title: scd.name }
                      }
                    })
                      })
                    }
                  } else {
                    return { key: fst.MenuID, title: fst.name }
                  }
                } else {
                  return { key: fst.MenuID, title: fst.name }
                }
              })
                })
              } else {
                roles.pass = true
              }
              let _param = {
                func: 'sPC_TrdMenu_AddUpt',
@@ -1501,6 +1533,7 @@
          return
        }
        
        if (['voucher'].includes(item.subtype)) return
        if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return
        if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return
        
@@ -1778,7 +1811,7 @@
              <div className="wrap">
                <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
                <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} />
                <img title="后退" className="back-view" onClick={this.backView} src={backurl} alt=""/>
                <ArrowLeftOutlined title="后退" className="back-view" onClick={this.backView}/>
                <CreateView resetmenu={this.getAppMenus} />
                <PasteController insert={this.insert} />
                <StyleCombControlButton menu={config} />