king
2020-04-03 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa
src/templates/comtableconfig/index.jsx
@@ -4,34 +4,37 @@
import { is, fromJS } from 'immutable'
import { DndProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip } from 'antd'
import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch, Tooltip, message } from 'antd'
import moment from 'moment'
import Api from '@/api'
import Utils from '@/utils/utils.js'
import options from '@/store/options.js'
import zhCN from '@/locales/zh-CN/comtable.js'
import enUS from '@/locales/en-US/comtable.js'
import { getSearchForm, getActionForm, getColumnForm } from '@/templates/tableshare/formconfig'
import { getSearchForm, getActionForm, getColumnForm } from '@/templates/zshare/formconfig'
import { queryTableSql } from '@/utils/option.js'
import ActionForm from './actionform'
import SettingForm from './settingform'
import TabForm from '@/templates/tableshare/tabform'
import SearchForm from '@/templates/tableshare/searchform'
import ColumnForm from '@/templates/tableshare/columnform'
import PasteForm from '@/templates/tableshare/pasteform'
import DragElement from '@/templates/tableshare/dragelement'
import ColspanForm from '@/templates/tableshare/colspanform'
import GridBtnForm from '@/templates/tableshare/gridbtnform'
import EditCard from '@/templates/tableshare/editcard'
import VerifyCard from '@/templates/tableshare/verifycard'
import VerifyCardExcelIn from '@/templates/tableshare/verifycardexcelin'
import VerifyCardExcelOut from '@/templates/tableshare/verifycardexcelout'
import VerifyCardPrint from '@/templates/tableshare/verifycardprint'
import MenuForm from '@/templates/tableshare/menuform'
import TabDragElement from '@/templates/tableshare/tabdragelement'
import TabForm from '@/templates/zshare/tabform'
import SearchForm from '@/templates/zshare/searchform'
import ColumnForm from '@/templates/zshare/columnform'
import PasteForm from '@/templates/zshare/pasteform'
import DragElement from '@/templates/zshare/dragelement'
import ColspanForm from '@/templates/zshare/colspanform'
import GridBtnForm from '@/templates/zshare/gridbtnform'
import EditCard from '@/templates/zshare/editcard'
import VerifyCard from '@/templates/zshare/verifycard'
import VerifyCardExcelIn from '@/templates/zshare/verifycardexcelin'
import VerifyCardExcelOut from '@/templates/zshare/verifycardexcelout'
import VerifyCardPrint from '@/templates/zshare/verifycardprint'
import MenuForm from '@/templates/zshare/menuform'
import TabDragElement from '@/templates/zshare/tabdragelement'
import TransferForm from '@/components/transferform'
import SourceElement from '@/templates/tableshare/dragelement/source'
import SourceElement from '@/templates/zshare/dragelement/source'
import CreateFunc from '@/templates/zshare/createfunc'
import CreateInterface from '@/templates/zshare/createinterface'
import Source from './source'
import './index.scss'
@@ -70,14 +73,14 @@
    originActions: null,     // 原始按钮信息,使用已有用户模板
    delActions: [],          // 删除按钮列表
    copyActions: [],         // 复制按钮组
    funcLoading: false,      // 存储过程创建中
    showColumnName: false,   // 显示列字段名控制
    tabviews: [],            // 所有标签页
    profileVisible: false,   // 验证信息模态框
    optionLibs: null,        // 自定义下拉选项库
    thawBtnVisible: false,   // 解冻按钮弹窗
    thawbtnlist: null,       // 解冻按钮列表
    thawButtons: []          // 已选择要解冻的按钮
    thawButtons: [],         // 已选择要解冻的按钮
    activeKey: '0'           // 默认展开基本信息
  }
  /**
@@ -165,6 +168,7 @@
    this.setState({
      config: _config,
      activeKey: menu.activeKey || '0',
      optionLibs: optionLibs,
      originActions: _oriActions,
      originMenu: JSON.parse(JSON.stringify(menu)),
@@ -337,6 +341,12 @@
            }
          })
        })
      } else {
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
      }
    })
  }
@@ -348,6 +358,46 @@
    this.setState = () => {
      return
    }
  }
  /**
   * @description 加载或刷新标签信息
   */
  reloadTab = () => {
    this.setState({
      loading: true,
      tabviews: []
    })
    Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
      if (res.status) {
        this.setState({
          loading: false,
          tabviews: res.UserTemp.map(temp => {
            return {
              uuid: temp.MenuID,
              value: temp.MenuID,
              text: temp.MenuName,
              type: temp.Template,
              MenuNo: temp.MenuNo
            }
          })
        })
        notification.success({
          top: 92,
          message: '刷新成功。',
          duration: 2
        })
      } else {
        this.setState({
          loading: false
        })
        notification.warning({
          top: 92,
          message: res.message,
          duration: 10
        })
      }
    })
  }
  /**
@@ -385,10 +435,12 @@
   * @description 搜索条件编辑,获取搜索条件表单信息
   */
  handleSearch = (card) => {
    const { menu } = this.props
    this.setState({
      modaltype: 'search',
      card: card,
      formlist: getSearchForm(card)
      formlist: getSearchForm(card, menu.roleList)
    })
  }
