From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/templates/sharecomponent/settingcalcomponent/index.jsx |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/templates/sharecomponent/settingcalcomponent/index.jsx b/src/templates/sharecomponent/settingcalcomponent/index.jsx
index 10a1a46..0c7b0d2 100644
--- a/src/templates/sharecomponent/settingcalcomponent/index.jsx
+++ b/src/templates/sharecomponent/settingcalcomponent/index.jsx
@@ -1,24 +1,24 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-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 VerifyCard from './verifycard'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 class DataSource extends Component {
   static propTpyes = {
     config: PropTypes.any,
     MenuID: PropTypes.string,
-    tableFields: PropTypes.any,
-    permFuncField: PropTypes.any,
     updateConfig: PropTypes.func
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     sourcelist: [],
     visible: false,
     loading: false,
@@ -39,6 +39,7 @@
     this.setState({
       visible: true
     })
+    MKEmitter.emit('modalStatus', '鏁版嵁婧�')
   }
 
   verifySubmit = () => {
@@ -46,9 +47,29 @@
 
     this.setState({loading: true})
     this.verifyRef.submitDataSource().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.setting.dataresource) {
+            res.setting.dataresource = res.setting.dataresource.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
+          }
+        })
+      }
+
+      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.setState({loading: false, visible: false})
       this.props.updateConfig({...config, ...res})
+
+      MKEmitter.emit('modalStatus', false)
     }, () => {
       this.setState({loading: false})
     })
@@ -60,25 +81,22 @@
 
     return (
       <div className="model-datasource">
-        <Icon type="setting" onClick={() => this.editDataSource()} />
+        <SettingOutlined onClick={() => this.editDataSource()} />
         <Modal
           wrapClassName="popview-modal"
-          title={'鏁版嵁婧愰厤缃�'}
+          title="鏁版嵁婧愰厤缃�"
           visible={visible}
           width={'75vw'}
           maskClosable={false}
-          style={{minWidth: '900px', maxWidth: '1200px'}}
           okText={dict['model.submit']}
           onOk={this.verifySubmit}
           confirmLoading={loading}
-          onCancel={() => { this.setState({ visible: false }) }}
+          onCancel={() => { MKEmitter.emit('modalStatus', false); this.setState({ visible: false }) }}
           destroyOnClose
         >
           <VerifyCard
             dict={dict}
             config={config}
-            tableFields={this.props.tableFields}
-            permFuncField={this.props.permFuncField}
             menuId={this.props.config.uuid}
             searches={config.search}
             wrappedComponentRef={(inst) => this.verifyRef = inst}

--
Gitblit v1.8.0