king
2024-08-25 326aa6b3effaccc71cfe0775d47b0f29eb3695a6
src/templates/subtableconfig/index.jsx
@@ -1,18 +1,14 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { DndProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
import { Button, Card, Modal, Collapse, notification, Spin, Switch, Tooltip, Col } from 'antd'
import { Button, Card, Collapse, notification, Spin, Tooltip, Col } from 'antd'
import { QuestionCircleOutlined, RedoOutlined } from '@ant-design/icons'
import moment from 'moment'
// import moment from 'moment'
import Api from '@/api'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import Utils from '@/utils/utils.js'
import MKEmitter from '@/utils/events.js'
import { updateSubTable } from '@/utils/utils-update.js'
import asyncComponent from '@/utils/asyncComponent'
@@ -26,11 +22,11 @@
import './index.scss'
const { Panel } = Collapse
const { confirm } = Modal
// const { confirm } = Modal
const Versions = asyncComponent(() => import('@/menu/versions'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
// const Versions = asyncComponent(() => import('@/menu/versions'))
// const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
// const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent'))
const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
const FieldsComponent = asyncComponent(() => import('@/templates/sharecomponent/fieldscomponent'))
@@ -51,7 +47,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,        // 字典
    config: null,            // 页面配置
    visible: false,          // 搜索条件、按钮、显示列,模态框显示控制
    menuloading: false,      // 菜单保存中
@@ -63,10 +58,9 @@
    delActions: [],          // 删除按钮列表
    copyActions: [],         // 复制按钮组
    tabviews: [],            // 所有标签页
    thawButtons: [],         // 已选择要解冻的按钮
    activeKey: '0',          // 默认展开基本信息
    chartview: null,         // 当前视图
    openEdition: ''          // 编辑版本标记,防止多人操作
    openEdition: '',         // 编辑版本标记,防止多人操作
  }
  /**
@@ -118,7 +112,7 @@
    this.setState({
      openEdition: editSubTab ? (editSubTab.open_edition || '') : (editTab.open_edition || ''),
      chartview: _config.charts[0].uuid,
      chartview: _config.charts ? _config.charts[0].uuid : '',
      originActions: _oriActions,
      config: _config,
      activeKey: _activeKey || '0',
@@ -133,6 +127,54 @@
   */
  componentDidMount () {
    this.reloadTab(false)
    document.onkeydown = (event) => {
      let e = event || window.event
      let keyCode = e.keyCode || e.which || e.charCode
      let preKey = ''
      if (e.ctrlKey) {
        preKey = 'ctrl'
      }
      if (e.shiftKey) {
        preKey = 'shift'
      } else if (e.altKey) {
        preKey = 'alt'
      }
      if (!preKey || !keyCode) return
      let _shortcut = `${preKey}+${keyCode}`
      if (_shortcut === 'ctrl+83') {
        let modals = document.querySelectorAll('.mk-pop-modal')
        let msg = null
        for (let i = 0; i < modals.length; i++) {
          if (msg) {
            break
          }
          let node = modals[i].querySelector('.mk-com-name')
          if (node) {
            msg = node.innerText
          }
        }
        if (msg) {
          notification.warning({
            top: 92,
            message: '请保存' + msg,
            duration: 5
          })
          return false
        }
        let node = document.getElementById('save-config')
        if (node && node.click) {
          node.click()
        }
        return false
      }
    }
  }
  /**
@@ -143,7 +185,7 @@
      loading: type,
      tabviews: []
    })
    Api.getSystemConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
    Api.getCloudConfig({func: 'sPC_Get_UserTemp', TypeCharTwo: 'tab'}).then(res => {
      if (res.status) {
        let _tabviews = []
        res.UserTemp.forEach(temp => {
@@ -192,6 +234,7 @@
    this.setState = () => {
      return
    }
    document.onkeydown = () => {}
  }
  // 页面返回
@@ -230,7 +273,7 @@
        func: 'sPC_MainMenu_Del',
        MenuID: item
      }
      Api.getSystemConfig(_param)
      Api.getCloudConfig(_param)
    })
    this.props.handleView(param)
@@ -239,421 +282,332 @@
  /**
   * @description 标签页保存
   */
  submitConfig = () => {
    const { delActions, thawButtons, openEdition } = this.state
    let _config = fromJS(this.state.config).toJS()
    let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig
  // submitConfig = () => {
  //   const { delActions, openEdition } = this.state
  //   let _config = fromJS(this.state.config).toJS()
  //   let copyreg = /\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/ig
    // 基本信息验证
    if (!_config.tabName || !_config.tabNo) {
      notification.warning({
        top: 92,
        message: this.state.dict['model.menu.basemsg'],
        duration: 5
      })
      this.setState({activeKey: '0'})
      return
    }
  //   // 基本信息验证
  //   if (!_config.tabName || !_config.tabNo) {
  //     notification.warning({
  //       top: 92,
  //       message: '请完善菜单基本信息!',
  //       duration: 5
  //     })
  //     this.setState({activeKey: '0'})
  //     return
  //   }
    if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) {
      notification.warning({
        top: 92,
        message: '此标签为复制标签,请修改标签名称和标签参数,不可以时间格式 YYYY-MM-DD HH:mm:ss 结尾!',
        duration: 5
      })
      return
    }
  //   if (copyreg.test(_config.tabNo) || copyreg.test(_config.tabName)) {
  //     notification.warning({
  //       top: 92,
  //       message: '此标签为复制标签,请修改标签名称和标签参数,不可以时间格式 YYYY-MM-DD HH:mm:ss 结尾!',
  //       duration: 5
  //     })
  //     return
  //   }
    if (_config.isAdd) {
      if (_config.search[0] && _config.search[0].origin) {
        _config.search = _config.search.filter(item => !item.origin)
      }
      if (_config.action[0] && _config.action[0].origin) {
        _config.action = _config.action.filter(item => !item.origin)
      }
      if (_config.columns[0] && _config.columns[0].origin) {
        _config.columns = _config.columns.filter(item => !item.origin)
      }
    }
  //   if (_config.isAdd) {
  //     if (_config.search[0] && _config.search[0].origin) {
  //       _config.search = _config.search.filter(item => !item.origin)
  //     }
  //     if (_config.action[0] && _config.action[0].origin) {
  //       _config.action = _config.action.filter(item => !item.origin)
  //     }
  //     if (_config.columns[0] && _config.columns[0].origin) {
  //       _config.columns = _config.columns.filter(item => !item.origin)
  //     }
  //   }
    if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) {
      _config.setting.doubleClick = ''
    }
  //   if (_config.setting.doubleClick && _config.action.findIndex((item) => item.uuid === _config.setting.doubleClick) === -1) {
  //     _config.setting.doubleClick = ''
  //   }
    // 未设置数据源或主键时,启用状态为false
    let result = this.verifyconfig(_config)
  //   // 未设置数据源或主键时,启用状态为false
  //   let result = this.verifyconfig(_config)
  
    if (result !== true) {
      _config.enabled = false
    }
  //   if (result !== true) {
  //     _config.enabled = false
  //   }
    if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态
      this.setState({
        menucloseloading: true
      })
    } else {
      this.setState({
        menuloading: true
      })
    }
  //   if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态
  //     this.setState({
  //       menucloseloading: true
  //     })
  //   } else {
  //     this.setState({
  //       menuloading: true
  //     })
  //   }
    let _LongParam = ''
    let reload = _config.isAdd
  //   let _LongParam = ''
    // 保存时删除配置类型,system 、user
    delete _config.type
    delete _config.isAdd
  //   // 保存时删除配置类型,system 、user
  //   delete _config.type
  //   delete _config.isAdd
    try {
      _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
    } catch (e) {
      notification.warning({
        top: 92,
        message: '编译错误',
        duration: 5
      })
  //   try {
  //     _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
  //   } catch (e) {
  //     notification.warning({
  //       top: 92,
  //       message: '编译错误',
  //       duration: 5
  //     })
      this.setState({
        menucloseloading: false,
        menuloading: false
      })
      return
    }
  //     this.setState({
  //       menucloseloading: false,
  //       menuloading: false
  //     })
  //     return
  //   }
    let btnParam = {
      func: 'sPC_Button_AddUpt',
      Type: 40,
      ParentID: _config.uuid,
      MenuNo: _config.tabNo,
      Template: 'SubTable',
      PageParam: '',
      LongParam: '',
      LText: []
    }
  //   // let btnParam = {
  //   //   func: 'sPC_Button_AddUpt',
  //   //   Type: 40,
  //   //   ParentID: _config.uuid,
  //   //   MenuNo: _config.tabNo,
  //   //   Template: 'SubTable',
  //   //   PageParam: '',
  //   //   LongParam: '',
  //   //   LText: []
  //   // }
    let btntabs = []
  //   // let btntabs = []
    _config.action.forEach((item, index) => {
      if (item.OpenType === 'popview') {
        btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`)
      }
      btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`)
    })
  //   // _config.action.forEach((item, index) => {
  //   //   if (item.hidden === 'true') return
  //   //   if (item.OpenType === 'popview') {
  //   //     btntabs.push(`select '${item.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`)
  //   //   }
  //   //   btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`)
  //   // })
    btnParam.LText = btnParam.LText.join(' union all ')
    btnParam.LText = Utils.formatOptions(btnParam.LText)
    btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
  //   // btnParam.LText = btnParam.LText.join(' union all ')
  //   // btnParam.LText = Utils.formatOptions(btnParam.LText)
  //   // btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
  //   // btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
    let tabParam = { // 添加标签按钮tab页
      func: 'sPC_sMenusTab_AddUpt',
      MenuID: _config.uuid,
      LText: btntabs.join(' union all ')
    }
  //   // let tabParam = { // 添加标签按钮tab页
  //   //   func: 'sPC_sMenusTab_AddUpt',
  //   //   MenuID: _config.uuid,
  //   //   LText: btntabs.join(' union all ')
  //   // }
    tabParam.LText = Utils.formatOptions(tabParam.LText)
    tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
  //   // tabParam.LText = Utils.formatOptions(tabParam.LText)
  //   // tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
  //   // tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
    let param = {
      func: 'sPC_Tab_AddUpt',
      MenuID: _config.uuid,
      MenuNo: _config.tabNo,
      Template: 'SubTable',
      MenuName: _config.tabName,
      Remark: _config.Remark,
      Sort: 0,
      PageParam: JSON.stringify({Template: 'SubTable'}),
      LongParam: _LongParam
    }
  //   let param = {
  //     func: 'sPC_Tab_AddUpt',
  //     MenuID: _config.uuid,
  //     MenuNo: _config.tabNo,
  //     Template: 'SubTable',
  //     MenuName: _config.tabName,
  //     Remark: _config.Remark,
  //     Sort: 0,
  //     PageParam: JSON.stringify({Template: 'SubTable'}),
  //     LongParam: _LongParam
  //   }
    if (openEdition) {
      param.open_edition = openEdition
    }
  //   if (openEdition) {
  //     param.open_edition = openEdition
  //   }
    // 有按钮或标签删除时,先进行删除操作
    // 删除成功后,保存页面配置
    new Promise(resolve => {
      if (delActions.length > 0) {
        let deffers = delActions.map(item => {
          let _param = {
            func: 'sPC_MainMenu_Del',
            MenuID: item.card.uuid
          }
  //   // 有按钮或标签删除时,先进行删除操作
  //   // 删除成功后,保存页面配置
  //   new Promise(resolve => {
  //     if (delActions.length > 0) {
  //       let deffers = delActions.map(item => {
  //         let _param = {
  //           func: 'sPC_MainMenu_Del',
  //           MenuID: item.card.uuid
  //         }
          let _ParentParam = null
  //         let _ParentParam = null
          try {
            _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
          } catch (e) {
            console.warn('Stringify Failure')
            _ParentParam = null
          }
  //         try {
  //           _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
  //         } catch (e) {
  //           console.warn('Stringify Failure')
  //           _ParentParam = null
  //         }
          if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮
            _param.ParentParam = _ParentParam
          }
  //         if (_ParentParam) { // 删除按钮时,保存按钮配置信息,用于恢复按钮
  //           _param.ParentParam = _ParentParam
  //         }
          return new Promise(resolve => {
            Api.getSystemConfig(_param).then(response => {
              resolve(response)
            })
          })
        })
        Promise.all(deffers).then(result => {
          let error = null
          result.forEach(response => {
            if (!response.status) {
              error = response
            }
          })
  //         return new Promise(resolve => {
  //           Api.getCloudConfig(_param).then(response => {
  //             resolve(response)
  //           })
  //         })
  //       })
  //       Promise.all(deffers).then(result => {
  //         let error = null
  //         result.forEach(response => {
  //           if (!response.status) {
  //             error = response
  //           }
  //         })
          if (error) {
            this.setState({
              menuloading: false,
              menucloseloading: false
            })
            notification.warning({
              top: 92,
              message: error.message,
              duration: 5
            })
            resolve(false)
          } else {
            this.setState({
              delActions: []
            })
            resolve(true)
          }
        })
      } else if (delActions.length === 0) {
        resolve(true)
      }
    }).then(resp => {
      if (resp === false) return
  //         if (error) {
  //           this.setState({
  //             menuloading: false,
  //             menucloseloading: false
  //           })
  //           notification.warning({
  //             top: 92,
  //             message: error.message,
  //             duration: 5
  //           })
  //           resolve(false)
  //         } else {
  //           this.setState({
  //             delActions: []
  //           })
  //           resolve(true)
  //         }
  //       })
  //     } else if (delActions.length === 0) {
  //       resolve(true)
  //     }
  //   }).then(resp => {
  //     if (resp === false) return
      if (thawButtons.length > 0) {
        let defers = thawButtons.map(item => {
          return new Promise((resolve) => {
            Api.getSystemConfig({
              func: 'sPC_MainMenu_ReDel',
              MenuID: item
            }).then(res => {
              if (res.status) {
                resolve('')
              } else {
                resolve(res.message)
              }
            })
          })
        })
  //     return true
  //   }).then(res => {
  //     if (res === true || res === false) return res
        return Promise.all(defers)
      } else {
        return true
      }
    }).then(res => {
      if (res === true || res === false) return res
  //     let msg = res.filter(Boolean)[0]
  //     if (msg) {
  //       notification.warning({
  //         top: 92,
  //         message: msg,
  //         duration: 5
  //       })
  //       return false
  //     } else {
  //       return true
  //     }
  //   }).then(resp => {
  //     if (resp === false) return
      let msg = res.filter(Boolean)[0]
      if (msg) {
        notification.warning({
          top: 92,
          message: msg,
          duration: 5
        })
        return false
      } else {
        this.setState({
          thawButtons: []
        })
        return true
      }
    }).then(resp => {
      if (resp === false) return
      Api.getSystemConfig(param).then(response => {
        if (response.status) {
          this.setState({
            openEdition: response.open_edition || '',
            config: _config,
            originConfig: fromJS(_config).toJS()
          }, () => {
            reload && MKEmitter.emit('revert')
            this.setState({
              menuloading: false,
              menucloseloading: false
            })
            this.submitAction(btnParam, tabParam)
          })
        } else {
          this.setState({
            menuloading: false,
            menucloseloading: false
          })
          notification.warning({
            top: 92,
            message: response.message,
            duration: 5
          })
        }
      })
    })
  }
  //     Api.getCloudConfig(param).then(response => {
  //       if (response.status) {
  //         this.setState({
  //           openEdition: response.open_edition || '',
  //           config: _config,
  //           originConfig: fromJS(_config).toJS()
  //         }, () => {
  //           this.setState({
  //             menuloading: false,
  //             menucloseloading: false
  //           })
  //           notification.success({
  //             top: 92,
  //             message: '保存成功',
  //             duration: 2
  //           })
  //           if (this.state.closeVisible) {
  //             this.handleViewBack()
  //           }
  //         })
  //         this.submitAction()
  //       } else {
  //         this.setState({
  //           menuloading: false,
  //           menucloseloading: false
  //         })
  //         notification.warning({
  //           top: 92,
  //           message: response.message,
  //           duration: 5
  //         })
  //       }
  //     })
  //   })
  // }
  /**
   * @description 保存或修改菜单按钮
   */
  submitAction = (btnParam, tabParam) => {
    const { config } = this.state
  // submitAction = () => {
  //   const { config } = this.state
    new Promise(resolve => {
      let deffers = []
  //   let oriActions = []
  //   this.state.originActions.forEach(item => {
  //     let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在
  //     if (!curBtn) return
  //     if (curBtn.OpenType !== item.prebtn.OpenType) return
  //     if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return
      if (tabParam.LText) {
        let defer = new Promise(resolve => {
          Api.getSystemConfig(tabParam).then(result => {
            resolve(result)
          })
        })
        deffers.push(defer)
      }
  //     oriActions.push({
  //       prebtn: item.prebtn,
  //       curBtn: curBtn
  //     })
  //   })
      if (btnParam.LText) {
        let defer = new Promise(resolve => {
          Api.getSystemConfig(btnParam).then(result => {
            if (result.status) {
              this.setState({ // 保存成功后清空复制列表
                copyActions: []
              })
            }
            resolve(result)
          })
        })
        deffers.push(defer)
      }
  //   if (oriActions.length === 0) return
      if (deffers.length === 0) {
        resolve(true)
      } else {
        Promise.all(deffers).then(result => {
          let error = false
          result.forEach(res => {
            if (!res.status) {
              error = res
            }
          })
  //   oriActions.forEach(action => {
  //     Api.getCloudConfig({
  //       func: 'sPC_Get_LongParam',
  //       MenuID: action.prebtn ? action.prebtn.uuid : ''
  //     }).then(result => {
  //       if (result.status && result.LongParam) {
  //         let _LongParam = ''
          if (error) {
            notification.warning({
              top: 92,
              message: error.message,
              duration: 5
            })
            resolve(false)
          } else {
            resolve(true)
          }
        })
      }
    }).then(response => {
      if (response === false) return response
  //         if (result.LongParam) {
  //           try {
  //             _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
  //           } catch (e) {
  //             console.warn('Parse Failure')
  //             _LongParam = ''
  //           }
  //         }
      let oriActions = []
      this.state.originActions.forEach(item => {
        let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在
        if (!curBtn) return
        if (curBtn.OpenType !== item.prebtn.OpenType) return
        if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return
        oriActions.push({
          prebtn: item.prebtn,
          curBtn: curBtn
        })
      })
      if (oriActions.length === 0) return 'true'
      oriActions.forEach(action => {
        Api.getSystemConfig({
          func: 'sPC_Get_LongParam',
          MenuID: action.prebtn ? action.prebtn.uuid : ''
        }).then(result => {
          if (result.status && result.LongParam) {
            let _LongParam = ''
            if (result.LongParam) {
              try {
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
            if (_LongParam) {
              let param = {
                func: 'sPC_ButtonParam_AddUpt',
                ParentID: config.uuid,
                MenuID: action.curBtn.uuid,
                MenuNo: config.tabNo,
                Template: _LongParam.type,
                MenuName: action.curBtn.label,
                PageParam: JSON.stringify({Template: _LongParam.type}),
                LongParam: result.LongParam
              }
              Api.getSystemConfig(param).then(() => {})
            }
          }
        })
      })
      return 'true'
    }).then(response => {
      if (response === 'true') {
        notification.success({
          top: 92,
          message: '保存成功',
          duration: 2
        })
        if (this.state.closeVisible) {
          this.handleViewBack()
        } else {
          this.setState({
            menuloading: false,
            menucloseloading: false
          })
        }
      } else {
        this.setState({
          menuloading: false,
          menucloseloading: false
        })
      }
    })
  }
  //         if (_LongParam) {
  //           let param = {
  //             func: 'sPC_ButtonParam_AddUpt',
  //             ParentID: config.uuid,
  //             MenuID: action.curBtn.uuid,
  //             MenuNo: config.tabNo,
  //             Template: _LongParam.type,
  //             MenuName: action.curBtn.label,
  //             PageParam: JSON.stringify({Template: _LongParam.type}),
  //             LongParam: result.LongParam
  //           }
  //           Api.getCloudConfig(param).then(() => {})
  //         }
  //       }
  //     })
  //   })
  // }
  cancelConfig = () => {
    const { config, originConfig } = this.state
    // const { config, originConfig } = this.state
    let _this = this
    // let that = this
    if (originConfig.isAdd) {
      confirm({
        content: '菜单尚未提交,确定放弃保存吗?',
        onOk() {
          _this.handleViewBack()
        },
        onCancel() {}
      })
    } else {
      if (!is(fromJS(originConfig), fromJS(config))) {
        this.setState({
          closeVisible: true
        })
      } else {
        this.handleViewBack()
      }
    }
    // if (originConfig.isAdd) {
    //   confirm({
    //     content: '菜单尚未提交,确定放弃保存吗?',
    //     onOk() {
    //       that.handleViewBack()
    //     },
    //     onCancel() {}
    //   })
    // } else {
    //   if (!is(fromJS(originConfig), fromJS(config))) {
    //     this.setState({
    //       closeVisible: true
    //     })
    //   } else {
    //     this.handleViewBack()
    //   }
    // }
    this.handleViewBack()
  }
  /**
@@ -722,7 +676,7 @@
          loading: true
        })
        Api.getSystemConfig({
        Api.getCloudConfig({
          func: 'sPC_Get_LongParam',
          MenuID: btn.OpenType === 'popview' ? btn.linkTab : btn.uuid
        }).then(res => {
@@ -831,27 +785,7 @@
      }
    })
    config.action && config.action.forEach((btn) => {
      if (['prompt', 'exec', 'pop'].includes(btn.OpenType) && btn.Ot === 'required' && btn.verify && btn.verify.scripts && btn.verify.scripts.length > 0) {
        let hascheck = false
        btn.verify.scripts.forEach(item => {
          if (item.status === 'false') return
          if (/\$check@|@check\$/ig.test(item.sql)) {
            hascheck = true
          }
        })
        if (hascheck) {
          notification.warning({
            top: 92,
            message: `可选择多行的按钮《${btn.label}》中 $check@ 或 @check$ 将不会生效!`,
            duration: 5
          })
        }
      }
    })
    if ((config.setting.interType === 'system' || config.setting.requestMode === 'system') && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) {
    if (config.setting.interType === 'system' && config.setting.default === 'false' && config.setting.scripts && config.setting.scripts.filter(item => item.status !== 'false').length === 0) {
      return '数据源中不执行默认sql,且未添加自定义脚本,不可启用!'
    } else if (config.setting.interType === 'custom' && config.setting.procMode !== 'inner' && config.setting.preScripts && config.setting.preScripts.filter(item => item.status !== 'false').length === 0) {
      return '数据源未设置前置脚本,不可启用!'
@@ -875,7 +809,6 @@
   */
  updateConfig = (res) => {
    this.setState({
      thawButtons: res.thawButtons,
      config: res.config
    })
  }
@@ -931,7 +864,7 @@
      MenuID: config.uuid
    }
    Api.getSystemConfig(param).then(res => {
    Api.getCloudConfig(param).then(res => {
      if (res.status) {
        let _config = ''
        if (res.LongParam) {
@@ -959,7 +892,7 @@
          config: null
        }, () => {
          this.setState({
            chartview: _config.charts[0].uuid,
            chartview: _config.charts ? _config.charts[0].uuid : '',
            config: _config,
            openEdition: res.open_edition || '',
            activeKey: '0',
@@ -978,7 +911,7 @@
  }
  render () {
    const { activeKey, config, chartview, openEdition } = this.state
    const { activeKey, config, chartview } = this.state
    if (!config) return null
@@ -994,7 +927,6 @@
              <Panel forceRender={true} header={'标签基本信息'} key="0" id="subtable-basedata">
                {/* 菜单信息 */}
                <MenuForm
                  dict={this.state.dict}
                  config={config}
                  updatemenu={this.updateconfig}
                />
@@ -1006,7 +938,7 @@
                />
              </Panel>
              {/* 搜索条件添加 */}
              <Panel header={this.state.dict['header.menu.search']} key="1">
              <Panel header="搜索" key="1">
                <div className="search-element">
                  {Source.searchItems.map((item, index) => {
                    return (<SourceElement key={index} content={item}/>)
@@ -1015,7 +947,7 @@
                <FieldsComponent config={config} type="search" />
              </Panel>
              {/* 按钮添加 */}
              <Panel header={this.state.dict['header.menu.action']} key="2">
              <Panel header="按钮" key="2">
                <div className="search-element">
                  {Source.actionItems.map((item, index) => {
                    return (<SourceElement key={index} content={item}/>)
@@ -1045,7 +977,7 @@
                })}
              </Panel>
              {/* 添加显示列 */}
              <Panel header={this.state.dict['header.menu.column']} key="3">
              <Panel header="显示列" key="3">
                <div className="search-element">
                  {Source.columnItems.map((item, index) => {
                    return (<SourceElement key={index} content={item}/>)
@@ -1063,12 +995,12 @@
              </div>
            } bordered={false} extra={
              <div>
                <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/>
                <EditComponent dict={this.state.dict} type="table" options={['search', 'form', 'action', 'columns']} config={config} MenuID={config.uuid} thawButtons={this.state.thawButtons} refresh={this.updateConfig}/>
                <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} />
                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['model.save']}</Button>
                <Button onClick={this.cancelConfig}>{this.state.dict['model.back']}</Button>
                {/* <Versions MenuId={config.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> */}
                {/* <ReplaceField type="table" config={config} updateConfig={this.updateconfig}/> */}
                {/* <EditComponent type="table" options={['search', 'form', 'action', 'columns']} config={config} refresh={this.updateConfig}/> */}
                {/* <Switch className="big" checkedChildren="启" unCheckedChildren="停" checked={config.enabled} onChange={this.onEnabledChange} /> */}
                {/* <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>保存</Button> */}
                <Button onClick={this.cancelConfig}>返回</Button>
              </div>
            } style={{ width: '100%' }}>
              <SettingComponent
@@ -1081,12 +1013,12 @@
                config={config}
                updatesearch={this.updatesearch}
              />
              <div className="chart-view" style={{position: 'relative'}}>
                {/* 视图组 权限 会员等级20+ */}
                {this.props.memberLevel >= 20 ? <ChartGroupComponent
              {config.charts ? <div className="chart-view" style={{position: 'relative'}}>
                {/* 视图组 已弃用 */}
                <ChartGroupComponent
                  config={config}
                  updatechartgroup={this.updatechartgroup}
                /> : null}
                />
                {config.charts.map(item => {
                  if (!config.expand && chartview !== item.uuid) return ''
@@ -1131,39 +1063,43 @@
                    )
                  }
                })}
              </div>
              </div> : <>
                <ActionComponent
                  type="subtable"
                  menu={{MenuID: config.uuid, MenuName: config.tabName, MenuNo: config.tabNo, fstMenuList: this.props.menu.fstMenuList}}
                  config={config}
                  tabs={this.state.tabviews}
                  setSubConfig={this.setSubConfig}
                  updateaction={this.updateaction}
                />
                <ColumnComponent
                  config={config}
                  menu={this.props.menu}
                  updatecolumn={this.updateconfig}
                />
              </>}
            </Card>
          </div>
        </DndProvider>
        <Modal
        {/* <Modal
          bodyStyle={{textAlign: 'center', color: '#000000', fontSize: '16px'}}
          closable={false}
          maskClosable={false}
          visible={this.state.closeVisible}
          onCancel={() => { this.setState({closeVisible: false}) }}
          footer={[
            <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['model.save']}</Button>,
            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['model.notsave']}</Button>,
            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['model.cancel']}</Button>
            <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>保存</Button>,
            <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>不保存</Button>,
            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>取消</Button>
          ]}
          destroyOnClose
        >
          {this.state.dict['header.menu.config.placeholder']}
        </Modal>
          配置已修改,是否保存配置信息?
        </Modal> */}
        {this.state.loading && <Spin size="large" />}
      </div>
    )
  }
}
const mapStateToProps = (state) => {
  return {
    memberLevel: state.memberLevel
  }
}
const mapDispatchToProps = () => {
  return {}
}
export default connect(mapStateToProps, mapDispatchToProps)(SubTableConfig)
export default SubTableConfig