king
2023-04-06 68a65838dd44b02cb1b3666a4383232af413b558
src/templates/sharecomponent/settingcomponent/index.jsx
@@ -5,14 +5,11 @@
import { SettingOutlined } from '@ant-design/icons'
import Utils, { FuncUtils } from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import MKEmitter from '@/utils/events.js'
import SettingForm from './settingform'
import CreateFunc from '@/templates/zshare/createfunc'
import CreateInterface from '@/templates/zshare/createinterface'
import './index.scss'
// import './index.scss'
class SettingComponent extends Component {
  static propTpyes = {
@@ -23,7 +20,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    menu: null,          // 菜单信息
    search: null,        // 搜索条件,包括主表搜索
    formlist: null,      // 表单信息
@@ -51,8 +47,6 @@
      search: _search,
      menu: menu
    })
    MKEmitter.emit('modalStatus', '数据源')
  }
  /**
@@ -70,12 +64,8 @@
        visible: false,
        loading: false
      })
      res.actionfixed = res.actionfixed === 'true'
      res.columnfixed = res.columnfixed === 'true'
      this.props.updatesetting({...config, setting: res})
      MKEmitter.emit('modalStatus', false)
    }, () => {
      this.setState({
        loading: false
@@ -93,7 +83,7 @@
    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, menu, _config)) // 创建存储过程sql
      let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting.innerFunc, menu, _config)) // 创建存储过程sql
      let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc))          // 删除存储过程sql
      this.refs.funcCreatComponent.exec(setting.innerFunc, newLText, DelText)
@@ -156,6 +146,16 @@
          setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
        }
      })
    } else {
      setting.scripts.forEach(item => {
        if (item.status === 'false') return
        if (/exec\s/ig.test(item.sql)) {
          maxScript = 1000
        } else if (item.sql.length > maxScript) {
          maxScript = item.sql.length
        }
      })
    }
    setting.maxScript = maxScript
@@ -178,29 +178,27 @@
  render() {
    const { config } = this.props
    const { dict, visible, search, menu, record } = this.state
    const { visible, search, menu, record } = this.state
    return (
      <div className="model-menu-setting">
        <SettingOutlined onClick={this.changeSetting} />
      <>
        <SettingOutlined style={{position: 'absolute', fontSize: '18px', right: '7px', top: '5px', padding: '10px', zIndex: 1}} onClick={this.changeSetting} />
        {/* 设置全局配置及列表数据源 */}
        <Modal
          wrapClassName="model-table-setting-verify-modal"
          title="数据源配置"
          wrapClassName="mk-pop-modal"
          visible={visible}
          width={900}
          width={'75vw'}
          maskClosable={false}
          onCancel={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false, loading: false })}}
          onCancel={() => { this.setState({ visible: false, loading: false })}}
          footer={[
            record && record.interType === 'system' ? <CreateInterface key="interface" loading={this.state.interloading} dict={dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/> : null,
            record && record.interType === 'inner' ? <CreateFunc key="create" dict={dict} ref="funcCreatComponent" trigger={this.tableCreatFunc}/> : null,
            <Button key="cancel" onClick={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false, loading: false }) }}>{this.state.dict['model.cancel']}</Button>,
            <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button>
            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>
          ]}
          destroyOnClose
        >
          <SettingForm
            dict={dict}
            menu={menu}
            config={config}
            search={search}
@@ -208,7 +206,7 @@
            wrappedComponentRef={(inst) => this.settingRef = inst}
          />
        </Modal>
      </div>
      </>
    )
  }
}