king
2023-08-27 d340a56429b12c3c893762730638631e147e047c
src/templates/sharecomponent/settingcomponent/index.jsx
@@ -4,10 +4,7 @@
import { Modal, Button } from 'antd'
import { SettingOutlined } from '@ant-design/icons'
import Utils, { FuncUtils } from '@/utils/utils.js'
import SettingForm from './settingform'
import CreateFunc from '@/templates/zshare/createfunc'
import CreateInterface from '@/templates/zshare/createinterface'
// import './index.scss'
@@ -73,43 +70,26 @@
    })
  }
  /**
   * @description 创建表格存储过程
   */
  tableCreatFunc = () => {
    const { config } = this.props
    const { menu } = this.state
  // /**
  //  * @description 创建表格接口(读出)
  //  */
  // tableCreatInterface = () => {
  //   const { config } = this.props
  //   const { menu } = this.state
    this.settingRef.handleConfirm('loading').then(setting => {
      let res = this.resetSetting(setting, config.setting)
      let _config = {...config, setting: res}
      let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting.innerFunc, menu, _config)) // 创建存储过程sql
      let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc))          // 删除存储过程sql
  //   this.settingRef.handleConfirm('loading').then(setting => {
  //     let res = this.resetSetting(setting, config.setting)
  //     let _config = {...config, setting: res}
  //     let _menu = {
  //       type: config.Template === 'CommonTable' ? 'main' : 'subtable',
  //       MenuID: menu.MenuID,
  //       menuName: menu.MenuName,
  //       menuNo: menu.MenuNo
  //     }
      this.refs.funcCreatComponent.exec(setting.innerFunc, newLText, DelText)
    })
  }
  /**
   * @description 创建表格接口(读出)
   */
  tableCreatInterface = () => {
    const { config } = this.props
    const { menu } = this.state
    this.settingRef.handleConfirm('loading').then(setting => {
      let res = this.resetSetting(setting, config.setting)
      let _config = {...config, setting: res}
      let _menu = {
        type: config.Template === 'CommonTable' ? 'main' : 'subtable',
        MenuID: menu.MenuID,
        menuName: menu.MenuName,
        menuNo: menu.MenuNo
      }
      this.refs.tableCreatInterface.triggerOutInterface(_menu, _config)
    })
  }
  //     this.refs.tableCreatInterface.triggerOutInterface(_menu, _config)
  //   })
  // }
  resetSetting = (s, ori) => {
    let setting = fromJS(s).toJS()
@@ -179,7 +159,7 @@
  render() {
    const { config } = this.props
    const { visible, search, menu, record } = this.state
    const { visible, search, menu } = this.state
    return (
      <>
@@ -192,8 +172,6 @@
          maskClosable={false}
          onCancel={() => { this.setState({ visible: false, loading: false })}}
          footer={[
            record && record.interType === 'system' ? <CreateInterface key="interface" loading={this.state.interloading} ref="tableCreatInterface" trigger={this.tableCreatInterface}/> : null,
            record && record.interType === 'inner' ? <CreateFunc key="create" ref="funcCreatComponent" trigger={this.tableCreatFunc}/> : null,
            <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>取消</Button>,
            <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>确定</Button>
          ]}
@@ -203,7 +181,7 @@
            menu={menu}
            config={config}
            search={search}
            updRecord={(record) => this.setState({record: fromJS(record).toJS()})}
            updRecord={() => {}}
            wrappedComponentRef={(inst) => this.settingRef = inst}
          />
        </Modal>