king
2024-08-20 58826d6f4eab9f8c9acf9fa8696f60039c645cfe
src/templates/sharecomponent/treesettingcomponent/index.jsx
@@ -1,9 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Icon, Modal } from 'antd'
import { Modal } from 'antd'
import { SettingOutlined } from '@ant-design/icons'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import SettingForm from './settingform'
import './index.scss'
@@ -16,7 +15,6 @@
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    menu: null,          // 菜单信息
    visible: false,      // 模态框控制
    loading: false       // 设置信息验证保存中
@@ -45,21 +43,28 @@
      loading: true
    })
    this.settingRef.handleConfirm().then(res => {
      if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
        window.GLOB.funcs.forEach(m => {
          let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
          res.scripts.forEach(item => {
            item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
          })
          if (res.dataresource) {
            res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
          }
        })
      }
      // if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
      //   window.GLOB.funcs.forEach(m => {
      //     let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
      //     res.scripts.forEach(item => {
      //       item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
      //     })
      //     if (res.dataresource) {
      //       res.dataresource = res.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
      //     }
      //   })
      // }
      this.setState({
        visible: false,
        loading: false
      })
      res.show = config.setting.show || 'true'
      res.advanceType = config.setting.advanceType || 'modal'
      res.advanceWidth = config.setting.advanceWidth || 1000
      res.drawerPlacement = config.setting.drawerPlacement || 'right'
      res.searchRatio = config.setting.searchRatio || 6
      res.searchLwidth = config.setting.searchLwidth !== undefined ? config.setting.searchLwidth : 33.3
      this.props.updatesetting({...config, setting: res})
    }, () => {
@@ -80,17 +85,16 @@
  render() {
    const { config } = this.props
    const { dict, visible, loading } = this.state
    const { visible, loading } = this.state
    return (
      <div className="model-tree-menu-setting">
        <Icon type="setting" onClick={this.changeSetting} />
        <SettingOutlined onClick={this.changeSetting} />
        {/* 设置全局配置及列表数据源 */}
        <Modal
          wrapClassName="model-tree-setting-verify-modal"
          title={dict['model.edit']}
          wrapClassName="mk-pop-modal"
          visible={visible}
          width={900}
          width={'75vw'}
          maskClosable={false}
          onCancel={() => { this.setState({ visible: false })}}
          confirmLoading={loading}
@@ -98,7 +102,6 @@
          destroyOnClose
        >
          <SettingForm
            dict={dict}
            config={config}
            menu={this.state.menu}
            inputSubmit={this.settingSave}