king
2022-08-15 704f82b06befe96e5f739b2dce419f76f5683a6f
src/views/mobdesign/index.jsx
@@ -161,9 +161,17 @@
    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
    MKEmitter.addListener('updateCustomComponent', this.updateCustomComponent)
    setTimeout(() => {
      this.updateCustomComponent()
      if (sessionStorage.getItem('app_custom_components')) {
        let list = sessionStorage.getItem('app_custom_components')
        list = JSON.parse(list)
        this.setCustomComponent(list)
      } else {
        this.updateCustomComponent()
      }
      this.getAppPictures()
      this.getSmStemp()
      this.getRoleFields()
      setGLOBFuncs()
    }, 1000)
@@ -413,36 +421,46 @@
      typename: sessionStorage.getItem('typename'),
      typecharone: ''
    }).then(res => {
      let coms = []
      if (res.cus_list && res.cus_list.length > 0) {
        res.cus_list.forEach(item => {
          let config = ''
          try {
            config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param)))
          } catch (e) {
            console.warn('Parse Failure')
            config = ''
          }
          if (!config || !item.c_name) return
          window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
          coms.push({
            uuid: item.c_id,
            type: 'menu',
            title: item.c_name,
            url: item.images,
            component: config.type,
            subtype: config.subtype,
            width: config.width || 24,
            config
          })
      if (!res.status) {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 5
        })
      } else if (res.cus_list) {
        sessionStorage.setItem('app_custom_components', JSON.stringify(res.cus_list))
        this.setCustomComponent(res.cus_list)
      }
      this.setState({customComponents: coms})
      this.getRoleFields()
    })
  }
  setCustomComponent = (cus_list) => {
    let coms = []
    cus_list.forEach(item => {
      let config = ''
      try {
        config = JSON.parse(window.decodeURIComponent(window.atob(item.long_param)))
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
      }
      if (!config || !item.c_name) return
      window.GLOB.UserComponentMap.set(item.c_id, item.c_name)
      coms.push({
        uuid: item.c_id,
        type: 'menu',
        title: item.c_name,
        url: item.images,
        component: config.type,
        subtype: config.subtype,
        config
      })
    })
    this.setState({customComponents: coms})
  }
  updateComponentStyle = (parentId, keys, style) => {
@@ -551,7 +569,8 @@
            Template: 'webPage',
            enabled: false,
            MenuName: urlParam.MenuName || '',
            MenuNo: urlParam.MenuNo || '',
            // MenuNo: urlParam.MenuNo || '',
            MenuNo: '',
            tables: [],
            components: [],
            viewType: 'menu',
@@ -801,7 +820,8 @@
      config.MenuID = MenuId
      config.open_edition = ''
      config.MenuName = urlParam.MenuName || ''
      config.MenuNo = urlParam.MenuNo || ''
      // config.MenuNo = urlParam.MenuNo || ''
      config.MenuNo = ''
      let indeComs = []
      config.components.forEach(item => {
@@ -957,7 +977,6 @@
          item.action && item.action.forEach(btn => {
            if (btn.hidden === 'true') return
            this.checkBtn(btn)
            m.children.push({
              key: btn.uuid,
              title: btn.label,
@@ -968,7 +987,6 @@
              if (cell.eleType !== 'button') return
              if (cell.hidden === 'true') return
              this.checkBtn(cell)
              m.children.push({
                key: cell.uuid,
                title: cell.label,
@@ -981,7 +999,6 @@
              if (cell.eleType !== 'button') return
              if (cell.hidden === 'true') return
              this.checkBtn(cell)
              m.children.push({
                key: cell.uuid,
                title: cell.label,
@@ -993,7 +1010,6 @@
            if (cell.eleType !== 'button') return
            if (cell.hidden === 'true') return
            this.checkBtn(cell)
            m.children.push({
              key: cell.uuid,
              title: cell.label,
@@ -1023,7 +1039,6 @@
          item.action && item.action.forEach(btn => {
            if (btn.hidden === 'true') return
            this.checkBtn(btn)
            m.children.push({
              key: btn.uuid,
              title: btn.label,
@@ -1034,7 +1049,6 @@
            col.elements.forEach(btn => {
              if (btn.hidden === 'true') return
              this.checkBtn(btn)
              m.children.push({
                key: btn.uuid,
                title: btn.label,
@@ -1090,7 +1104,8 @@
                menus.push({
                  MenuID: m.uuid,
                  MenuName: m.setting.name,
                  MenuNo: m.setting.MenuNo
                  // MenuNo: m.setting.MenuNo
                  MenuNo: ''
                })
              }
            } else if (m.setting.type === 'linkmenu' && menuObj[m.setting.linkMenuId]) {
@@ -1194,26 +1209,6 @@
    })
    return menus
  }
  checkBtn = (btn) => {
    if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
      let hascheck = false
      btn.verify.scripts.forEach(item => {
        if (item.status === 'false') return
        if (/\$check@|@check\$/ig.test(item.sql)) {
          hascheck = true
        }
      })
      if (hascheck) {
        notification.warning({
          top: 92,
          message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
          duration: 5
        })
      }
    }
  }
  getMiniStyle = (config) => {
@@ -1625,16 +1620,16 @@
    let searchSum = 0
    let swipes = []
    let check = (components) => {
    let check = (components, level, sign) => {
      components.forEach(item => {
        if (error) return
        if (item.type === 'tabs') {
          item.subtabs.forEach(tab => {
            check(tab.components)
            check(tab.components, level + 1, tab.uuid)
          })
          return
        } else if (item.type === 'group') {
          check(item.components)
          check(item.components, level, sign)
          return
        } else if (item.type === 'navbar' && !item.wrap.MenuNo) {
          error = `导航栏《${item.name}》未设置菜单参数!`
@@ -1649,7 +1644,8 @@
          }
        }
        if (item.wrap && item.wrap.pagestyle === 'slide' && item.pageable && item.setting.laypage !== 'false') {
          swipes.push(item.name)
          // swipes.push(item.name)
          swipes.push({level, name: item.name, sign})
        }
        item.errors && item.errors.forEach(err => {
@@ -1659,7 +1655,7 @@
      })
    }
    check(config.components)
    check(config.components, 1, 'view')
    // if (!error && viewType === 'userbind' && config.components.filter(item => item.type === 'login').length === 0) {
    //   error = '用户绑定页面必须添加登录。'
@@ -1667,8 +1663,27 @@
    if (!error && searchSum > 1) {
      error = '搜索组件与导航栏的搜索功能不可同时使用。'
    } else if (!error && swipes.length > 1) {
      error = `页面中不可同时使用多个滑动加载组件。(${swipes.join('、')})`
    } else if (!error && swipes.length > 0) {
      swipes.forEach(cell => {
        if (!error && cell.level > 2) {
          error = `不可在多层标签页中使用滑动加载组件。(${cell.name})`
        }
      })
      if (!error) {
        let levels = swipes.map(s => s.level)
        levels = Array.from(new Set(levels))
        if (levels.length > 1) {
          error = `不可在页面与标签页中同时使用滑动加载组件。(${swipes.map(s => s.name).join('、')})`
        }
      }
      if (!error) {
        let signs = swipes.map(s => s.sign)
        signs = Array.from(new Set(signs))
        if (signs.length !== swipes.length) {
          error = `页面中(或同一标签页中)不可同时使用多个滑动加载组件。(${swipes.map(s => s.name).join('、')})`
        }
      }
    }
    if (show && error) {
@@ -1921,7 +1936,7 @@
              <div className="pc-setting-tools">
                <Collapse accordion activeKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
                  {/* 基本信息 */}
                  <Panel header={dict['mob.basemsg']} forceRender className="basedata" key="basedata">
                  <Panel header="基本信息" forceRender className="basedata" key="basedata">
                    {/* 菜单信息 */}
                    {config ? <MenuForm
                      dict={dict}