| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal, Button } from 'antd' |
| | | import { Modal, Button } from 'antd' |
| | | import { SettingOutlined } from '@ant-design/icons' |
| | | |
| | | import Utils, { FuncUtils } from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | menu: null, // 菜单信息 |
| | | search: null, // 搜索条件,包括主表搜索 |
| | | formlist: null, // 表单信息 |
| | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | this.settingRef.handleConfirm().then(res => { |
| | | this.settingRef.handleConfirm().then(setting => { |
| | | let res = this.resetSetting(setting) |
| | | this.setState({ |
| | | visible: false, |
| | | loading: false |
| | |
| | | const { menu } = this.state |
| | | |
| | | this.settingRef.handleConfirm('func').then(setting => { |
| | | let _config = {...config, setting: setting} |
| | | let res = this.resetSetting(setting) |
| | | let _config = {...config, setting: res} |
| | | let newLText = Utils.formatOptions(FuncUtils.getTableFunc(setting, menu, _config)) // 创建存储过程sql |
| | | let DelText = Utils.formatOptions(FuncUtils.dropfunc(setting.innerFunc)) // 删除存储过程sql |
| | | |
| | |
| | | const { menu } = this.state |
| | | |
| | | this.settingRef.handleConfirm('interface').then(setting => { |
| | | let _config = {...config, setting: setting} |
| | | let res = this.resetSetting(setting) |
| | | let _config = {...config, setting: res} |
| | | let _menu = { |
| | | type: config.Template === 'CommonTable' ? 'main' : 'subtable', |
| | | MenuID: menu.MenuID, |
| | |
| | | |
| | | this.refs.tableCreatInterface.triggerOutInterface(_menu, _config) |
| | | }) |
| | | } |
| | | |
| | | resetSetting = (s) => { |
| | | let setting = fromJS(s).toJS() |
| | | let maxScript = 0 |
| | | |
| | | if (window.GLOB.funcs && window.GLOB.funcs.length > 0) { |
| | | window.GLOB.funcs.forEach(m => { |
| | | let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig') |
| | | setting.scripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | |
| | | 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.preScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | setting.cbScripts.forEach(item => { |
| | | item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | }) |
| | | if (setting.dataresource) { |
| | | setting.dataresource = setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | setting.maxScript = maxScript |
| | | |
| | | return setting |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | |
| | | |
| | | return ( |
| | | <div className="model-menu-setting"> |
| | | <Icon type="setting" onClick={this.changeSetting} /> |
| | | <SettingOutlined onClick={this.changeSetting} /> |
| | | {/* 设置全局配置及列表数据源 */} |
| | | <Modal |
| | | wrapClassName="model-table-setting-verify-modal" |