king
2023-09-07 28483549baee23b4ca11e4ddbc9f93244d5fbb7c
2023-09-07
9个文件已修改
421 ■■■■■ 已修改文件
src/menu/tablenodes/index.jsx 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils-custom.js 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/sidemenu/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/design/sidemenu/index.scss 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/menudesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobdesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/pcdesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/rolemanage/index.jsx 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/tabledesign/index.jsx 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/tablenodes/index.jsx
@@ -109,6 +109,221 @@
    return {tbs, ptbs}
  }
  getFuncAndInterface = (config) => {
    let ptbs = []
    let filterBtn = (cell, tbs) => {
      if (cell.intertype === 'inner') {
        tbs.push({
          label: cell.innerFunc + ' (' + cell.label + ')',
          color: 'orange',
          id: Utils.getuuid(),
          direction: 'left'
        })
      } else if (cell.intertype === 'outer' || cell.intertype === 'custom') {
        if (cell.innerFunc) {
          tbs.push({
            label: cell.innerFunc + ' (' + cell.label + ')',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (cell.outerFunc) {
          tbs.push({
            label: cell.outerFunc + ' (' + cell.label + ')',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (cell.interface && cell.sysInterface !== 'true') {
          tbs.push({
            label: cell.interface + ' (' + cell.label + ')',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (cell.proInterface) {
          tbs.push({
            label: cell.proInterface + ' (' + cell.label + ')',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (cell.callbackFunc) {
          tbs.push({
            label: cell.callbackFunc + ' (' + cell.label + ')',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
      }
    }
    let filterSetting = (item, tbs) => {
      if (!item.setting) return
      if (item.setting.interType === 'inner') {
        tbs.push({
          label: item.setting.innerFunc + ' (数据源)',
          color: 'orange',
          id: Utils.getuuid(),
          direction: 'left'
        })
      } else if (item.setting.interType === 'outer') {
        if (item.setting.outerFunc) {
          tbs.push({
            label: item.setting.outerFunc + ' (数据源)',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (item.setting.interface && item.setting.sysInterface !== 'true') {
          tbs.push({
            label: item.setting.interface + ' (数据源)',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
        if (item.setting.proInterface) {
          tbs.push({
            label: item.setting.proInterface + ' (数据源)',
            color: 'orange',
            id: Utils.getuuid(),
            direction: 'left'
          })
        }
      }
    }
    let traversal = (components, extra) => {
      components.forEach(item => {
        if (item.type === 'tabs') {
          item.subtabs.forEach(tab => {
            traversal(tab.components, extra)
          })
        } else if (item.type === 'group') {
          traversal(item.components, extra)
        } else {
          let tbs = []
          filterSetting(item, tbs)
          if (item.action) {
            item.action.forEach(cell => {
              if (cell.OpenType === 'popview') {
                if (cell.config.components) {
                  traversal(cell.config.components, `-${cell.label}(弹窗)`)
                }
              } else {
                filterBtn(cell, tbs)
              }
            })
          }
          if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
            item.subcards.forEach(card => {
              card.elements && card.elements.forEach(cell => {
                if (cell.eleType !== 'button') return
                if (cell.OpenType === 'popview') {
                  if (cell.config.components) {
                    traversal(cell.config.components, `-${cell.label}(弹窗)`)
                  }
                } else {
                  filterBtn(cell, tbs)
                }
              })
              card.backElements && card.backElements.forEach(cell => {
                if (cell.eleType !== 'button') return
                if (cell.OpenType === 'popview') {
                  if (cell.config.components) {
                    traversal(cell.config.components, `-${cell.label}(弹窗)`)
                  }
                } else {
                  filterBtn(cell, tbs)
                }
              })
            })
          } else if (item.type === 'balcony') {
            item.elements && item.elements.forEach(cell => {
              if (cell.eleType !== 'button') return
              if (cell.OpenType === 'popview') {
                if (cell.config.components) {
                  traversal(cell.config.components, `-${cell.label}(弹窗)`)
                }
              } else {
                filterBtn(cell, tbs)
              }
            })
          } else if (item.type === 'table') {
            let loopCol = (cols) => {
              cols.forEach(col => {
                if (col.type === 'colspan') {
                  loopCol(col.subcols)
                } else if (col.type === 'custom') {
                  col.elements.forEach(cell => {
                    if (cell.eleType !== 'button') return
                    if (cell.OpenType === 'popview') {
                      if (cell.config.components) {
                        traversal(cell.config.components, `-${cell.label}(弹窗)`)
                      }
                    } else {
                      filterBtn(cell, tbs)
                    }
                  })
                }
              })
            }
            loopCol(item.cols)
          } else if (item.type === 'form') {
            item.subcards.forEach(group => {
              filterBtn(group.subButton, tbs)
            })
          }
          if (tbs.length) {
            ptbs.push({
              label: item.name + extra,
              id: Utils.getuuid(),
              direction: 'left',
              color: 'orange',
              children: tbs
            })
          }
        }
      })
    }
    if (config.interfaces) {
      config.interfaces.forEach(item => {
        let tbs = []
        filterSetting(item, tbs)
        if (tbs.length) {
          ptbs.push({
            label: item.name,
            id: Utils.getuuid(),
            direction: 'left',
            color: 'orange',
            children: tbs
          })
        }
      })
    }
    traversal(config.components, '')
    return ptbs
  }
  trigger = () => {
    const { config } = this.props
@@ -172,6 +387,12 @@
          })
        }
        let funcs = this.getFuncAndInterface(config)
        if (funcs.length) {
          data.children.push(...funcs)
        }
        if (result.tb_list) {
          result.tb_list.sort((a, b) => a.tbname > b.tbname ? 1 : -1)
          let length = result.tb_list.length
src/utils/utils-custom.js
@@ -1224,6 +1224,157 @@
}
/**
 * @description 获取接口及函数
 */
export function getFuncsAndInters (config) {
  let inters = []
  // let funcs = []
  let filterBtn = (cell) => {
    if (cell.intertype === 'inner') {
      // funcs.push(cell.innerFunc)
    } else if (cell.intertype === 'outer' || cell.intertype === 'custom') {
      // if (cell.innerFunc) {
      //   funcs.push(cell.innerFunc)
      // }
      // if (cell.outerFunc) {
      //   funcs.push(cell.outerFunc)
      // }
      if (cell.interface && cell.sysInterface !== 'true') {
        inters.push(cell.interface)
      }
      if (cell.proInterface) {
        inters.push(cell.proInterface)
      }
      // if (cell.callbackFunc) {
      //   funcs.push(cell.callbackFunc)
      // }
    }
  }
  let filterSetting = (item) => {
    if (!item.setting) return
    if (item.setting.interType === 'inner') {
      // funcs.push(item.setting.innerFunc)
    } else if (item.setting.interType === 'outer') {
      // if (item.setting.outerFunc) {
      //   funcs.push(item.setting.outerFunc)
      // }
      if (item.setting.interface && item.setting.sysInterface !== 'true') {
        inters.push(item.setting.interface)
      }
      if (item.setting.proInterface) {
        inters.push(item.setting.proInterface)
      }
    }
  }
  let traversal = (components) => {
    if (!components) return
    components.forEach(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          traversal(tab.components)
        })
      } else if (item.type === 'group') {
        traversal(item.components)
      } else {
        filterSetting(item)
        if (item.action) {
          item.action.forEach(cell => {
            if (cell.OpenType === 'popview') {
              if (cell.config) {
                traversal(cell.config.components)
              }
            } else {
              filterBtn(cell)
            }
          })
        }
        if (item.type === 'card' || item.type === 'carousel' || item.type === 'timeline') {
          item.subcards.forEach(card => {
            card.elements && card.elements.forEach(cell => {
              if (cell.eleType !== 'button') return
              if (cell.OpenType === 'popview') {
                if (cell.config) {
                  traversal(cell.config.components)
                }
              } else {
                filterBtn(cell)
              }
            })
            card.backElements && card.backElements.forEach(cell => {
              if (cell.eleType !== 'button') return
              if (cell.OpenType === 'popview') {
                if (cell.config) {
                  traversal(cell.config.components)
                }
              } else {
                filterBtn(cell)
              }
            })
          })
        } else if (item.type === 'balcony') {
          item.elements && item.elements.forEach(cell => {
            if (cell.eleType !== 'button') return
            if (cell.OpenType === 'popview') {
              if (cell.config) {
                traversal(cell.config.components)
              }
            } else {
              filterBtn(cell)
            }
          })
        } else if (item.type === 'table') {
          let loopCol = (cols) => {
            cols.forEach(col => {
              if (col.type === 'colspan') {
                loopCol(col.subcols)
              } else if (col.type === 'custom') {
                col.elements.forEach(cell => {
                  if (cell.eleType !== 'button') return
                  if (cell.OpenType === 'popview') {
                    if (cell.config) {
                      traversal(cell.config.components)
                    }
                  } else {
                    filterBtn(cell)
                  }
                })
              }
            })
          }
          loopCol(item.cols)
        } else if (item.type === 'form') {
          item.subcards.forEach(group => {
            filterBtn(group.subButton)
          })
        }
      }
    })
  }
  if (config.interfaces) {
    config.interfaces.forEach(item => {
      filterSetting(item)
    })
  }
  traversal(config.components)
  // inters = Array.from(new Set(inters))
  return inters.length > 0 ? 'true' : 'false'
}
/**
 * @description 检测组件内容
 */
export function checkComponent (card) {
src/views/design/sidemenu/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import { is, fromJS } from 'immutable'
import { Menu, Popover, Modal, notification } from 'antd'
import { EditOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons'
import { EditOutlined, PlusOutlined, SettingOutlined, ApiOutlined } from '@ant-design/icons'
import moment from 'moment'
import asyncComponent from '@/utils/asyncComponent'
@@ -326,7 +326,7 @@
                {item.children.map(cell => {
                  return (
                    <Menu.Item key={cell.MenuID}>
                      <span className="editable-menu-item" onDoubleClick={() => this.editmenu(cell)}>{cell.MenuName}</span>
                      <span className="editable-menu-item" onDoubleClick={() => this.editmenu(cell)}>{cell.PageParam && cell.PageParam.interfaces === 'true' ? <ApiOutlined title="菜单中使用了外部接口" /> : null}{cell.MenuName}</span>
                    </Menu.Item>
                  )
                })}
src/views/design/sidemenu/index.scss
@@ -12,9 +12,17 @@
      padding-left: 48px;
    }
    .editable-menu-item {
      position: relative;
      display: block;
      padding-left: 48px;
      cursor: pointer;
      .anticon-api {
        position: absolute;
        left: 25px;
        top: 11px;
        color: orange;
      }
    }
  }
  .ant-menu-sub.ant-menu-inline {
src/views/menudesign/index.jsx
@@ -13,7 +13,7 @@
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import antdZhCN from 'antd/es/locale/zh_CN'
import MKEmitter from '@/utils/events.js'
import { getTables } from '@/utils/utils-custom.js'
import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
import '@/assets/css/design.scss'
@@ -778,6 +778,8 @@
        config.tbkey = key
      }
      let interfaces = getFuncsAndInters(config)
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: config.fstMenuId || '',
@@ -788,7 +790,7 @@
        EasyCode: config.easyCode || '',
        Template: 'CustomPage',
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}),
        PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', interfaces}),
        open_edition: config.open_edition,
        LText: '',
        LTexttb: '',
src/views/mobdesign/index.jsx
@@ -12,7 +12,7 @@
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import antdZhCN from 'antd/es/locale/zh_CN'
import MKEmitter from '@/utils/events.js'
import MenuUtils, { getTables } from '@/utils/utils-custom.js'
import MenuUtils, { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
import asyncComponent from '@/utils/asyncComponent'
import '@/assets/css/design.scss'
@@ -1503,6 +1503,8 @@
      let menus_used_list = subMenus.map(m => `'${config.uuid}','${config.MenuName || ''}','${config.MenuNo || ''}','${m.MenuID}','${m.MenuName}'`).join(';')
      menus_used_list = window.btoa(window.encodeURIComponent(menus_used_list || 'del'))
      let interfaces = getFuncsAndInters(config)
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: 'mk_app',
@@ -1515,7 +1517,7 @@
        TypeCharOne: sessionStorage.getItem('kei_no'),
        Typename: sessionStorage.getItem('typename'),
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'webPage'}),
        PageParam: JSON.stringify({Template: 'webPage', interfaces}),
        open_edition: config.open_edition,
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))),
        LText: '',
src/views/pcdesign/index.jsx
@@ -10,7 +10,7 @@
import Api from '@/api'
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import { getTables } from '@/utils/utils-custom.js'
import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
import antdZhCN from 'antd/es/locale/zh_CN'
import MKEmitter from '@/utils/events.js'
import MenuUtils from '@/utils/utils-custom.js'
@@ -1203,6 +1203,8 @@
        config.tbkey = key
      }
      let interfaces = getFuncsAndInters(config)
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: 'mk_app',
@@ -1215,7 +1217,7 @@
        TypeCharOne: sessionStorage.getItem('kei_no'),
        Typename: 'pc',
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'webPage'}),
        PageParam: JSON.stringify({Template: 'webPage', interfaces}),
        menus_rolelist: window.btoa(window.encodeURIComponent(JSON.stringify(roleParam))),
        open_edition: config.open_edition,
        LText: '',
src/views/rolemanage/index.jsx
@@ -3,8 +3,8 @@
import { Spin, notification, Button, Table, Modal, ConfigProvider, Tree, Input, Empty } from 'antd'
import moment from 'moment'
import md5 from 'md5'
import enUS from 'antd/es/locale/en_US'
import zhCN from 'antd/es/locale/zh_CN'
import { ApiOutlined } from '@ant-design/icons'
import Api from '@/api'
import Utils from '@/utils/utils.js'
@@ -15,7 +15,6 @@
const { TreeNode } = Tree
const { Search } = Input
const _locale = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
const Header = asyncComponent(() => import('./header'))
const TransferForm = asyncComponent(() => import('@/templates/zshare/basetransferform'))
@@ -29,6 +28,8 @@
        title: '菜单名称', dataIndex: 'MenuName', key: 'MenuName', align: 'center', render: (text, record) => {
          if (record.extra) {
            return <span style={{color: '#1890ff'}}>{text}</span>
          } else if (record.interfaces === 'true') {
            return <span><ApiOutlined style={{color: 'orange', marginRight: '5px'}} title="菜单中使用了外部接口" />{text}</span>
          }
          return text
        }
@@ -136,6 +137,12 @@
        let menus = result.menus.map(item => {
          item.nodes = ''
          item.type = 'view'
          if (item.PageParam) {
            try {
              let PageParam = JSON.parse(item.PageParam)
              item.interfaces = PageParam.interfaces || 'false'
            } catch (e) {}
          }
          if (item.menus_rolelist) {
            try {
              let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
@@ -886,7 +893,7 @@
    return (
      <div className="mk-role-manage">
        <ConfigProvider locale={_locale}>
        <ConfigProvider locale={zhCN}>
          <Header app={app} />
          {loading ?
            <div className="loading-mask">
src/views/tabledesign/index.jsx
@@ -12,7 +12,7 @@
import Utils, { setGLOBFuncs } from '@/utils/utils.js'
import antdZhCN from 'antd/es/locale/zh_CN'
import MKEmitter from '@/utils/events.js'
import { getTables } from '@/utils/utils-custom.js'
import { getTables, getFuncsAndInters } from '@/utils/utils-custom.js'
import SourceElement from '@/templates/zshare/dragsource'
import asyncComponent from '@/utils/asyncComponent'
import Source from './source'
@@ -579,6 +579,8 @@
        config.tbkey = key
      }
      let interfaces = getFuncsAndInters(config)
      let param = {
        func: 'sPC_TrdMenu_AddUpt',
        FstID: config.fstMenuId || '',
@@ -589,7 +591,7 @@
        EasyCode: config.easyCode || '',
        Template: 'BaseTable',
        MenuName: config.MenuName || '',
        PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false'}),
        PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', interfaces}),
        open_edition: config.open_edition,
        LText: '',
        LTexttb: '',