king
2023-09-05 c9967063fa42e15d9f695220c76641cfa28669f2
src/tabviews/basetable/index.jsx
@@ -13,6 +13,7 @@
// 通用组件
const AntvTabs = asyncComponent(() => import('@/tabviews/custom/components/tabs/antv-tabs'))
const MkBaseTable = asyncComponent(() => import('@/tabviews/custom/components/table/base-table'))
const FlowFloat = asyncComponent(() => import('@/tabviews/zshare/flowFloat'))
const SettingComponent = asyncComponent(() => import('@/tabviews/zshare/settingcomponent'))
const TableNodes = asyncComponent(() => import('@/tabviews/zshare/tablenodes'))
const AutoMatic = asyncComponent(() => import('@/tabviews/zshare/automatic'))
@@ -35,7 +36,6 @@
    lostmsg: '',          // 页面丢失时的提示信息
    config: null,         // 页面配置信息,包括组件等
    userConfig: null,     // 用户自定义设置
    loading: false,       // 列表数据加载中
    visible: false,       // 标签页控制
    shortcuts: null,      // 快捷键
    autoMatic: null
@@ -102,6 +102,48 @@
        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) {
          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 { // 配置信息解析
@@ -148,7 +190,7 @@
        })
      }
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName)
      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName, config.process === 'true')
      let autoMatic = null
      if (config.autoMatic && config.autoMatic.enable === 'true') {
@@ -263,10 +305,15 @@
    }
  }
  filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName) => {
  filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName, process) => {
    return components.filter(item => {
      item.$pageId = pageId
      item.$searchId = pageId
      if (process) {
        item.$process = process
        item.$flowId = 'flow' + this.props.MenuID
      }
      item.$menuname = (MenuName || '') + '-' + (item.name || '主表')
@@ -287,7 +334,7 @@
          if (tab.permission !== 'true') { // 权限未开启不做权限控制
            skip = true
          }
          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName)
          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName, process)
          return tab
        })
@@ -410,6 +457,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.controlField) {
      if (/,/ig.test(cell.controlVal)) {
@@ -640,7 +692,6 @@
      loadingview: true,    // 页面加载中
      viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
      config: null,         // 页面配置信息,包括组件等
      loading: false,       // 列表数据加载中
      shortcuts: null,
    }, () => {
      this.loadconfig()
@@ -670,17 +721,30 @@
  }
  render() {
    const { loadingview, viewlost, config, loading, shortcuts, autoMatic } = this.state
    const { loadingview, viewlost, config, shortcuts, autoMatic } = this.state
    if (!config || viewlost) {
      return (
        <div className="custom-table-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-table-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}>
        {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null}
      <div className="custom-table-wrap" id={this.state.ContainerId} style={config.style}>
        <Row className="component-wrap">{this.getComponents()}</Row>
        {config && window.GLOB.breakpoint ? <DebugTable /> : null}
        {!window.GLOB.mkHS && config && autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : 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}
        {window.GLOB.breakpoint ? <DebugTable /> : null}
        <div className="user-tools">
          {autoMatic ? <AutoMatic autoMatic={autoMatic} tabId={config.MenuID} config={config.components[0]} /> : null}
          {config.process === 'true' ? <FlowFloat config={config}/> : null}
          <SettingComponent config={config} shortcuts={shortcuts || []}/>
          <TableNodes config={config} />
        </div>
      </div>
    )
  }