king
2020-03-30 461e4fff4b51d067671244eec63b097cd9012b6e
src/templates/subtableconfig/index.jsx
@@ -30,6 +30,7 @@
import TransferForm from '@/components/transferform'
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'
@@ -2012,6 +2013,57 @@
    }
  }
  /**
   * @description 创建表格接口
   */
  tableCreatInterface = () => {
    const { config } = this.state
    this.menuformRef.handleConfirm().then(res => {
      this.settingRef.handleConfirm().then(setting => {
        if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
          let param = {
            func: 's_DataSrc_Save',
            LText: setting.dataresource,
            MenuID: config.uuid
          }
          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)
        }
        if (setting.interType !== 'inner' || setting.innerFunc) {
          notification.warning({
            top: 92,
            message: '接口类型为-内部,且不存在内部函数时,才可以创建接口!',
            duration: 10
          })
          return
        }
        let _config = {...config, setting: setting}
        let _menu = {
          type: 'subtable',
          MenuID: config.uuid,
          menuName: res.tabName,
          menuNo: res.tabNo
        }
        this.refs.tableCreatInterface.exec(_menu, _config).then(result => {
          if (result === 'success') {
            this.setState({
              config: _config
            })
          }
        })
      })
    })
  }
  pasteSubmit = () => {
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType !== 'action') {
@@ -2386,6 +2438,7 @@
            })
          }}
          footer={[
            <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>