king
2020-03-18 aaee2aa047e856141dce84c5d3f1cd16d9a00dcd
src/tabviews/managetable/index.jsx
@@ -9,18 +9,21 @@
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
import asyncComponent from '@/utils/asyncLoadComponent'
import options from '@/store/options.js'
import asyncComponent from '@/utils/asyncComponent'
import asyncLoadComponent from '@/utils/asyncLoadComponent'
import {refreshTabView, modifyTabview} from '@/store/action'
import MainTable from '@/tabviews/commontable/mainTable'
import MainAction from '@/tabviews/tableshare/actionList'
import MainSearch from '@/tabviews/tableshare/topSearch'
import SubTable from '@/tabviews/subtable'
import MainTable from '@/tabviews/zshare/normalTable'
import MainAction from '@/tabviews/zshare/actionList'
import MainSearch from '@/tabviews/zshare/topSearch'
import NotFount from '@/components/404'
import './index.scss'
const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable'))
const SubTabTable = asyncComponent(() => import('@/tabviews/subtabtable'))
const FormTab = asyncComponent(() => import('@/tabviews/formtab'))
const { TabPane } = Tabs
const { TreeNode } = Tree
const { Paragraph } = Typography
@@ -54,9 +57,7 @@
    orderBy: '',          // 排序
    search: '',           // 搜索条件数组,使用时需分场景处理
    BIDs: {},             // 上级表id
    setsingle: false,     // 主表单选多选切换
    pickup: false,        // 主表数据隐藏显示切换
    isLinkMain: false,    // 是否存在与主表关联的子表
    popAction: false,     // 弹框页面,按钮信息
    popData: false,       // 弹框页面,所选的表格数据
    visible: false,       // 弹框显示隐藏控制
@@ -81,9 +82,9 @@
      let config = ''
      try { // 配置信息解析
        config = window.decodeURIComponent(window.atob(result.LongParam))
        config = JSON.parse(config)
        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
      }
@@ -113,12 +114,6 @@
      let colMap = new Map() // 用于字段过滤
      // 权限过滤
      // config.action = config.action.filter(item => permAction[item.uuid])
      // config.tabgroups.forEach(group => {
      //   if (!config[group]) return
      //   config[group] = config[group].filter(tab => permAction[tab.uuid])
      // })
      // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid
      config.columns.forEach(col => {
@@ -164,18 +159,6 @@
        })
      }
      let _isLinkMain = false // 检查是否有与主表关联的子表
      config.tabgroups.forEach(groupId => {
        if (!config[groupId] || config[groupId].length === 0) return
        config[groupId].forEach(tab => {
          if (tab.supMenu === 'mainTable') {
            _isLinkMain = true
          }
        })
      })
      this.setState({
        loadingview: false,
        config: config,
@@ -184,7 +167,6 @@
        actions: _actions,
        columns: _columns,
        logcolumns: _logcolumns,
        isLinkMain: _isLinkMain,
        arr_field: _arrField.join(','),
        search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化)
      }, () => {
@@ -363,9 +345,9 @@
    if (setting.interType === 'inner') {
      param.func = setting.innerFunc
    } else {
      if (setting.sysInterface === 'true') {
        param.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi
      } else {
      if (setting.sysInterface === 'true' && options.cloudServiceApi) {
        param.rduri = options.cloudServiceApi
      } else if (setting.sysInterface !== 'true') {
        param.rduri = setting.interface
      }
@@ -536,9 +518,7 @@
      orderBy: '',
      search: '',
      BIDs: {},
      setsingle: false,
      pickup: false,
      isLinkMain: false
      pickup: false
    }, () => {
      this.loadconfig()
    })
@@ -652,22 +632,6 @@
      }
    })
  }
  /**
   * @description 表格单选多选切换
   */
  checkChange = () => {
    const { setsingle, BIDs } = this.state
    let _BIDs = JSON.parse(JSON.stringify(BIDs))
    _BIDs.mainTable = ''
    this.setState({
      setsingle: !setsingle,
      pickup: false,
      BIDs: _BIDs
    })
  }
  
  /**
   * @description 数据展开合并切换
@@ -706,6 +670,7 @@
        type: btn.tabTemplate,
        selected: true,
        param: {
          menuType: 'HS',
          parentId: this.props.MenuID,
          btn: btn,
          data: data[0] || null,
@@ -739,6 +704,7 @@
        view: 'formtab',
        tabBtn: btn,
        tabParam: {
          menuType: 'HS',
          btn: btn,
          data: data[0] || null,
          primaryId: btn.Ot !== 'notRequired' ? _primaryId : '',
@@ -844,11 +810,11 @@
  }
  render() {
    const { view, setting, searchlist, actions, columns, loadingview, viewlost, setsingle, pickup, isLinkMain, config } = this.state
    const { view, setting, searchlist, actions, columns, loadingview, viewlost, pickup, config } = this.state
    return (
      <div>
        {view === 'commontable' ? <div className={'commontable ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}>
        {view === 'commontable' ? <div className="commontable pick-control" id={this.state.ContainerId}>
          {loadingview && <Spin size="large" />}
          {searchlist && searchlist.length > 0 ?
            <MainSearch
@@ -862,6 +828,7 @@
              ref="mainButton"
              BID=""
              type="main"
              menuType="HS"
              setting={setting}
              actions={actions}
              dict={this.state.dict}
@@ -876,18 +843,17 @@
          }
          {columns && setting.onload !== 'false' ?
            <div className="main-table-box">
              {isLinkMain ?
              {this.state.data && this.state.data.length > 0 ?
                <div className="pickchange">
                  {setting.tableType === 'checkbox' ? <Switch title="单选切换" checkedChildren="单" unCheckedChildren="多" defaultChecked={setsingle} onChange={this.checkChange} /> : null}
                  {this.state.BIDs.mainTable && (setting.tableType === 'radio' || setsingle) ? <Switch title="收起" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} /> : null}
                  <Switch title="收起" checkedChildren="开" unCheckedChildren="关" defaultChecked={pickup} onChange={this.pickupChange} />
                </div> : null
              }
              <MainTable
                ref="mainTable"
                tableId="mainTable"
                pickup={pickup}
                setting={setting}
                columns={columns}
                setsingle={setsingle}
                dict={this.state.dict}
                data={this.state.data}
                total={this.state.total}
@@ -915,6 +881,7 @@
                      } key={`${index}`}>
                        {_tab.type === 'SubTable' ?
                          <SubTable
                            menuType="HS"
                            Tab={_tab}
                            MenuID={_tab.linkTab}
                            SupMenuID={this.props.MenuID}
@@ -952,6 +919,7 @@
          >
            {<SubTabTable 
              BID={''}
              menuType="HS"
              SupMenuID={this.props.MenuID}
              MenuID={this.state.popAction.linkTab}
              BData={this.state.BIDs['mainTabledata'] || ''}