@@ -413,12 +465,80 @@
   * @description 显示列与合并列编辑,获取表单信息
   */
  handleColumn = (card) => {
    const { menu } = this.props
    if (card.type !== 'colspan') {
      this.setState({
        modaltype: 'columns',
        card: card,
        formlist: getColumnForm(card)
      let menulist = menu.fstMenuList.map(item => {
        return {
          value: item.MenuID,
          label: item.text,
          isLeaf: false
        }
      })
      if ((card.type === 'text' || card.type === 'number') && card.linkmenu && card.linkmenu.length > 0) {
        let _param = {
          func: 'sPC_Get_FunMenu',
          ParentID: card.linkmenu[0],
          systemType: options.systemType,
          debug: 'Y'
        }
        this.setState({
          loading: true
        })
        Api.getSystemConfig(_param).then(result => {
          if (result.status) {
            menulist = menulist.map(item => {
              if (item.value === card.linkmenu[0]) {
                item.children = result.data.map(item => {
                  let submenu = {
                    value: item.ParentID,
                    label: item.MenuNameP,
                    children: item.FunMenu.map(cell => {
                      return {
                        value: cell.MenuID,
                        label: cell.MenuName,
                        MenuID: cell.MenuID,
                        MenuName: cell.MenuName,
                        MenuNo: cell.MenuNo,
                        Ot: cell.Ot,
                        PageParam: cell.PageParam,
                        LinkUrl: cell.LinkUrl
                      }
                    })
                  }
                  submenu.children = submenu.children.filter(cell => cell.MenuID !== menu.MenuID)
                  return submenu
                })
              }
              return item
            })
          } else {
            notification.warning({
              top: 92,
              message: result.message,
              duration: 10
            })
          }
          this.setState({
            loading: false,
            modaltype: 'columns',
            card: card,
            formlist: getColumnForm(card, menu.roleList, menulist)
          })
        })
      } else {
        this.setState({
          modaltype: 'columns',
          card: card,
          formlist: getColumnForm(card, menu.roleList, menulist)
        })
      }
    } else {
      this.setState({
        modaltype: 'colspan',
@@ -579,13 +699,39 @@
          })
        }
        let fieldrepet = false // 字段重复
        let labelrepet = false // 提示文字重复
        let _search = config.search.map(item => {
          if (item.uuid !== res.uuid && item.field === res.field) {
            fieldrepet = true
          } else if (item.uuid !== res.uuid && item.field && item.label === res.label) {
            labelrepet = true
          }
          if (item.uuid === res.uuid) {
            return res
          } else {
            return item
          }
        })
        if (fieldrepet) {
          notification.warning({
            top: 92,
            message: '字段已存在!',
            duration: 10
          })
          return
        } else if (labelrepet) {
          notification.warning({
            top: 92,
            message: '名称已存在!',
            duration: 10
          })
          return
        }
        _search = _search.filter(item => !item.origin)
        this.setState({
@@ -768,13 +914,39 @@
      })
    } else if (modaltype === 'columns' || modaltype === 'colspan') {
      this.columnFormRef.handleConfirm().then(res => {
        let fieldrepet = false // 字段重复
        let labelrepet = false // 提示文字重复
        let _columns = config.columns.map(item => {
          if (item.uuid !== res.uuid && item.field === res.field) {
            fieldrepet = true
          } else if (item.uuid !== res.uuid && item.field && item.label === res.label) {
            labelrepet = true
          }
          if (item.uuid === res.uuid) {
            return res
          } else {
            return item
          }
        })
        if (fieldrepet) {
          notification.warning({
            top: 92,
            message: '字段已存在!',
            duration: 10
          })
          return
        } else if (labelrepet) {
          notification.warning({
            top: 92,
            message: '名称已存在!',
            duration: 10
          })
          return
        }
        _columns = _columns.filter(item => !item.origin)
        this.setState({
@@ -814,7 +986,7 @@
  editModalCancel = () => {
    const { config, card, modaltype } = this.state
    if (card.focus) {
    if (card && card.focus) {
      let _config = null
      if (modaltype === 'search') {
        let _search = config.search.filter(item => item.uuid !== card.uuid)
@@ -856,9 +1028,6 @@
      let btn = res         // 按钮信息
      let newLText = ''     // 创建存储过程sql
      let DelText = ''      // 删除存储过程sql
      let isExit = false    // 存储过程是否存在
      let sysTVPText = ''   // 已有的存储过程语句(云端)
      let localTVPText = '' // 已有的存储过程语句(本地)
      // 创建存储过程,必须填写内部函数名
      if (!btn.innerFunc) {
@@ -869,11 +1038,6 @@
        })
        return
      }
      // 创建中
      this.setState({
        funcLoading: true
      })
      new Promise(resolve => {
        // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。
@@ -913,12 +1077,12 @@
              DelText = Utils.formatOptions(Utils.dropfunc(_param.funcName))
              resolve(true)
            } else {
              resolve(false)
              notification.warning({
                top: 92,
                message: '弹窗(表单)按钮,请先配置表单信息!',
                duration: 10
              })
              resolve(false)
            }
          })
        } else if (btn.OpenType === 'excelIn') {
@@ -958,208 +1122,43 @@
          resolve(true)
        }
      }).then(res => {
        // 获取云端及本地,是否已存在该存储过程的信息
        if (res === false) return res
        if (!res) return
        let sysDefer = new Promise(resolve => {
          Api.getSystemConfig({
            func: 'sPC_Get_TVP', // 云端获取存储结果
            TVPName: btn.innerFunc
          }).then(result => {
            resolve(result)
          })
        })
        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
          if (result !== 'success') return
        let localDefer = new Promise(resolve => {
          let _param = { // 获取本地存储过程信息
            func: 's_get_userproc',
            LText: btn.innerFunc
          }
          _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
          _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
          Api.getLocalConfig(_param).then(result => {
            resolve(result)
          })
        })
        return Promise.all([sysDefer, localDefer])
      }).then(res => {
        // 云端结果与新语句不同时,更新云端信息
        if (res === false) return res
        let isError = false
        res.forEach((result, index) => {
          if (!result.status) {
            notification.warning({
              top: 92,
              message: result.message,
              duration: 10
            })
            isError = true
          } else if (index === 0) {
            sysTVPText = result.TVPText
          } else {
            if (result.Ltext) { // 本地存储过程是否存在
              isExit = true
          let _action = config.action.map(item => {
            if (item.uuid === btn.uuid) {
              return btn
            } else {
              return item
            }
            localTVPText = Utils.formatOptions(result.Ltext)
          }
        })
        if (isError) return false
        if ((newLText === localTVPText) && (newLText === sysTVPText)) {
          return 'drop'
        } else if (!localTVPText || (localTVPText === sysTVPText)) {
          // 本地存储过程不存在,将新的存储过程更新至云端
          return Api.getSystemConfig({
            func: 'sPC_TVP_InUp',
            TVPName: btn.innerFunc,
            TVPText: newLText,
            TypeName: 'P'
          })
        } else {
          return new Promise(resolve => {
            Api.getSystemConfig({ // 添加现有的本地存储过程至云端
              func: 'sPC_TVP_InUp',
              TVPName: btn.innerFunc,
              TVPText: localTVPText,
              TypeName: 'P'
            }).then(result => {
              if (result.status) {
                Api.getSystemConfig({
                  func: 'sPC_TVP_InUp', // 添加最新的存储过程至云端
                  TVPName: btn.innerFunc,
                  TVPText: newLText,
                  TypeName: 'P'
                }).then(response => {
                  resolve(response)
                })
              } else {
                resolve(result)
              }
            })
          })
        }
      }).then(res => {
        // 云端信息更新后,判断是删除或是直接新建存储过程
        if (res === false || res === 'drop') return res
          _action = _action.filter(item => !item.origin)
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else if (isExit) {
          return 'drop'
        } else {
          return 'create'
        }
      }).then(res => {
        // 删除存储过程
        if (res === false || res === 'create') return res
          // 判断是否存在操作列
          let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0
          let _gridBtn = config.gridBtn
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: DelText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 根据上述操作结果,判断是否新建存储过程
        if (res === false || res === 'create') return res
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else {
          return 'create'
        }
      }).then(res => {
        // 新建存储过程
        if (res === false) return res
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: newLText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 处理新建结果
        if (res === false) return res
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else {
          notification.success({
            top: 92,
            message: '创建成功',
            duration: 2
          })
          return true
        }
      }).then(res => {
        // 新建成功后,更新页面按钮信息
        if (res === false) {
          this.setState({
            funcLoading: false
          })
          return
        }
        let _action = config.action.map(item => {
          if (item.uuid === btn.uuid) {
            return btn
          if (_gridBtn) {
            _gridBtn.display = _hasGridbtn
          } else {
            return item
            _gridBtn = {
              display: _hasGridbtn,
              Align: 'center',
              IsSort: 'false',
              uuid: Utils.getuuid(),
              label: this.state.dict['header.form.column.action'],
              type: 'action',
              style: 'button',
              show: 'horizontal',
              Width: 120
            }
          }
        })
        _action = _action.filter(item => !item.origin)
        // 判断是否存在操作列
        let _hasGridbtn = _action.filter(act => act.position === 'grid').length > 0
        let _gridBtn = config.gridBtn
        if (_gridBtn) {
          _gridBtn.display = _hasGridbtn
        } else {
          _gridBtn = {
            display: _hasGridbtn,
            Align: 'center',
            IsSort: 'false',
            uuid: Utils.getuuid(),
            label: this.state.dict['header.form.column.action'],
            type: 'action',
            style: 'button',
            show: 'horizontal',
            Width: 120
          }
        }
        this.setState({
          config: {...config, action: _action, gridBtn: _gridBtn},
          funcLoading: false
          this.setState({
            config: {...config, action: _action, gridBtn: _gridBtn}
          })
        })
      })
    })
@@ -1170,10 +1169,10 @@
   */
  tableCreatFunc = () => {
    const { menu } = this.props
    let config = JSON.parse(JSON.stringify(this.state.config))
    const { config } = this.state
    this.settingRef.handleConfirm().then(res => {
      const setting = res
    this.settingRef.handleConfirm().then(setting => {
      if (!(setting.interType === 'inner') || !setting.innerFunc) {
        notification.warning({
          top: 92,
@@ -1183,205 +1182,77 @@
        return
      }
      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
        let param = {
          func: 's_DataSrc_Save',
          LText: setting.dataresource,
          MenuID: menu.MenuID
        }
        param.LText = Utils.formatOptions(param.LText)
        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
        Api.getLocalConfig(param)
      }
      this.setState({
        funcLoading: true
      })
      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, config)) // 创建存储过程sql
      let _config = {...config, setting: setting}
      let newLText = Utils.formatOptions(Utils.getTableFunc(setting, menu, _config)) // 创建存储过程sql
      let DelText = Utils.formatOptions(Utils.dropfunc(setting.innerFunc))          // 删除存储过程sql
      new Promise(resolve => {
        let sysDefer = new Promise(resolve => {
          Api.getSystemConfig({
            func: 'sPC_Get_TVP', // 云端获取存储结果
            TVPName: setting.innerFunc
          }).then(result => {
            if (!result.status) {
              notification.warning({
                top: 92,
                message: result.message,
                duration: 10
              })
              resolve(false)
            } else {
              resolve(result)
            }
          })
        })
        let localDefer = new Promise(resolve => {
          let _param = { // 获取本地存储过程信息
            func: 's_get_userproc',
            LText: setting.innerFunc
          }
          _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
          _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
          Api.getLocalConfig(_param).then(result => {
            if (!result.status) {
              notification.warning({
                top: 92,
                message: result.message,
                duration: 10
              })
              resolve(false)
            } else {
              resolve(result)
            }
          })
        })
        Promise.all([sysDefer, localDefer]).then(result => {
          resolve(result)
        })
      }).then(res => {
        // 获取云端及本地,是否已存在该存储过程的信息
        if (res === false) return res
        if (res[0] === false || res[1] === false) return false
        let cloudfunc = ''
        let localfunc = ''
        res.forEach((item, index) => {
          if (index === 0 && item.TVPText) {
            cloudfunc = item.TVPText
          } else if (index === 1 && item.Ltext) {
            localfunc = Utils.formatOptions(item.Ltext)
          }
        })
        if ((newLText === localfunc) && (newLText === cloudfunc)) {
          return 'drop'
        } else if (!localfunc || (cloudfunc === localfunc)) {
          // 本地存储过程不存在,或云端和本地存储过程一致时,将新的存储过程更新至云端
          return Api.getSystemConfig({
            func: 'sPC_TVP_InUp',
            TVPName: setting.innerFunc,
            TVPText: newLText,
            TypeName: 'P'
          })
        } else {
          return new Promise(resolve => {
            Api.getSystemConfig({ // 添加现有的本地存储过程至云端
              func: 'sPC_TVP_InUp',
              TVPName: setting.innerFunc,
              TVPText: localfunc,
              TypeName: 'P'
            }).then(result => {
              if (result.status) {
                Api.getSystemConfig({
                  func: 'sPC_TVP_InUp', // 添加最新的存储过程至云端
                  TVPName: setting.innerFunc,
                  TVPText: newLText,
                  TypeName: 'P'
                }).then(response => {
                  resolve(response)
                })
              } else {
                resolve(result)
              }
            })
          })
        }
      }).then(res => {
        // 云端信息更新后,判断是删除或是直接新建存储过程
        if (res === false || res === 'drop') return res
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else {
          return 'create'
        }
      }).then(res => {
        // 删除存储过程
        if (res === false || res === 'create') return res
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: DelText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 根据上述操作结果,判断是否新建存储过程
        if (res === false || res === 'create') return res
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else {
          return 'create'
        }
      }).then(res => {
        // 新建存储过程
        if (res === false) return res
        let _param = {
          func: 'sPC_TableData_InUpDe',
          LText: newLText,
          TypeCharOne: 'proc' // 删除或创建存储过程
        }
        _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp)
        return Api.getLocalConfig(_param)
      }).then(res => {
        // 处理新建结果
        if (res === false) return res
        if (!res.status) {
          notification.warning({
            top: 92,
            message: res.message,
            duration: 10
          })
          return false
        } else {
          notification.success({
            top: 92,
            message: '创建成功',
            duration: 2
          })
          return true
        }
      }).then(res => {
        // 新建成功后,更新页面按钮信息
        if (res === false) {
      this.refs.tableCreatFunc.exec(setting.innerFunc, newLText, DelText).then(result => {
        if (result === 'success') {
          this.setState({
            funcLoading: false
            config: _config
          })
        }
      })
    })
  }
  /**
   * @description 创建按钮接口(写入)
   */
  btnCreatInterface = () => {
    const { menu } = this.props
    const { config } = this.state
    this.menuformRef.handleConfirm().then(res => {
      this.actionFormRef.handleConfirm().then(result => {
        if (!['pop', 'exec', 'prompt'].includes(result) || result.funcType || result.intertype !== 'inner' || result.innerFunc ) {
          notification.warning({
            top: 92,
            message: '打开方式为 弹窗(表单)、提示框或直接执行,且使用系统函数时,才可以创建接口!',
            duration: 10
          })
          return
        }
        this.setState({
          config: {...config, setting: setting}
        })
        let _menu = {
          type: 'main',
          MenuID: menu.MenuID,
          menuName: res.menuName,
          menuNo: res.menuNo
        }
        this.refs.btnCreatInterface.triggerInInterface(result, config, _menu)
      })
    })
  }
  /**
   * @description 创建表格接口(读出)
   */
  tableCreatInterface = () => {
    const { menu } = this.props
    const { config } = this.state
    this.menuformRef.handleConfirm().then(res => {
      this.settingRef.handleConfirm().then(setting => {
        if (setting.interType !== 'inner' || setting.innerFunc) {
          notification.warning({
            top: 92,
            message: '接口类型为-内部,且不存在内部函数时,才可以创建接口!',
            duration: 10
          })
          return
        }
        let _config = {...config, setting: setting}
        let _menu = {
          type: 'main',
          MenuID: menu.MenuID,
          menuName: res.menuName,
          menuNo: res.menuNo
        }
        this.refs.tableCreatInterface.triggerOutInterface(_menu, _config)
      })
    })
  }
@@ -1447,6 +1318,21 @@
      profileVisible: true,
      card: element
    })
  }
  /**
   * @description 按钮双击触发子配置
   */
  btnDoubleClick = (element) => {
    if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) {
      this.setSubConfig(element, 'button')
    } else {
      notification.warning({
        top: 92,
        message: '此按钮无子配置项!',
        duration: 10
      })
    }
  }
  /**
@@ -1760,6 +1646,7 @@
        }
  
        let _sort = 0
        let btntabs = []
        let btnParam = {             // 添加菜单按钮
          func: 'sPC_Button_AddUpt',
@@ -1769,11 +1656,22 @@
          Template: menu.PageParam.Template || '',
          PageParam: '',
          LongParam: '',
          LText: _config.action.map(item => {
            _sort++
            return `select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`
          })
          LText: []
        }
        _config.action.forEach(item => {
          _sort++
          if (item.OpenType === 'popview') {
            btntabs.push({
              uuid: item.uuid,
              linkTab: item.linkTab,
              label: item.label,
              sort: _sort
            })
          }
          btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${_sort * 10}' as Sort`)
        })
  
        btnParam.LText = btnParam.LText.join(' union all ')
        btnParam.LText = Utils.formatOptions(btnParam.LText)
@@ -1787,6 +1685,9 @@
        let _LText = []
        btntabs.forEach(item => {
          _LText.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${item.sort * 10}' as Sort`)
        })
        _config.tabgroups.forEach(groupId => {
          _config[groupId].forEach(item => {
            _sort++
@@ -1818,6 +1719,10 @@
          LTexttb: _tables.map(item => `select '${menu.MenuID}' as MenuID,'${item}' as tbName`)
        }
        if (menu.menuSort) { // 菜单新建时设置排序
          param.Sort = menu.menuSort
        }
        param.LText = param.LText.join(' union all ')
        param.LText = Utils.formatOptions(param.LText)
        param.LTexttb = param.LTexttb.join(' union all ')
@@ -1845,7 +1750,7 @@
                  _ParentParam = null
                }
                if (_ParentParam) {
                if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮
                  _param.ParentParam = _ParentParam
                }
              }
@@ -2523,7 +2428,7 @@
   */
  setSubConfig = (item, type) => {
    const { menu } = this.props
    const { config, originMenu, optionLibs } = this.state
    const { config, originMenu, optionLibs, activeKey } = this.state
    if (!originMenu.MenuID) { // menuID不存在时,为新建菜单,提示菜单尚未保存
      notification.warning({
@@ -2574,6 +2479,9 @@
          uuid = item.linkTab
          isbutton = false
        }
        // 保存当前打开页签
        _originMenu.activeKey = activeKey
        let param = {
          optionLibs: optionLibs,
@@ -2864,6 +2772,27 @@
    })
  }
  copycolumn = () => {
    const { config } = this.state
    let oInput = document.createElement('input')
    let val = {
      copyType: 'columns',
      columns: config.columns
    }
    oInput.value = window.btoa(window.encodeURIComponent(JSON.stringify(val)))
    document.body.appendChild(oInput)
    oInput.select()
    document.execCommand('Copy')
    oInput.className = 'oInput'
    oInput.style.display = 'none'
    message.success('复制成功。')
    document.body.removeChild(oInput)
  }
  /**
   * @description 选择不保存时,如有复制按钮,则删除
   */
@@ -2879,43 +2808,64 @@
  }
  pasteSubmit = () => {
    const { config } = this.state
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType !== 'action') {
      if (res.copyType === 'action') {
        this.setState({
          modaltype: ''
        }, () => {
          this.handleAction(res, 'copy')
        })
      } else if (res.copyType === 'columns') {
        if (config.columns && config.columns.length > 0) {
          notification.warning({
            top: 92,
            message: '显示列已存在!',
            duration: 10
          })
          return
        }
        this.setState({
          modaltype: '',
          config: {...config, columns: res.columns}
        })
      } else {
        notification.warning({
          top: 92,
          message: '配置信息格式错误!',
          duration: 10
        })
        return
      }
      this.setState({
        modaltype: ''
      }, () => {
        this.handleAction(res, 'copy')
      })
    })
  }
  render () {
    const { modaltype } = this.state
    const configAction = this.state.config.action.filter(_action =>
    const { modaltype, activeKey, config } = this.state
    const configAction = config.action.filter(_action =>
      !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab')
    )
    let configTabs = []
    this.state.config.tabgroups.forEach(group => {
      configTabs.push(...this.state.config[group])
    config.tabgroups.forEach(group => {
      configTabs.push(...config[group])
    })
    let hasbtncrtinter = false
    if (modaltype === 'actionEdit' && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) {
      hasbtncrtinter = true
    }
    return (
      <div className="common-table-board">
        <DndProvider backend={HTML5Backend}>
          {/* 工具栏 */}
          <div className="tools">
            <Collapse accordion defaultActiveKey="0" bordered={false}>
            <Collapse accordion defaultActiveKey={activeKey} bordered={false} onChange={(key) => this.setState({activeKey: key})}>
              {/* 基本信息 */}
              <Panel header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata">
              <Panel forceRender={true} header={this.state.dict['header.menu.basedata']} key="0" id="common-basedata">
                {/* 菜单信息 */}
                <MenuForm
                  dict={this.state.dict}
@@ -3042,7 +2992,12 @@
            </Collapse>
          </div>
          <div className="setting">
            <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
            <Card title={
              <div>
                {this.state.dict['header.menu.page.configurable']}
                <Icon type="redo" style={{marginLeft: '10px'}} title="刷新标签列表" onClick={this.reloadTab} />
              </div>
            } bordered={false} extra={
              <div>
                <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={this.state.config.enabled} onChange={this.onEnabledChange} />
                <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button>
@@ -3057,7 +3012,7 @@
                </Tooltip>
                <DragElement
                  type="search"
                  list={this.state.config.search}
                  list={config.search}
                  handleList={this.handleList}
                  handleMenu={this.handleSearch}
                  deleteMenu={this.deleteElement}
@@ -3073,13 +3028,14 @@
                </div>
                <DragElement
                  type="action"
                  list={this.state.config.action}
                  setting={this.state.config.setting}
                  list={config.action}
                  setting={config.setting}
                  handleList={this.handleList}
                  handleMenu={this.handleAction}
                  copyElement={(val) => this.handleAction(val, 'copy')}
                  deleteMenu={this.deleteElement}
                  profileMenu={this.profileAction}
                  doubleClickCard={this.btnDoubleClick}
                  placeholder={this.state.dict['header.form.action.placeholder']}
                />
              </div>
@@ -3088,12 +3044,13 @@
                <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《显示列》中,选择对应类型的显示列拖至此处添加;或点击《添加显示列》按钮批量添加,选择批量添加时,需提前选择使用表。注:添加合并列时,需设置可选列。">
                  <Icon type="question-circle" />
                </Tooltip>
                {config.columns && config.columns.length > 0 ? <Icon className="column-copy" title="copy" type="copy" onClick={this.copycolumn} /> : null}
                <Switch checkedChildren="开" unCheckedChildren="关" defaultChecked={this.state.showColumnName} onChange={this.onColumnNameChange} />
                <DragElement
                  type="columns"
                  list={this.state.config.columns}
                  setting={this.state.config.setting}
                  gridBtn={this.state.config.gridBtn}
                  list={config.columns}
                  setting={config.setting}
                  gridBtn={config.gridBtn}
                  handleList={this.handleList}
                  handleMenu={this.handleColumn}
                  deleteMenu={this.deleteElement}
@@ -3103,13 +3060,13 @@
                />
              </div>
              {/* 标签组 */}
              {this.state.config.tabgroups.map((groupId, index) => {
              {config.tabgroups.map((groupId, index) => {
                return (
                  <div key={index} className="tab-list">
                    {index === 0 ? <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《标签页》中,选择对应类型的标签页拖至此处添加。">
                      <Icon type="question-circle" />
                    </Tooltip> : null}
                    {index !== (this.state.config.tabgroups.length - 1) ?
                    {index !== (config.tabgroups.length - 1) ?
                      <Icon type="arrow-down" onClick={() => {this.handleGroup(index, 'down')}} /> : null
                    }
                    {index !== 0 ? <Icon type="arrow-up" onClick={() => {this.handleGroup(index, 'up')}} /> : null}
@@ -3118,10 +3075,11 @@
                    <TabDragElement
                      type="tabs"
                      groupId={groupId}
                      list={this.state.config[groupId]}
                      list={config[groupId]}
                      handleList={this.handleList}
                      handleMenu={this.handleTab}
                      deleteMenu={this.deleteElement}
                      doubleClickCard={(tab) => this.setSubConfig(tab, 'tab')}
                      placeholder={this.state.dict['header.form.tab.placeholder']}
                    />
                  </div>)
@@ -3156,7 +3114,8 @@
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            modaltype === 'actionEdit' ? <Button key="delete" className="mk-btn mk-purple" onClick={this.creatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button> : null,
            hasbtncrtinter ? <CreateInterface key="interface" dict={this.state.dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null,
            modaltype === 'actionEdit' ? <CreateFunc key="create" dict={this.state.dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>{this.state.dict['header.cancel']}</Button>,
            <Button key="confirm" type="primary" onClick={this.handleSubmit}>{this.state.dict['header.confirm']}</Button>
          ]}
@@ -3168,7 +3127,7 @@
            tabs={this.state.tabviews}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            setting={this.state.config.setting}
            setting={config.setting}
            wrappedComponentRef={(inst) => this.actionFormRef = inst}
          />
        </Modal>
@@ -3185,6 +3144,7 @@
          <ColumnForm
            dict={this.state.dict}
            card={this.state.card}
            MenuID={this.props.menu.MenuID}
            inputSubmit={this.handleSubmit}
            formlist={this.state.formlist}
            wrappedComponentRef={(inst) => this.columnFormRef = inst}
@@ -3204,7 +3164,7 @@
            dict={this.state.dict}
            card={this.state.card}
            inputSubmit={this.handleSubmit}
            columns={this.state.config.columns}
            columns={config.columns}
            wrappedComponentRef={(inst) => this.columnFormRef = inst}
          />
        </Modal>
@@ -3221,7 +3181,7 @@
          <GridBtnForm
            dict={this.state.dict}
            inputSubmit={this.handleSubmit}
            card={this.state.config.gridBtn}
            card={config.gridBtn}
            wrappedComponentRef={(inst) => this.gridBtnFormRef = inst}
          />
        </Modal>
@@ -3286,7 +3246,7 @@
            <VerifyCard
              card={this.state.card}
              dict={this.state.dict}
              columns={this.state.config.columns}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
@@ -3294,7 +3254,7 @@
            <VerifyCardPrint
              card={this.state.card}
              dict={this.state.dict}
              columns={this.state.config.columns}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
@@ -3302,7 +3262,7 @@
            <VerifyCardExcelIn
              card={this.state.card}
              dict={this.state.dict}
              columns={this.state.config.columns}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
@@ -3320,14 +3280,14 @@
          visible={this.state.settingVisible}
          width={700}
          maskClosable={false}
          // onOk={this.settingSave}
          onCancel={() => { // 取消修改
            this.setState({
              settingVisible: false
            })
          }}
          footer={[
            <Button key="delete" className="mk-btn mk-purple" onClick={this.tableCreatFunc} loading={this.state.funcLoading}>{this.state.dict['header.menu.func.create']}</Button>,
            <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>,
            <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>,
            <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>,
            <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
          ]}
@@ -3337,8 +3297,8 @@
            dict={this.state.dict}
            menu={this.props.menu}
            inputSubmit={this.settingSave}
            data={this.state.config.setting}
            columns={this.state.config.columns}
            data={config.setting}
            columns={config.columns}
            usefulFields={this.props.permFuncField}
            wrappedComponentRef={(inst) => this.settingRef = inst}
          />
@@ -3369,7 +3329,7 @@
          destroyOnClose
        >
          {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />}
          {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawbtnlist}/>}
          {this.state.thawbtnlist && <TransferForm ref="trawmenu" menulist={this.state.thawbtnlist}/>}
        </Modal>
        {/* 按钮配置信息粘贴复制 */}
        <Modal