king
2022-07-06 be22457344d6d3fc079de2a4f0a1e06e4c0f85c3
src/tabviews/zshare/actionList/index.jsx
@@ -4,8 +4,6 @@
import { Affix } from 'antd'
import asyncComponent from './asyncButtonComponent'
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import './index.scss'
const NormalButton = asyncComponent(() => import('./normalbutton'))
@@ -16,143 +14,135 @@
const NewPageButton = asyncComponent(() => import('./newpagebutton'))
const ChangeUserButton = asyncComponent(() => import('./changeuserbutton'))
const PrintButton = asyncComponent(() => import('./printbutton'))
const FuncMegvii = asyncComponent(() => import('./funcMegvii'))
const FuncZip = asyncComponent(() => import('./funczip'))
class ActionList extends Component {
  static propTpyes = {
    BID: PropTypes.any,               // 主表ID
    lock: PropTypes.any,              // 可编辑表中按钮锁定
    BData: PropTypes.any,             // 主表数据
    MenuName: PropTypes.any,          // 菜单名称
    selectedData: PropTypes.any,      // 子表中选择数据
    Tab: PropTypes.any,               // 如果当前元素为标签时,tab为标签信息
    MenuID: PropTypes.string,         // 菜单ID
    actions: PropTypes.array,         // 按钮组
    columns: PropTypes.array,         // 显示列
    setting: PropTypes.any,           // 页面通用设置
    ContainerId: PropTypes.any,       // tab页面ID,用于弹窗控制
    refreshdata: PropTypes.func,      // 执行完成后数据刷新
    getexceloutparam: PropTypes.func, // 获取excel导出数据
    ContainerId: PropTypes.any        // tab页面ID,用于弹窗控制
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS
  }
  state = {}
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
  updateStatus = (type, positon, btn) => {
    if (type === 'refresh') {
      this.props.refreshdata(positon, btn)
    } else if (type === 'trigger') { // 日历中的新标签页触发事件
      this.props.refreshdata('trigger')
    }
  }
  getButtonList = (actions) => {
    const { BID, BData, MenuID, Tab, columns, setting, ContainerId, selectedData, getexceloutparam, MenuName } = this.props
    const { BID, BData, MenuID, Tab, columns, setting, ContainerId, selectedData, lock } = this.props
    return actions.map(item => {
      if (['exec', 'prompt', 'pop'].includes(item.OpenType)) {
        return (
          <NormalButton
            key={item.uuid}
            show="actionList"
            show={item.show || 'actionList'}
            disabled={lock || false}
            BID={BID}
            Tab={Tab}
            btn={item}
            BData={BData}
            setting={setting}
            columns={columns}
            MenuName={MenuName}
            ContainerId={ContainerId}
            selectedData={selectedData}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'excelIn') {
        return (
          <ExcelInButton
            key={item.uuid}
            show="actionList"
            BID={BID}
            Tab={Tab}
            btn={item}
            setting={setting}
            MenuName={MenuName}
            selectedData={selectedData}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'excelOut') {
        return (
          <ExcelOutButton
            key={item.uuid}
            show="actionList"
            BID={BID}
            Tab={Tab}
            btn={item}
            setting={setting}
            MenuName={MenuName}
            getexceloutparam={getexceloutparam}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'popview') {
        return (
          <PopupButton
            key={item.uuid}
            show="actionList"
            show={item.show || 'actionList'}
            disabled={lock || false}
            BID={BID}
            Tab={Tab}
            btn={item}
            BData={BData}
            setting={setting}
            selectedData={selectedData}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'tab' || item.OpenType === 'blank') {
      } else if (item.OpenType === 'excelOut') {
        return (
          <ExcelOutButton
            key={item.uuid}
            show={item.show || 'actionList'}
            disabled={lock || false}
            BID={BID}
            Tab={Tab}
            btn={item}
            BData={BData}
            setting={setting}
          />
        )
      } else if (item.OpenType === 'popview') {
        return (
          <PopupButton
            key={item.uuid}
            show={item.show || 'actionList'}
            disabled={lock || false}
            BID={BID}
            Tab={Tab}
            btn={item}
            BData={BData}
            setting={setting}
            selectedData={selectedData}
          />
        )
      } else if (item.OpenType === 'tab') {
        return (
          <TabButton
            key={item.uuid}
            show="actionList"
            show={item.show || 'actionList'}
            disabled={lock || false}
            btn={item}
            BData={BData}
            MenuID={MenuID}
            setting={setting}
            selectedData={selectedData}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') {
        return (
          <NewPageButton
            key={item.uuid}
            show="actionList"
            show={item.show || 'actionList'}
            disabled={lock || false}
            btn={item}
            BData={BData}
            setting={setting}
            selectedData={selectedData}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'funcbutton') {
        if (item.funcType === 'changeuser') {
        if (item.funcType === 'changeuser' || item.funcType === 'closetab') {
          return (
            <ChangeUserButton
              key={item.uuid}
              show="actionList"
              show={item.show || 'actionList'}
              disabled={lock || false}
              BID={BID}
              btn={item}
              BData={BData}
              MenuID={MenuID}
              setting={setting}
              selectedData={selectedData}
              updateStatus={this.updateStatus}
            />
          )
        } else if (item.funcType === 'print') {
          return (
            <PrintButton
              key={item.uuid}
              show="actionList"
              show={item.show || 'actionList'}
              disabled={lock || false}
              BID={BID}
              Tab={Tab}
              btn={item}
@@ -160,7 +150,32 @@
              setting={setting}
              ContainerId={ContainerId}
              selectedData={selectedData}
              updateStatus={this.updateStatus}
            />
          )
        } else if (item.funcType === 'megvii') {
          return (
            <FuncMegvii
              key={item.uuid}
              show={item.show || 'actionList'}
              disabled={lock || false}
              BID={BID}
              Tab={Tab}
              btn={item}
              setting={setting}
              selectedData={selectedData}
            />
          )
        } else if (item.funcType === 'filezip') {
          return (
            <FuncZip
              key={item.uuid}
              show={item.show || 'actionList'}
              disabled={lock || false}
              BID={BID}
              Tab={Tab}
              btn={item}
              setting={setting}
              selectedData={selectedData}
            />
          )
        }
@@ -173,7 +188,7 @@
    const { setting, MenuID, actions } = this.props
    let fixed = setting.actionfixed && setting.tabType === 'main' // 按钮是否固定在头部
    if (fixed) {
    if (fixed && MenuID) {
      return (
        <Affix offsetTop={48}>
          <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}>