king
2020-03-26 a24beb36feaa46f39cbb26ce5277e84f91241ce8
src/tabviews/subtable/index.jsx
@@ -12,13 +12,14 @@
import options from '@/store/options.js'
import SubTable from '@/tabviews/zshare/normalTable'
import SubAction from '@/tabviews/zshare/actionList'
// import SubAction from '@/tabviews/zshare/actionList'
import SubSearch from '@/tabviews/zshare/topSearch'
import asyncLoadComponent from '@/utils/asyncLoadComponent'
import NotFount from '@/components/404'
import './index.scss'
const SubAction = asyncLoadComponent(() => import('@/tabviews/zshare/actionList'))
const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable'))
class SubTabViewTable extends Component {
@@ -32,7 +33,9 @@
    ContainerId: PropTypes.any,      // 三级菜单Container(html) ID
    handleTableId: PropTypes.func,   // 控制表格数据切换时,更新在主表中的id
    handleMainTable: PropTypes.func, // 刷新主表
    refreshtabs:PropTypes.any
    refreshtabs: PropTypes.any,      // 标签刷新控制
    userConfig: PropTypes.any,       // 用户自定义设置
    triggerBtn: PropTypes.any        // 快捷键或点击行按钮触发事件
  }
  state = {
@@ -58,7 +61,8 @@
    popAction: false,     // 弹框页面,按钮信息
    popData: false,       // 弹框页面,所选的表格数据
    visible: false,       // 弹框显示隐藏控制
    pickup: false,         // 子表数据隐藏显示切换
    pickup: false,        // 子表数据隐藏显示切换
    triggerBtn: null      // 按钮触发
  }
  /**
@@ -70,6 +74,10 @@
      this.loadmaindata(nextProps.BID, 'refresh')
    } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) {
      this.reloadtable()
    } else if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.parentId === this.props.MenuID) {
      this.setState({
        triggerBtn: nextProps.triggerBtn
      })
    }
  }
@@ -77,7 +85,7 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { permAction, Tab, BID } = this.props
    const { permAction, Tab, BID, userConfig } = this.props
    let param = {
      func: 'sPC_Get_LongParam',
@@ -153,6 +161,33 @@
        })
      }
      if (userConfig) {
        config.setting.tableType = userConfig.setting.tableType
        config.action = config.action.map(item => {
          if (userConfig.action[item.uuid]) {
            item = {...item, ...userConfig.action[item.uuid]}
          }
          if (item.execMode) {
            item.OpenType = 'funcbutton'
          }
          if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify && item.printer) {
            item.verify.defaultPrinter = item.printer.defaultPrinter || ''
            if (item.verify.printerTypeList && item.printer.printerList) {
              item.verify.printerTypeList = item.verify.printerTypeList.map(cell => {
                cell.printer = item.printer.printerList[cell.Value] || ''
                return cell
              })
            }
          }
          return item
        })
      }
      // 1、筛选字段集,2、过滤隐藏列及合并列中的字段uuid
      config.columns.forEach(col => {
        if (col.field) {
@@ -215,6 +250,21 @@
          valid = false
        }
      })
      // 添加用户显示列设置
      if (userConfig) {
        _columns = _columns.map(item => {
          if (userConfig.columns[item.uuid]) {
            item = {...item, ...userConfig.columns[item.uuid]}
          }
          return item
        })
        _columns.sort((pre, next) => {
          return pre.sort - next.sort
        })
      }
      this.setState({
        loadingview: false,
@@ -640,7 +690,15 @@
   * @description 表格中,按钮触发事件传递
   */
  buttonTrigger = (btn, record) => {
    this.refs.subButton.actionTrigger(btn, record)
    this.setState({
      triggerBtn: {
        uuid: new Date().getTime(),
        parentId: this.props.MenuID,
        button: btn,
        data: record
      }
    })
    // this.refs.subButton.actionTrigger(btn, record)
  }
  /**
@@ -698,7 +756,7 @@
  }
  render() {
    const { setting, searchlist, actions, columns, loadingview, viewlost, pickup } = this.state
    const { setting, searchlist, actions, columns, loadingview, viewlost, pickup, triggerBtn } = this.state
    return (
      <div className="subtable" id={'subtable' + this.props.MenuID}>
@@ -713,9 +771,9 @@
        {actions ?
          <div className="sub-action">
            <SubAction
              ref="subButton"
              type="sub"
              menuType={this.props.menuType}
              triggerBtn={triggerBtn}
              setting={setting}
              actions={actions}
              Tab={this.props.Tab}