From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 十月 2022 17:57:34 +0800 Subject: [PATCH] 2022-10-17 --- src/templates/sharecomponent/treesettingcomponent/index.jsx | 42 +++++++++++++++++++++++++++++------------- 1 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/templates/sharecomponent/treesettingcomponent/index.jsx b/src/templates/sharecomponent/treesettingcomponent/index.jsx index 70a2779..867f295 100644 --- a/src/templates/sharecomponent/treesettingcomponent/index.jsx +++ b/src/templates/sharecomponent/treesettingcomponent/index.jsx @@ -1,10 +1,10 @@ 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 MKEmitter from '@/utils/events.js' import './index.scss' @@ -12,12 +12,10 @@ static propTpyes = { MenuID: PropTypes.string, // 鑿滃崟ID config: PropTypes.object, // 鑿滃崟閰嶇疆淇℃伅 - permFuncField: PropTypes.array, // 瀛樺偍杩囩▼鍙敤寮�澶村瓧娈� updatesetting: PropTypes.func } state = { - dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, menu: null, // 鑿滃崟淇℃伅 visible: false, // 妯℃�佹鎺у埗 loading: false // 璁剧疆淇℃伅楠岃瘉淇濆瓨涓� @@ -34,6 +32,7 @@ visible: true, menu: menu }) + MKEmitter.emit('modalStatus', '鏁版嵁婧�') } /** @@ -46,12 +45,32 @@ 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*/`) + } + }) + } 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}) + + MKEmitter.emit('modalStatus', false) }, () => { this.setState({ loading: false @@ -70,29 +89,26 @@ 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 })}} + onCancel={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false })}} confirmLoading={loading} onOk={this.settingSave} destroyOnClose > <SettingForm - dict={dict} config={config} menu={this.state.menu} inputSubmit={this.settingSave} - permFuncField={this.props.permFuncField} wrappedComponentRef={(inst) => this.settingRef = inst} /> </Modal> -- Gitblit v1.8.0