king
2023-09-05 c9967063fa42e15d9f695220c76641cfa28669f2
src/tabviews/custom/index.jsx
@@ -44,6 +44,7 @@
const Iframe = asyncComponent(() => import('./components/iframe'))
const Calendar = asyncComponent(() => import('./components/calendar'))
const DebugTable = asyncComponent(() => import('@/tabviews/debugtable'))
const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat'))
const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes'))
const MkInterfaces = asyncComponent(() => import('@/tabviews/custom/components/interfaces'))
@@ -132,6 +133,49 @@
        return
      }
      if (config.process === 'true') {
        let unset = true
        if (result.works_flow_code && result.works_long_param) {
          try { // 流程信息解析
            let flowConfig = JSON.parse(window.decodeURIComponent(window.atob(result.works_long_param)))
            flowConfig.flow_code = result.works_flow_code
            flowConfig.flow_name = result.works_flow_name
            config.flow_code = result.works_flow_code
            config.flow_name = result.works_flow_name
            unset = false
            window.GLOB.UserCacheMap.set('flow' + MenuID, flowConfig)
          } catch (e) {
            unset = true
            console.warn('Parse Failure')
          }
        }
        if (unset) {
          config.interfaces = []
          this.setState({
            config: config,
            viewlost: true,
            loadingview: false,
            lostmsg: '抱歉,您访问的页面未设置工作流,请联系管理员。'
          })
          return
        }
      } else if (result.works_flow_code) {
        Api.getSystemConfig({
          func: 's_works_flow_param_sso_menu_upt_v6',
          upt_type: 'del',
          works_flow_code: '',
          works_flow_name: '',
          long_param: '',
          flow_id: '',
          menuid: config.MenuID,
          menuname: config.MenuName,
          username: sessionStorage.getItem('User_Name') || '',
          fullName: sessionStorage.getItem('Full_Name') || ''
        })
      }
      // HS不使用自定义设置
      if (result.LongParamUser && !window.GLOB.mkHS) {
        try { // 配置信息解析
@@ -193,7 +237,7 @@
      let initInters = []
      config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID, config.process === 'true')
      let params = []
      let BID = param.$BID || ''
@@ -324,12 +368,17 @@
    }
  }
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => {
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process) => {
    return components.filter(item => {
      item.$pageId = pageId
      item.$searchId = searchId
      item.$syncId = syncId
      
      if (process) {
        item.$process = process
        item.$flowId = 'flow' + this.props.MenuID
      }
      if (cache) {
        item.$cache = cache
        item.$time = time
@@ -444,7 +493,7 @@
            _searchId = tab.uuid
          }
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid)
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid, process)
          
          if (_searchId === tab.uuid) {
            tab.components.forEach(cell => {
@@ -468,7 +517,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId)
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId, process)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) {
@@ -720,6 +769,11 @@
            group.subButton.Ot = item.wrap.datatype === 'static' ? 'notRequired' : 'requiredSgl'
          }
          if (item.$process) {
            group.subButton.$process = true
            group.subButton.$flowId = 'flow' + this.props.MenuID
          }
          if (item.$cache && item.$time) {
            group.$cache = item.$cache
            group.$time = item.$time
@@ -812,6 +866,11 @@
    cell.$menuId = item.uuid
    cell.$MenuID = this.props.MenuID
    cell.$view = 'popview'
    if (item.$process) {
      cell.$process = true
      cell.$flowId = 'flow' + this.props.MenuID
    }
    if (cell.btnstyle) { // 兼容
      cell.style = cell.style || {}
@@ -1572,15 +1631,29 @@
  render() {
    const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state
    if (!config || viewlost) {
      return (
        <div className="custom-page-wrap">
          {loadingview ? <Spin className="view-spin" size="large" /> : null}
          {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
          <div className="user-tools">
            {config && config.process === 'true' ? <FlowFloat init={true} config={config}/> : null}
          </div>
        </div>
      )
    }
    return (
      <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''} ${config && config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}>
        {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null}
        <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row>
        {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null}
        {config && window.GLOB.breakpoint ? <DebugTable /> : null}
        {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null}
        {!window.GLOB.mkHS && config ? <SettingComponent config={config} shortcuts={shortcuts || []}/> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      <div className={`custom-page-wrap ${config.minWidth ? 'mk-scroll' : ''} ${loading ? 'loading' : ''} ${config.mask === 'false' ? 'mk-no-mask' : ''}`} id={this.state.ContainerId} style={config.style}>
        {loading && !config.$cache ? <Spin className="view-spin" size="large" /> : null}
        <Row id={'menu' + config.uuid} style={{minWidth: config.minWidth || 'unset'}} className="component-wrap">{this.getComponents()}</Row>
        {config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null}
        {window.GLOB.breakpoint ? <DebugTable /> : null}
        <div className="user-tools">
          {config.process === 'true' ? <FlowFloat config={config}/> : null}
          <SettingComponent config={config} shortcuts={shortcuts || []}/>
          <TableNodes config={config} />
        </div>
      </div>
    )
  }