king
2021-08-26 966ff7fb84181f0fa86a56569a8492453c3ae80a
src/views/mobdesign/index.jsx
@@ -47,6 +47,7 @@
sessionStorage.setItem('appType', 'mob')       // 应用类型
document.body.className = ''
window.GLOB.UserComponentMap = new Map() // 缓存用户自定义组件
window.GLOB.TabsMap = new Map()          // 缓存用户操作的标签页
window.GLOB.CacheIndependent = new Map()
window.GLOB.urlFields = []               // url变量
window.GLOB.customMenu = null            // 保存菜单信息
@@ -63,7 +64,6 @@
    menuloading: false,
    oriConfig: null,
    config: null,
    visible: false,
    customComponents: [],
    direction: 'vertical',
    settingshow: true,
@@ -81,7 +81,7 @@
        sessionStorage.setItem('lang', param.lang || 'zh-CN')
        sessionStorage.setItem('kei_no', param.kei_no || '')
        sessionStorage.setItem('role_type', param.role_type || 'true')
        sessionStorage.setItem('login_types', param.login_types || 'true')
        sessionStorage.setItem('login_types', param.login_types || 'false')
        sessionStorage.setItem('typename', param.typename || 'mob')
        this.setState({
@@ -133,6 +133,7 @@
      return
    }
    MKEmitter.addListener('changeEditMenu', this.changeEditMenu)
    MKEmitter.addListener('triggerMenuSave', this.submitConfig)
    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
    MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent)
    setTimeout(() => {
@@ -151,6 +152,7 @@
      return
    }
    MKEmitter.removeListener('changeEditMenu', this.changeEditMenu)
    MKEmitter.removeListener('triggerMenuSave', this.submitConfig)
    MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
    MKEmitter.removeListener('updateCustomComponent', this.updateCustomComponent)
  }
@@ -276,13 +278,11 @@
            })
          } else {
            sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
            sessionStorage.setItem('appHomeId', homeId)
            this.props.history.replace('/mobdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'}))))
          }
        })
      } else {
        sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
        sessionStorage.setItem('appHomeId', homeId)
        this.props.history.replace('/mobdesign/' + window.btoa(window.encodeURIComponent(JSON.stringify({MenuID: homeId, type: 'view'}))))
      }
    })
@@ -503,6 +503,11 @@
      appIndeList = appIndeList.map(item => (item.keys_type !== 'index' ? item.keys_id : '')).join(',')
      let menus = res.menus.filter(item => appIndeList.indexOf(item.MenuID) === -1)
      menus = menus.map(item => {
        item.value = item.MenuID
        item.label = item.MenuName
        return item
      })
      sessionStorage.setItem('appMenus', JSON.stringify(menus))
    })
  }
@@ -675,7 +680,10 @@
          title: item.name,
          children: []
        }
        if (item.type === 'tabs') {
        if (item.type === 'topbar' || item.type === 'login') {
          return null
        } else if (item.type === 'tabs') {
          let tabs = []
          item.subtabs.forEach(tab => {
            let s = traversal(tab.components)
@@ -751,6 +759,13 @@
              title: menu.setting.name
            }
          })
        } else if (item.type === 'form') {
          m.children = item.subcards.map(m => {
            return {
              key: m.uuid,
              title: m.setting.title
            }
          })
        } else if (item.type === 'table' && item.subtype === 'normaltable') {
          item.action && item.action.forEach(btn => {
            this.checkBtn(btn)
@@ -770,8 +785,6 @@
            })
          })
        }
        if (m.children.length === 0) return null
        return m
      })
@@ -850,12 +863,14 @@
        config.enabled = false
      }
      let parMenuId = sessionStorage.getItem('kei_no') + 'pc' + sessionStorage.getItem('lang')
      let roleParam = {type: 'view', key: config.uuid, title: config.MenuName, children: []}
      roleParam.children = this.getMenuMessage()
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: parMenuId,
        SndID: parMenuId,
        ParentID: parMenuId,
        FstID: 'mk_app',
        SndID: 'mk_app',
        ParentID: 'mk_app',
        MenuID: config.uuid,
        MenuNo: config.MenuNo || '',
        EasyCode: '',
@@ -865,16 +880,13 @@
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'webPage'}),
        open_edition: config.open_edition,
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))),
        LText: '',
        LTexttb: ''
      }
      param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      param.secretkey = Utils.encrypt('', param.timestamp)
      let roleParam = {key: config.uuid, title: config.MenuName, children: []}
      roleParam.children = this.getMenuMessage()
      console.log(roleParam)
      new Promise(resolve => {
        let _config = fromJS(config).toJS()
@@ -905,29 +917,8 @@
                return
              }
              let _param = {
                func: 'sPC_TrdMenu_AddUpt',
                FstID: parMenuId,
                SndID: parMenuId,
                ParentID: parMenuId,
                MenuID: item.uuid,
                MenuNo: item.wrap.MenuNo || Utils.getuuid(),
                EasyCode: '',
                Template: item.type,
                TypeCharOne: sessionStorage.getItem('kei_no'),
                Typename: sessionStorage.getItem('typename'),
                MenuName: item.name || '',
                PageParam: JSON.stringify({Template: item.type}),
                open_edition: item.open_edition || '',
                LText: '',
                LTexttb: ''
              }
              _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(item)))
              _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              _param.secretkey = Utils.encrypt('', _param.timestamp)
              let roles = {
                type: 'navbar',
                key: item.uuid,
                title: item.name,
                children: []
@@ -939,7 +930,29 @@
                  title: menu.name
                }
              })
              console.log(roles)
              let _param = {
                func: 'sPC_TrdMenu_AddUpt',
                FstID: 'mk_app',
                SndID: 'mk_app',
                ParentID: 'mk_app',
                MenuID: item.uuid,
                MenuNo: item.wrap.MenuNo || Utils.getuuid(),
                EasyCode: '',
                Template: item.type,
                TypeCharOne: sessionStorage.getItem('kei_no'),
                Typename: sessionStorage.getItem('typename'),
                MenuName: item.name || '',
                PageParam: JSON.stringify({Template: item.type}),
                open_edition: item.open_edition || '',
                menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roles))),
                LText: '',
                LTexttb: ''
              }
              _param.LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(item)))
              _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
              _param.secretkey = Utils.encrypt('', _param.timestamp)
              
              Api.getSystemConfig(_param).then(res => {
                if (!res.status) {
@@ -1035,12 +1048,7 @@
          this.setState({
            config,
            oriConfig: fromJS(config).toJS(),
            menuloading: false,
            comloading: true
          }, () => {
            this.setState({
              comloading: false
            })
            menuloading: false
          })
          notification.success({
@@ -1058,6 +1066,7 @@
            menuloading: false
          })
        }
        MKEmitter.emit('completeSave')
      })
    }, 300)
  }
@@ -1125,7 +1134,7 @@
          error = `导航栏《${item.name}》未设置菜单参数!`
        }
        if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform'].includes(item.subtype) && item.wrap.datatype === 'static') return
        if (['propcard', 'brafteditor', 'sandbox', 'tabbar', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return
        if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return
        if (item.setting) {
@@ -1251,7 +1260,6 @@
              duration: 5
            })
          } else {
            sessionStorage.setItem('appHomeId', config.MenuID)
            sessionStorage.setItem('appViewList', JSON.stringify(appViewList))
          }
        })